Commit Graph
5 Commits
Author SHA1 Message Date
Lauri Ojansivu 76f6eba249 Link Sync History rows to the chain when they are written, not planned.
Sync and the stored rule archive runner fixed each History row's
previousHash and integrityHash when they PLANNED a batch, so the board's
History chain had to stay unchanged from planning until the last row was
written - which needed a multi-row History reservation that would block
or queue ordinary edits, and made a coordinated board refuse Sync.
Maintainer decision of 2026-09-30: plans are content only, and each row
is linked when it is appended, like an ordinary edit.

On a board still on the legacy path, the batch holds one writer token
(so a chain migration drains it) and each row is linked after the
chain's tip - the newest hashed row, then its successors, since the rows
of one batch share a planned createdAt and "newest" alone is a tie that
forks the chain. On a coordinated board each row goes through the chain
head. Appends are idempotent by row _id, and a replay accepts only the
planned content. The archive runner needs no reservation any more; it
captures the actor's redo candidates when it plans. Plans in the old
chained format are refused. An index on (boardId, previousHash) serves
the tip walk.

Unit and MongoDB tests: plans carry no link; rows chain correctly in
both modes and replay once; ordinary History written between planning
and writing is neither blocked nor forked; a coordinated board appends
through the head; old-format plans and adapters without admission or
linking are refused. The full-app archive case now runs without a
reservation and verifies the resulting chain. 561 server tests pass;
the one other failure in that run, the activity notification recovery
scan, is intermittent and passes on its own.

Thanks to xet7 !
2026-09-30 10:35:57 +03:00
Lauri Ojansivu 281f294746 Admit Sync History through the board's History writer gate.
Sync writes History rows it hashed when it planned them, straight into
the collection. On a board whose History chain had been migrated to the
coordinated head, that would fork the chain, and a migration could start
while a Sync batch was still writing. persistSyncFieldHistory now writes
only as a writer the History gate admits: production ChangeHistory holds
a legacy writer token for the whole batch, so a migration drains it
first, and a coordinated board refuses Sync History with
sync-history-coordination-required instead of appending around the head.
There is no default: an adapter without admission is refused. The rule
archive path shares it through persistSyncEffects.

A MongoDB integration test uses the real gate: the batch holds a token
while it writes and releases it after; a migration waits for a batch in
flight, a new batch is refused while the board drains, the in-flight one
completes; a coordinated board refuses and writes nothing. Test adapters
gained the pass-through admission; 561 server tests pass.

Thanks to xet7 !
2026-09-30 02:44:52 +03:00
Lauri Ojansivu 58e7efa8ef Validate saved Sync effects and actor before applying card changes 2026-09-28 04:23:37 +03:00
Lauri Ojansivu aa68ece6c1 Preserve activity and notification policy in durable Sync plans 2026-09-28 04:20:50 +03:00
Lauri Ojansivu 4ceeb47606 Coordinate saved Sync History and activity effects through one adapter 2026-09-28 04:10:08 +03:00