Skip to content

test(contract): check the app against the client contract, and bind Search's registry endpoints - #72

Merged
jm-rivera merged 8 commits into
devfrom
feat/client-contract-check
Oct 23, 2026
Merged

jm-rivera merged 8 commits into
devfrom
feat/client-contract-check

Conversation

@jm-rivera

@jm-rivera jm-rivera commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The API checks recorded client exchanges against the composed app's current schemas and code registry. It builds OpenAPI with Search, Datasets, Graph, and Presentation enabled, then validates recorded request bodies, response bodies, and problem statuses. Strict required fields must remain required and non-nullable, strict enum values must remain admitted, and every contract action must name an active registry code. Empty scenario, exchange, or problem coverage fails the gate. This establishes schema and registry compatibility; SDK replay and live journeys check client handling and deployed behavior.

Search binds /api/search/resolve and /api/search/options to their registry endpoints. This disambiguates codes whose status differs across surfaces, with refusal exemplars verifying each Search mapping.

Wire-change guidance is in docs/development.md. CONTRIBUTING.md covers public contributions.

Merge after #66, #67, and #68. Their wire changes are required by the recorded scenarios. All six spec-kit pins currently identify 98d78be and must move together to the final release commit containing DevelopmentFinanceObservatory/spec-kit#10 and DevelopmentFinanceObservatory/spec-kit#11 before merge. The test group includes dfo-spec-kit-client-contract, and a check keeps its pin aligned with the kit.

Testing: a current-dev composition with #65, #66, #67, and #68 passed all 101 contract cases plus 99 registry, source-choice, source-scope, and assumption tests, serially. The standalone branch depends on the earlier PRs for the recorded wire behavior.

tests/contract/test_client_contract.py checks the composed app against
the scenarios, strict fields and actions that dfo-spec-kit-client-contract
ships. Each recorded exchange must match a route and validate against
its request and response schemas. Every strict member must stay
required and non-nullable, and every strict enum value must stay
admitted. Every action must name an active registry code, and every
problem code must carry the status the server would pick for its route.

The six spec-kit pins move to 98d78be together, and the test group
gains dfo-spec-kit-client-contract. CONTRIBUTING.md describes how to
change what the clients read.
The Search surface declared no registry_endpoints, so registered_status
read a Search code's status across every endpoint, and found two for
facet_binding_unsupported: 501 on Search and 422 elsewhere.
/api/search/resolve binds search.resolve and /api/search/options binds
search.options, as the Graph and Datasets routes bind theirs.

Search's classifier sets each status itself, so no response changes.
tests/engine/test_refusal_registry.py checks that every search.*
endpoint the registry maps is bound to a route, and that each Search
exception exemplar goes out at the status the registry gives its code
on each Search endpoint that maps it.
@jm-rivera jm-rivera changed the title test(contract): check the app against the client contract test(contract): check the app against the client contract, and bind Search's registry endpoints Oct 21, 2026
Keep the public contribution guide and move the contract update guidance
into the maintainer notes. Describe the test as schema and registry
validation of recorded exchanges.
Move all six spec-kit pins to 95a15cf, where spec-kit#11 landed on dev,
so the gate checks the 118 scenarios the SDK clients replay.
# Conflicts:
#	packages/dfo-data-tools/pyproject.toml
#	pyproject.toml
#	uv.lock
@jm-rivera
jm-rivera marked this pull request as ready for review October 23, 2026 11:57
@jm-rivera
jm-rivera marked this pull request as draft October 23, 2026 11:59
@jm-rivera
jm-rivera marked this pull request as ready for review October 23, 2026 11:59
The pin comment names the spec-kit dev commit and what it registers.
…35d29c

The client contract's served document and scenarios are captured at
dfo-apis 035d29c, so recorded versions pages carry `enrichment_stamp`,
and a client reads the newest plain build of a spec.
@github-actions github-actions Bot removed the run-eval label Oct 23, 2026
@jm-rivera
jm-rivera merged commit e17d7f5 into dev Oct 23, 2026
25 checks passed
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