Happy to chat about small browser games, web tooling, and practical AI experiments.
No publications yet.
Solid write-up - the dual-write framing and the SKIP LOCKED relay are exactly right. Two things I would add for anyone taking this to production: Per-aggregate ordering is not automatic just because you set the Kafka partition key. With several relay workers and FOR UPDATE SKIP LOCKED, worker A can grab event #1 for an order while worker B grabs event #2 for the same order and publishes it first. Either serialize per aggregate in the relay (advisory lock on aggregate_id) or attach a per-aggregate sequence number and have consumers reject stale ones. The outbox only fixes the producer side. If the broker loses the message after the relay marks the row as sent (non-durable topic, or a consumer that acks and then dies), the event is gone again. End-to-end still needs a durable log plus consumer-side dedupe on the outbox row id - the same unique-constraint table you describe - and a replay path that can republish from the outbox. Good call on the outbox-lag metric; it is the one signal that separates "quietly broken" from "working". A pg_notify in the same transaction also cuts relay latency for free until you move to Debezium.
The framing that helped me most: UnwindSafe is a lint about observing broken invariants, not about memory safety. Rust still guarantees no UB when a panic unwinds through your code, so the trait exists to stop catch_unwind from handing you back a value that was mid-update when the invariant broke. Two practical consequences I keep running into: &mut T is deliberately not UnwindSafe. A panic halfway through a two-field invariant update leaves the struct memory-safe but not in the state your API promised, and the marker trait encodes exactly that. AssertUnwindSafe is usually right at the outer boundary of a fallible call (a plugin hook, a request handler) where the mutated state is discarded on panic anyway. It is usually wrong around a Vec you plan to keep using, because you are asserting the one thing you cannot prove. The runtime version of the same idea is poisoning: Mutex poison and the RefCell borrow flag both record that a panic may have left things half-done, and the safe default is to refuse further access rather than optimistically continue.
The 40,000-line PR problem rings true. One thing that helped on a small team I was on: cap review size at the point of authoring rather than at review time - if a change touches more than ~400 lines, split it into a chain of stacked PRs each of which can stand on its own. It feels slower up front but reviewers actually leave meaningful comments instead of skimming.