Skip to content

fix: unify not-found errors to exit 3 (NotFoundError)#21

Merged
vessux merged 1 commit into
mainfrom
fix/18-notfound-exit-3
Jun 10, 2026
Merged

fix: unify not-found errors to exit 3 (NotFoundError)#21
vessux merged 1 commit into
mainfrom
fix/18-notfound-exit-3

Conversation

@vessux

@vessux vessux commented Jun 10, 2026

Copy link
Copy Markdown
Owner

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 raised UsageError (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.tssource(s) not found
  • src/bundle/compose.tsextends missing parent
  • src/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 here

Stay UsageError (exit 2) — these are validation/syntax errors, not not-found:

  • src/bundle/resolve.ts — bare ref missing source qualifier
  • src/bundle/compose.ts — cycle in extends chain

Tests

Exit-code assertions added for all five sites (3 not-found → exit 3, 2 validation → exit 2) in compose.test.ts and resolve.test.ts. Full suite (348 tests), tsc --noEmit, and biome check all 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.

⚠️ 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 observe the new code.

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.
@vessux vessux merged commit 09dafae into main Jun 10, 2026
4 checks passed
@vessux vessux deleted the fix/18-notfound-exit-3 branch June 10, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify the 'not found' error family to exit 3 (NotFoundError)

1 participant