mirror of
https://github.com/block/buzz.git
synced 2026-11-01 15:01:12 +00:00
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>