Skip to content

fix(identities): Repair Slack Identities linked by dashboard posts - #3072

Merged
BYK merged 6 commits into
mainfrom
fix/repair-web-linked-slack-identities
Nov 10, 2026
Merged

BYK merged 6 commits into
mainfrom
fix/repair-web-linked-slack-identities

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #3066, as asked in the review. Refs #3065.

Migration 0095 repairs Slack Identities that a dashboard post linked to the poster's User before #3066.

Evidence. A Slack instruction stores the Actor from the Slack profile (createSlackActor) in provenance.actor. Slack is the only source that may give a Slack Identity its email. So an instruction with the Identity's Slack user and email proves that email, and nothing else does.

Candidates. A Slack Identity is a candidate when:

Self-check instead of a dry run. Slack emails are unique in a workspace, so a User has at most one correct Slack Identity per team. The migration repairs a candidate only when evidence proves exactly one other Slack Identity of the same User in that team. It leaves every other candidate as it is:

  • a poster with no Slack Identity of their own;
  • a poster whose own Slack Identity has no evidence, because they linked it through a dashboard post or because retention removed its events.

The migration is idempotent.

Repair (one statement, so every part reads the same rows):

  • Delete the poster's Participant rows on roots that the damaged Identity started or sent a Turn in. Keep a row when the poster started that root, or wrote in it, through another Identity.
  • Clear user_id, email, email_normalized, and email_verified on the Identity. That is its state before the link. Its own Slack Turns have no email, so they cannot link it again.
  • Clear the Identity's display_name when it matches the poster's web Identity and no Slack evidence proves it. The same write copied the poster's name when Slack gave the starter none.
  • Clear the poster User's display_name when the starter's own Slack instructions prove it is the starter's name and no proven Slack Identity of the User has it. Clear it on the User's web Identities too: dashboard posts copy the User name there, and the next save copies it back. Conversations read the User name before the Identity name, so without this all of the poster's work showed the starter's name.
  • Bump detail_version on the affected roots.

Not repaired:

  • Review items that the starter's Turns assigned to the poster by default. The item does not record whether the agent picked the assignee or the default did.
  • OAuth Identities, timezone, and customization that the starter's Turns saved on the poster's User during the link. These are keyed by User, and nothing records which person saved them.

Report. The migration reports its counts with RAISE INFO, and junior upgrade now prints Postgres INFO messages, so the counts appear in the junior-prod Vercel build log. The report has no identifiers:

0095 Slack Identity repair: N candidates, N repaired, N skipped with no proven Slack Identity, N skipped with more than one, N Participant rows removed, N roots updated, N User names and N web Identity names cleared

The skipped counts show how many victims a later fix must reach.

Merge only when junior-prod production serves a release that contains #3066. Every junior-prod build runs junior upgrade before the build, while the current deployment still serves traffic. If an older release serves traffic when the migration runs, its workers can link an Identity again, and the migration does not run again. #3066 shipped in 0.291.0, and junior-prod production serves 0.291.0.

I checked it locally against Postgres 17 with the pre-#3066 code. Cases checked:

  • A starter linked to a poster with a proven Slack Identity is repaired. The poster keeps their link and the roots they started or wrote in.
  • A Participant row added by the starter's Turn in a third person's root is removed.
  • No repair when the poster has no Slack Identity, or when no Slack Identity of the poster has evidence.
  • An old linked victim with no events does not block the repair of other victims.
  • A poster User that took the starter's name gets its name cleared.
  • A second run changes nothing.

migration-info-messages.test.ts covers the report path. There is no committed test for 0095 itself, per repo policy.

via @BYK.

--

View Session in Sentry

@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 10, 2026 1:44pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

14 screenshot changes — 14 changed · 0 added · 0 removed

Review screenshots in Frameshift

Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Attachment · Mobile
Conversation Attachment · Mobile
Changed
Conversation Attachment Modal · Desktop
Conversation Attachment Modal · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Show 8 more changed screenshots
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Conversation Unsent Answers · Desktop
Conversation Unsent Answers · Desktop
Changed
Conversation Unsent Answers · Mobile
Conversation Unsent Answers · Mobile
Changed
Locations · Desktop
Locations · Desktop
Changed
Memories · Mobile
Memories · Mobile
Changed
Push Notifications Tip · Desktop
Push Notifications Tip · Desktop
Changed
Settings · Desktop
Settings · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed

@sentry-junior
sentry-junior Bot marked this pull request as ready for review November 10, 2026 12:34
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 10, 2026
sentry-junior Bot and others added 4 commits November 10, 2026 13:09
Before #3066, a dashboard post into a Slack thread could link the thread
starter's Slack Identity to the poster's User. Migration 0095 finds those
Identities, removes the Participant rows that the link added, and clears
the copied email and User link.

An Identity is repaired only when the poster's web Identity, with the
same email, wrote in one of its roots, and none of its own Slack
instructions carry that email from the Slack profile.

Refs #3065

Co-Authored-By: BYK <[email protected]>
The same Conversation write that copied the poster's email also copied
their name when Slack gave the starter none. The repair now clears a name
that matches the poster's web Identity. The next Slack Turn of the
Identity saves its own name again.

Co-Authored-By: BYK <[email protected]>
No one can run a production dry run for 0095, so the migration now
checks its own rule. It repairs a candidate only when exactly one other
Slack Identity of its User stays linked in that team. Slack emails are
unique in a workspace, so that one is the correct link. Other candidates
stay as they are.

The repair also clears a User name that came from the starter's
Identity, when no kept Identity of the User has that name.

Co-Authored-By: BYK <[email protected]>
…roves

An adversarial review found that a kept Identity with no events counted
as proof. Retention removes events, and a poster who linked their own
Slack Identity through a dashboard post has no Slack email evidence. In
that case the old guard unlinked the poster's real Identity. The guard
now counts only Slack Identities that a Slack instruction proves.

The repair also removes Participant rows that the link added through the
damaged Identity's Turns in roots that other people started.

Co-Authored-By: BYK <[email protected]>
@blacksmith-sh

blacksmith-sh Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Found 2 test failures on Blacksmith runners:

Failures

Test View Logs
[chromium] › packages/junior-dashboard/e2e/
conversations-mobile.spec.ts:768:1 › keeps the message in view while earlier history an
d late content load
View Logs
packages/junior-dashboard/e2e/conversations-mobile.spec.ts/
keeps the message in view while earlier history and late content load
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fdcdde8. Configure here.

Dashboard posts copy the User name to the poster's web Identity, and the
next save of that Identity copies it back to the User. So the web
Identity name is not evidence that the name is the poster's. The repair
now proves the starter's name from Slack evidence and clears it on the
User and on the User's web Identities. It also keeps a starter's own
Slack name when Slack evidence proves it.
No one can query the production database, so a data migration cannot
show what it changed. junior upgrade now prints Postgres INFO messages
that its migrations raise. The messages appear in the Vercel build log.

Migration 0095 reports its counts this way: candidates, repairs, skipped
candidates by reason, and removed rows. The report has no identifiers.

Co-Authored-By: BYK <[email protected]>
@BYK
BYK enabled auto-merge (squash) November 10, 2026 13:50
@BYK
BYK merged commit ba56ea2 into main Nov 10, 2026
44 checks passed
@BYK
BYK deleted the fix/repair-web-linked-slack-identities branch November 10, 2026 13:52

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 452f9b81 Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant