Skip to content

fix(client-contract): read a no_data part's gap kind from its own reason - #21

Open
jm-rivera wants to merge 1 commit into
devfrom
fix/timed-out-gaps-keep-reasons
Open

jm-rivera wants to merge 1 commit into
devfrom
fix/timed-out-gaps-keep-reasons

Conversation

@jm-rivera

Copy link
Copy Markdown
Contributor

A no_data part now becomes a gap of its own reason's gap_kind, whatever the answer's diagnostics.timed_out says. The old rule turned every no_data part of a timed-out answer into a timed_out gap. That made sense when Search reported an unfinished part as variable_not_resolved. Search now marks each part it left unresolved at its time limit with the reason timed_out (dfo-apis src/search/engine/fanout.py, _placeholder_no_data), so the override only erased the reason, message and choices of parts Search did answer. The SDK e2e testers saw an entity_ambiguous choice reduced to a timed_out gap with no options.

python/client-contract/README.md states the new rule. answer-timed-out is re-derived so its unfinished part carries reason timed_out and the message dfo-apis renders for it, and the expected gap stays timed_out. The new synthetic answer-timed-out-keeps-reasons keeps variable_not_resolved under diagnostics.timed_out: true and expects a not_understood gap. tools/validate_client_contract.py answer_gaps reads the part's reason alone, and tools/capture_client_contract.py derives both scenarios.

The test row diagnostics-not-an-object-read relied on the old rule, so it is replaced by test_diagnostics_that_is_not_an_object_holds_no_warnings, which pins the README clause through the replay reader with a string, a list and an object control.

Downstream, dfo-apis pins this package and the SDK's contract/SOURCE must sit at or behind that pin. A follow-up bumps both, and the SDK drops its timed-out override in the same change.

Testing: uv run tools/validate_client_contract.py reports 121 scenarios valid; pytest tools/tests 530 passed; python/client-contract pytest 78 passed, ruff check and format clean.

A no_data part becomes a gap of its reason's gap_kind whatever
diagnostics.timed_out says. Search marks every part it left unresolved at
its time limit with the reason timed_out, so a part it answered before the
limit keeps its reason, its message and its choices.

answer-timed-out now carries reason timed_out on the unfinished part, and
answer-timed-out-keeps-reasons pins a resolved part that keeps
variable_not_resolved under a timed-out answer. The validator's
answer_gaps reads the part's reason alone, and a new validator test pins
that a diagnostics that is not an object holds no warnings.

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