fix: error on file arguments that match nothing - #57
Merged
Conversation
MPV
force-pushed
the
claude/error-missing-files
branch
from
July 23, 2026 07:14
cf28833 to
f47ab43
Compare
This was referenced Jul 23, 2026
MPV
force-pushed
the
claude/error-missing-files
branch
from
July 23, 2026 08:24
10f5d17 to
33cead9
Compare
This was referenced Jul 23, 2026
MPV
force-pushed
the
claude/error-missing-files
branch
from
July 23, 2026 08:45
f47ab43 to
10f5d17
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
July 24, 2026 06:45
33cead9 to
64ff278
Compare
This was referenced Aug 2, 2026
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 2, 2026 07:57
713ab54 to
2e16578
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 2, 2026 07:58
64ff278 to
9bb2ee4
Compare
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 6, 2026 20:55
2e16578 to
d0e1a34
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 6, 2026 20:57
9bb2ee4 to
e54ca21
Compare
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 6, 2026 20:57
d0e1a34 to
2d3647e
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 6, 2026 21:06
e54ca21 to
3f146ce
Compare
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 6, 2026 21:52
2d3647e to
53fe0b3
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 6, 2026 21:52
3f146ce to
9fe9c10
Compare
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 8, 2026 21:47
53fe0b3 to
ca552c8
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 8, 2026 21:47
9fe9c10 to
0695b9c
Compare
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 9, 2026 12:55
ca552c8 to
87da9bd
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 9, 2026 12:55
0695b9c to
46823aa
Compare
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 9, 2026 12:59
87da9bd to
ee7024e
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 9, 2026 12:59
46823aa to
41ce0c9
Compare
filepath.Glob returns no matches and no error both for a glob that matches nothing and for a literal path that does not exist, so a typo'd filename was silently skipped: `kir typo.yaml` produced no output and exited 0. Treat an argument that resolves to zero files as an error naming that argument; Run then reports it and exits non-zero. The behavioral golden suite reflects this: TestCLI.MissingFile now exits 1 with the error on stderr. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
MPV
force-pushed
the
claude/nonzero-exit
branch
from
August 9, 2026 13:05
ee7024e to
6d71fe7
Compare
MPV
force-pushed
the
claude/error-missing-files
branch
from
August 9, 2026 13:05
41ce0c9 to
29869fa
Compare
MPV
pushed a commit
that referenced
this pull request
Aug 9, 2026
#55 (exit non-zero on a processing failure) and #57 (error on a no-match argument), now combined here, share one contract: kir processes the whole batch, prints what it can, and exits non-zero if any input failed. Record it as docs/adr/0008-best-effort-processing-and-exit-codes.md and point ADR 0007's exit-column reference at it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
MPV
pushed a commit
that referenced
this pull request
Aug 9, 2026
#55 (exit non-zero on a processing failure) and #57 (error on a no-match argument), now combined here, share one contract: kir processes the whole batch, prints what it can, and exits non-zero if any input failed. Record it as docs/adr/0008-best-effort-processing-and-exit-codes.md and point ADR 0007's exit-column reference at it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
MPV
added a commit
that referenced
this pull request
Aug 9, 2026
* fix: exit non-zero when a file cannot be processed Per-file processing errors were logged but Run still returned 0, so a pipeline like `kir manifests/* | xargs grype` could not tell that some manifests failed to parse — the kind of silent gap that matters for a tool feeding a vulnerability scanner. Count per-file failures and, after processing every file, return a non-zero exit code. Files that succeed are still printed; only the exit status changes. The behavioral golden suite pins this: TestFailure/BadYAML feeds a malformed manifest through cmd.Run and asserts the error on stderr plus exit 1 (without this change it exits 0). TestRunFileFailure covers the same contract at the cmd unit level. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC * fix: error on file arguments that match nothing filepath.Glob returns no matches and no error both for a glob that matches nothing and for a literal path that does not exist, so a typo'd filename was silently skipped: `kir typo.yaml` produced no output and exited 0. Treat an argument that resolves to zero files as an error naming that argument; Run then reports it and exits non-zero. The behavioral golden suite reflects this: TestCLI.MissingFile now exits 1 with the error on stderr. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC * docs: record best-effort processing and exit codes as ADR 0008 #55 (exit non-zero on a processing failure) and #57 (error on a no-match argument), now combined here, share one contract: kir processes the whole batch, prints what it can, and exits non-zero if any input failed. Record it as docs/adr/0008-best-effort-processing-and-exit-codes.md and point ADR 0007's exit-column reference at it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC --------- Co-authored-by: Claude <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
Treat a file argument that resolves to zero files as an error naming that argument.
Before → After
Why
filepath.Globreturns no matches and no error both for a glob that matches nothing and for a literal path that doesn't exist — so a typo was silently skipped. Now it errors, andRunreports it and exits non-zero.Golden suite:
TestCLI.MissingFilenow exits1with the error on stderr.Stack / Release
Top of the CLI stack (#55 → this).
fix:→ patch.🤖 Generated with Claude Code
https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC