Commit fafe911
authored
Activate fixture 037 case 5 (resume re-fire) (#102)
* Activate fixture 037 case 5 (resume re-fire)
Wires the langfuse conformance harness for the remaining decision-tree
case of proposal 0043's §8.4.1 trace.input/output sourcing fixture.
The two-phase resume flow (first invoke catches NodeException → resume
invoke completes) now runs end-to-end through new harness primitives:
- ``flaky: {fail_first_invocation_only: true, on_success: {...}}``
compact test seam in ``_build_node_body``.
- ``checkpointer: in_memory`` directive registers
``InMemoryCheckpointer`` on the graph builder.
- ``returns_state_snapshot`` added to ``_TRACE_IO_HOOK_REGISTRY``.
- ``_run_resume_case`` runs the two-phase flow + asserts both traces +
checks the §8.4.1 invariants (distinct trace ids, shared
correlation_id, first trace unchanged, hooks re-fire on resumed
trace).
Activation surfaced two engine bugs that PR #99 missed.
The first: ``InvocationCompletedEvent.final_state`` on the failure
path defaulted to ``starting_state``, but spec §8.4.1 *Resume
semantics* requires the failure-path ``trace.output`` hook to receive
"the partial final state captured at the failure point" (the most
recent successful step's post-merge state). Adds a new
``latest_state_box`` on ``_InvocationContext`` that the engine writes
after every successful step's ``state = step_result.state``
assignment; the outermost ``invoke()`` reads it in the finally-block
before falling back to ``starting_state``.
The second: ``latest_state_box`` MUST be per-context (unlike its
sibling ``final_node_box`` which shares by reference across subgraph
descents). An inner-subgraph step's success previously would
overwrite the outer box with an inner-typed state; on a subsequent
outer-level raise the outer ``trace.output`` hook would receive an
inner state when its signature expects the outer state class. Each
``descend_into_*`` method now omits ``latest_state_box`` from the
copy, so each level gets a fresh box.
Four new unit-test regressions pin the bug fix across all four
graph-descent shapes: flat, subgraph, fan-out instance, parallel-
branches branch. Each test wires a graph where an outer node
succeeds (outer_a_done=true) and a deeper raise propagates back; the
``trace_output_from_state`` hook MUST see the outer-state-typed
value with the success captured.
Cross-cap parser deferral for 037 stays in place — that parser
still doesn't model ``langfuse_trace`` shape. Activation lives in
the langfuse-specific harness only.
* Tighten fan-out regression + fix CHANGELOG count
PR #102 review caught two issues:
The fan-out regression test's inner subgraph contained only a raising
node, so under the original shared-`latest_state_box` bug no inner
step would have successfully written to the box — the test would
have passed without exercising the leak it was meant to guard. The
inner subgraph now has two nodes: `inner_succeeds` writes
`inner_done=true` (so the descent's _invoke writes inner state to the
box) followed by `inner_raises`. Confirmed by temp-reverting the
descend-omit-`latest_state_box` change and observing the test fail
with the typed-state-mismatch assertion.
CHANGELOG said "three regression tests" but enumerated four (flat,
subgraph, fan-out, parallel-branches). Bumped the count to four.1 parent bdfb285 commit fafe911
5 files changed
Lines changed: 632 additions & 19 deletions
File tree
- src/openarmature/graph
- tests
- conformance
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | | - | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1059 | 1059 | | |
1060 | 1060 | | |
1061 | 1061 | | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1065 | 1068 | | |
1066 | 1069 | | |
1067 | 1070 | | |
1068 | 1071 | | |
1069 | 1072 | | |
1070 | 1073 | | |
1071 | 1074 | | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
1072 | 1090 | | |
1073 | 1091 | | |
1074 | 1092 | | |
1075 | | - | |
| 1093 | + | |
1076 | 1094 | | |
1077 | 1095 | | |
1078 | 1096 | | |
| |||
1201 | 1219 | | |
1202 | 1220 | | |
1203 | 1221 | | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1204 | 1231 | | |
1205 | 1232 | | |
1206 | 1233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
500 | 517 | | |
501 | 518 | | |
502 | 519 | | |
| |||
545 | 562 | | |
546 | 563 | | |
547 | 564 | | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
548 | 568 | | |
549 | 569 | | |
550 | 570 | | |
| |||
596 | 616 | | |
597 | 617 | | |
598 | 618 | | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
599 | 622 | | |
600 | 623 | | |
601 | 624 | | |
| |||
650 | 673 | | |
651 | 674 | | |
652 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
653 | 679 | | |
654 | 680 | | |
655 | 681 | | |
| |||
0 commit comments