Wire get_invocation_metadata fixtures (043/045/046)#191
Merged
chris-colinsky merged 2 commits intoJun 25, 2026
Conversation
Wire the get_invocation_metadata read-access family (proposal 0048) into the YAML conformance harness via a hand-built runner -- the cross-cap adapter doesn't model augment_metadata, capture_invocation_metadata_into, retry_middleware, or direct_call. The runner processes a node's in-node directives in YAML key order (043 augments then captures; 045 attempt 1 captures then augments), drives 045's retry via RetryMiddleware + a category-carrying transient, and handles 046's no-graph direct call. Asserts final_state field equality plus the immutability invariant (the read is a MappingProxyType). Move 043/045/046 to _SUPPORTED_FIXTURES; 044 (fan-out scoping) stays a follow-up -- its fan-out collection of per-instance captures is a distinct shape. Test-only.
There was a problem hiding this comment.
Pull request overview
Wires proposal-0048 get_invocation_metadata read-access conformance fixtures (043/045/046) into the observability YAML harness by adding a dedicated, hand-built runner inside tests/conformance/test_observability.py.
Changes:
- Moves fixtures 043/045/046 into
_SUPPORTED_FIXTURESand leaves 044 in_UNIT_TESTED_FIXTURES(fan-out scoping deferred). - Adds
_run_get_invocation_metadata_fixture+ helpers to execute the 043/045 graph-based cases and the 046 direct-call case. - Extends the main fixture dispatcher to route these fixture IDs to the new runner.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
From CoPilot review of #191: assert known keys instead of silently dropping unrecognized ones, so a fixture-schema change or a typo fails the conformance harness loudly rather than passing false-green. - retry_middleware: assert only max_attempts / classifier are present. - _apply_metadata_directives: raise on any key outside the recognized directives + the structural keys it legitimately skips.
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.
What
Wires three of the four
get_invocation_metadataread-access conformance fixtures (proposal 0048) into the YAML harness via a hand-built runner intest_observability.py. The cross-cap adapter raises on these fixtures' directives (augment_metadata,capture_invocation_metadata_into,retry_middleware,direct_call), so the runner is hand-built, mirroring the unit tests intest_observability_metadata.py.How
RetryMiddleware; attempt 0 augments then raises a category-carrying transient (provider_rate_limit, which the default classifier retries), attempt 1 captures the baseline-only read then augments and succeeds. Asserts the failed attempt's write is discarded and the successful one is visible downstream.get_invocation_metadata()call with no active invocation returns an emptyMappingProxyTypewithout raising.final_statefield equality plus the immutability invariant (the captured read is aMappingProxyType). The other invariants (caller-baseline, write-discarded, downstream-visible) are structurally covered by the concretefinal_stateexpectations.Scope
Moves 043/045/046 to
_SUPPORTED_FIXTURES. 044 (fan-out scoping) stays a follow-up -- its fan-out collection of per-instance captures is a distinct shape (the same kind of work fixture 029 needed), kept out to keep this runner focused.Test plan
tests/conformance/test_observability.py -k "043 or 045 or 046"-> 3 passed.tests/-> 1467 passed; coverage guard green. ruff + pyright clean.Test-only; no src or CHANGELOG change.