fix: unify not-found errors to exit 3 (NotFoundError)#21
Merged
Conversation
Source-not-found, missing-`extends`-parent, and in-compose bundle-not-found
all raised UsageError (exit 2), contradicting the README "Exit codes" table
which documents `3 = Source / bundle / parent not found`. Make the code match
the contract: every "a referenced name/artifact doesn't exist" condition now
raises NotFoundError (exit 3). Genuine validation/syntax errors (bare ref
missing source qualifier, extends cycle) stay UsageError (exit 2).
Sites changed to NotFoundError:
- resolve.ts source(s) not found
- compose.ts extends missing parent
- compose.ts bundle not found (in-compose) — also resolves the latent
inconsistency with the same condition at the top level
(exec.ts), which already returned exit 3.
Tests assert the exit code for all five sites (3 not-found -> 3, 2
validation -> 2). README table row 3 already describes this behavior, so no
doc change is needed.
BREAKING (pre-1.0): source-not-found and missing-parent now exit 3 instead
of 2; scripts/CI wrappers branching on exit 2 for these will see the new code.
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.
Closes #18.
What
The README "Exit codes" table documents
3 = Source / bundle / parent not found, but only the top-level bundle lookup actually returned exit 3. Source-not-found, missing-extends-parent, and in-compose bundle-not-found all raisedUsageError(exit 2). This makes the code match the documented contract.This is the code option from #9 (already closed as superseded by #18).
Changes
Now raise
NotFoundError(exit 3):src/bundle/resolve.ts—source(s) not foundsrc/bundle/compose.ts—extendsmissing parentsrc/bundle/compose.ts— bundle not found (in-compose); also resolves the latent inconsistency where the same condition was exit 3 at the top level (src/bundle/exec.ts) but exit 2 hereStay
UsageError(exit 2) — these are validation/syntax errors, not not-found:src/bundle/resolve.ts— bare ref missing source qualifiersrc/bundle/compose.ts— cycle inextendschainTests
Exit-code assertions added for all five sites (3 not-found → exit 3, 2 validation → exit 2) in
compose.test.tsandresolve.test.ts. Full suite (348 tests),tsc --noEmit, andbiome checkall pass. Smoke-tested end-to-end:umbel run <missing>exits 3.Docs
README "Exit codes" table needs no change — row 3 already describes this behavior, and row 2 ("Usage error / validation") does not imply not-found lands there.
Source-not-found and missing-parent now exit 3 instead of 2. Scripts/CI wrappers branching on exit 2 for these will observe the new code.