Skip to content

Commit a3a451d

Browse files
Correct in-node accessor + deferral comment claims
The persist() example in the queryable observer pattern docs was reading state.invocation_id, but a default State has no such field. Switch the snippet to bind invocation_id from current_invocation_id() (the supported in-node accessor) with a brief note that it is guaranteed non-None inside a node body. The 0048 fixture-deferral comment in test_fixture_parsing.py claimed unit tests covered per-attempt scoping under retry and per-async-context scoping under fan-out. Neither is true: there are no retry-attempt tests in test_observability_metadata.py, and the fan-out coverage lives in the runtime conformance harness via the predecessor proposal 0034/0040 fixtures, not as unit tests here. Rewrite the comment to be honest about what each pin actually covers and to flag the retry-side gap.
1 parent c3f1a91 commit a3a451d

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

docs/concepts/observability.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,19 @@ release the bucket via the §9.4 `drop` discipline:
577577

578578
```python
579579
async def persist(state: PipelineState) -> Mapping[str, Any]:
580+
# current_invocation_id() returns the engine-minted (or
581+
# caller-supplied) id of the active invocation; never None
582+
# inside a node body.
583+
invocation_id = current_invocation_id()
580584
# 1. Wait for every event under this invocation_id to dispatch
581585
# to every attached observer; bounded by the timeout.
582-
await graph.drain_events_for(state.invocation_id, timeout=2.0)
586+
await graph.drain_events_for(invocation_id, timeout=2.0)
583587
# 2. Read the bucket — the accumulator's view now reflects the
584588
# full event stream for this invocation.
585-
usage_records = accumulator.get_bucket(state.invocation_id)
589+
usage_records = accumulator.get_bucket(invocation_id)
586590
# 3. Release the bucket per §9.4. Skip this step only if the
587591
# accumulator is intentionally session-scoped across resumes.
588-
accumulator.drop(state.invocation_id)
592+
accumulator.drop(invocation_id)
589593
# ...
590594
```
591595

tests/conformance/test_fixture_parsing.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,18 @@ def _id(case: tuple[str, Path]) -> str:
277277
# ``current_invocation_metadata`` plus the §9 queryable observer
278278
# pattern (convention-only); v0.12.0 adds ``get_invocation_metadata``
279279
# as the canonical alias and the §9 documentation. Behavior is
280-
# pinned by ``tests/unit/test_observability_metadata.py`` (read
281-
# roundtrip + per-async-context scoping under fan-out + per-attempt
282-
# scoping under retry + outside-invocation empty). Fixture-shape
283-
# activation is queued for a future PR.
280+
# pinned by:
281+
# - ``tests/unit/test_observability_metadata.py``: read
282+
# roundtrip + alias identity + mid-invocation augmentation
283+
# visible to next node + outside-invocation empty.
284+
# - Predecessor proposal 0034/0040 conformance fixtures
285+
# (observability/026, 027, 029, 030, 034 — already
286+
# implemented and exercised by the runtime harness) cover
287+
# per-async-context scoping under fan-out + parallel-branches.
288+
# - Per-attempt scoping under retry is the OPEN gap documented
289+
# on the 0048 manifest entry (status = "partial"); pinning
290+
# lands in the follow-on retry-metadata-reset PR.
291+
# Fixture-shape activation is queued for a future PR.
284292
"observability/043-get-invocation-metadata-roundtrip": (
285293
"Proposal 0048 fixture-shape models pending; contract pinned by unit tests"
286294
),

0 commit comments

Comments
 (0)