Skip to content

fix: create potentially missing .snakemake folder in case of very long command lines for spawned jobs#3894

Merged
johanneskoester merged 1 commit intomainfrom
huge-command-shadow-minimal
Jan 8, 2026
Merged

fix: create potentially missing .snakemake folder in case of very long command lines for spawned jobs#3894
johanneskoester merged 1 commit intomainfrom
huge-command-shadow-minimal

Conversation

@Hocnonsense
Copy link
Copy Markdown
Contributor

@Hocnonsense Hocnonsense commented Dec 20, 2025

will fix #3891 by force to create the .snakemake folder for the script

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

    • Enhanced robustness when executing shell commands with very long argument strings by ensuring proper directory initialization.
  • Tests

    • Added test coverage for handling extremely long command-line arguments in shadow mode.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 20, 2025

📝 Walkthrough

Walkthrough

When shell commands exceed the maximum argument length, the code now ensures the .snakemake directory exists before creating temporary script files. This prevents failures when using shadow: "minimal" with large commands, and includes a test case demonstrating the fix.

Changes

Cohort / File(s) Summary
Shell command length handling
src/snakemake/shell.py
Added .snakemake directory creation before writing temporary script files when shell command length exceeds MAX_ARG_LEN.
Shadow directive test coverage
tests/test_shadow/Snakefile
Added minimal_huge_cmd rule generating test output with large concatenated shell command under shadow: "minimal", and updated minimal_ok rule to depend on new test output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • src/snakemake/shell.py: Verify the directory creation logic correctly handles the .snakemake path and doesn't introduce race conditions or permission issues.
  • tests/test_shadow/Snakefile: Confirm the new rule follows established testing patterns and the huge_cmd variable generates a command exceeding system argument limits.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed Description includes the issue reference (#3891) and explains the fix (forcing .snakemake folder creation). Both QC checkboxes are marked complete, indicating test coverage and documentation assessment.
Linked Issues check ✅ Passed Changes directly address issue #3891 by ensuring .snakemake directory exists before creating temporary scripts [#3891], and include a test case with shadow 'minimal' and large commands [#3891].
Out of Scope Changes check ✅ Passed All changes are scoped to fixing issue #3891: the shell.py modification handles temporary directory creation, and the test additions verify the fix works with shadow 'minimal'.
Title check ✅ Passed The title accurately and specifically describes the main change: creating the .snakemake folder before handling very long command lines for spawned jobs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 changed the title fix: huge command line in shadow: "minimal" fix: create potentially missing .snakemake folder in case of very long command lines for spawned jobs Jan 8, 2026
@johanneskoester johanneskoester merged commit 4b431dd into main Jan 8, 2026
61 checks passed
@johanneskoester johanneskoester deleted the huge-command-shadow-minimal branch January 8, 2026 16:28
johanneskoester pushed a commit that referenced this pull request Jan 8, 2026
🤖 I have created a release *beep* *boop*
---


##
[9.14.6](v9.14.5...v9.14.6)
(2026-01-08)


### Bug Fixes

* create local clone of git repos for source files from hosting
providers ([#3643](#3643))
([d2f8aba](d2f8aba))
* create potentially missing .snakemake folder in case of very long
command lines for spawned jobs
([#3894](#3894))
([4b431dd](4b431dd))
* make ilp solver enumeration lazy
([#3900](#3900))
([30e1509](30e1509))
* Prevent broken report_href links by using deterministic report IDs
with fixed prefix length
([#3889](#3889))
([6d8f4d8](6d8f4d8))
* refactor LoggerManager setup and scope
([#3851](#3851))
([f46d904](f46d904))
* yield proper error message in case a local git source file is not
retrievable
([#3892](#3892))
([ed79cae](ed79cae))


### Documentation

* explain how to pass nested config via CLI
([#3885](#3885))
([9d8c539](9d8c539))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
@Hocnonsense Hocnonsense self-assigned this Mar 18, 2026
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.

Bug: edge case when there is a huge shell command with shadow: 'minimal'

2 participants