Skip to content

Conversation

@johanneskoester
Copy link
Contributor

@johanneskoester johanneskoester commented Sep 10, 2025

Summary by CodeRabbit

  • Tests
    • Strengthened storage plugin tests by asserting that reported object size is an integer and non-negative, enhancing validation and early detection of incorrect values.
    • Improves test coverage and confidence in size metadata handling for storage objects.
    • No changes to runtime behavior or public APIs; end-user functionality remains unchanged.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

📝 Walkthrough

Walkthrough

A new assertion was added in snakemake_interface_storage_plugins/tests.py to check that obj.size() returns a non-negative integer, placed after the existing mtime() type check.

Changes

Cohort / File(s) Change Summary
Tests
snakemake_interface_storage_plugins/tests.py
Added assertion in TestStorageBase._test_storage to verify obj.size() is an int and >= 0, positioned after the mtime() type check.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Pre-merge checks (2 passed, 1 warning)

❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly indicates that the pull request addresses an issue with the size method test, directly reflecting the addition of the new assertion without extraneous details, and is clear and concise.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/test-size

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 marked this pull request as ready for review September 10, 2025 18:52
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
snakemake_interface_storage_plugins/tests.py (1)

99-99: Cache size() result; optionally assert 0 for directories

obj.size() may hit remote storage. It’s called twice here; cache it. Also, per StorageObject docs, directories should report size 0—consider asserting that when directory=True.

-            assert isinstance(obj.size(), int) and obj.size() >= 0
+            size_ = obj.size()
+            assert isinstance(size_, int) and size_ >= 0
+            if directory:
+                assert size_ == 0
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4c1481 and f492ba1.

📒 Files selected for processing (1)
  • snakemake_interface_storage_plugins/tests.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:

  • snakemake_interface_storage_plugins/tests.py
🧬 Code graph analysis (1)
snakemake_interface_storage_plugins/tests.py (2)
snakemake_interface_storage_plugins/io.py (1)
  • size (93-93)
snakemake_interface_storage_plugins/storage_object.py (1)
  • size (148-150)
🔇 Additional comments (1)
snakemake_interface_storage_plugins/tests.py (1)

99-99: Confirm correct size() interface in this test
Ensure obj is a StorageObject whose size() returns an int, not the I/O interface’s size() returning Dict[str, int], to avoid ambiguity in the assertion.

@johanneskoester johanneskoester merged commit d6f9a2a into main Sep 10, 2025
5 checks passed
@johanneskoester johanneskoester deleted the fix/test-size branch September 10, 2025 18:58
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