🤖 fix(desktop): consolidate fresh mention action admission and stable choices - #7191
Conversation
9164074 to
b411da5
Compare
b411da5 to
4316a13
Compare
96c6d9c to
ff2b68c
Compare
jedwards27
left a comment
There was a problem hiding this comment.
:bot: Jude’s code review agent — REQUEST CHANGES
Reviewed base bb8cca21e13099bc6206b18c62272b72928574ca through exact head ff2b68cb15bcd9d01ac37aedff5511b605166ad2.
1. Major — background third-party membership changes leave the mention directory stale
The global notification hook filters on the viewer's pubkey (desktop/src/features/channels/useMembershipNotifications.ts:52-60), while relay membership notifications p-tag only the changed member (crates/buzz-relay/src/handlers/side_effects.rs:913-928). Thus viewer V does not receive that path when actor A adds/removes target T. The mounted-channel path does refresh on membership system rows (desktop/src/features/messages/hooks.ts:375-390), but the all-channel subscription used for background channels accepts those rows without scheduling a refresh (desktop/src/features/channels/useLiveChannelUpdates.ts:232-335,385-401). V can therefore keep a removed agent visible, or omit a newly added agent, until polling despite already receiving the background-channel row.
Author action: detect membership rows in the all-channel live-event production path (or emit a genuinely viewer-addressed global event), invoke the coalescing scheduler there, and add a caller-bound regression for a background-channel A→T add/remove observed by V. Deleting the production invocation should make that test fail.
Verification owner: :bot: Jude’s code review agent will trace active/background delivery, run the full Desktop package, mutation-delete the invocation, and exercise V's first @ search after the background change.
2. Moderate — refresh/reorder can silently retarget keyboard selection
An open picker reranks when the directory changes (desktop/src/features/messages/lib/useMentions.ts:369-399), but selection is retained only as a numeric index and merely clamped (desktop/src/features/messages/lib/useMentionSelection.ts:7-23). Enter/Tab inserts whichever identity now occupies that index (useMentions.ts:776-815). A production-hook probe selected Bob in [Alice, Bob], then rerendered [Agent, Alice, Bob]; selection stayed at index 1 and therefore moved to Alice instead of following Bob to index 2. The next Enter/Tab can mention the wrong recipient without further navigation.
Author action: preserve selection by stable suggestion identity (normalized pubkey/persona ID/team ID) across refresh/reorder, with an explicit safe fallback if the identity disappears. Add a regression that changes ordering while the picker is open, asserts the visible highlight remains on the intended identity, and then verifies Enter/Tab inserts that identity. Restoring index-only clamping should fail the test.
Verification owner: :bot: Jude’s code review agent will verify keyboard/highlight/visible-row behavior and exact inserted recipient identity.
Evidence and confidence
- Full Desktop package:
6,028 passed, 0 failedat the exact head; HEAD unchanged and review trees clean afterward. git diff --checkpassed.- Exact-head CI run
34262722726: Desktop Core, four smoke shards, relay-backed Desktop E2E/integration, macOS/Windows builds green; DCO, Semgrep, and zizmor green. Cancelled entries belong to a superseded run, not this head. - Confidence gap, not a separate defect: no native GUI/accessibility journey was run. After the fixes, exact-head native evidence should cover a background third-party membership change and open-picker reorder.
jedwards27
left a comment
There was a problem hiding this comment.
:bot: Jude’s code review agent
Requesting changes on exact head ff2b68cb15bcd9d01ac37aedff5511b605166ad2 after reconciling both assigned lanes. Two independent author-actionable defects remain.
-
Open-picker refresh can silently retarget keyboard selection. Membership refresh reranks suggestions (
desktop/src/features/messages/lib/useMentions.ts:369-399), but selection persists only as a numeric index (desktop/src/features/messages/lib/useMentionSelection.ts:7-23); Enter/Tab inserts the identity now occupying that index (useMentions.ts:776-815). A production-hook probe selected Bob in[Alice, Bob], refreshed to[Agent, Alice, Bob], and retained index 1 (Alice) instead of Bob at index 2. This can mention the wrong recipient without further navigation.Required change: preserve selection by stable suggestion identity (normalized pubkey/persona/team identity) across reorder; use an explicit safe fallback if it disappears. Add a regression that reorders an open picker, asserts the same visible identity remains highlighted, then verifies Enter and Tab insert that identity.
-
Third-party membership changes in background channels miss the refresh scheduler. The global notification hook filters
#pto the viewer (desktop/src/features/channels/useMembershipNotifications.ts:52-60), but relay membership notifications tag the changed member (crates/buzz-relay/src/handlers/side_effects.rs:913-928). Mounted-channel rows refresh atdesktop/src/features/messages/hooks.ts:375-390, while the all-channel background path receives system rows but never callsrefreshDirectoryAfterMembershipChange(desktop/src/features/channels/useLiveChannelUpdates.ts:232-335,385-401). A viewer can therefore retain stale mention candidates after another actor changes a third party in a background channel.Required change: invoke the coalescing refresh scheduler from the all-channel production event path (or provide a viewer-addressed global event). Add a caller-bound behavioral regression for a background A→T add/remove observed by V; deleting the production invocation must fail it.
Baseline evidence was green: Desktop 6,028/6,028, clean git diff --check, and 17 successful/10 skipped exact-head checks. An older duplicate run is cancelled. Live head was unchanged immediately before review.
|
On the open-picker reorder retargeting keyboard selection (Moderate finding) — valid at this PR's head; fix owned by #7197 Valid as reviewed at Per this stack's ownership split the fix is #7197's stable installed-snapshot chooser, not a backport here. At #7197's head Existing coverage of this mechanism at #7239's head
Scope, stated plainly: standalone #7191 at |
|
On the background third-party membership change leaving the mention directory stale (Major finding) — fixed at this PR's new head Valid as reviewed at Fix published as commit New mounted-caller regression, Red / green / deletion control — actual runs bound to this exact candidate (the validated dirty state, now byte-identical to the published commit):
Full-suite proof scope: the entire desktop package suite was run once at this exact candidate — 6031/6031 tests pass, 87 suites, exit 0 ( Stack note: the identical fix is mechanically replayed onto #7192's new head Status, stated plainly: the claim-1 code is fixed and published at
|
jedwards27
left a comment
There was a problem hiding this comment.
:bot: Jude’s code review agent — REQUEST CHANGES
Reviewed: bb8cca21e13099bc6206b18c62272b72928574ca..f66687ef989f14bfa026b16d4a35def9beb74b58.
The changed head fixes the prior background-channel membership refresh defect: the all-channel production callback now invokes the coalescing directory scheduler, with a caller-bound regression that fails when that invocation is removed. One independent wrong-recipient defect remains.
[P2] Preserve the selected identity when membership refresh reranks the open picker
Membership refresh can reorder suggestions, but selection remains only a numeric index and is merely clamped (desktop/src/features/messages/lib/useMentionSelection.ts:7-23). The visible highlight follows the item occupying that index (MentionAutocomplete.tsx:363-373), and Enter/Tab insert suggestions[mentionSelectedIndex] (useMentions.ts:776-815).
At this exact head, a production-hook probe selected Bob at index 1 in [Alice, Bob], refreshed to [Agent, Alice, Bob], and retained index 1—now Alice. The next Enter/Tab therefore targets a different recipient without user navigation.
Author action: preserve selection by stable suggestion identity (normalized pubkey, persona ID, or team ID) across refresh/reorder. If the identity disappears, use an explicit safe fallback. Add a production-path regression that reorders an open picker, asserts the same identity stays highlighted, and verifies both Enter and Tab insert that exact identity; mutation-prove against index-only clamping.
Verification owner: reviewer — rerun highlight/Enter/Tab and disappearance recovery behavior, full Desktop package, and exact-head gates.
Validation: full Desktop package passed 6,031/6,031; typecheck, check, git diff --check, repo-policy audit, and exact-head CI run 34382606766 passed. The background callback regression failed causally when its new production invocation was removed, then passed after restoration. Residual confidence gap: native Desktop/AX observation was not run; reviewer/tooling-owned and not the reason for this verdict.
f66687e to
0973992
Compare
|
Published consolidated head Exact-tree evidence (tree Feedback mapping at this head: review 5168528058's P2 wrong-recipient selection is addressed in this unit's installed-rows/identity selection ( Limits: no native Tauri/WebKit, VoiceOver, IME or live-relay execution claimed; evidence binds currently installed dependencies. Exact-head CI is pending at Re-review of this changed head is requested — prior CHANGES_REQUESTED at |
jedwards27
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Reviewed bb8cca21e13099bc6206b18c62272b72928574ca..0973992daf750590225dd9a0b1d2cf5874eb71d3 at exact head 0973992daf750590225dd9a0b1d2cf5874eb71d3.
Risk: High — this changes messaging recipient correctness across asynchronous directory refresh, community/identity lifecycle, selection, pinning, and publication boundaries. A stale or retargeted same-name choice could silently notify the wrong person.
Behavior/contracts traced: membership-driven refresh and coalescing; cancellation and stale-response fences; community/identity reset; stable installed autocomplete choices during background rerank; exact-pubkey/channel admission at pointer, Enter, Tab, pin, and publication boundaries; persistence and editor lifecycle; unavailable/Retry behavior; same-name identity presentation; keyboard, pointer, and focus behavior.
Findings: No blocking or non-blocking code defect found. The prior wrong-recipient Enter/Tab blocker is resolved: the displayed request snapshot remains identity-stable while current evidence updates availability, and action-time admission rechecks the exact displayed destination. The regression moves selection to the second of two same-name rows, injects reordered results, and proves Enter and Tab still bind the originally selected pubkey (desktop/src/features/messages/lib/useMentionSelection.ts:7-43, desktop/src/features/messages/lib/useMentions.ts:499-599,793-844,909-941, desktop/src/features/messages/lib/mentionAdmissionJourney.test.mjs:564-610). Mutation back to live reranked candidates made both regressions fail; restored production code passed.
Unavailable identities retain their installed row rather than transferring the old index to another recipient, become disabled with a truthful reason and Retry, and Retry preserves keyboard focus (desktop/src/features/messages/lib/useMentions.ts:516-535; desktop/src/features/messages/ui/MentionAutocomplete.tsx:337-404,511-554).
Author action: none.
Verification owner: CI/release gate for required merge checks; reviewer/tooling for any additional native accessibility assurance.
Validation at exact head:
- Full Desktop unit suite: 6,164/6,164 passed.
- Focused consolidated mention/lifecycle suite: 97/97 passed.
- Same-name mutation suite: restored code 31/31 passed; deliberate unstable-candidate mutation failed the Enter and Tab regressions.
- Membership-refresh mutation: removing refresh scheduling failed joined/removed-member regressions; restored tree passed.
- Desktop typecheck: passed.
pnpm check: passed with pre-existing non-fatal warnings.- Full
just test: passed, including 2,019 mobile tests. - Browser picker journey: 3/3 passed; inspected distinct same-name and Checking/Unavailable/Retry states.
- Exact-head GitHub checks: 17 successful, 10 path-filtered/skipped, 0 failed, including Desktop Core, Desktop smoke/relay/integration E2E, Windows/macOS builds, Semgrep, zizmor, and DCO.
Manual/native evidence: Browser Chromium/mock-bridge journey and screenshots were inspected. Native Tauri/WebKit, VoiceOver, and IME were not run.
Residual risk: OS-delivered keyboard, screen-reader announcement, and IME behavior remain unwitnessed natively. Source, mutation-resistant tests, browser interaction evidence, full package tests, and platform builds found no author-actionable defect. Local just check could not resolve origin/main in the review checkout because the file-size script strips the MCP checkout's required GIT_CONFIG_*; this is reviewer-environment contamination, not a PR-caused gate failure, and the corresponding exact-head GitHub checks are green.
— :bot: Jude’s code review agent
…nt (#7190) 🤖 ## Summary Fixes four ways the composer could lose your text or cursor while working with @ mentions: - **A failed send no longer wipes your draft.** If mention preparation fails while sending (for example, a failed upload), the draft stays as typed, the error is shown, and you can send again. - **A closing menu can no longer steal your cursor.** A still-animating ⋯ menu can no longer grab a late pointer event and steal focus from the composer; Escape still refocuses its trigger. - **Delayed automatic mentions no longer overwrite your typing.** The per-agent "Automatically mention … in this conversation" toggle re-adds the label to your next draft, but only if that draft is untouched — any draft edit or channel switch cancels the re-add. - **Regenerated automatic mention labels leave no residue.** After a regeneration (for example, an agent rename), the current label is the one later updated or removed — no duplicated or leftover text. Part of the mention-editor stack: #7190 → #7191 → #7192 (review in order); stands on its base branch alone. ### Related issue Continues the merged mention-editor work from #7124 and #7128. No separate tracking issue for this slice. ### Testing - Unit tests cover each fix: draft retention on failed sends, re-add revocation on draft edits or channel switches, and regenerated-label ownership. - Browser specs cover the closing-menu focus case, failed sends, and an always-mention agent surviving save, reopen, and publication. - All PR checks pass on this head. --------- Signed-off-by: Logan Johnson <loganj@squareup.com> Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
…hoices Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Signed-off-by: Logan Johnson <loganj@squareup.com>
0973992 to
4b0a3e8
Compare
1c33575
into
integration/mention-picker-stack-844abd33-base
jedwards27
left a comment
There was a problem hiding this comment.
:bot: Jude’s code review agent — APPROVE
Reviewed: 65e814f7286063143ce95022ae0f3705de9ec4d3..4b0a3e8dbafadeea14a8155c3d0e269328400cf6 (exact head 4b0a3e8dbafadeea14a8155c3d0e269328400cf6). The PR merged at this immutable head while final evidence was being reconciled, so this is the exact-head review verdict; author action: none.
Risk: High — this affects recipient correctness across asynchronous directory refresh, membership/community lifecycle, stable selection, pinning, and publication. A stale or silently retargeted same-name choice can notify the wrong person.
Behavior/contracts traced: background membership-event delivery; refresh coalescing, cancellation, and stale-response fencing; community/identity reset; stable installed choices through rerank or disappearance; exact-pubkey/channel admission for pointer, Enter, Tab, pin, and publication; unavailable/Retry and focus behavior; same-name presentation; persistence and editor lifecycle.
Findings: No blocking or non-blocking code, product/UI, accessibility-contract, or regression-causality defect found. The restack introduced no implementation delta: prior reviewed head 0973992daf750590225dd9a0b1d2cf5874eb71d3 and this head both resolve to tree 37197dcfc70d80225ca15e0d7b78d58d1bb0ea09; their diff is empty. Full revalidation at the new SHA still confirmed that stable installed identity survives rerank/disappearance, unavailable rows remain disabled with truthful reasons, Retry restores editor focus, and Enter/Tab/pointer admit the exact displayed destination.
Author action: none.
Verification owner: CI/release owned required gates, all green before merge. Reviewer/tooling owns optional additional native Tauri/WebKit, VoiceOver, IME, and live-relay assurance.
Validation at exact head, clean worktrees:
- Full Desktop unit package: 6,164/6,164 passed.
- Focused product/mention/lifecycle suite: 183/183 passed.
- Focused systems/lifecycle suite: 157/157 passed.
- Browser Playwright picker journey: 3/3 passed.
- Desktop typecheck and
pnpm check: passed; only pre-existing non-fatal diagnostics were reported. - Membership-refresh mutation: deleting the background all-channel
refreshDirectoryAfterMembershipChangecall made joined/removed regressions fail; restored code passed. - Stable-choice mutation: replacing installed snapshots with live reranked candidates failed 8/31, including same-name Enter and Tab identity contracts; restored code passed.
- Exact-head checks: 17 successful / 10 path-filtered skipped / 0 failed, including Desktop core, smoke, relay/integration E2E, macOS/Windows builds, Semgrep, zizmor, and DCO.
Manual/native evidence: Browser Chromium/mock-bridge interaction was rerun. Native Tauri/WebKit, VoiceOver, IME, and a new live-relay journey were not rerun.
Residual risk: OS-delivered keyboard, screen-reader announcement, IME, and native WebKit behavior remain unwitnessed at this restacked SHA. This is a reviewer/tooling confidence gap, not an author-actionable defect: the source tree is identical to the previously approved implementation, causal regressions and full Desktop tests pass, browser interaction was exercised, platform builds and exact-head CI are green.
— :bot: Jude’s code review agent
🤖 ## Summary Keeps buffered messages reachable while you read, so the way back to the newest message never disappears. - **"Jump to latest" stays available whenever messages are waiting.** While you read away from the newest message, new arrivals are buffered; the pill could vanish even then, leaving no way down. Clicking it releases them and scrolls to newest. - Browser regressions drive that recovery with real input: a native wheel-return to the frozen bottom, the button kept through panel close, an ambiguous @ mention replaced with the exact recipient before resending, and authored drafts deleted through the real editor with a native select-all. Based on the mention-editor integration branch, which now includes #7190 and #7191. The send-flow failure handling this branch originally carried — visible mention-resolution errors that release the pending send, and one shared authorization-error reason — landed with #7191 and is unchanged here; the remaining diff is the timeline recovery and its test coverage. ### Related issue Continues the merged mention-editor work from #7124 and #7128. Discovered during #7239 — its separately authorized follow-up, not a replacement. [Originating Buzz conversation](buzz://message?channel=8dcd7afb-0193-4a3e-8ae9-72838de89a1d&id=00f3b6fc0f24a5be445fdb8b1fd092cbdae5eb46615d95119ef2d8c566396738) ### Testing - Browser regressions: native wheel-return to the frozen bottom, panel close without losing the button, ambiguous-send recovery via the exact recipient, and the dirty-edit fixture's real select-all with real keyboard focus (wrong-replacement negative control included). - This head's exact tree is the validated candidate: full desktop package suite (6,164 tests), typecheck and E2E build, formatting and text-size guards, and 38 Chromium browser regressions with zero retries. - PR checks gate this head. Browser evidence is mock-bridge Chromium — no native Tauri/WebKit, VoiceOver, IME, or live-relay claim. Signed-off-by: Logan Johnson <loganj@squareup.com> Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
🤖
Summary
Keeps @ mention choices accurate and safe while membership and access change.
Part of the mention-editor stack: #7190 → this PR → #7192 (review in order).
Related issue
Continues the merged mention-editor work from #7124 and #7128; no separate tracking issue.
Testing