Repository navigation
feat(service,features): an inbox mark, answer, or close answers the transaction it committed in - #4437
Merged
Conversation
…ransaction it committed in Marking an item read or unread, marking every item read, answering an item or its open ask, and a member's close each return pg_current_xact_id() in the RETURNING of the write that changes the row, and the wire answer carries it as an optional txid. A write that changed nothing (a mark already standing, an answer or close sent again) carries none, so a window following the inbox has nothing to wait for. Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
This branch was successfully deployed
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.
The service half of the inbox's txid wait: each member write on the inbox returns the txid of the transaction that changed its row, as Neon's mutations guide describes. The host PR that waits on it with
confirmWrite(#4423) follows.What changes
inbox-store.ts:pg_current_xact_id()::textis read in theRETURNINGof the write that changes the row. No extra transaction or statement is added.upsertRead,upsertUnread, andupsertAllRead(mark read, mark unread, mark all read).answerItem(answer by revision, and answer to an ask by its message).memberCloseItem(a member's close).inbox-wire.ts):inboxAnsweredSchema,inboxMessagedSchema(an answer by reply),inboxReadStateSchema, andinboxReadAllSchemaeach get an optionaltxid. A desktop that doesn't know the field drops it.Old work
#3264 merged without a txid half. Its head (
refs/pull/3264/head) has no txid hunks, and no*inbox*txid*branch exists, so this is new code. It follows the chat txid PR (#4251) as its pattern.Tests
inbox-store.test.ts:{ marked: 0 }with no txid when nothing was unreadinbox-threads.test.ts: an answer to an ask is taken with a txid, and the same answer sent again (REPEATED) has none.coding-agents-app.test.ts: the PUT and DELETE read routes and mark all read carry a txid on the wire.Made with Luke