Skip to content

Conversation

@mschubert
Copy link
Contributor

@mschubert mschubert commented Jul 26, 2025

see #3684

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of asset redeployment by skipping files with missing SHA256 checksums, reducing unnecessary redeployments.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 26, 2025

📝 Walkthrough

Walkthrough

The condition for skipping redeployment of asset files in src/snakemake/assets/__init__.py was changed. Now, the redeployment is skipped if the asset's SHA256 is None or if the existing file's checksum matches the asset's SHA256, instead of only skipping when the checksum is present and matches.

Changes

File(s) Change Summary
src/snakemake/assets/init.py Modified logic for determining when to skip redeploying an asset file based on SHA256 checksum.

Sequence Diagram(s)

sequenceDiagram
    participant AssetManager
    participant FileSystem

    AssetManager->>FileSystem: Check if asset file exists
    alt Asset SHA256 is None OR file checksum matches asset SHA256
        AssetManager-->>FileSystem: Skip redeployment
    else
        AssetManager->>FileSystem: Redeploy asset file
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5-10 minutes

Possibly related PRs

Suggested reviewers

  • johanneskoester

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 429cff4 and 4fea663.

📒 Files selected for processing (1)
  • src/snakemake/assets/__init__.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/assets/__init__.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: johanneskoester
PR: snakemake/snakemake#3203
File: snakemake/assets/__init__.py:0-0
Timestamp: 2024-11-21T10:15:16.961Z
Learning: In `snakemake/assets/__init__.py`, the `version` placeholders in asset URLs refer to the versions of external assets, not the Snakemake version. Therefore, these placeholders should not be flagged for version inconsistencies related to Snakemake.
Learnt from: kdm9
PR: snakemake/snakemake#3562
File: src/snakemake/checkpoints.py:90-90
Timestamp: 2025-05-06T01:37:23.382Z
Learning: In Snakemake checkpoints implementation, tracking only the first missing output for each checkpoint is sufficient, because if one output is missing, all outputs for that checkpoint are considered incomplete. This was the behavior before PR #3562 and maintained in the pluralized `checkpoints.get()` implementation.
Learnt from: johanneskoester
PR: snakemake/snakemake#3117
File: tests/test_wrapper/Snakefile:11-11
Timestamp: 2024-10-06T14:09:54.370Z
Learning: Changes made within test cases, such as in `tests/test_wrapper/Snakefile`, are for testing purposes and do not require updates to the project documentation.
Learnt from: johanneskoester
PR: snakemake/snakemake#3140
File: snakemake/dag.py:1308-1308
Timestamp: 2024-10-14T09:42:11.571Z
Learning: In `snakemake/dag.py`, avoid flagging missing lines or indentation issues when there is no clear syntax or logical error to prevent false positives.
Learnt from: johanneskoester
PR: snakemake/snakemake#3132
File: snakemake/deployment/conda.py:85-88
Timestamp: 2024-10-11T13:12:35.827Z
Learning: In the `snakemake/deployment/conda.py` file, within the `Env` class, validation of `env_dir` occurs later in the code, so it's unnecessary to validate `env_dir` in the `__init__` method.
src/snakemake/assets/__init__.py (4)

Learnt from: johanneskoester
PR: #3203
File: snakemake/assets/init.py:0-0
Timestamp: 2024-11-21T10:15:16.961Z
Learning: In snakemake/assets/__init__.py, the version placeholders in asset URLs refer to the versions of external assets, not the Snakemake version. Therefore, these placeholders should not be flagged for version inconsistencies related to Snakemake.

Learnt from: johanneskoester
PR: #3117
File: tests/test_wrapper/Snakefile:11-11
Timestamp: 2024-10-06T14:09:54.370Z
Learning: Changes made within test cases, such as in tests/test_wrapper/Snakefile, are for testing purposes and do not require updates to the project documentation.

Learnt from: johanneskoester
PR: #3148
File: snakemake/dag.py:1332-1336
Timestamp: 2024-11-12T12:08:20.342Z
Learning: In snakemake/dag.py, when code is outdated and will disappear upon resolving merge conflicts, avoid making code review suggestions on that code.

Learnt from: kdm9
PR: #3562
File: src/snakemake/checkpoints.py:90-90
Timestamp: 2025-05-06T01:37:23.382Z
Learning: In Snakemake checkpoints implementation, tracking only the first missing output for each checkpoint is sufficient, because if one output is missing, all outputs for that checkpoint are considered incomplete. This was the behavior before PR #3562 and maintained in the pluralized checkpoints.get() implementation.

