fix(store): fail the caller when a native-store append fails - #52
Merged
TheGreatAxios merged 1 commit intoSep 27, 2026
Conversation
TheGreatAxios
added this pull request to stack #50
September 27, 2026 00:56
The store's write queue swallowed every failure, so send, writeMailboxMessage and persist reported a uid (and announced it) for a row that never landed. appendMessage resolves only once its own insert and counter update commit, in one transaction, and on failure rolls the in-memory uidNext, highestModSeq and message back and rejects. Every append in the package goes through it. NUL is dropped from header values and cached envelope fields, since Postgres text and jsonb refuse it; raw keeps every byte.
TheGreatAxios
force-pushed
the
cl-9434-mailbox-fail-requests-when-a-native-store-write-fails
branch
from
September 27, 2026 01:23
73f144a to
780b43a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
writeMailboxMessageand persist, and persist announced it.NativeMailboxStore.appendMessageresolves only once its own insert andmailbox_stateupdate commit (one transaction). On failure it removes the message from the in-memory mirror, rollsuidNextandhighestModSeqback, and rejects. Send, write and persist all use it: send fails beforedeliver, write rejects before publishing, persist logs and announces nothing.headerValue) and from every cached envelope field before the insert, since Postgrestext/jsonbrefuse it.rawkeeps every byte.Verification
e2e/write-failure.test.tsinstalls a real trigger that refuses one insert and asserts:appendMessagerejects with the counters rolled back; send returns 500 without callingdeliverand the next send gets uid 1;writeMailboxMessagerejects with no bus event; persist announces nothing. It also covers NUL in the subject on send, write and persist. All 7 fail on chore: align repo scaffolding with the package standard #51.bun run check, build,test:e2eand the pack smoke pass locally.Closes CL-9434