fix: insert '--' before snakemake targets to prevent --rerun-triggers consuming them#89
Merged
Merged
Conversation
… consuming them snakemake's --rerun-triggers uses nargs=+ in argparse, causing it to greedily consume the first target path as an extra trigger value when targets immediately follow the trigger list. Extract _build_snakemake_cmd() helper and append '--' before any target paths so argparse stops flag processing before the targets are seen. Add three regression tests that directly exercise the command-building logic. Fixes #87 Co-authored-by: Francois Lanusse <EiffL@users.noreply.github.com>
✅ Eval Results
Graders✅ spec_valid (1.00) Full output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #87
Summary
_build_snakemake_cmd()helper incommands.pythat owns snakemake argv construction--before any target paths to terminate argparse flag processingRoot cause
snakemake's
--rerun-triggersusesnargs=+in argparse, so it greedily consumes the first positional argument after the trigger list as another trigger value. Whenlc run <output>appends target paths immediately after the trigger values, snakemake rejects the path as "invalid choice".Test plan
test_run_cmd_inserts_separator_before_targets— reproduces the bug; asserts--appears between triggers and targetstest_run_cmd_no_separator_when_no_targets— no--when running rule alltest_run_cmd_multiple_triggers_all_before_separator— all trigger tokens precede--Generated with Claude Code