⏰ 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). (43)
  • GitHub Check: tests (10, windows-latest, py312)
  • GitHub Check: tests (10, ubuntu-latest, py313)
  • GitHub Check: tests (7, windows-latest, py313)
  • GitHub Check: tests (10, ubuntu-latest, py312)
  • GitHub Check: tests (9, windows-latest, py312)
  • GitHub Check: tests (8, windows-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py313)
  • GitHub Check: tests (7, ubuntu-latest, py311)
  • GitHub Check: tests (7, windows-latest, py312)
  • GitHub Check: tests (8, windows-latest, py313)
  • GitHub Check: tests (7, macos-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py312)
  • GitHub Check: tests (5, windows-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py311)
  • GitHub Check: tests (6, windows-latest, py313)
  • GitHub Check: tests (6, macos-latest, py313)
  • GitHub Check: tests (7, ubuntu-latest, py312)
  • GitHub Check: tests (6, ubuntu-latest, py312)
  • GitHub Check: tests (7, ubuntu-latest, py313)
  • GitHub Check: tests (3, ubuntu-latest, py311)
  • GitHub Check: tests (6, ubuntu-latest, py313)
  • GitHub Check: tests (6, ubuntu-latest, py311)
  • GitHub Check: tests (6, windows-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py311)
  • GitHub Check: tests (5, windows-latest, py313)
  • GitHub Check: tests (5, ubuntu-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py313)
  • GitHub Check: tests (4, ubuntu-latest, py311)
  • GitHub Check: tests (5, macos-latest, py313)
  • GitHub Check: tests (5, macos-latest, py312)
  • GitHub Check: tests (4, macos-latest, py312)
  • GitHub Check: tests (4, ubuntu-latest, py313)
  • GitHub Check: tests (4, windows-latest, py312)
  • GitHub Check: tests (4, ubuntu-latest, py312)
  • GitHub Check: tests (4, windows-latest, py313)
  • GitHub Check: tests (3, windows-latest, py313)
  • GitHub Check: tests (3, windows-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py313)
  • GitHub Check: tests (3, ubuntu-latest, py312)
  • GitHub Check: tests (2, windows-latest, py312)
  • GitHub Check: tests (1, windows-latest, py313)
  • GitHub Check: tests (2, windows-latest, py313)
  • GitHub Check: tests (1, windows-latest, py312)
🔇 Additional comments (1)
src/snakemake/assets/__init__.py (1)

544-547: LGTM! Logic correctly implements the intended behavior.

The change properly implements the PR objective by skipping redeployment when no SHA256 checksum is provided. The conditional now correctly handles both cases:

  • When asset.sha256 is None: assumes the existing file is valid (no verification possible)
  • When checksums match: existing file is verified as up-to-date

This prevents unnecessary redownloading of assets when integrity verification isn't specified.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mschubert mschubert changed the title if file is present and no sha256 provided assume pass fix: if file is present and no sha256 provided assume pass Jul 26, 2025
@mschubert mschubert changed the title fix: if file is present and no sha256 provided assume pass fix: if asset is present and no sha256 provided assume pass Jul 27, 2025
@johanneskoester johanneskoester merged commit 7731175 into snakemake:main Jul 28, 2025
82 of 83 checks passed
johanneskoester pushed a commit that referenced this pull request Jul 29, 2025
🤖 I have created a release *beep* *boop*
---


##
[9.9.0](v9.8.2...v9.9.0)
(2025-07-29)


### Features

* python 3.13 support
([#3602](#3602))
([429cff4](429cff4))


### Bug Fixes

* dag mermaid-js edges
(bug:[#3556](#3556))
([#3669](#3669))
([c6e2e71](c6e2e71))
* if asset is present and no sha256 provided assume pass
([#3685](#3685))
([7731175](7731175))

---
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
…e#3685)

see snakemake#3684

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

* **Bug Fixes**
* Improved handling of asset redeployment by skipping files with missing
SHA256 checksums, reducing unnecessary redeployments.
<!-- 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.9.0](snakemake/snakemake@v9.8.2...v9.9.0)
(2025-07-29)


### Features

* python 3.13 support
([snakemake#3602](snakemake#3602))
([429cff4](snakemake@429cff4))


### Bug Fixes

* dag mermaid-js edges
(bug:[snakemake#3556](snakemake#3556))
([snakemake#3669](snakemake#3669))
([c6e2e71](snakemake@c6e2e71))
* if asset is present and no sha256 provided assume pass
([snakemake#3685](snakemake#3685))
([7731175](snakemake@7731175))

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

2 participants