Repository navigation
fix(wework): restrict project tools to ClaudeCode devices - #1280
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR filters standalone devices and tool availability based on Claude Code device type detection. Device filtering via ChangesDevice Type Filtering and Tool Availability
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
wework/src/components/layout/workspace-panels/WorkspacePanelCards.tsx (1)
110-127: 💤 Low value
getSessionStartErrorMessagereceives an unused argument.The function is defined with no parameters but is called with
eas an argument at lines 127 and 169. The error details are discarded. If this is intentional (to always show a generic message), remove the argument from the call sites for clarity. If error details should influence the message, update the function signature.- const getSessionStartErrorMessage = () => t('workbench.project_tool_start_failed', '启动失败') + const getSessionStartErrorMessage = (_error?: unknown) => t('workbench.project_tool_start_failed', '启动失败')Or remove arguments at call sites:
- setProjectError(getSessionStartErrorMessage(e)) + setProjectError(getSessionStartErrorMessage())🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/components/layout/workspace-panels/WorkspacePanelCards.tsx` around lines 110 - 127, getSessionStartErrorMessage is defined with no parameters but callers (in startTerminalSession and another call around where setProjectError(...) is invoked) pass the caught error `e`; either remove the unused `e` argument from those setProjectError(getSessionStartErrorMessage(e)) call sites so they call getSessionStartErrorMessage() with no args, or change getSessionStartErrorMessage to accept an error parameter (e.g., (err?: unknown)) and incorporate err into the returned string; update all usages (references in startTerminalSession and the other setProjectError call) to match the chosen signature so the function and callers stay consistent.wework/src/components/layout/workspace-panels/WorkspacePanelCards.test.tsx (1)
306-323: 💤 Low valueTest name is misleading; setup includes dead code.
The test sets up
fetchMock.mockRejectedValueOncebut then assertsfetchMockis never called. The test verifies probing was removed entirely, not that it handles blocked probing. Consider:
- Renaming the test to match actual behavior
- Removing the unnecessary mock setup
- test('opens IDE even when browser preflight probing would be blocked', async () => { + test('opens IDE without preflight probing', async () => { const api = createProjectApiMock() - fetchMock.mockRejectedValueOnce(new TypeError('Mixed content blocked')) render(<WorkspacePanelCards currentProject={project} devices={cloudDevices} />)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/components/layout/workspace-panels/WorkspacePanelCards.test.tsx` around lines 306 - 323, Rename the test and remove the dead mock setup: change the test title on the test that currently reads "opens IDE even when browser preflight probing would be blocked" to something matching the actual behavior (e.g. "opens IDE without preflight probing") and delete the unused fetchMock.mockRejectedValueOnce(new TypeError('Mixed content blocked')) line; the rest of the test (render(<WorkspacePanelCards ...>), userEvent.click(screen.getByTestId('workspace-ide-card')), and the assertions expect(fetchMock).not.toHaveBeenCalled() / expect(api.startCodeServerSession)... / expect(window.open)...) should remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@wework/src/components/layout/workspace-panels/WorkspacePanelCards.test.tsx`:
- Around line 306-323: Rename the test and remove the dead mock setup: change
the test title on the test that currently reads "opens IDE even when browser
preflight probing would be blocked" to something matching the actual behavior
(e.g. "opens IDE without preflight probing") and delete the unused
fetchMock.mockRejectedValueOnce(new TypeError('Mixed content blocked')) line;
the rest of the test (render(<WorkspacePanelCards ...>),
userEvent.click(screen.getByTestId('workspace-ide-card')), and the assertions
expect(fetchMock).not.toHaveBeenCalled() / expect(api.startCodeServerSession)...
/ expect(window.open)...) should remain unchanged.
In `@wework/src/components/layout/workspace-panels/WorkspacePanelCards.tsx`:
- Around line 110-127: getSessionStartErrorMessage is defined with no parameters
but callers (in startTerminalSession and another call around where
setProjectError(...) is invoked) pass the caught error `e`; either remove the
unused `e` argument from those setProjectError(getSessionStartErrorMessage(e))
call sites so they call getSessionStartErrorMessage() with no args, or change
getSessionStartErrorMessage to accept an error parameter (e.g., (err?: unknown))
and incorporate err into the returned string; update all usages (references in
startTerminalSession and the other setProjectError call) to match the chosen
signature so the function and callers stay consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5a79372f-21ca-4529-8372-586ce35ae971
📒 Files selected for processing (5)
wework/src/components/chat/ChatInput.test.tsxwework/src/components/layout/workspace-panels/WorkspacePanelCards.test.tsxwework/src/components/layout/workspace-panels/WorkspacePanelCards.tsxwework/src/lib/device-capabilities.tswework/src/lib/device-selection.ts
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Tests