You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cortex): allocate DAG sequence numbers per author, seeded from the store
`DagAction::seq` is documented as a per-author sequence, and the DAG store keys
its author index on `(author, seq)`. The node allocated it from one
process-global counter that always started at 1, which broke that contract in
two ways — the second one loses history.
Gaps: interleaved writes by different authors (the node itself, the tool
surface) drew from the same counter, so each author's sequence came out full of
holes. Nothing in-tree depends on contiguity, but the number no longer means
what the type says it means.
Eviction: because the counter restarted at 1 on every process start, a node
reopening a persistent DAG re-issued sequence numbers the store already held.
`put` inserts into the author index unconditionally, so each new action silently
REPLACED the pre-restart action holding that key. Measured on a sled-backed
store: four writes across a restart leave four actions on disk and a two-entry
author chain. The evicted actions are still stored, still signed and still
linked by hash — but they disappear from every view built on the author chain:
`/api/v1/dag/chain`, the git-provenance list, the approval list. History that is
present and unreadable is not much better than history that is missing.
`AppState::next_dag_seq` now allocates per author and seeds an author's counter
from its highest recorded `seq` the first time it is asked, so numbering
continues the chain instead of colliding with it. All seven allocation sites —
the shared triple write path, delete, the two Raft-routed handlers, the GraphQL
mutations, custom actions, review approvals and git provenance — go through it.
Regression tests cover both symptoms: a restart against a persistent store must
leave all writes visible with a contiguous 1..4 sequence, and two authors
writing through the same node must each own a gapless sequence.
0 commit comments