Files
buzz/desktop/src-tauri
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 7d096ae299 fix(managed-agents): close CAS race between reconcile and inline flush barrier
spawn_event_sync previously called mark_unready() between the reconcile
and its trailing run_boot_barrier call, opening a window where the flush
loop could win the claim_in_progress CAS and certify readiness against
the pre-reconcile database state. A stale row retained by reconcile would
then publish before the post-reconcile barrier could gate it.

Fix: hold InProgress continuously through the entire reconcile+barrier
window. Add run_boot_barrier_after_claim (skips the CAS) called by
spawn_event_sync; run_boot_barrier (with CAS) remains the flush-loop
entry. The process-global static in config_sync_readiness.rs makes the
latch app-state-free, keeping app_state.rs within its size gate.

Also split flush-barrier tests into a dedicated file and rewrite them
to exercise production transition functions via module-level free
functions, with thread_local isolation for test parallelism. Each test
now exercises a named production invariant: (a) snapshot-vs-gate race,
(b) InProgress rejects second claim, (c) barrier error resets to Unready,
(d) Thufir's deterministic interleaving proof, (e) retry publishes.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-01 14:09:31 -04:00
..