Skip to content

fix(http,audits): the guide describes the router that exists, and the registry gate finds its own - #31

Merged
indykish merged 2 commits into
mainfrom
feat/rust-router-guide-and-error-registry
Sep 4, 2026
Merged

fix(http,audits): the guide describes the router that exists, and the registry gate finds its own#31
indykish merged 2 commits into
mainfrom
feat/rust-router-guide-and-error-registry

Conversation

@indykish

@indykish indykish commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

The two files 0.9.3 deliberately left. Merging this publishes 0.9.4.

docs/REST_API_DESIGN_GUIDELINES.md

§7 taught a six-place route registration through files that no longer exist. The router it now describes is built FROM the route table: Route::all() is walked at startup, so a path cannot be served under a spelling the table does not carry. Adding an endpoint is a family enum variant plus its ALL entry, a RouteMeta row, a handler in a plane crate, and the generated document — and the failure table says which of those fail loudly and which one is silent.

Guard replaces the middleware policy table. RouteClass and Scopes join it. Ownership is written down for the first time: derived from the template, so the cross-tenant check a handler used to call by hand is not a thing a handler can forget.

§8 describes an axum handler taking the extractors it reads and returning Result<Response, Refusal>. §4 and §5 stop naming hx.ok and hx.fail.

The base is the product repo's own copy, which had already been corrected in place and would have been overwritten by the next orly update.

audits/error-codes.sh

The script hard-coded one repository's registry path, source globs and allowlist — the debt its own header acknowledged and named the fix for. All four now resolve at run time from ORLY_ERROR_PREFIX, ORLY_ERROR_REGISTRY, ORLY_ERROR_SOURCES and ORLY_ERROR_ALLOWLIST, or by autodetection: Rust where something declares ErrorCode::declare("<PREFIX>-…"), Zig where an error_registry.zig exists. A repository with neither skips with a reason instead of hard-exiting or passing vacuously.

Two findings the Rust runtime forced:

  • Unit tests live inside the file they cover, so #[cfg(test)] blocks are skipped by brace depth, the same shape audits/ufs.sh already uses.
  • A doc comment naming a retired code is prose, not a call site, so comment lines leave the USED set.

Verification

macOS bash 3.2:

make audit                    → green
bash evals/dispatch/run.sh    → 43 passed, 0 failed
bash evals/dispatch/parity.sh → 10 passed, 0 failed
audits/rule-ledger.sh         → 23 passed, 0 failed

Against the product repo the rewritten gate autodetects its Rust registry and reports registry (rust): 172 declared — the number that proves it found a registry rather than scanning nothing. Against a repository with none it prints skipped — no UZ-* registry found and exits 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BSLUVqAJkk9Yj3TfSC3U2Z

indykish and others added 2 commits September 4, 2026 18:47
… registry gate finds its own

Two pack files still described a Zig daemon that the product they ship to
retired. Both are rewrites rather than path swaps, which is why they were left
out of 0.9.3 and reported instead.

`docs/REST_API_DESIGN_GUIDELINES.md` §7 taught a six-place route registration
— a `Route` union, a `match()` arm, a spec table, a scope table, an invoke
shim — through files that no longer exist. The router it now describes is built
FROM the route table: `Route::all()` is walked at startup, so a path cannot be
served under a spelling the table does not carry, and adding an endpoint is a
family enum plus its `ALL` entry, a `RouteMeta` row, a handler in a plane
crate, and the generated document. The failure table says which of those fail
loudly and which one — a variant missing from `ALL` — is silent and answers
404. Guards replace the middleware policy table, `RouteClass` and `Scopes` join
them, and `Ownership` is written down for the first time: it is derived from
the template, so the cross-tenant check a Zig handler had to remember by hand
is not a thing a handler can forget. §8 describes an axum handler taking the
extractors it reads and returning `Result<Response, Refusal>`; §4 and §5 stop
naming `hx.ok` and `hx.fail`. The base is the product repo's own copy, which
had already been corrected in place and would have been overwritten by an
update.

`audits/error-codes.sh` hard-coded one repository's registry path, source globs
and allowlist — the debt its own header acknowledged and named the fix for. All
four are resolved at run time now, from `ORLY_ERROR_*` or by autodetection:
Rust where something declares `ErrorCode::declare("<PREFIX>-…")`, Zig where an
`error_registry.zig` exists, and a repository with neither SKIPS with a reason
rather than hard-exiting or passing vacuously. Two findings the Rust runtime
forced: unit tests live inside the file they cover, so `#[cfg(test)]` blocks are
skipped by brace depth the way the UFS gate already does; and a doc comment
naming a retired code is prose, not a call site, so comment lines leave the
USED set.

Verified on macOS bash 3.2: `make audit` green — fixture evals 43/43, parity
10/10, ledger 23/23. Against the product repo the rewritten gate autodetects
its Rust registry and reports `172 declared`, which is the number that proves
it found the registry rather than scanning nothing; against a repository with
no registry it skips with a reason and exits 0. `docs/RULE_ENFORCEMENT.md`
regenerated by the command the audit named.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BSLUVqAJkk9Yj3TfSC3U2Z
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@indykish
indykish merged commit 9a1a9e3 into main Sep 4, 2026
4 checks passed
@indykish
indykish deleted the feat/rust-router-guide-and-error-registry branch September 4, 2026 17:39
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.

2 participants