fix: ensure proper wrapper prefix is passed to CWL and shown in wrapper error messages#4121
Conversation
…er error messages
📝 WalkthroughWalkthroughAdds a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/snakemake/cwl.py`:
- Around line 205-211: The current argument construction uses *[
(f"--wrapper-prefix {dag.workflow.workflow_settings.wrapper_prefix}" if
dag.workflow.workflow_settings.wrapper_prefix else []) ], which when
wrapper_prefix is falsy inserts an empty list element into the arguments list;
change the expression to produce either a single-item list or an empty list
before unpacking—e.g. replace the outer list-wrapped conditional with (
[f"--wrapper-prefix {dag.workflow.workflow_settings.wrapper_prefix}"] if
dag.workflow.workflow_settings.wrapper_prefix else [] ) so that unpacking with *
yields no element when wrapper_prefix is unset (locate the snippet building the
CWL arguments around dag.workflow.workflow_settings.wrapper_prefix).
In `@src/snakemake/wrapper.py`:
- Around line 120-123: The WorkflowError message uses DEFAULT_WRAPPER_PREFIX
unconditionally which can misreport the actual wrapper location; update the
error to include the actual prefix used when locating the script (the variable
named prefix or the computed effective prefix) instead of
DEFAULT_WRAPPER_PREFIX, falling back to DEFAULT_WRAPPER_PREFIX only if no custom
prefix is present so the message correctly shows the URL/path used when
script_source is None (refer to script_source, DEFAULT_WRAPPER_PREFIX, prefix,
and path to locate and fix the message).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d15679b4-0e63-47cc-9694-473859c9bdc4
📒 Files selected for processing (2)
src/snakemake/cwl.pysrc/snakemake/wrapper.py
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/snakemake/cwl.py (1)
205-209:⚠️ Potential issue | 🟠 MajorThe
--wrapper-prefixargument format is incorrect for CWL.The argument is emitted as a single combined string
"--wrapper-prefix value"which CWL will pass as one argv entry. argparse expects these as two separate argv entries:--wrapper-prefixfollowed by the value.Compare to
--modeon lines 215-216 which correctly uses separate elements:"--mode", str(ExecMode.SUBPROCESS.item_to_choice()),The past review already suggested this fix - split into two elements:
Proposed fix
*( - [f"--wrapper-prefix {dag.workflow.workflow_settings.wrapper_prefix}"] + ["--wrapper-prefix", dag.workflow.workflow_settings.wrapper_prefix] if dag.workflow.workflow_settings.wrapper_prefix else [] ),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/snakemake/cwl.py` around lines 205 - 209, The CWL argument for wrapper prefix is emitted as a single combined string so it becomes one argv entry; update the args construction that currently uses [f"--wrapper-prefix {dag.workflow.workflow_settings.wrapper_prefix}"] to emit two separate argv entries: "--wrapper-prefix" and the value dag.workflow.workflow_settings.wrapper_prefix (mirroring how "--mode" is produced with ExecMode.SUBPROCESS.item_to_choice()), ensuring the list contains two elements instead of one combined string.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/snakemake/cwl.py`:
- Around line 205-209: The CWL argument for wrapper prefix is emitted as a
single combined string so it becomes one argv entry; update the args
construction that currently uses [f"--wrapper-prefix
{dag.workflow.workflow_settings.wrapper_prefix}"] to emit two separate argv
entries: "--wrapper-prefix" and the value
dag.workflow.workflow_settings.wrapper_prefix (mirroring how "--mode" is
produced with ExecMode.SUBPROCESS.item_to_choice()), ensuring the list contains
two elements instead of one combined string.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c9f0dbda-58ff-45d6-994d-dda93dfa3f7f
📒 Files selected for processing (1)
src/snakemake/cwl.py
🤖 I have created a release *beep* *boop* --- ## [9.17.3](v9.17.2...v9.17.3) (2026-03-24) ### Bug Fixes * add curl when containerize with wrapper ([#4115](#4115)) ([44979e4](44979e4)) * ensure proper wrapper prefix is passed to CWL and shown in wrapper error messages ([#4121](#4121)) ([11b6f29](11b6f29)) * ensure that strings that purely contain integers or floats (e.g. "42") remain strings when parsing profiles ([#4119](#4119)) ([3ca08e1](3ca08e1)) * incorrect highlighting in HTML report ([#4120](#4120)) ([1ef224d](1ef224d)) ### Documentation * document an accidental (sorry) recent breaking change in type checking compatibility of Python scripts, in favor of a clean and robust new syntax ([#4116](#4116)) ([013bc43](013bc43)) * Rework tutorial ([#4068](#4068)) ([4bba4a9](4bba4a9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Released version 9.17.3 <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
QC
docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).Summary by CodeRabbit