Repository navigation
fix(web): simplify Room deletion confirmation and align Direct Room title - #691
Conversation
…itle Closes WHI-936.
There was a problem hiding this comment.
Approve with nits (1 P3)
Scope: base main, merge base 963f4b52, 1 commit, 6 files reviewed at 250c48ab. Helper skills: coderbook loaded; ponytail-review and karpathy-guidelines were not loaded, though I applied their checklists (callers/callees/tests, over-engineering, unrelated changes) by hand. Ran in a separate session.
Findings
P3
apps/web/src/features/rooms/room-surface.tsx:787:const headerName = room.name;is now just an alias. The old conditional is gone, so the variable doesn't name anything new. Useroom.namedirectly at its three uses (aria label,ActorAvatarname, heading) and delete the variable.
Verified as fine
- Double submit / pending state: the danger button now calls
deleteRoom.mutate()directly.Buttonsetsdisabled={disabled || loading}(apps/web/src/components/ui/button.tsx:76), so a second click can't fire while the request is pending.onClosestill refuses to close while it's pending (room-delete-dialog.tsx, theonCloseguard). - The delete still targets the real Room:
RoomDeleteDialognow getspresentationRoom, which only overridesname(room-surface.tsx:350-351). The DELETE call, the room-list cache filter andremoveQueriesall key onroom.id(room-delete-dialog.tsx:38-75).room.nameis only used for display. - The other caller is unaffected:
room-settings-panel.tsx:200passes the rawroom. Its delete buttons only render for owners in the group-Room branch (room-settings-panel.tsx:92,138,157), whereroom.nameis the correct title.kind === "room"picks the existing all-members description. ModalDialog.descriptionaccepts aRichMessagenode: it's typedReactNode(components/ui/modal-dialog.tsx:56).- Fallback to
direct_peer.display_name:actorscomes from a non-suspenseuseQuery(room-surface.tsx:293), solivePeerNameis also undefined on first load, not only for deleted Agents. The fallback improves both cases. The sidebar's Direct Room row also usesdirect_peer.display_name(room-secondary-navigation.tsx:546-547), so the PR's "agree with sidebar" claim holds. - Dead code removed: the
typeToConfirmandconfirmationLabelmessages are gone from bothroom-dialogs.messages.tsandzh-CN.json.useId,useStateandFormEventare no longer imported.GENERAL_AGENT_DEFAULT_NAMEis still used byquick-create-general-agent-page.tsx, so it stays. - Tests: the new
room-surface.test.tsxcase covers a deleted-Agent Direct Room with a staleroom.nameand the Agent missing from the actors catalog. It checks the header, the Direct-specific description, that there's no textbox, a single DELETE, and the redirect. - Repo rules: CJK only appears in
apps/web/src/i18n/locales/zh-CN.json, which is allowed. No contracts, env vars or cross-app imports are touched.
Unverified
- The old
RoomHeaderrule had a special case: when the presented name was"New Agent"(GENERAL_AGENT_DEFAULT_NAME), it showed the Room'sdirect_peer.display_namesnapshot instead. Now the header always shows the live catalog name. I couldn't find this rule's origin (it dates back to the initial import) or a test for it. I also couldn't confirm that every Agent rename path refreshes the tenant actors query (in-app profile edits do, viaactor-profile.tsx:300-312). If an Agent renames itself out-of-band, the header could show "New Agent" until that query refetches.
Process notes
- None.
CI
All checks pass: check (web), web tests (1/2), web tests (2/2), web-static, repository-gate, CodeQL. The other app checks were skipped because the PR doesn't touch those apps. I ran no tests locally.
Automated review by Claude Code
Automated review of 250c48a by Claude Code.
|
Addressed the P3 review comment in |
There was a problem hiding this comment.
Approve (0 findings)
Scope: follow-up on 250c48a. Base main, merge base 963f4b52; 2 commits, 7 files reviewed (full merge-base diff plus 250c48a..2c9d3c8). Loaded ponytail-review (sections 1–3); coderbook and karpathy-guidelines were not loaded for this follow-up, so their checklists were applied from the review instructions only. Ran in a separate session.
Previous findings
- Resolved:
headerNamealias inRoomHeader. It is gone, andapps/web/src/features/rooms/room-surface.tsx:803,817,838now usesroom.namedirectly.
Findings
None.
Verified as fine
- The dialog no longer has a type-to-confirm input. The confirm button is always enabled, keeps
data-voice-risk="never"and is disabled while the request is pending throughloading. Close and cancel are blocked while the request is pending (room-delete-dialog.tsx:103-121). - Direct Rooms get
deleteDirectRoomDescriptionbased on the structuredroom.kind, not on any text match (room-delete-dialog.tsx:85-88). The en and zh-CN catalogs both define the new key, and both drop the unusedtypeToConfirm/confirmationLabelkeys. - Title alignment:
peerName = livePeerName || room.direct_peer?.display_name(room-surface.tsx:348) feedspresentationRoom, andpresentationRoomis passed to bothRoomHeaderandRoomDeleteDialog(room-surface.tsx:573). The header therefore no longer needs its ownGENERAL_AGENT_DEFAULT_NAMErule. That constant is still used byquick-create-general-agent-page.tsx, so the dropped import leaves no dead code. - Cache removal on unmount and late-confirmation handling are unchanged. The existing tests that covered them now just skip the input step (
room-delete-dialog.test.tsx). - The new E2E test (
apps/web/e2e/room-creation.spec.ts:371-475) reuses selectors and strings that already exist:Skip for now,... settings from avatar, andThis Room is not available to you(apps/web/src/app/route-pages.messages.ts:12). It checks persistence from a fresh browser context. - No CJK in added lines outside
apps/web/src/i18n/locales/and none in commit messages. No merge commits.
Process notes
2c9d3c87 fix(web): drop headerName alias and add Room deletion E2Epatches the previous commit in response to review. Consider squashing it into250c48abbefore the rebase merge.
CI
At review time: changes passed. web tests (1/2), web tests (2/2), web-static, repository-gate and Analyze (actions) were still pending, and the other app checks were skipped as unrelated. I ran no tests myself; the real-service Playwright E2E is not part of CI, and the author reports it passed locally.
Automated review by Claude Code
Automated review of 2c9d3c8 by Claude Code.
Summary
Closes https://linear.app/linger1024/issue/WHI-936
RoomDeleteDialogwith a standard two-step confirmation modal that displays the target Room name directly in the description and keepsdata-voice-risk="never"on the danger button.deleteDirectRoomDescriptionwhenroom.kind === "direct"so deleting a Direct Room whose peer Agent has already been deleted does not claim every member will lose access.room.direct_peer?.display_namewhenlivePeerNameis absent inRoomSurfaceContent, passpresentationRoomtoRoomDeleteDialog, and useroom.namedirectly inRoomHeaderso the sidebar, header, and delete dialog agree on renamed/deleted-Agent Direct Room names.apps/web/e2e/room-creation.spec.tsfor deleting a Room via Room settings and verifying unavailability from a fresh session.Files Changed
apps/web/src/features/rooms/room-delete-dialog.tsxapps/web/src/features/rooms/room-dialogs.messages.tsapps/web/src/i18n/locales/zh-CN.jsonapps/web/src/features/rooms/room-surface.tsxapps/web/src/features/rooms/room-delete-dialog.test.tsxapps/web/src/features/rooms/room-surface.test.tsxapps/web/e2e/room-creation.spec.tsVerification
make check-repository-gate BASE=origin/main: passed (commitlint,env:inventory:check, changed-file Prettier/ESLint/English-only check,check-docs).make check-web BASE=origin/main: passed (typecheck,lint,react:doctor, andvitest— 421 test files, 3841 tests passed).apps/web/e2e/room-creation.spec.tsagainst production Web build + TeamHub + PostgreSQL): 4 passed.