Repository navigation
feat(client-contract): proxy refusals as problem documents, 202 never done, re-record at apis 0ba344270 - #20
Merged
Conversation
…e-record at apis 0ba344270
The website proxy's own refusals (rate_limited at 429, transient_unavailable
at 502) are application/problem+json documents with code, retryable and
trace_id, as every other refusal is. The README, proxy-codes.json,
client-codes.json, the scenario schema, the validator and the capture
tool drop the {error, retry, detail} body. The validator checks a proxy
problem document's media type, members and retryable, and refuses a 202
whose operation reads done.
A 202 operation reads pending or running, or failed for a deterministic
failure. fetch-spec-accepted-running pins running, and
fetch-spec-poll-pacing-changes pins a retry_after_ms that changes from
one poll to the next.
served/openapi.json is re-captured from apis 0ba344270, which adds the
timed_out no-data reason and the optional entity_refs member, and the
31 recorded scenarios are re-recorded live against dev at that commit.
Two validator nits: a wrapped docstring line and the test id
action-row-no-data-reason-missing.
This was referenced Oct 24, 2026
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.
The client contract described the website proxy's own refusals as a second body shape,
{error, retry, detail}with the code inerror, beside the problem documents every other refusal sends, and its served OpenAPI predated thetimed_outno-data reason that apis already emits, so neither client could name it.The proxy's
rate_limited(429, withRetry-After) andtransient_unavailable(502) refusals are nowapplication/problem+jsondocuments withtype,title,status,detail,code,retryable: trueandtrace_id.python/client-contract/README.md,proxy-codes.json,client-codes.jsonandscenario.schema.jsondescribe one refusal shape.tools/validate_client_contract.pyreads the code andretryablefrom the problem document only, and a new_check_proxy_problemrefuses a proxy code sent as plain JSON, without a common member, or not retryable.tools/capture_client_contract.pywrites the website's document, andsearch-proxy-rate-limitedandsearch-proxy-unavailableare re-derived. The website side is in DevelopmentFinanceObservatory/website (proxy problem documents, linked once open).The README states that a 202 operation reads
pendingorrunning, orfailedfor a deterministic failure, and neverdone;_check_acceptedrefuses a scenario whose 202 readsdone.fetch-spec-accepted-runningpins a 202 that readsrunning, andfetch-spec-poll-pacing-changespins aretry_after_msthat changes from poll to poll (2500, 4000, 1000 ms), which the live re-record had stopped exercising. The apis change that resets adoneoperation on submission ships in the companion apis PR; dev answerspendingfor every recorded 202 already.served/openapi.jsonandSOURCE.jsonare re-captured from apis 0ba344270, which addstimed_outtoNoData.reasonand an optionalentity_refson four answer-part schemas, and the 31 recorded scenarios are re-recorded live against dev at that commit, so everyorigin.dfo_commitmatches. Also: a wrapped docstring line in the validator, and the test idaction-row-no-data-reason-missing.A reviewer should check
_check_proxy_problem,_check_accepted, and that the re-recorded scenarios still pin what their names say.Testing:
uv run tools/validate_client_contract.pyreports the contract valid with 120 scenarios;tools/testspassed (525) andpython/client-contractpassed (78), with ruff check and format clean on the touched files. The new test rows for a proxy problem withoutretryable, a proxy problem in plain JSON and a 202 readingdonefail with their checks removed.