T-GIB9-not-found-status-in-generated-http
State: planning/draft · Impact: medium · Complexity: medium
Every handler error in the generated HTTP transport answers 500, whatever the actual error is. A missing note or plugin should answer 404. Today a client that reads status codes instead of body text cannot tell “not found” from a real server fault.
| Location | Role today |
|---|---|
solutions/determined/crates/determined-platform/src/api/transport/http/generated.rs:123-127 | fn err(msg: String) -> ApiError hardcodes StatusCode::INTERNAL_SERVER_ERROR for every handler error. File header: “Auto-generated HTTP route handlers. DO NOT EDIT.” |
Cargo.toml:135 | Pins the external ontogen crate (git = "https://github.com/sksizer/rust-ontogen") whose axum-server emitter produces generated.rs, including err(). The mapping cannot be fixed by editing this repo’s copy — only by fixing the emitter and regenerating. |
rust-ontogen docs/planning/epics/http-error-mapping.md | The upstream E0003 epic for consumer-controlled HTTP error responses, with a design document behind it. This repo’s own backlog entry for the defect was retired into it. |
Proposed
Section titled “Proposed”err() maps each AppError variant to its own status: NotFound → 404,
Invalid → 400, Upstream → 502, anything else → 500. A GET for a note
or plugin that does not exist answers 404, not 500.
Approach
Section titled “Approach”- Fix the emitter in
rust-ontogenso it emits a per-variant status match instead of one hardcodedINTERNAL_SERVER_ERROR. - Bump the pinned
ontogenrev in this repo’s rootCargo.toml. - Rebuild
determined-platformsogenerated.rsregenerates from the new emitter; do not hand-edit the generated file. - Verify the two known-open routes now answer 404: a note or plugin
path that resolves to nothing in an empty vault, and a note path
missing its
.mdsuffix. - Confirm the upstream E0003 epic records the fix once the emitter change lands.
| Area | Note |
|---|---|
Cargo.toml | Bump the pinned ontogen rev to one carrying the per-variant status fix |
solutions/determined/crates/determined-platform/src/api/transport/http/generated.rs | Regenerated by the build, not hand-edited |
solutions/determined/products/agent-pants/tests/e2e/consoleWatch.ts | Drop the KNOWN_OPEN allowance for the 500-on-missing-note pattern once the API answers 404 |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: A GET for a note or plugin path that resolves to nothing answers HTTP 404, not 500.
- AC-2:
AppError::Invalidanswers 400 andAppError::Upstreamanswers 502; every other error still answers 500. - AC-3: The
KNOWN_OPENe2e allowance for the 500-on-missing-note pattern is removed and the affected specs still pass.
Out of scope
Section titled “Out of scope”- Hand-editing
generated.rs. It is generated; the fix belongs in therust-ontogenemitter. - A broader HTTP status vocabulary beyond
NotFound/Invalid/Upstream.
Dependencies
Section titled “Dependencies”- The fix lands in the external
rust-ontogenrepository first; this task cannot close by editing only this repo. - The upstream E0003 epic describes the same defect and owns the fix direction.
Discovery context
Section titled “Discovery context”Found by the agent-pants bug survey, N-5LD4-bug-sweep-2026-09-12-agent-pants (rows AP-42, AP-43, AP-44). The page-side symptom — a route that addresses nothing should not even ask the API — was fixed separately; this task is the remaining backend half.