Skip to content

Wire get_invocation_metadata fixtures (043/045/046)#191

Merged
chris-colinsky merged 2 commits into
mainfrom
feature/wire-get-invocation-metadata-fixtures
Jun 25, 2026
Merged

Wire get_invocation_metadata fixtures (043/045/046)#191
chris-colinsky merged 2 commits into
mainfrom
feature/wire-get-invocation-metadata-fixtures

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

What

Wires three of the four get_invocation_metadata read-access conformance fixtures (proposal 0048) into the YAML harness via a hand-built runner in test_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 in test_observability_metadata.py.

How

  • Directive order is load-bearing. The runner processes a node's in-node directives in YAML key order: 043 augments then captures (so the captured read includes the in-node write), while 045's attempt 1 captures then augments (so its read sees the baseline only). Both fall out of iterating the node's keys in order.
  • 045 (retry scoping): the retried node runs under 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.
  • 046 (outside invocation): a bare get_invocation_metadata() call with no active invocation returns an empty MappingProxyType without raising.
  • Asserts final_state field equality plus the immutability invariant (the captured read is a MappingProxyType). The other invariants (caller-baseline, write-discarded, downstream-visible) are structurally covered by the concrete final_state expectations.

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.
  • Full tests/ -> 1467 passed; coverage guard green. ruff + pyright clean.

Test-only; no src or CHANGELOG change.

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.
Copilot AI review requested due to automatic review settings June 25, 2026 03:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_FIXTURES and 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.

Comment thread tests/conformance/test_observability.py
Comment thread tests/conformance/test_observability.py
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.
@chris-colinsky chris-colinsky merged commit fa95dc2 into main Jun 25, 2026
5 checks passed
@chris-colinsky chris-colinsky deleted the feature/wire-get-invocation-metadata-fixtures branch June 25, 2026 03:16
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.

2 participants