fix: endpoint failures use the standard error shape and count in metrics - #197
Merged
Conversation
The output endpoint's 500 and 504 bodies were hand-built JSON; they now render through ApiError like every other failure, the 503 keeps its missing_sources list under a declared EndpointUnavailableBody schema, and all failure statuses appear in the OpenAPI spec. A timed-out run also returned before the counters, so unified_api_endpoint_total never saw it despite the docs saying it counts as result=error — it flows through them now. GET /metrics joins the OpenAPI spec as well.
blaipr
force-pushed
the
fix/endpoint-error-bodies
branch
from
August 26, 2026 12:03
6c504c1 to
fa58a36
Compare
Merged
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.
What
500script/builtin failure,504timeout, the neither-output-nor-script guard) rendered hand-builtjson!bodies; they now flow throughApiError— one source for the shape, finishing the migrationerror.rsdescribes.unified_api_endpoint_totalnever counted it — despitedocs/endpoints.mdpromising that timed-out runs count asresult="error"("so alerting on the error rate catches hung transformers too"). Timeouts and builtin-render panics now flow through the counters and the duration histogram before answering.503keeps itsmissing_sourceslist (now sorted, deterministic) under a declaredEndpointUnavailableBodyschema instead of an undeclared ad-hoc body.#[utoipa::path]on both endpoint handlers now declares 500/503/504 with their bodies, andGET /metricsjoins the OpenAPI spec — it was the only routed handler missing from it, and the spec never mentioned thatserver.metrics_require_authmoves it behind the key.Tests
New
tests/adapters/out/output/slow.pysample transformer plus an integration test: a script endpoint withtimeout_seconds: 1answers504whose body is the standard{"error": ...}shape naming the limit it hit.Note:
a_cron_scheduled_source_syncs_into_the_cacheanda_reload_replaces_the_running_task_generationflaked once under full-suite parallel load and pass in isolation and on re-run — pre-existing timing sensitivity, unrelated to this diff.