Skip to content

fix: only modify wrapper URI if imported rule actually uses a wrapper#3790

Merged
johanneskoester merged 1 commit into
mainfrom
fix/modify_wrapper
Oct 12, 2025
Merged

fix: only modify wrapper URI if imported rule actually uses a wrapper#3790
johanneskoester merged 1 commit into
mainfrom
fix/modify_wrapper

Conversation

@johanneskoester

@johanneskoester johanneskoester commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

Description

QC

  • The PR contains a test case for the changes or the changes are already covered by an existing test case.
  • The documentation (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

  • Bug Fixes
    • Fixed an issue where rules without a wrapper could error during modifier application; the wrapper is now only modified when present.
    • No behavioral changes for rules that already use a wrapper.
    • Reduces unexpected failures during pipeline execution and improves error resilience, especially in scenarios with optional wrapper configuration.

@coderabbitai

coderabbitai Bot commented Oct 12, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Added a None guard in apply_modifier to call modifier.modify_wrapper_uri only when self.wrapper is not None. No other logic changes.

Changes

Cohort / File(s) Summary of changes
Wrapper URI modification guard
src/snakemake/ruleinfo.py
Apply wrapper modification only if self.wrapper is not None; preserves wrapper when absent.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant RuleInfo
  participant Modifier

  Caller->>RuleInfo: apply_modifier(modifier)
  alt wrapper is not None
    RuleInfo->>Modifier: modify_wrapper_uri(self.wrapper)
    Modifier-->>RuleInfo: new_wrapper_uri
    RuleInfo-->>Caller: complete
  else wrapper is None
    Note right of RuleInfo: Skip wrapper modification
    RuleInfo-->>Caller: complete
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description includes the template headings and ticked QC boxes but lacks any substantive description under the “Description” section, leaving the placeholder text unchanged and failing to explain the purpose or details of the change. Please replace the placeholder in the Description section with a concise summary of the change, explaining that the wrapper URI modification is now guarded by a None check and why this fix is needed, to provide clear context for reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title concisely and accurately summarizes the main change, indicating that the wrapper URI modification now only occurs when the imported rule has a wrapper, directly reflecting the code change in apply_modifier.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/modify_wrapper

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c28da7c and 8681e10.

📒 Files selected for processing (1)
  • src/snakemake/ruleinfo.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

Files:

  • src/snakemake/ruleinfo.py
🧠 Learnings (1)
📚 Learning: 2025-09-17T04:03:59.943Z
Learnt from: Hocnonsense
PR: snakemake/snakemake#3714
File: src/snakemake/modules.py:236-241
Timestamp: 2025-09-17T04:03:59.943Z
Learning: In Snakemake's WorkflowModifier, rule filtering via rule_whitelist and rule_exclude_list happens upstream during rule creation in the rule() decorator. The avail_rulename() method returns None for filtered-out rules, causing the entire rule creation to be skipped. This means child_modifier.rule_proxies only contains rules that passed the filtering, so inherit_rule_proxies doesn't need additional filtering logic.

Applied to files:

  • src/snakemake/ruleinfo.py
🧬 Code graph analysis (1)
src/snakemake/ruleinfo.py (2)
src/snakemake/workflow.py (2)
  • wrapper (2308-2313)
  • modifier (556-557)
src/snakemake/modules.py (1)
  • modify_wrapper_uri (287-291)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (45)
  • GitHub Check: tests (9, ubuntu-latest, py313)
  • GitHub Check: tests (9, windows-2022, py313)
  • GitHub Check: tests (7, windows-2022, py313)
  • GitHub Check: tests (9, ubuntu-latest, py311)
  • GitHub Check: tests (8, windows-2022, py313)
  • GitHub Check: tests (10, ubuntu-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py312)
  • GitHub Check: tests (10, windows-2022, py313)
  • GitHub Check: tests (8, ubuntu-latest, py311)
  • GitHub Check: tests (8, ubuntu-latest, py313)
  • GitHub Check: tests (9, ubuntu-latest, py312)
  • GitHub Check: tests (6, ubuntu-latest, py313)
  • GitHub Check: tests (10, ubuntu-latest, py311)
  • GitHub Check: tests (10, ubuntu-latest, py313)
  • GitHub Check: tests (3, ubuntu-latest, py312)
  • GitHub Check: tests (7, macos-latest, py313)
  • GitHub Check: tests (7, ubuntu-latest, py313)
  • GitHub Check: tests (4, ubuntu-latest, py313)
  • GitHub Check: tests (4, ubuntu-latest, py311)
  • GitHub Check: tests (6, windows-2022, py313)
  • GitHub Check: tests (7, ubuntu-latest, py311)
  • GitHub Check: tests (5, windows-2022, py313)
  • GitHub Check: tests (3, windows-2022, py313)
  • GitHub Check: tests (5, ubuntu-latest, py311)
  • GitHub Check: tests (5, ubuntu-latest, py312)
  • GitHub Check: tests (3, macos-latest, py313)
  • GitHub Check: tests (6, ubuntu-latest, py311)
  • GitHub Check: tests (7, ubuntu-latest, py312)
  • GitHub Check: tests (4, windows-2022, py313)
  • GitHub Check: tests (6, ubuntu-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py313)
  • GitHub Check: tests (5, ubuntu-latest, py313)
  • GitHub Check: tests (4, macos-latest, py313)
  • GitHub Check: tests (2, ubuntu-latest, py313)
  • GitHub Check: tests (4, ubuntu-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py311)
  • GitHub Check: tests (1, macos-latest, py313)
  • GitHub Check: tests (2, windows-2022, py313)
  • GitHub Check: tests (2, macos-latest, py313)
  • GitHub Check: tests (1, windows-2022, py313)
  • GitHub Check: tests (2, ubuntu-latest, py312)
  • GitHub Check: tests (2, ubuntu-latest, py311)
  • GitHub Check: tests (1, ubuntu-latest, py313)
  • GitHub Check: tests (1, ubuntu-latest, py311)
  • GitHub Check: tests (1, ubuntu-latest, py312)
🔇 Additional comments (1)
src/snakemake/ruleinfo.py (1)

109-110: LGTM! Good defensive programming.

The None guard correctly prevents processing when no wrapper is present, avoiding potential errors in modify_wrapper_uri (e.g., pattern.sub() on None). This aligns with the PR objective to only modify wrapper URIs when rules actually use wrappers.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@johanneskoester johanneskoester merged commit 08ef3b4 into main Oct 12, 2025
112 of 113 checks passed
@johanneskoester johanneskoester deleted the fix/modify_wrapper branch October 12, 2025 09:40
johanneskoester pushed a commit that referenced this pull request Oct 12, 2025
🤖 I have created a release *beep* *boop*
---


##
[9.13.2](v9.13.1...v9.13.2)
(2025-10-12)


### Bug Fixes

* fix --consider-ancient for input functions (was not applied in those
cases) ([#3788](#3788))
([c28da7c](c28da7c))
* only modify wrapper URI if imported rule actually uses a wrapper
([#3790](#3790))
([08ef3b4](08ef3b4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
kjohnsen pushed a commit to kjohnsen/snakemake that referenced this pull request Dec 15, 2025
…snakemake#3790)

### Description

<!--Add a description of your PR here-->

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] The documentation (`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).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed an issue where rules without a wrapper could error during
modifier application; the wrapper is now only modified when present.
  * No behavioral changes for rules that already use a wrapper.
* Reduces unexpected failures during pipeline execution and improves
error resilience, especially in scenarios with optional wrapper
configuration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
kjohnsen pushed a commit to kjohnsen/snakemake that referenced this pull request Dec 15, 2025
🤖 I have created a release *beep* *boop*
---


##
[9.13.2](snakemake/snakemake@v9.13.1...v9.13.2)
(2025-10-12)


### Bug Fixes

* fix --consider-ancient for input functions (was not applied in those
cases) ([snakemake#3788](snakemake#3788))
([c28da7c](snakemake@c28da7c))
* only modify wrapper URI if imported rule actually uses a wrapper
([snakemake#3790](snakemake#3790))
([08ef3b4](snakemake@08ef3b4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

1 participant