engine: ingress errors use the same {error:{...}} envelope as every other route - #19
Open
Morgandri1 wants to merge 1 commit into
Open
engine: ingress errors use the same {error:{...}} envelope as every other route#19Morgandri1 wants to merge 1 commit into
Morgandri1 wants to merge 1 commit into
Conversation
… 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`.
|
Deployment failed for project wheel with the following error: Learn More: https://vercel.com/morgandri1s-projects?upgradeToPro=build-rate-limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Web caught this live while re-probing the endpoint Test button against the real ingress implementation:
ingress.rs's ownerr()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'sApiError) — includingwheel-api's owningress_honestytest, which already mocks the wrapped shape.Effect: web's
endpoint-probe.tserrorCode()only recognizes the wrapped envelope on purpose (a bare top-levelcodecould 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 forno_such_endpoint.err()now returnswheel_core::ErrorBody(the same typeApiErrorbuilds its response from) with a message per call site.Test plan
cargo build --workspace— cleancargo test -p wheel-engine— 282 passed, including newingress_errors_use_the_same_envelope_as_every_other_engine_route(locks the shape: exactly one top-level key,error, containingcode+message)cargo clippy -p wheel-engine --all-targets -- -D warnings— cleancargo fmt -p wheel-engine -- --check— cleancc web (PR #13 documents current bare behavior and will flip once this lands, per their note)