Skip to content

Add config and cli option#1303

Merged
alexdewar merged 4 commits into
mainfrom
1298-config-input-file
May 28, 2026
Merged

Add config and cli option#1303
alexdewar merged 4 commits into
mainfrom
1298-config-input-file

Conversation

@mjademitchell
Copy link
Copy Markdown
Collaborator

Description

Added a copy_input_files option to settings.toml and --no-copy-input-files CLI flag for the run command. When disabled, input files will not be copied to the output folder.

Also updated regenerate_test_data.sh to pass --no-copy-input-files so the test data folder doesn't get cluttered with duplicates of the example model input files.

Fixes #1298

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
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.51%. Comparing base (97ffb30) to head (b5982fc).
⚠️ Report is 47 commits behind head on main.

Files with missing lines Patch % Lines
src/cli.rs 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1303      +/-   ##
==========================================
- Coverage   89.65%   89.51%   -0.15%     
==========================================
  Files          57       58       +1     
  Lines        8441     8537      +96     
  Branches     8441     8537      +96     
==========================================
+ Hits         7568     7642      +74     
- Misses        565      580      +15     
- Partials      308      315       +7     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new program setting and CLI override to control whether model input files are copied into the run output directory, primarily to avoid unnecessary duplication in generated outputs (e.g., regression test data).

Changes:

  • Add copy_input_files to Settings (default true) and document it in the settings schema.
  • Add --no-copy-input-files to the run command and gate the existing copy_input_files(...) call on the setting.
  • Update tests/regenerate_test_data.sh to use the new CLI flag (though the current update appears inconsistent with the stated goal; see comments).

Reviewed changes

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

File Description
tests/regenerate_test_data.sh Adds an additional example run using --no-copy-input-files (currently doesn’t prevent copying into the primary data/$example outputs).
src/settings.rs Introduces copy_input_files: bool with default true.
src/cli.rs Adds --no-copy-input-files flag and skips copying when disabled.
schemas/settings.yaml Documents the new copy_input_files setting with default true.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/regenerate_test_data.sh Outdated
Comment on lines +26 to +31
env MUSE2_LOG_LEVEL=error MUSE2_USE_DEFAULT_SETTINGS=1 \
cargo -q run example run -o "data/$example" "$example" \
--overwrite $@
env MUSE2_LOG_LEVEL=error MUSE2_USE_DEFAULT_SETTINGS=1 \
cargo -q run example run -o "data/${example}_debug" "$example" \
--overwrite --no-copy-input-files $@
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.

Yeah I don't think we need the second run. I'd just add --no-copy-input-files to the first run

Comment thread src/cli.rs
Comment on lines 141 to +174
@@ -161,9 +168,10 @@ pub fn handle_run_command(model_path: &Path, opts: &RunOpts) -> Result<()> {
.to_str()
.context("Invalid chars in model directory name")?;

copy_input_files(&model_path, output_path, model_name)
.context("Failed to copy input files to output directory.")?;

if settings.copy_input_files {
copy_input_files(&model_path, output_path, model_name)
.context("Failed to copy input files to output directory.")?;
}
Copy link
Copy Markdown
Member

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

All looks good except for the double running of the model in regenerate_test_data.sh thing that Copilot flagged.

@alexdewar alexdewar self-requested a review May 28, 2026 09:10
Copy link
Copy Markdown
Member

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

Nearly there, but there a couple of small fixes needed.

There is another weird issue where the permissions for regenerate_test_data.sh have changed and it's not executable any more. Not sure if it still works in Windows (Windows does permissions differently to Unix), but on Linux I get this error:

❯ just regenerate_test_data
sh: line 1: tests/regenerate_test_data.sh: Permission denied
error: recipe `regenerate_test_data` failed on line 23 with exit code 126

You can change it back with:

git add --chmod=+x tests/regenerate_test.data.sh
git commit -m "Fix permissions for `regenerate_test_data.sh`"

Comment thread tests/cli.rs Outdated
Comment thread tests/regenerate_test_data.sh Outdated
@mjademitchell mjademitchell requested a review from alexdewar May 28, 2026 11:37
Copy link
Copy Markdown
Member

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

The permissions were still not fixed, so I've pushed the fix directly.

All good otherwise though. Thanks!

@alexdewar alexdewar merged commit a97211f into main May 28, 2026
6 checks passed
@alexdewar alexdewar deleted the 1298-config-input-file branch May 28, 2026 11:52
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.

Add config and CLI option for toggling input file copying

4 participants