Add workspace chat tabs#347
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Closing for now; branch will be kept for further local validation. |
There was a problem hiding this comment.
Review mode: initial
Findings
-
[Minor] Render-side
workspacePathComparisonKeymay miscompare on Windows —Sidebar.tsxcallsworkspacePathComparisonKey(path)but the function signature in the renderer copy (if it mirrors the main process) usesprocess.platform, which is undefined in Electron renderers withoutnodeIntegration. The extraplatformargument passed fromchatWorkspaceKey(workspacePathComparisonKey(workspacePath, globalThis.navigator?.platform ?? '')) is ignored by the function. If the renderer hasn't injected a platform check, path comparisons on Windows will be case-sensitive, causing duplicate tab entries and mismatches.
Suggested fix: Export the platform-aware logic frompackages/sharedand use a runtime check (e.g.,navigator.platformor an env constant) in the renderer. Remove the unused second parameter from the call. -
[Nit] Unhandled rejection in
handleConfirmCloseChat—Sidebar.tsx:96-103: IfswitchDesign(fallback.id)throws (e.g., IPC network error), the promise rejection goes unhandled. ThesoftDeleteDesigncall would still proceed if the error is swallowed, potentially deleting a conversation while in a stale state.
Suggested fix: Wrap the switch and delete in a try-catch that logs the error and optionally shows a toast. -
[Nit] Missing changeset for a user-visible feature — The PR adds chat tabs, the "New conversation" button, workspace collapse in hub, and new i18n strings. Per
CLAUDE.md, user-visible changes require a changeset (pnpm changeset).
Suggested fix: Runpnpm changesetwith apatchbump and a short summary. Example:Added workspace chat tabs: create fresh conversations sharing the same workspace, switch/delete from sidebar, collapsed workspace cards in hub. -
[Minor]
canvas.previewTabsAriaLabeli18n key is unused — TheCanvasFileTabBarcomponent usest('canvas.previewTabsAriaLabel'), but theCanvasTabBarcomponent (which now only renders the files tab) usest('canvas.tabsAriaLabel'). The new key is correctly added to all locales, but the oldcanvas.previewTabkey (removed from the component) is still present in locale files — dead strings. No behavioral harm, but consider removing the orphaned key in a cleanup follow-up.
Summary
This PR adds workspace chat tabs that let users start fresh conversations within the same workspace without copying snapshots or chat history. The changes span IPC (new workspaceReuse parameter), preload, main process (workspace conflict bypass, path comparison key), renderer (sidebar tabs, store action, hub deduplication), and i18n. The diff is well-structured, with strong test coverage for the new IPC path, store action, workspace collision handling, and hub display logic.
Residual risks:
- The renderer-side platform check for path comparison has a potential gap on Windows (see finding above).
- The confirmation delete chat UI replaces the previous close-without-confirm for conversation tabs, but existing designs without a workspace are unaffected.
- No E2E tests for the new sidebar interaction (button toggle, tab switching, deletion flow) were added; the coverage relies on unit tests of the store slice.
Testing
- New Vitest tests added:
design-workspace.test.ts(allowExistingWorkspaceBinding),generation-ipc.test.ts(case-insensitive workspace key on win32),snapshots-ipc.create-design.test.ts(fresh conversation IPC path, conflict protection, missing path rejection),store.test.ts(clean state after creation),RecentTab.test.ts(workspace collapse, active representative). - No regression failures expected; existing tests continue to pass (typecheck, lint, test suite passed per PR description).
- Suggested follow-up: Add a Playwright E2E test that creates a design, opens a second conversation from the sidebar, switches tabs, and deletes one conversation without data loss.
Open-CoDesign Bot
Summary
Test plan
pnpm --filter @open-codesign/desktop build.Principles
🤖 Generated with Claude Code