Reducer: an equal-timestamp approved -> done settles its approval (10.4.6)
2026-10-13 — An equal-timestamp approved -> done settles its approval
Package 10.4.5 → 10.4.6 · spec-kitty-events#87 · PR #91 · v10.4.6 is
also the first tag carrying the untagged 10.4.5
(rollback-seed lane authority) · fix to the
status.events.jsonl reducer (spec_kitty_events.diary.reduce /
reduce_parsed, the event-ordering step).
A work package that was approved and merged could travel backwards in a
migrated mission: done in the real log, in_progress with verdict
changes_requested in the reduced snapshot. Public API and serialized shapes
are byte-identical; this is a reduction-ordering fix only, so the on-wire schema
version stays 3.0.0.
What changed
- A real
approved -> …now sorts after its same-timestamp approval. The reducer used to order events strictly by(at, event_id). It now orders them by(at, follows-a-same-at-approval, event_id): a non-seed event that leavesapprovedand shares itsatwith a non-seed-> approvedof the same work package sorts after that approval, whatever their event IDs say. The new helper is_order_transitionsindiary.py; every other event keeps its(at, event_id)position.
That tie-break carries the whole fix. Once the done sorts after its approval,
arm (ii) continuity applies it, so the work package’s final setter is the done
event rather than a bare approval, and the later rollback-shaped seed has no
bare-sibling approval left to contest. The bare-sibling test (_is_bare_sibling)
is unchanged and plays no part here: it still returns False for a non-approval
setter like the done.
Why it mattered
Event IDs are ULIDs, and two events written in the same instant carry no
promise about which ULID is smaller. When a WP’s real in_review -> approved and
approved -> done shared a timestamp and the done drew the smaller id, the
reducer:
- met the
donefirst, while the WP was stillin_review, and dropped it under arm (ii)from_lanecontinuity (it claims to leaveapproved, but the WP was not there yet); - applied the approval, leaving the WP at
approved; - judged that approval bare, because no real event left
approvedafter it in(at, event_id)order; - let a later rollback-shaped
migration:seed (in_review -> in_progress, verdictchanges_requested) win the bare-sibling contest of spec-kitty-events#81 and take the lane.
An approval that a real done followed is a settled decision, not a bare
sibling (spec-kitty#6061). The rule was right; the ordering hid the done from
it.
Behavioral contract
| # | Event | at | event_id |
|---|---|---|---|
| 1–4 | planned -> claimed -> in_progress -> for_review -> in_review | 10:00–10:03 | …0001–…0004 |
| 5 | in_review -> approved (real reviewer) | 10:04 | …0006 |
| 6 | approved -> done (real merge) | 10:04 | …0005 |
| 7 | in_review -> in_progress, changes_requested (migration: rollback seed) | 11:00 | …0090 |
| Package | Resolved lane | Resolved verdict |
|---|---|---|
10.4.5 | in_progress | changes_requested |
10.4.6 | done | approved |
The regression test is
tests/test_status_diary_reducer.py::TestSeedLaneAuthorityArriving::test_equal_at_done_sorting_before_its_approval_settles_it
(@pytest.mark.regression). It was red through reduce() before the fix.
Scope and non-regression
- Ordering changes only when a same-WP, same-
atreal approval exists. Reconstruction seeds never move. - The
10.4.5(spec-kitty#6061),10.4.4(spec-kitty#6058) and10.4.3bare-sibling (spec-kitty-events#81) outcomes are unchanged, as are real-against-real arbitration,force=True, seedless logs and the Lamportreduce_status_eventspath. - The snapshot shape and the
3.0.0envelope schema are unchanged.
Downstream
A consumer pinned to spec-kitty-events>=10.4.4,<11 picks up 10.4.6 on its
next resolve; raise the floor to >=10.4.6 to require this fix and the
10.4.5 one it carries. Snapshots
already materialized from migrated missions whose approval and done share a
timestamp keep the wrong lane until they are re-materialized from the log.
See the repo-root CHANGELOG.md and
COMPATIBILITY.md for the versioned record and the
compatibility rationale.