Files
buzz/crates
tlongwell-blockandDawn 7850a95277 fix(relay): commit-abort classifier requires SQLSTATE allowlist
Review blocker from Mari: treating every sqlx::Error::Database as proof
of rollback is unsafe — PostgreSQL reports indeterminate commit
outcomes as server errors too (08007 transaction_resolution_unknown,
40003 statement_completion_unknown). A false "aborted" would replay a
transaction that actually committed, misreport durable inserts as
duplicates, and skip their mentions.

Classify as provably-aborted only an explicit allowlist: class 23
(integrity constraint violation — deferred triggers such as the
0021/0022 guards raise 23514, deferred FK/unique checks land here too),
40001 serialization_failure, and 40P01 deadlock_detected. Everything
else — including 08007/40003, unknown codes, and missing SQLSTATE —
defaults to indeterminate (no replay, CommitOutcomeUnknown to callers).

The classification test now raises real SQLSTATEs through Postgres and
table-tests both sides of the allowlist, specifically rejecting
08007/40003.

Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
2026-07-19 19:10:50 -04:00
..