Skip to content

Prevent running models when input data is inside output dir - #1482

Merged
AdrianDAlessandro merged 4 commits into
mainfrom
no-model-within-output-dir
Aug 13, 2026
Merged

Prevent running models when input data is inside output dir#1482
AdrianDAlessandro merged 4 commits into
mainfrom
no-model-within-output-dir

Conversation

@AdrianDAlessandro

Copy link
Copy Markdown
Collaborator

Description

This PR adds a check to ensure the model input data directory is not inside the output directory. It is quite simple, I am unsure if it is addressing the issue properly.

Fixes #1299

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.02%. Comparing base (121bad6) to head (55ffab4).

Files with missing lines Patch % Lines
src/cli.rs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1482      +/-   ##
==========================================
+ Coverage   89.91%   90.02%   +0.10%     
==========================================
  Files          60       60              
  Lines        8556     8558       +2     
  Branches     8556     8558       +2     
==========================================
+ Hits         7693     7704      +11     
+ Misses        543      535       -8     
+ Partials      320      319       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a guard to the run CLI flow to prevent running a model when the model input directory is located inside the chosen output directory, reducing the risk of accidentally deleting inputs when overwriting outputs (Issue #1299).

Changes:

  • Add an ensure! check in handle_run_command to reject model_path values nested under output_path.
  • Add an integration test intended to assert the new failure mode and a helper to capture CLI stderr.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/common.rs Adds a get_muse2_stderr helper for integration tests to inspect failure output.
tests/cli.rs Adds a new CLI integration test intended to verify run fails when the model directory is inside the output directory.
src/cli.rs Adds a runtime guard in handle_run_command to prevent using an input directory nested within the output directory.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/cli.rs
Comment thread tests/common.rs Outdated
Comment thread src/cli.rs
@AdrianDAlessandro
AdrianDAlessandro force-pushed the no-model-within-output-dir branch from 4f68aee to 55ffab4 Compare August 13, 2026 13:29

@tsmbland tsmbland left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct

@AdrianDAlessandro
AdrianDAlessandro merged commit bd753de into main Aug 13, 2026
8 checks passed
@AdrianDAlessandro
AdrianDAlessandro deleted the no-model-within-output-dir branch August 13, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disallow running models from within output dir

4 participants