mirror of
https://github.com/block/buzz.git
synced 2026-11-05 00:41:28 +00:00
The retention cache resolved an equal-`created_at` collision by skipping the inbound event unconditionally, while the relay breaks that tie by lowest event id. The two could therefore disagree about which same-second event is the head, and every later disk-vs-head compare inherited the error. Retained rows now carry the event id as a real column so the local compare can match `replace_parameterized_event`. A pending row still wins its tie regardless of id: it is durable local intent, arbitrated against a writer-consistent head by the boot pass rather than dropped by a cache compare. The id is re-derived from a parsed and verified event, never read from the JSON's self-asserted `id` field, so a legacy row whose bytes do not verify stays unresolved instead of receiving a key it could win a tie with. `RetainedEvent::pending`/`::inbound` replace the hand-built literals at every call site, which makes it structurally impossible for a row's ordering key to describe different bytes than its own `raw_event`. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>