-
Notifications
You must be signed in to change notification settings - Fork 617
fix: always raise FileNotFoundError in case of missing files in resource expressions that do size evaluations #3854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rce expressions that do size evaluations
📝 WalkthroughWalkthroughAdded an async predicate helper to compute InputFiles sizes and refactored size_files/size_tempfiles to use it; annotated _IOFile.size as async returning int; changed local size handling to raise storage-plugin FileOrDirectoryNotFoundError; and treated that exception as file-not-found in exceptions and resources logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/snakemake/io/__init__.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 theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
Files:
src/snakemake/io/__init__.py
🧬 Code graph analysis (1)
src/snakemake/io/__init__.py (2)
src/snakemake/scheduling/job_scheduler.py (1)
get_size(199-200)src/snakemake/common/__init__.py (1)
async_run(96-113)
🪛 Ruff (0.14.6)
src/snakemake/io/__init__.py
1958-1958: Unused function argument: iofile
(ARG001)
⏰ 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). (46)
- GitHub Check: tests (10, windows-2022, py313)
- GitHub Check: tests (10, ubuntu-latest, py312)
- GitHub Check: tests (9, ubuntu-latest, py311)
- GitHub Check: tests (10, ubuntu-latest, py313)
- GitHub Check: tests (10, ubuntu-latest, py311)
- GitHub Check: tests (9, ubuntu-latest, py313)
- GitHub Check: tests (7, windows-2022, py313)
- GitHub Check: tests (8, ubuntu-latest, py313)
- GitHub Check: tests (9, windows-2022, py313)
- GitHub Check: tests (8, ubuntu-latest, py311)
- GitHub Check: tests (9, ubuntu-latest, py312)
- GitHub Check: tests (8, windows-2022, py313)
- GitHub Check: tests (8, ubuntu-latest, py312)
- GitHub Check: tests (6, ubuntu-latest, py312)
- GitHub Check: tests (7, ubuntu-latest, py313)
- GitHub Check: tests (5, macos-latest, py313)
- GitHub Check: tests (6, windows-2022, py313)
- GitHub Check: tests (5, ubuntu-latest, py311)
- GitHub Check: tests (6, macos-latest, py313)
- GitHub Check: tests (7, ubuntu-latest, py312)
- GitHub Check: tests (6, ubuntu-latest, py311)
- GitHub Check: tests (7, ubuntu-latest, py311)
- GitHub Check: tests (6, ubuntu-latest, py313)
- GitHub Check: tests (5, windows-2022, py313)
- GitHub Check: tests (4, macos-latest, py313)
- GitHub Check: tests (5, ubuntu-latest, py313)
- GitHub Check: tests (5, ubuntu-latest, py312)
- GitHub Check: tests (4, ubuntu-latest, py312)
- GitHub Check: tests (4, ubuntu-latest, py313)
- GitHub Check: tests (4, windows-2022, py313)
- GitHub Check: tests (2, windows-2022, py313)
- GitHub Check: tests (3, windows-2022, py313)
- GitHub Check: tests (3, ubuntu-latest, py313)
- GitHub Check: tests (4, ubuntu-latest, py311)
- GitHub Check: tests (3, ubuntu-latest, py312)
- GitHub Check: tests (2, ubuntu-latest, py313)
- GitHub Check: tests (3, ubuntu-latest, py311)
- GitHub Check: tests (2, macos-latest, py313)
- GitHub Check: tests (1, ubuntu-latest, py312)
- GitHub Check: tests (1, macos-latest, py313)
- GitHub Check: tests (2, ubuntu-latest, py312)
- GitHub Check: tests (1, windows-2022, py313)
- GitHub Check: tests (2, ubuntu-latest, py311)
- GitHub Check: tests (1, ubuntu-latest, py311)
- GitHub Check: tests (1, ubuntu-latest, py313)
- GitHub Check: apidocs
🔇 Additional comments (3)
src/snakemake/io/__init__.py (3)
37-37: LGTM!The
Awaitableimport is correctly added to support the type annotation in the new_predicated_size_filesmethod.
1956-1961: Refactoring approach is sound.The delegation to
_predicated_size_fileswith an always-true predicate correctly preserves the original behavior while using the new unified implementation.Note: The static analysis warning about the unused
iofileparameter infunc_trueis a false positive—the parameter is required to match the predicate signature expected by_predicated_size_files.
1963-1968: LGTM!The refactoring correctly uses
_predicated_size_fileswith a predicate that filters for temporary files, maintaining the expected behavior while leveraging the new unified implementation.
There was a problem hiding this 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
♻️ Duplicate comments (1)
src/snakemake/io/__init__.py (1)
1930-1955: _predicated_size_files still drops computed sizes and has a mismatched return typeThe core issues in this helper are only partially fixed and will currently break all size-based resource computations:
get_sizenever returns the computed size.
- Lines 1937–1941:
size = await f.size()is computed and asserted, but there is noreturn size.- As written, for existing files that pass the predicate,
get_sizealways falls through toreturn None.- As a result,
sizes = await asyncio.gather(...)will contain onlyNone(for existing files) and_IOFileinstances (for missing files). After filtering with[res for res in sizes if res is not None], you end up with an empty list whenever all files exist, sosize_files,size_files_kb, etc. all collapse to zero. This is a runtime correctness bug.Return annotation is inconsistent with actual behavior.
_predicated_size_filesis annotated as-> List[_IOFile], but the helper is conceptually returning a list of sizes (ints) and is consumed as such bysize_filesand the derived properties (size_files_kb,size, etc.).- After the missing-file sentinel is checked and
FileNotFoundErroris raised for any string-like result, the remaining values are sizes, not_IOFileobjects. The annotation should reflect that (e.g.List[int]).Callable type parameterization is non-idiomatic and may confuse type checkers.
- For
Callable, the first type argument should be a list of argument types. UsingCallable[_IOFile, Awaitable[bool]]is unconventional;Callable[[_IOFile], Awaitable[bool]]better matches standard typing usage and tools’ expectations.These issues overlap with the earlier bot review that flagged missing returns and the incorrect return annotation, so this is effectively a refinement / continuation of that comment.
A minimal, focused fix could look like this:
- def _predicated_size_files( - self, predicate: Callable[_IOFile, Awaitable[bool]] - ) -> List[_IOFile]: + def _predicated_size_files( + self, predicate: Callable[[_IOFile], Awaitable[bool]] + ) -> List[int]: async def sizes(): - async def get_size(f: _IOFile) -> Optional[Union[int, str]]: + async def get_size(f: _IOFile) -> Optional[Union[int, str]]: if await predicate(f): if await f.exists(): size = await f.size() assert ( isinstance(size, int) and size >= 0 ), f"Invalid size for file {f}: {size}" + return size else: return f return None @@ - return [res for res in sizes if res is not None] + return [res for res in sizes if res is not None]This preserves your missing-file behavior (raising
FileNotFoundErrorwhen any path is not present) while ensuring successful size computations actually propagate out tosize_filesand the derived properties.For the
Callableannotation, please double-check against the Python version and typing docs you target, to ensure the suggested shape is acceptable to both the interpreter and your type checker.To verify the behavior end-to-end, you might also want to add/extend tests asserting that:
InputFiles.size_filesreturns the actual byte sizes when all inputs exist.- A missing file in
InputFilescauses aFileNotFoundErrorwhen accessingsize_filesorsize.size_tempfilesbehaves analogously but restricted totemp-flagged entries.
🧹 Nitpick comments (1)
src/snakemake/io/__init__.py (1)
1957-1963: size_files predicate: unused parameter and alignment with Ruff ARG001The implementation correctly delegates to
_predicated_size_fileswith a predicate that always passes, but Ruff is right that theiofileargument infunc_trueis unused.You can silence the warning and make the intent clearer by marking the parameter as intentionally unused:
@property def size_files(self): - async def func_true(iofile): + async def func_true(_iofile): return True return self._predicated_size_files(func_true)This keeps behavior identical while satisfying the static analysis hint.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/snakemake/io/__init__.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 theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
Files:
src/snakemake/io/__init__.py
🧬 Code graph analysis (1)
src/snakemake/io/__init__.py (2)
src/snakemake/scheduling/job_scheduler.py (1)
get_size(199-200)src/snakemake/common/__init__.py (2)
async_run(96-113)func_true(51-52)
🪛 Ruff (0.14.6)
src/snakemake/io/__init__.py
1959-1959: Unused function argument: iofile
(ARG001)
⏰ 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 (6, ubuntu-latest, py312)
- GitHub Check: tests (10, ubuntu-latest, py312)
- GitHub Check: tests (10, windows-2022, py313)
- GitHub Check: tests (10, ubuntu-latest, py313)
- GitHub Check: tests (8, ubuntu-latest, py313)
- GitHub Check: tests (9, ubuntu-latest, py312)
- GitHub Check: tests (10, ubuntu-latest, py311)
- GitHub Check: tests (9, ubuntu-latest, py313)
- GitHub Check: tests (9, windows-2022, py313)
- GitHub Check: tests (9, ubuntu-latest, py311)
- GitHub Check: tests (8, windows-2022, py313)
- GitHub Check: tests (8, ubuntu-latest, py311)
- GitHub Check: tests (7, ubuntu-latest, py313)
- GitHub Check: tests (5, windows-2022, py313)
- GitHub Check: tests (8, ubuntu-latest, py312)
- GitHub Check: tests (7, ubuntu-latest, py312)
- GitHub Check: tests (5, ubuntu-latest, py312)
- GitHub Check: tests (7, windows-2022, py313)
- GitHub Check: tests (7, ubuntu-latest, py311)
- GitHub Check: tests (5, macos-latest, py313)
- GitHub Check: tests (6, ubuntu-latest, py313)
- GitHub Check: tests (6, ubuntu-latest, py311)
- GitHub Check: tests (5, ubuntu-latest, py313)
- GitHub Check: tests (6, windows-2022, py313)
- GitHub Check: tests (5, ubuntu-latest, py311)
- GitHub Check: tests (4, windows-2022, py313)
- GitHub Check: tests (4, ubuntu-latest, py312)
- GitHub Check: tests (3, windows-2022, py313)
- GitHub Check: tests (3, ubuntu-latest, py313)
- GitHub Check: tests (4, macos-latest, py313)
- GitHub Check: tests (3, macos-latest, py313)
- GitHub Check: tests (4, ubuntu-latest, py311)
- GitHub Check: tests (4, ubuntu-latest, py313)
- GitHub Check: tests (3, ubuntu-latest, py312)
- GitHub Check: tests (3, ubuntu-latest, py311)
- GitHub Check: tests (2, macos-latest, py313)
- GitHub Check: tests (2, ubuntu-latest, py313)
- GitHub Check: tests (2, windows-2022, py313)
- GitHub Check: tests (2, ubuntu-latest, py312)
- GitHub Check: tests (1, windows-2022, py313)
- GitHub Check: tests (1, macos-latest, py313)
- GitHub Check: tests (1, ubuntu-latest, py312)
- GitHub Check: tests (2, ubuntu-latest, py311)
- GitHub Check: tests (1, ubuntu-latest, py313)
- GitHub Check: tests (1, ubuntu-latest, py311)
🔇 Additional comments (2)
src/snakemake/io/__init__.py (2)
37-37: Awaitable import is appropriate for new async predicate signatureImporting
Awaitablefromcollections.abchere is consistent with the new async predicate typing in_predicated_size_filesand looks correct.
1965-1969: size_tempfiles delegation looks correctThe new
size_tempfilesimplementation cleanly reuses_predicated_size_fileswith atemp-flag-based predicate and will raiseFileNotFoundErrorwhen any temp file is missing, which aligns with the PR objective once_predicated_size_filesis fixed as above.
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/snakemake/io/__init__.py (1)
1927-1983: Potential unit mismatch betweensize_tempfilesandtemp_size_mb
_predicated_size_files()returns the raw results off.size(), i.e. sizes in bytes. With the new implementation:
size_tempfilesnow returns aList[int]of byte sizes for temp files.temp_size_mbstill doesreturn sum(self.size_tempfiles), so despite the_mbsuffix it now sums bytes, not megabytes.That internal inconsistency is error-prone for callers relying on
temp_size_mbto be in MB. Either the units should be converted or the API renamed; preserving the existing name strongly suggests keeping MB semantics.One straightforward fix is to convert to MiB when computing
temp_size_mb:@property def temp_size_mb(self): - return sum(self.size_tempfiles) + # size_tempfiles currently returns sizes in bytes; convert to MiB here. + return sum(size / 1024 / 1024 for size in self.size_tempfiles)This keeps
size_tempfilesas a low-level byte-based helper while restoring the documented intent oftemp_size_mb.
🧹 Nitpick comments (1)
src/snakemake/io/__init__.py (1)
648-662: Preserve original FileNotFoundError as the cause when wrapping in FileOrDirectoryNotFoundErrorThe split between
size()andsize_local()and the move toFileOrDirectoryNotFoundErrorfor missing local files is coherent and matches the new cross-module handling.To keep the original OS-level
FileNotFoundErrorin the exception chain (and satisfy tools like Ruff B904), consider binding the exception and re-raising with an explicit cause:async def size_local(self): # follow symlinks but throw error if invalid await self.check_broken_symlink() - try: - return os.path.getsize(self.file) - except FileNotFoundError: - raise FileOrDirectoryNotFoundError(Path(self.file)) + try: + return os.path.getsize(self.file) + except FileNotFoundError as e: + # Propagate a uniform not-found error type while preserving the OS error as cause. + raise FileOrDirectoryNotFoundError(Path(self.file)) from eIf you intentionally want to hide the underlying cause,
from Nonewould also address the linter warning.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pyproject.tomlis excluded by!pyproject.toml
📒 Files selected for processing (3)
src/snakemake/exceptions.py(2 hunks)src/snakemake/io/__init__.py(4 hunks)src/snakemake/resources.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 theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
Files:
src/snakemake/resources.pysrc/snakemake/exceptions.pysrc/snakemake/io/__init__.py
🧬 Code graph analysis (1)
src/snakemake/io/__init__.py (2)
src/snakemake/scheduling/job_scheduler.py (1)
get_size(199-200)src/snakemake/common/__init__.py (2)
async_run(96-113)func_true(51-52)
🪛 Ruff (0.14.6)
src/snakemake/io/__init__.py
661-661: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling
(B904)
⏰ 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 (8, ubuntu-latest, py313)
- GitHub Check: tests (9, windows-2022, py313)
- GitHub Check: tests (10, windows-2022, py313)
- GitHub Check: tests (10, ubuntu-latest, py313)
- GitHub Check: tests (9, ubuntu-latest, py313)
- GitHub Check: tests (10, ubuntu-latest, py311)
- GitHub Check: tests (10, ubuntu-latest, py312)
- GitHub Check: tests (8, ubuntu-latest, py312)
- GitHub Check: tests (9, ubuntu-latest, py311)
- GitHub Check: tests (9, ubuntu-latest, py312)
- GitHub Check: tests (7, ubuntu-latest, py313)
- GitHub Check: tests (8, ubuntu-latest, py311)
- GitHub Check: tests (8, windows-2022, py313)
- GitHub Check: tests (8, macos-latest, py313)
- GitHub Check: tests (7, ubuntu-latest, py312)
- GitHub Check: tests (6, ubuntu-latest, py312)
- GitHub Check: tests (7, windows-2022, py313)
- GitHub Check: tests (4, ubuntu-latest, py311)
- GitHub Check: tests (7, ubuntu-latest, py311)
- GitHub Check: tests (6, windows-2022, py313)
- GitHub Check: tests (6, ubuntu-latest, py313)
- GitHub Check: tests (5, macos-latest, py313)
- GitHub Check: tests (5, ubuntu-latest, py313)
- GitHub Check: tests (5, ubuntu-latest, py311)
- GitHub Check: tests (4, windows-2022, py313)
- GitHub Check: tests (6, ubuntu-latest, py311)
- GitHub Check: tests (5, windows-2022, py313)
- GitHub Check: tests (3, windows-2022, py313)
- GitHub Check: tests (5, ubuntu-latest, py312)
- GitHub Check: tests (4, ubuntu-latest, py312)
- GitHub Check: tests (2, ubuntu-latest, py312)
- GitHub Check: tests (3, macos-latest, py313)
- GitHub Check: tests (2, windows-2022, py313)
- GitHub Check: tests (4, ubuntu-latest, py313)
- GitHub Check: tests (3, ubuntu-latest, py313)
- GitHub Check: tests (3, ubuntu-latest, py312)
- GitHub Check: tests (2, ubuntu-latest, py311)
- GitHub Check: tests (2, ubuntu-latest, py313)
- GitHub Check: tests (3, ubuntu-latest, py311)
- GitHub Check: tests (1, windows-2022, py313)
- GitHub Check: tests (1, ubuntu-latest, py312)
- GitHub Check: tests (2, macos-latest, py313)
- GitHub Check: tests (1, ubuntu-latest, py313)
- GitHub Check: tests (1, ubuntu-latest, py311)
- GitHub Check: tests (1, macos-latest, py313)
🔇 Additional comments (2)
src/snakemake/resources.py (1)
239-270: Group resource evaluation correctly handles storage-backed file-not-foundCatching both
FileNotFoundErrorandFileOrDirectoryNotFoundErroraroundjob.resourcesevaluation keeps the existing “skip jobs whose resource evaluation depends on not-yet-present group files” behavior, while extending it to storage-plugin paths. The change is cohesive with the rest of the PR.src/snakemake/exceptions.py (1)
634-640: is_file_not_found_error now consistently covers storage-plugin missing filesExtending
is_file_not_found_errorto returnTrueforFileOrDirectoryNotFoundErrorensures that callers (likeeval_resource_expression) uniformly recognize missing-file conditions from both local IO and storage plugins.
|
Please format your code with |
There was a problem hiding this 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)
src/snakemake/io/__init__.py (1)
657-660: Add exception chaining for better debugging.While the exception conversion to
FileOrDirectoryNotFoundErroris correct for unified error handling, the original exception context should be preserved usingraise ... from errto maintain the full traceback.Apply this diff:
- try: - return os.path.getsize(self.file) - except FileNotFoundError: - raise FileOrDirectoryNotFoundError(Path(self.file)) + try: + return os.path.getsize(self.file) + except FileNotFoundError as err: + raise FileOrDirectoryNotFoundError(Path(self.file)) from err
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pyproject.tomlis excluded by!pyproject.toml
📒 Files selected for processing (1)
src/snakemake/io/__init__.py(3 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 theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
Files:
src/snakemake/io/__init__.py
🪛 Ruff (0.14.7)
src/snakemake/io/__init__.py
660-660: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling
(B904)
⏰ 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). (46)
- 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, windows-2022, py313)
- GitHub Check: tests (9, ubuntu-latest, py312)
- GitHub Check: tests (8, ubuntu-latest, py312)
- GitHub Check: tests (8, ubuntu-latest, py313)
- GitHub Check: tests (9, ubuntu-latest, py311)
- GitHub Check: tests (7, ubuntu-latest, py313)
- GitHub Check: tests (9, ubuntu-latest, py313)
- GitHub Check: tests (8, windows-2022, py313)
- GitHub Check: tests (8, ubuntu-latest, py311)
- GitHub Check: tests (6, ubuntu-latest, py311)
- GitHub Check: tests (4, ubuntu-latest, py313)
- GitHub Check: tests (7, windows-2022, py313)
- GitHub Check: tests (6, ubuntu-latest, py313)
- GitHub Check: tests (6, ubuntu-latest, py312)
- GitHub Check: tests (7, ubuntu-latest, py312)
- GitHub Check: tests (5, ubuntu-latest, py312)
- GitHub Check: tests (7, ubuntu-latest, py311)
- GitHub Check: tests (4, windows-2022, py313)
- GitHub Check: tests (6, windows-2022, py313)
- GitHub Check: tests (6, macos-latest, py313)
- GitHub Check: tests (4, ubuntu-latest, py311)
- GitHub Check: tests (5, windows-2022, py313)
- GitHub Check: tests (4, macos-latest, py313)
- GitHub Check: tests (5, ubuntu-latest, py313)
- GitHub Check: tests (3, windows-2022, py313)
- GitHub Check: tests (5, ubuntu-latest, py311)
- GitHub Check: tests (3, macos-latest, py313)
- GitHub Check: tests (3, ubuntu-latest, py313)
- GitHub Check: tests (4, ubuntu-latest, py312)
- GitHub Check: tests (2, macos-latest, py313)
- GitHub Check: tests (3, ubuntu-latest, py311)
- GitHub Check: tests (2, ubuntu-latest, py311)
- GitHub Check: tests (2, windows-2022, py313)
- GitHub Check: tests (3, ubuntu-latest, py312)
- GitHub Check: tests (2, ubuntu-latest, py313)
- GitHub Check: tests (2, ubuntu-latest, py312)
- GitHub Check: tests (1, ubuntu-latest, py313)
- GitHub Check: tests (1, ubuntu-latest, py311)
- GitHub Check: tests (1, ubuntu-latest, py312)
- GitHub Check: tests (1, windows-2022, py313)
- GitHub Check: tests (1, macos-latest, py313)
- GitHub Check: apidocs
🔇 Additional comments (5)
src/snakemake/io/__init__.py (5)
48-48: LGTM: Import supports unified error handling.The import of
FileOrDirectoryNotFoundErrorenables consistent error handling for missing files across local and storage-backed paths, which aligns with the PR objective.
648-653: LGTM: Simplified size computation with proper type annotation.The explicit
-> intreturn type and streamlined storage logic improve clarity. Exceptions will correctly propagate from both storage and local paths.
1927-1937: LGTM: Predicated size helper correctly implements filtering logic.The method properly filters files using an async predicate and computes sizes concurrently. When a missing file is encountered,
FileOrDirectoryNotFoundErrorwill propagate fromf.size(), correctly implementing the PR objective to raise exceptions for missing files during size evaluations.
1940-1944: LGTM: Refactored to use predicated helper.The property correctly delegates to
_predicated_size_fileswith a predicate that selects all files, maintaining the original behavior while leveraging the new helper.
1946-1951: LGTM: Refactored to use predicated helper.The property correctly filters for temp-flagged files using the predicated helper, maintaining the original behavior while simplifying the implementation.
🤖 I have created a release *beep* *boop* --- ## [9.14.1](v9.14.0...v9.14.1) (2025-12-02) ### Bug Fixes * always raise FileNotFoundError in case of missing files in resource expressions that do size evaluations ([#3854](#3854)) ([0f1991a](0f1991a)) * ensure that spawned jobs do not handle retries themselves. The main process does that. ([#3855](#3855)) ([396271b](396271b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
…rce expressions that do size evaluations (snakemake#3854) <!--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 * **Refactor** * Reworked file-size logic into a predicate-driven helper so regular and temporary file-size queries delegate to a common implementation. * **Bug Fixes** * Broadened recognition of missing-file errors and treat them as not-found; affected resource evaluations are skipped instead of failing. * **Type Annotations** * Clarified file-size return-type annotations to be integer-valued for improved correctness and tooling. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
🤖 I have created a release *beep* *boop* --- ## [9.14.1](snakemake/snakemake@v9.14.0...v9.14.1) (2025-12-02) ### Bug Fixes * always raise FileNotFoundError in case of missing files in resource expressions that do size evaluations ([snakemake#3854](snakemake#3854)) ([0f1991a](snakemake@0f1991a)) * ensure that spawned jobs do not handle retries themselves. The main process does that. ([snakemake#3855](snakemake#3855)) ([396271b](snakemake@396271b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
QC
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
Refactor
Bug Fixes
Type Annotations
✏️ Tip: You can customize this high-level summary in your review settings.