Skip to content

Commit 8721d7c

Browse files
Fix degrade extra-outputs key in fan-out example
The fan-out-with-retry degrade mode supplied its extra_outputs value under the parent field name (`topics`) in degraded_update, but proposal 0066 reads degraded_update in the subgraph's field-name space. The subgraph field is `topic` (extra_outputs={topics: topic}), so the parent-keyed entry was ignored, leaving the slot null (0069) and tripping BatchState.topics: list[str] validation in degrade mode. Key the degraded value by the subgraph field `topic` (the doc walkthrough already documents `topic: other`). Caught running MODE=degrade against the v0.14.0rc1 artifact; the example smoke test only exercises fail_fast, so it slipped through #161.
1 parent bcbf932 commit 8721d7c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

examples/fan-out-with-retry/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,14 @@ def build_graph(mode: str = "fail_fast") -> CompiledGraph[BatchState]:
336336
# partial in place of the instance result, so the batch finishes
337337
# instead of aborting (fail_fast) or dropping the instance
338338
# (collect). Retry stays inner so it still sees raw transients
339-
# first. The degraded mapping is keyed the way the fan-out
340-
# projects an instance: the collect_field (``summary``) plus
341-
# each parent extra_outputs key (``topics``).
339+
# first. The degraded mapping is keyed in the subgraph's
340+
# field-name space (proposal 0066): the collect_field (``summary``)
341+
# plus each extra_outputs subgraph field (``topic``, which the
342+
# fan-out projects to the parent ``topics`` list). Supplying
343+
# ``topic`` keeps the slot non-null so the ``list[str]`` parent
344+
# field validates (an omitted source would be a null slot, §9.3).
342345
degrade = FailureIsolationMiddleware(
343-
degraded_update={"summary": "(unavailable)", "topics": "other"},
346+
degraded_update={"summary": "(unavailable)", "topic": "other"},
344347
event_name="headline_degraded",
345348
)
346349
instance_middleware = (degrade, retry, timing)

0 commit comments

Comments
 (0)