Skip to content

docs(client-contract): state build joining, the fetch wait and the base URL rule - #23

Draft
jm-rivera wants to merge 1 commit into
devfrom
docs/client-waiting-rules
Draft

jm-rivera wants to merge 1 commit into
devfrom
docs/client-waiting-rules

Conversation

@jm-rivera

Copy link
Copy Markdown
Contributor

The DFO clients are about to rely on three behaviours that the contract did not state, so this writes them down before the clients depend on them.

python/client-contract/README.md now says that a POST for a build identical to one that is pending or running returns that same operation, because dfo-apis derives the operation id from the request (src/datasets_api/operation_store.py compute_operation_id hashes the request identity, the origin catalogue build id and the rendering). A client that stops waiting can post the same build again to join it. Within one catalogue build the id is stable; a new catalogue build gives a new id.

The timeout paragraph replaces fetch(timeout=1800) with a wait that has no whole-call deadline by default, fetch(timeout=…) as the opt-in bound, and a download stall bound: a download that delivers no byte for 30 s raises the retryable network_error. The per-attempt 30 s bound and every replayed behaviour are unchanged; timeouts are not replayed, so no scenario changes.

rules/base-url.json adds the base URL rule beside key-lookup: the argument, then DFO_BASE_URL, then https://developmentfinance.org/api/v1. An empty variable counts as unset, an empty or malformed argument refuses with base_url_invalid (already in client-codes.json), and only the chosen source is checked. rules.schema.json, contract.py RULES, rules/README.md and a reference resolver in tests/test_rules.py carry it. The validator does not yet cross-check the rule's error reason against client-codes.json as it does for key lookup.

Testing: uv run pytest -q in python/client-contract 93 passed; tools/validate_client_contract.py valid with 23 client codes and 120 scenarios; tools/tests/test_validate_client_contract.py 311 passed; ruff and ty clean. No scenario was re-recorded and no API was called.

…se URL rule

A POST for a build identical to one pending or running returns that
operation, so a client that stops waiting can post again to join it.
fetch waits with no whole-call deadline by default, and a download that
delivers no byte for 30 s is a retryable network_error. The new base-url
rule orders the argument, DFO_BASE_URL and the public default, with 14
vectors replayed by a reference resolver in tests/test_rules.py.

This branch has not been deployed

No deployments
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