fix: add directory short-circuit to -T handler#100
Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: add directory short-circuit to -T handler#100Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
The -B handler already short-circuits for directories (returning true without opening the file for heuristic content check), but -T did not. In Perl, both -T and -B return true for directories. Without this check, -T on a mocked directory would attempt to open the (possibly non-existent) path on disk for content heuristics, failing silently. Also adds explicit @stat guard to the -s handler for consistency with -e, -M, -C, -A handlers (previously relied on implicit undef propagation from empty array access). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Adds directory detection to the
-Thandler in_check_from_stat, matching the existing-Bhandler behavior.Why
The
-Bhandler already short-circuits for directories (PR #91), but-Twas missed. In Perl, both-Tand-Breturn true for directories. Without this check,-Ton a mocked directory attempts to open the (possibly non-existent) path on disk for heuristic content analysis, which silently fails.How
S_IFDIRmode-bit check to the-Tdispatch entry, identical to the-Bpattern@statguard to the-shandler for consistency with-e,-M,-C,-A(was relying on implicit undef propagation from empty array access)Testing
t/T-directory-check.tverifying-Tand-Bdirectory behavior symmetry, plus-Tand-son non-existent mock files🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 78 insertions(+), 2 deletions(-)
Code scan: clean
Tests: passed (0 Tests)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline