You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs(api): derive api-reference from route handlers (single source of truth) to prevent silent omissions #828
The auto-generated docs/api-reference.md is driven by a manually-maintained endpoint list in crates/uteke-server/src/api_registry.rs, separate from the actual route handlers in handlers.rs. When an endpoint is added to handlers.rs but not to api_registry.rs, it is silently omitted from the reference doc — there is no build-time check tying the two together.
This already happened: /doc/list, /doc/search, /doc/update exist in handlers.rs but were missing from api_registry.rs (and therefore from docs/api-reference.md) since they were added. Fixed reactively in #827, but the gap went unnoticed for weeks and misled a downstream consumer (corin) into thinking the endpoints might not exist.
Evidence
A diff of route matches in handlers.rs vs path: entries in api_registry.rs is the only way to catch this today — it must be done by hand:
Make the route registry the single source of truth so the doc cannot drift from reality. Options (in increasing effort):
CI guard (cheapest): add a test/script that diffs handler routes against api_registry.rs paths and fails if they diverge. Catches future drift immediately.
Derive registry from handlers: extract the (method, path) list from the handler match table and generate the Endpoint list automatically (descriptions/types still curated, but the path set is authoritative).
Annotate handlers: attach doc metadata (description, request type) directly at each match arm via a macro/attribute, and have docgen read those — eliminating api_registry.rs entirely.
Recommendation
Start with (1) — a cargo test assertion that the registry path set ⊇ handler route set. Low effort, prevents recurrence, and unblocks a later move to (2)/(3).
Context
Discovered while validating corin (codecoradev/corin#205) against the uteke route registry.
I’m taking the recommended CI-guard slice. I’ll replace the current registry spot-check with a test that extracts the (Method, path) arms from uteke-server/src/handlers.rs and asserts every handler path is present in ENDPOINTS, so a newly added route cannot silently disappear from the API docs. I’ll run the focused server tests and formatting checks.
Activity
tomatotomata commentedon Aug 1, 2026
I’m taking the recommended CI-guard slice. I’ll replace the current registry spot-check with a test that extracts the (Method, path) arms from uteke-server/src/handlers.rs and asserts every handler path is present in ENDPOINTS, so a newly added route cannot silently disappear from the API docs. I’ll run the focused server tests and formatting checks.