fix(#894): cold flights key on None; typed generation access; abort-Set producer pins

Review round 10 (1 minor bug; 2 major + 2 small quality — the majors
both pins-that-cannot-fail).

- The flight key's cold fallback was the literal 0, which collides
  with a live session's generation 0: an eviction/close landing inside
  a held flight's window let a post-truncation request rejoin a
  generation-0 pre-truncation flight.  Cold/detached workstreams now
  key on None (rewinds need a live session, so two cold flights are
  always mutually safe; a rehydrated session restarting at 0 can never
  share the manager slot with its evicted predecessor — documented
  at-site).  The read is TYPED (live_session.session._history_generation)
  so mypy carries the shape a getattr chain hid — and the typed access
  immediately surfaced an unfaithful SimpleNamespace mock in the
  reasoning-rehydration tests (no .session attr), now made faithful.
- Abort-Set producer pins: histCtrls.add exactly once and BEFORE the
  await, delete exactly once and in the finally — without them the
  destroy() consumer sweep was satisfiable by an always-empty Set.
- _make_session gains ws_id; the generation producer pin uses it.
- _coord_stick_latch: G2/G5's inline single-failure prologues RULED
  deliberate at-site (their baselines/phase timings interleave into
  the prologue; a per-divergence flag would obscure the choreography).
- Stray trailing whitespace stripped.

250 pins green; G2/G5/G7 re-run READY.
This commit is contained in:
Patrick Buckley
2026-07-24 14:51:19 -07:00
parent 60f6dc07a2
commit d8d026394f
6 changed files with 45 additions and 19 deletions
+15
View File
@@ -943,6 +943,21 @@ def test_coordinator_history_stale_latch_contract():
)
# destroy() must abort the in-flight fetch (dead-not-inert, the
# staleRetryTimer ruling applied to the r7 bound).
# Producer pins first — the destroy() consumer sweep below is
# satisfiable by an always-empty Set without them.
assert body.count("histCtrls.add(histCtrl)") == 1, (
"every dispatch must register its controller in the abort Set."
)
assert body.count("histCtrls.delete(histCtrl)") == 1, (
"the fetch finally must release its own controller — without the "
"delete the Set grows for the life of the pane."
)
assert body.index("histCtrls.add(histCtrl)", fetch_start) < awt, (
"the controller must be registered BEFORE the await."
)
assert fin < body.index("histCtrls.delete(histCtrl)", fetch_start), (
"the controller release must sit in the fetch finally."
)
destroy_code = _strip_comments(destroy_slice)
assert "histCtrls.forEach" in destroy_code and ".abort()" in destroy_code, (
"destroy() must abort EVERY in-flight /history (a Set — a "