Repository navigation
feat(client-contract): read the newest plain build and record against dfo-apis 035d29cd0 - #15
Merged
Merged
Conversation
… dfo-apis c7543c9d6 "Newest version" is the first listed version with no base_content_version, read across every versions page (`validate_client_contract.newest_plain`), so a derived groupby rendering listed first is skipped. The served document and all 31 recorded scenarios are captured at dfo-apis c7543c9d6, whose versions page carries `enrichment_stamp`, and the 87 synthetic scenarios are derived again. Twelve scenario questions are reworded where Search now answers the old wording with another shape: the candidates questions read mortality in Kenya, the async build reads ODA disbursements by sector, and the place question names a year.
…et and check refs against their scenarios The async build questions read one variable over donor and recipient groups, so the finished operation's manifest lists one variable and the scenarios hold 13,080,568 bytes, under the 16,000,000-byte budget the validator and the record run now enforce (`validate_client_contract.SCENARIOS_BUDGET`). A ref whose record holds members names the scenario that serves them, and the validator checks each member's spec, content version, sentence and digest against it (`_served_by`). `newest_plain` reads the whole versions page before it takes a plain version. The validator tests hard-link their package copy.
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's served document and recordings date from dfo-apis 635943e0, before DevelopmentFinanceObservatory/apis#37 made the Datasets versions page carry a required
enrichment_stamp. DevelopmentFinanceObservatory/apis#72's exchange gate therefore refuses the recordedfetch-ref-newest-versionversions response. The validator ties every recorded scenario to the served document's commit, so this PR captures the whole contract again at dfo-apis 035d29cd0:served/openapi.jsonandserved/SOURCE.jsonthroughtools/capture_client_contract.py openapi, all 31 recorded scenarios against the deployed dev app in one run, and the 87 synthetic scenarios derived from them. The scenarios hold 13,080,568 bytes, 1,124,502 of them in binary bodies, against 13,911,513 at 95a15cf. The validator and the record run now refuse ascenarios/directory over 16,000,000 bytes (SCENARIOS_BUDGET), and the validator tests hard-link their package copy rather than copying 14 MB per test."Newest version" now means the first listed version whose
base_content_versionis null, read across every page of the versions list (validate_client_contract.newest_plain,versions_pathwith?limit=100and the cursor). On dev a derived groupby version ofspec_774d6c001a6250aa67ca676ab067895eis listed ahead of its plain build, and the old first-entry rule handed a client that rendering as the newest data.fetch-ref-newest-versionnow requires a derived version listed first, so the record shows the rule skipping it. A version without a string-or-nullbase_content_version, or anext_cursorof another type, refusescontract_violation. The README andscenario.schema.jsonstate the rule.Twelve scenario questions are reworded where Search at 035d29cd0 answers the old wording with another shape. GNI of Germany now answers definite, so the candidates scenarios ask about mortality in Kenya from 2013 to 2022. "Debt of Kenya" refuses
no_observationswith no options, sochoose-option-beside-definiteasks "GDP of the G20 in 2015, and Germany India ODA". The DAC2a every-provider build estimates 1,632 rows now that an unnamed donor side reads its published total, so the async scenarios ask for ODA disbursements from the DAC (or OECD) countries to the G77 countries over six decades, about 110,000 rows of one variable, whose finished manifest stays small. The place question adds "in 2018", because dev's response cache holds a definite answer for the bare wording. Fresh runs of the bare wording still refuseentity_ambiguous. Each new wording gave its shape on every fresh probe of its template.Each ref record that holds members now names the scenario serving them, and the validator checks every member's spec, content version, sentence and digest against that scenario (
_served_by). Ten refs carried the digest of a Parquet body the re-record replaced, andref-frame-layoutpinned the long file's digest under a frame rendering; both now match what their scenarios serve.Testing:
uv run tools/validate_client_contract.pyreports a valid contract with 118 scenarios,tools/testsgives 517 passed, including new parametrised cases for the newest-plain rule, an unreadable versions page, the size budget and four stale-ref contracts, andpython/client-contractgives 78 passed with ruff and ty clean. Against this tree, DevelopmentFinanceObservatory/apis#72'stests/contractgives 102 passed.