fix: croak on I/O errors in Snapshot.pm#19
Draft
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:mainfrom
Draft
fix: croak on I/O errors in Snapshot.pm#19Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:mainfrom
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:mainfrom
Conversation
opendir failure in __get_directory_names() silently returned an empty list, making I/O errors indistinguishable from genuinely empty directories. Similarly, open/close failures in __vms_untargz() silently returned 0, hiding write errors from callers. All three paths now croak() with descriptive messages including the errno, consistent with the existing error-handling pattern in _extract_archive(). Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replace silent early-returns with
croak()inSnapshot.pmso callers can distinguish I/O errors from empty/successful results.Why
Three error paths silently swallowed failures:
__get_directory_names():opendirfailure returned()— identical to an empty directory__vms_untargz():open/closefailures returned0— identical to a command failureThis made debugging I/O issues nearly impossible since errors were invisible to callers.
How
Replaced
return ()/return 0withCarp::croak()including the path and$!, matching the existing error pattern used elsewhere in_extract_archive()(lines 128-131).Testing
t/syncer_snap_croak.tverifies__get_directory_namescroaks on nonexistent dir and succeeds on valid dirt/syncer_snap.tstill passes🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 45 insertions(+), 3 deletions(-)
Code scan: clean
Tests: skipped
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline