Repository navigation
Description
API product implementation work · roadmap #1008 · use parent dependency order; not a separate product rank.
Part of #857. Stack rank 2 of 13. Depends on: T1 (sequencing only — the extraction itself is independent, but landing after T1 avoids rebasing the three test files twice).
Color
The paths derivation this epic needs already exists, gated, in three test files — er-server/tests/mcp_manifest.rs (role, path params, request-body JSON Schema, summary, for all ~92 routes), tests/response_envelopes.rs (success-envelope classification per GET), and tests/mock_contract.rs — including three copies of the same brace-matching router walk. This ticket lifts the machinery into a crate so the OpenAPI emitter (next ticket) can consume it. Pure refactor with a byte-level fidelity proof, which is what makes it a safe PR despite touching three gates.
Scope
- New crate
rust/crates/er-api-spec, pure functions over&strsource (unit-testable without er-server):routes(src)— the single copy of the router walk.role_of,path_params,tool_name,method_and_path, summary extraction — lifted frommcp_manifest.rsverbatim.struct_fields,type_schema,body_schema— lifted frommcp_manifest.rs.classify_envelope+success_only/object_keys— lifted fromresponse_envelopes.rs.
- Comments move with the code — they record real bugs (the qualified-role prefix,
by_paramvs nothing, the GET-with-a-body case, the shared-line error arm) and must survive. - The three test files become thin consumers asserting against the committed artifacts. Every
assert!(… > N, "parser is broken")floor survives — a derivation that matches nothing reports all-clear.
Out of scope
Any change to what is derived. No new fields, no OpenAPI output.
Testing
The fidelity proof is the whole test: rust/crates/er-mcp/tools.json and frontend/src/lib/api/envelopes.json must be byte-identical after the lift. Any diff means the walk changed behaviour and the PR is wrong. Unit tests move with their functions. make check.
Definition of done
Epic DoD, plus: one copy of the router walk in the workspace; the three tests import er-api-spec; both committed artifacts byte-identical to before.
Activity
athvin commentedon Nov 9, 2026
Claimed — working in #1059 (draft). Closing that PR releases the claim. User authorized taking this ready Todo prerequisite next; promoted to In progress before implementation.
wip: claim #859 — extract shared API source derivation
refactor(api): extract shared source contract derivation