fix: croak on unknown options in stat_as_* helpers#94
Merged
atoomic merged 1 commit intocpan-authors:mainfrom Apr 23, 2026
Merged
Conversation
Previously, typos like stat_as_file(szie => 42) were silently ignored, producing stat arrays with default zeros — a subtle source of test failures. Now _stat_for() validates all option keys against the known set and croaks immediately on unknown keys. The 'mode' key gets a specific hint pointing to 'perms' since the file type bits are set automatically by the stat_as_* function. 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
Validates option keys in
stat_as_*helpers — typos now croak instead of silently producing wrong stat arrays.Why
stat_as_file(szie => 42)silently returns a stat array withsize = 0because the typo key is ignored during the%name2ixlookup. This produces subtle test failures where the stat array looks correct at first glance but has default zeros where specific values were intended.How
%known_optsset (perms, uid, gid + all%name2ixkeys) in_stat_for()st_prefix)modekey gets a specific helpful message pointing topermsstat-helpers-invalid-user-group.tcovering typos, unknown keys, mode hint, and regression checksTesting
Full test suite passes (
make test).🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 36 insertions(+), 1 deletion(-)
Code scan: clean
Tests: passed (0 Tests)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline