Skip to content

engine: ingress errors use the same {error:{...}} envelope as every other route - #19

Open
Morgandri1 wants to merge 1 commit into
mainfrom
sdk/ingress-error-envelope-shape
Open

engine: ingress errors use the same {error:{...}} envelope as every other route#19
Morgandri1 wants to merge 1 commit into
mainfrom
sdk/ingress-error-envelope-shape

Conversation

@Morgandri1

Copy link
Copy Markdown
Owner

Summary

Web caught this live while re-probing the endpoint Test button against the real ingress implementation: ingress.rs's own err() helper built a bare {"code": "..."} body for its 404 (no_such_endpoint) and 405 (method_not_allowed) responses, disagreeing with every other engine route's {"error":{"code","message"}} envelope (api/mod.rs's ApiError) — including wheel-api's own ingress_honesty test, which already mocks the wrapped shape.

Effect: web's endpoint-probe.ts errorCode() only recognizes the wrapped envelope on purpose (a bare top-level code could belong to an endpoint's own response body, so it can't safely be loosened) — so a genuine "no endpoint at this path" 404 fell back to a generic message instead of the specific one already written for no_such_endpoint.

err() now returns wheel_core::ErrorBody (the same type ApiError builds its response from) with a message per call site.

Test plan

  • cargo build --workspace — clean
  • cargo test -p wheel-engine — 282 passed, including new ingress_errors_use_the_same_envelope_as_every_other_engine_route (locks the shape: exactly one top-level key, error, containing code+message)
  • cargo clippy -p wheel-engine --all-targets -- -D warnings — clean
  • cargo fmt -p wheel-engine -- --check — clean

cc web (PR #13 documents current bare behavior and will flip once this lands, per their note)

… other route

Web caught this live probing the endpoint Test button: ingress.rs's own
err() built a bare {"code": "..."} body for its 404/405 responses,
disagreeing with every other engine route's {"error":{"code","message"}}
envelope (api/mod.rs's ApiError) -- including wheel-api's own
ingress_honesty test, which already mocks the wrapped shape. web's
endpoint-probe.ts only recognises the wrapped envelope on purpose (a
bare top-level `code` could belong to an endpoint's own response body),
so it silently fell back to a generic message instead of the specific
no_such_endpoint one.

err() now returns wheel_core::ErrorBody (the same type ApiError builds
its response from), with a message per call site. New test locks in the
shape: exactly one top-level key (`error`), containing `code` and
`message`.
@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

Deployment failed for project wheel with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/morgandri1s-projects?upgradeToPro=build-rate-limit

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.

1 participant