Repository navigation
fix(review-desk): Purge private Review items and add missing foreign keys - #2477
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c274a56. Configure here.
sentry-junior
Bot
force-pushed
the
fix/review-item-purge-fks
branch
from
November 1, 2026 19:43
74aa53a to
1a51c50
Compare
This was referenced Nov 1, 2026
dcramer
approved these changes
Nov 1, 2026
dcramer
enabled auto-merge (squash)
November 1, 2026 21:25
Member
|
Needs rebased |
sentry-junior
Bot
force-pushed
the
fix/review-item-purge-fks
branch
from
November 1, 2026 21:29
1a51c50 to
f7c9aa7
Compare
…keys Transcript purge of a non-public Conversation tree now deletes the Review items it added, the same way it deletes its Briefs. Add foreign keys for added_by_conversation_id and Slack card conversation_id, and set null on closed_by_user_id when its User is deleted. Co-Authored-By: David Cramer <[email protected]>
…turned private Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
…vate items A purge already leaves an open item of an Automation open, because a later run can still change it (#2506). The private item delete did not skip it, so a purge of the first run removed an item that the Automation still updates. Skip open Automation items in the delete and in the purge selection, so the next purge deletes the item after it closes. Co-Authored-By: David Cramer <[email protected]>
sentry-junior
Bot
force-pushed
the
fix/review-item-purge-fks
branch
from
November 1, 2026 21:50
f7c9aa7 to
f941ba8
Compare
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.

Transcript purge did not touch Review items. So the title, body, and answer of an item from a private Conversation stayed after Junior purged that Conversation.
Purge. When
purgeConversationTreescrubs a non-public tree, it now deletes the private Review items that the tree added (added_by_conversation_id). This follows the existing rule for Briefs: private Briefs are deleted, public Briefs stay. The assignees, links, and Slack card rows cascade. A public item stays, also when its destination turned private later, because other Conversations can still link to it.selectExpiredRootsalso counts private items as remaining work, the same as private Briefs.Foreign keys (migration
0070_review_item_foreign_keys):junior_review_items.added_by_conversation_id→junior_conversationswithON DELETE cascade. This matches the link table. Conversation rows stay after a purge, so this changes nothing today.junior_review_item_slack_cards.conversation_id→junior_conversationswithON DELETE cascade.junior_review_items.closed_by_user_id: nowON DELETE set null. Before, it had no rule, so it blocked the User delete. A null value already means "an agent closed it".Existing rows meet the new constraints: the add tool inserts the added-by Conversation as a link, and that link already has a foreign key. Cards are posted only for linked Conversations.
Decisions for you
set nullonclosed_by_user_id, an item closed by a deleted User reads as closed by an agent.The rule is documented in
chat/review-items/README.md("Purge").via David Cramer.
--
View Session [Sentry]