Skip to content

fix(web): simplify Room deletion confirmation and align Direct Room title - #691

Merged
NightRain233 merged 2 commits into
mainfrom
fix/whi-936-room-delete-confirm
Nov 25, 2026
Merged

NightRain233 merged 2 commits into
mainfrom
fix/whi-936-room-delete-confirm

Conversation

@NightRain233

@NightRain233 NightRain233 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes https://linear.app/linger1024/issue/WHI-936

  • Replace the type-to-confirm input in RoomDeleteDialog with a standard two-step confirmation modal that displays the target Room name directly in the description and keeps data-voice-risk="never" on the danger button.
  • Use deleteDirectRoomDescription when room.kind === "direct" so deleting a Direct Room whose peer Agent has already been deleted does not claim every member will lose access.
  • Fall back to room.direct_peer?.display_name when livePeerName is absent in RoomSurfaceContent, pass presentationRoom to RoomDeleteDialog, and use room.name directly in RoomHeader so the sidebar, header, and delete dialog agree on renamed/deleted-Agent Direct Room names.
  • Add real-service Playwright E2E coverage in apps/web/e2e/room-creation.spec.ts for deleting a Room via Room settings and verifying unavailability from a fresh session.

Files Changed

  • apps/web/src/features/rooms/room-delete-dialog.tsx
  • apps/web/src/features/rooms/room-dialogs.messages.ts
  • apps/web/src/i18n/locales/zh-CN.json
  • apps/web/src/features/rooms/room-surface.tsx
  • apps/web/src/features/rooms/room-delete-dialog.test.tsx
  • apps/web/src/features/rooms/room-surface.test.tsx
  • apps/web/e2e/room-creation.spec.ts

Verification

  • 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, and vitest — 421 test files, 3841 tests passed).
  • Real-service Playwright E2E (apps/web/e2e/room-creation.spec.ts against production Web build + TeamHub + PostgreSQL): 4 passed.

@linger-review linger-review 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.

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. Use room.name directly at its three uses (aria label, ActorAvatar name, heading) and delete the variable.

Verified as fine

  • Double submit / pending state: the danger button now calls deleteRoom.mutate() directly. Button sets disabled={disabled || loading} (apps/web/src/components/ui/button.tsx:76), so a second click can't fire while the request is pending. onClose still refuses to close while it's pending (room-delete-dialog.tsx, the onClose guard).
  • The delete still targets the real Room: RoomDeleteDialog now gets presentationRoom, which only overrides name (room-surface.tsx:350-351). The DELETE call, the room-list cache filter and removeQueries all key on room.id (room-delete-dialog.tsx:38-75). room.name is only used for display.
  • The other caller is unaffected: room-settings-panel.tsx:200 passes the raw room. Its delete buttons only render for owners in the group-Room branch (room-settings-panel.tsx:92,138,157), where room.name is the correct title. kind === "room" picks the existing all-members description.
  • ModalDialog.description accepts a RichMessage node: it's typed ReactNode (components/ui/modal-dialog.tsx:56).
  • Fallback to direct_peer.display_name: actors comes from a non-suspense useQuery (room-surface.tsx:293), so livePeerName is also undefined on first load, not only for deleted Agents. The fallback improves both cases. The sidebar's Direct Room row also uses direct_peer.display_name (room-secondary-navigation.tsx:546-547), so the PR's "agree with sidebar" claim holds.
  • Dead code removed: the typeToConfirm and confirmationLabel messages are gone from both room-dialogs.messages.ts and zh-CN.json. useId, useState and FormEvent are no longer imported. GENERAL_AGENT_DEFAULT_NAME is still used by quick-create-general-agent-page.tsx, so it stays.
  • Tests: the new room-surface.test.tsx case covers a deleted-Agent Direct Room with a stale room.name and 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 RoomHeader rule had a special case: when the presented name was "New Agent" (GENERAL_AGENT_DEFAULT_NAME), it showed the Room's direct_peer.display_name snapshot 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, via actor-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.

@NightRain233

Copy link
Copy Markdown
Contributor Author

Addressed the P3 review comment in room-surface.tsx (removed the redundant headerName alias and used room.name directly) and added a real-service E2E test in apps/web/e2e/room-creation.spec.ts verifying the single confirmation Room deletion flow and fresh-session unavailability.

@linger-review linger-review 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.

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: headerName alias in RoomHeader. It is gone, and apps/web/src/features/rooms/room-surface.tsx:803,817,838 now uses room.name directly.

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 through loading. Close and cancel are blocked while the request is pending (room-delete-dialog.tsx:103-121).
  • Direct Rooms get deleteDirectRoomDescription based on the structured room.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 unused typeToConfirm/confirmationLabel keys.
  • Title alignment: peerName = livePeerName || room.direct_peer?.display_name (room-surface.tsx:348) feeds presentationRoom, and presentationRoom is passed to both RoomHeader and RoomDeleteDialog (room-surface.tsx:573). The header therefore no longer needs its own GENERAL_AGENT_DEFAULT_NAME rule. That constant is still used by quick-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, and This 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 E2E patches the previous commit in response to review. Consider squashing it into 250c48ab before 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.

@NightRain233
NightRain233 added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 78af7e3 Nov 25, 2026
16 checks passed
@NightRain233
NightRain233 deleted the fix/whi-936-room-delete-confirm branch November 25, 2026 06:11
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