Skip to content

fix: fix iofile formatting to always display the storage query if it is set, also in case of missing input exceptions#3786

Merged
johanneskoester merged 1 commit intomainfrom
fix/fmt_iofile
Oct 11, 2025
Merged

fix: fix iofile formatting to always display the storage query if it is set, also in case of missing input exceptions#3786
johanneskoester merged 1 commit intomainfrom
fix/fmt_iofile

Conversation

@johanneskoester
Copy link
Copy Markdown
Contributor

@johanneskoester johanneskoester commented Oct 11, 2025

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

  • New Features
    • Formatted file references now clearly indicate when a file is in storage by appending “in storage” where applicable.
  • Bug Fixes
    • Standardized the return of formatted file paths: in non-input/output contexts, formatting now consistently returns the annotated string representation, ensuring predictable display and messaging across the app.

…is set, also in case of missing input exceptions
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 11, 2025

📝 Walkthrough

Walkthrough

Updates fmt_iofile in src/snakemake/io/fmt.py to adjust storage phrasing when neither input nor output flags are set and to change the default return value to an annotated string when no specific IO branch applies.

Changes

Cohort / File(s) Summary of Changes
I/O formatting logic
src/snakemake/io/fmt.py
- When f.is_storage and not as_input/as_output, storage_phrase now "in storage" (was empty).
- Default/fallback return now annotate(f_str) instead of returning f in non-flagged/non-IO branches.
- No public/exported API changes declared.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant fmt_iofile

    Caller->>fmt_iofile: format IOFile (f, flags)
    alt as_input or as_output
        fmt_iofile-->>Caller: formatted string (uses flags)
    else no IO flags
        alt f.is_storage
            Note right of fmt_iofile: storage_phrase = "in storage"
        else not storage
            Note right of fmt_iofile: storage_phrase = ""
        end
        fmt_iofile-->>Caller: annotate(f_str)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description retains the placeholder comment instead of a substantive summary of the changes, so the template’s description section is not properly filled out even though the QC checklist is completed. Please replace the placeholder in the Description section with a concise overview of the storage query formatting fix and its handling of missing input exceptions, ensuring the description clearly summarizes what was changed and why.
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 (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly identifies the core change of always displaying the storage query for iofiles, including in missing input exceptions, and directly reflects the modifications made in the changeset.
✨ 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/fmt_iofile

📜 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 dc8acf4 and fbaa26f.

📒 Files selected for processing (1)
  • src/snakemake/io/fmt.py (2 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/io/fmt.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: johanneskoester
PR: snakemake/snakemake#3600
File: src/snakemake/jobs.py:960-964
Timestamp: 2025-05-23T09:40:24.474Z
Learning: In the `cleanup` method of the `Job` class in `src/snakemake/jobs.py`, files in the `to_remove` list should be formatted with `fmt_iofile` without specifying `as_output=True` or `as_input=True` parameters, as these files should be displayed as generic files rather than specifically as output files.
⏰ 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 (10, ubuntu-latest, py313)
  • GitHub Check: tests (10, ubuntu-latest, py312)
  • GitHub Check: tests (10, ubuntu-latest, py311)
  • GitHub Check: tests (10, windows-2022, py313)
  • GitHub Check: tests (9, ubuntu-latest, py311)
  • GitHub Check: tests (8, ubuntu-latest, py313)
  • GitHub Check: tests (9, ubuntu-latest, py313)
  • GitHub Check: tests (8, windows-2022, py313)
  • GitHub Check: tests (5, ubuntu-latest, py313)
  • GitHub Check: tests (6, ubuntu-latest, py312)
  • GitHub Check: tests (9, ubuntu-latest, py312)
  • GitHub Check: tests (9, windows-2022, py313)
  • GitHub Check: tests (8, ubuntu-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py311)
  • GitHub Check: tests (7, windows-2022, py313)
  • GitHub Check: tests (5, windows-2022, py313)
  • GitHub Check: tests (6, ubuntu-latest, py313)
  • GitHub Check: tests (7, ubuntu-latest, py313)
  • GitHub Check: tests (6, ubuntu-latest, py311)
  • GitHub Check: tests (5, ubuntu-latest, py312)
  • GitHub Check: tests (7, ubuntu-latest, py311)
  • GitHub Check: tests (6, windows-2022, py313)
  • GitHub Check: tests (1, windows-2022, py313)
  • GitHub Check: tests (7, ubuntu-latest, py312)
  • GitHub Check: tests (5, macos-latest, py313)
  • GitHub Check: tests (6, macos-latest, py313)
  • GitHub Check: tests (4, windows-2022, py313)
  • GitHub Check: tests (4, ubuntu-latest, py312)
  • GitHub Check: tests (4, ubuntu-latest, py311)
  • GitHub Check: tests (3, ubuntu-latest, py313)
  • GitHub Check: tests (3, ubuntu-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py311)
  • GitHub Check: tests (3, windows-2022, py313)
  • GitHub Check: tests (3, ubuntu-latest, py311)
  • GitHub Check: tests (2, ubuntu-latest, py313)
  • GitHub Check: tests (4, ubuntu-latest, py313)
  • GitHub Check: tests (3, macos-latest, py313)
  • GitHub Check: tests (2, ubuntu-latest, py312)
  • GitHub Check: tests (2, windows-2022, py313)
  • GitHub Check: tests (2, macos-latest, py313)
  • GitHub Check: tests (2, ubuntu-latest, py311)
  • GitHub Check: tests (1, ubuntu-latest, py313)
  • GitHub Check: tests (1, macos-latest, py313)
  • GitHub Check: tests (1, ubuntu-latest, py311)
  • GitHub Check: tests (1, ubuntu-latest, py312)
🔇 Additional comments (2)
src/snakemake/io/fmt.py (2)

17-17: LGTM! Storage phrase now displayed in generic contexts.

Setting storage_phrase = "in storage" when neither as_input nor as_output is specified ensures that storage files are always annotated with their storage context. This aligns with the PR objective to display the storage query in all cases, including missing input exceptions.

Based on learnings, files are formatted without as_input/as_output flags in some contexts (e.g., cleanup), so this change ensures those cases now produce informative output.


49-50: Approve consistent fmt_iofile return type. No callers check for a None return, and this change guarantees a string is always returned, improving error messages.


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 b1c29fa into main Oct 11, 2025
60 checks passed
@johanneskoester johanneskoester deleted the fix/fmt_iofile branch October 11, 2025 08:27
johanneskoester pushed a commit that referenced this pull request Oct 11, 2025
🤖 I have created a release *beep* *boop*
---


##
[9.13.1](v9.13.0...v9.13.1)
(2025-10-11)


### Bug Fixes

* **config:** restore $ref resolution for schemas
([#3777](#3777))
([a3e0939](a3e0939))
* fix iofile formatting to always display the storage query if it is
set, also in case of missing input exceptions
([#3786](#3786))
([b1c29fa](b1c29fa))

---
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
…is set, also in case of missing input exceptions (snakemake#3786)

### 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

* **New Features**
* Formatted file references now clearly indicate when a file is in
storage by appending “in storage” where applicable.
* **Bug Fixes**
* Standardized the return of formatted file paths: in non-input/output
contexts, formatting now consistently returns the annotated string
representation, ensuring predictable display and messaging across the
app.

<!-- 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.1](snakemake/snakemake@v9.13.0...v9.13.1)
(2025-10-11)


### Bug Fixes

* **config:** restore $ref resolution for schemas
([snakemake#3777](snakemake#3777))
([a3e0939](snakemake@a3e0939))
* fix iofile formatting to always display the storage query if it is
set, also in case of missing input exceptions
([snakemake#3786](snakemake#3786))
([b1c29fa](snakemake@b1c29fa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
@coderabbitai coderabbitai Bot mentioned this pull request Jan 29, 2026
2 tasks
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