Skip to content

feat(database,service,features): a sidebar section's or repository pin's write answers the transaction it committed in - #4434

Merged
luke-agent[bot] merged 1 commit into
mainfrom
luke/sidebar-write-txid
Oct 21, 2026
Merged

luke-agent[bot] merged 1 commit into
mainfrom
luke/sidebar-write-txid

Conversation

@charleslpan

@charleslpan charleslpan commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The service half of the txid wait for the pins-and-sections area: every write the host's followed sidebar shows now answers the transaction it changed a row in, so the host can wait for it to land on the live view before it answers the window (host PR follows once #4423 merges).

What changed

  • task-section-store.ts: each mutating statement (insert, edit, move, delete a section, put/move/remove an entry) reads pg_current_xact_id()::text in its own RETURNING, as Neon's mutations guide does. writeTaskSections answers it as txid beside the sections. No extra transaction or statement.
  • repository-pin-store.ts: pin and unpin return it the same way; setRepositoryPin answers { pins, txid? }.
  • A write that changes no row answers no txid: a section made again under its id, edited to the title and icon it had, moved to where it stood, an entry moved to where it stood, a delete of what's gone, a pin already pinned, an unpin already gone. Edit and move now skip a row that already stands so (is distinct from), so a no-op writes nothing.
  • Wire: taskSectionsWrittenSchema and repositoryPinsWrittenSchema (the GET answers plus an optional txid) are the PUT outputs; TaskClient.writeTaskSection / pinRepository answer them. The host takes the sections and pins out of them as before and ignores the txid until the host PR.

Old work: the txid half of #3960 (branch luke/live-sidebar, and luke/live-sidebar-txid) was never pushed, and #3960's one commit carries no txid, so this is written fresh after the chat pattern in #4251.

Out of scope: task pins (the tasks-and-agents worker's), Better Auth's writes, the agent tools' section writes (they get the txid from the store but wait on nothing).

Tests

  • store: every changing write answers a distinct txid, every no-op answers none, for sections and pins (task-section-store.test.ts).
  • routes: the PUT answers carry a txid when they wrote and none when they didn't (repository-pins-procedures.test.ts, task-sections-procedures.test.ts).

Made with Luke

View guided diff Turn on auto-fix


Devin Review

…n's write answers the transaction it committed in

Every write to the account's sidebar sections (make, edit, move, delete,
and putting a task in a section or in none) and every repository pin or
unpin reads `pg_current_xact_id()` in its own statement's RETURNING and
answers it as `txid` on the PUT's answer, for the host to wait on its
followed sidebar before it answers the window. A write that changed no
row, such as a section given the title and icon it had, moved to the
place it stood, made again under its id, a pin already pinned, or an
unpin already gone, returns no row and answers no txid, so there is
nothing to wait for. The section edit and move, and an entry's move,
now skip a row that already stands so.

Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
luke-web Ready Ready Preview Oct 21, 2026 8:50pm UTC

Request Review

@luke-agent
luke-agent Bot added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit 5815612 Oct 21, 2026
11 of 12 checks passed
@luke-agent
luke-agent Bot deleted the luke/sidebar-write-txid branch October 21, 2026 21:00

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch was successfully deployed

1 active deployment
Preview — 97b852e6 Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant