detect signedin->guest transition for usage#2017
detect signedin->guest transition for usage#2017ignaciojimenezr wants to merge 1 commit intomainfrom
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
WalkthroughThis pull request introduces a new 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 (1)
mcpjam-inspector/client/src/hooks/__tests__/useActor.test.tsx (1)
60-71: ⚡ Quick winAdd one explicit cross-auth mismatch test (WorkOS user present, Convex identity absent).
That case is central to transition safety and currently implicit; pinning it would prevent subtle regressions in
statusresolution.Proposed test addition
+ it("does not report user when WorkOS has a user but Convex has no identity", () => { + mockUseAuth.mockReturnValue({ + user: { id: "workos_user_123" }, + isLoading: false, + }); + mockUseConvexAuth.mockReturnValue({ + isAuthenticated: false, + isLoading: false, + }); + + const { result } = renderHook(() => useActor()); + + expect(result.current.status).toBe("guest"); + expect(result.current.isAuthenticated).toBe(false); + expect(mockUseQuery).toHaveBeenCalledWith("users:getCurrentUser", "skip"); + });🤖 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 `@mcpjam-inspector/client/src/hooks/__tests__/useActor.test.tsx` around lines 60 - 71, Add a test that explicitly covers the cross-auth mismatch: mockUseConvexAuth should return isAuthenticated: false/isLoading: false while mockUseQuery returns a WorkOS user object when the WorkOS query key used by useActor is invoked; renderHook(() => useActor()) and assert that result.current reflects the WorkOS-authenticated state (i.e., status is the WorkOS/user status used in your hook and result.current.isAuthenticated reflects the WorkOS presence), and also assert mockUseQuery was called for the WorkOS query key (and that the Convex users:getCurrentUser call was not treated as the active identity). Use the same helpers in the file (mockUseConvexAuth, mockUseQuery, useActor) to locate where to add the test.
🤖 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 `@mcpjam-inspector/client/src/hooks/__tests__/useActor.test.tsx`:
- Around line 60-71: Add a test that explicitly covers the cross-auth mismatch:
mockUseConvexAuth should return isAuthenticated: false/isLoading: false while
mockUseQuery returns a WorkOS user object when the WorkOS query key used by
useActor is invoked; renderHook(() => useActor()) and assert that result.current
reflects the WorkOS-authenticated state (i.e., status is the WorkOS/user status
used in your hook and result.current.isAuthenticated reflects the WorkOS
presence), and also assert mockUseQuery was called for the WorkOS query key (and
that the Convex users:getCurrentUser call was not treated as the active
identity). Use the same helpers in the file (mockUseConvexAuth, mockUseQuery,
useActor) to locate where to add the test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 19a6364f-e715-4151-bac2-df7120aa6dab
📒 Files selected for processing (8)
mcpjam-inspector/client/src/components/mcp-sidebar.tsxmcpjam-inspector/client/src/components/sidebar/sidebar-credit-usage.tsxmcpjam-inspector/client/src/components/sidebar/sidebar-user.tsxmcpjam-inspector/client/src/components/ui/error-boundary.tsxmcpjam-inspector/client/src/hooks/__tests__/useActor.test.tsxmcpjam-inspector/client/src/hooks/__tests__/useCreditBalance.test.tsxmcpjam-inspector/client/src/hooks/useActor.tsmcpjam-inspector/client/src/hooks/useCreditBalance.ts
Internal previewPreview URL: https://mcp-inspector-pr-2017.up.railway.app |
Uh oh!
There was an error while loading. Please reload this page.