-
Notifications
You must be signed in to change notification settings - Fork 29
feat(mesh): render user names via USER_GET tool #2135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ponent - Adjusted the layout of the tabs and actions section for improved responsiveness and visual consistency. - Modified CSS classes to enhance overflow handling and spacing between elements.
🧪 BenchmarkShould we run the MCP Gateway benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Release OptionsShould a new version be published when this PR is merged? React with an emoji to vote on the release type:
Current version: Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 18 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/mesh/src/storage/user.ts">
<violation number="1" location="apps/mesh/src/storage/user.ts:72">
P2: Type assertion `as User & { image?: string }` has no effect here because the function's declared return type is `Promise<User | null>`. Callers won't have type-safe access to the `image` field. Either update the return type to `Promise<(User & { image?: string }) | null>`, or define a separate `UserWithImage` type.</violation>
</file>
<file name="apps/mesh/src/web/hooks/use-user.ts">
<violation number="1" location="apps/mesh/src/web/hooks/use-user.ts:33">
P2: Query runs even when `userId` is empty. Add `enabled: !!userId` to prevent unnecessary API calls with invalid user IDs.</violation>
</file>
<file name="apps/mesh/src/web/components/user/user.tsx">
<violation number="1" location="apps/mesh/src/web/components/user/user.tsx:47">
P2: The `Avatar.Skeleton` should receive the `size` prop to match the actual avatar size and prevent layout shift when loading completes. Currently it defaults to `"base"` (40×40px) while the avatar uses `"xs"` (24×24px).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| updatedAt: result.updatedAt, | ||
| // Include image field from Better Auth | ||
| image: result.image ?? undefined, | ||
| } as User & { image?: string }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Type assertion as User & { image?: string } has no effect here because the function's declared return type is Promise<User | null>. Callers won't have type-safe access to the image field. Either update the return type to Promise<(User & { image?: string }) | null>, or define a separate UserWithImage type.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/storage/user.ts, line 72:
<comment>Type assertion `as User & { image?: string }` has no effect here because the function's declared return type is `Promise<User | null>`. Callers won't have type-safe access to the `image` field. Either update the return type to `Promise<(User & { image?: string }) | null>`, or define a separate `UserWithImage` type.</comment>
<file context>
@@ -0,0 +1,74 @@
+ updatedAt: result.updatedAt,
+ // Include image field from Better Auth
+ image: result.image ?? undefined,
+ } as User & { image?: string };
+ }
+}
</file context>
| export function useUser(userId: string) { | ||
| const toolCaller = createToolCaller<{ id: string }, UserGetOutput>(); | ||
|
|
||
| return useQuery({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Query runs even when userId is empty. Add enabled: !!userId to prevent unnecessary API calls with invalid user IDs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/hooks/use-user.ts, line 33:
<comment>Query runs even when `userId` is empty. Add `enabled: !!userId` to prevent unnecessary API calls with invalid user IDs.</comment>
<file context>
@@ -0,0 +1,42 @@
+export function useUser(userId: string) {
+ const toolCaller = createToolCaller<{ id: string }, UserGetOutput>();
+
+ return useQuery({
+ queryKey: KEYS.user(userId),
+ queryFn: async () => {
</file context>
| if (isLoading) { | ||
| return ( | ||
| <div className={`flex items-center gap-2 ${className || ""}`}> | ||
| <Avatar.Skeleton /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The Avatar.Skeleton should receive the size prop to match the actual avatar size and prevent layout shift when loading completes. Currently it defaults to "base" (40×40px) while the avatar uses "xs" (24×24px).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/components/user/user.tsx, line 47:
<comment>The `Avatar.Skeleton` should receive the `size` prop to match the actual avatar size and prevent layout shift when loading completes. Currently it defaults to `"base"` (40×40px) while the avatar uses `"xs"` (24×24px).</comment>
<file context>
@@ -0,0 +1,87 @@
+ if (isLoading) {
+ return (
+ <div className={`flex items-center gap-2 ${className || ""}`}>
+ <Avatar.Skeleton />
+ <div className="flex flex-col gap-1">
+ <div className="h-3 w-24 bg-muted animate-pulse rounded" />
</file context>
What
Why
Show human-friendly user info in collection tables instead of raw user ids, without exposing user data outside authenticated MCP access.
Testing
Summary by cubic
Show user names and avatars in collection tables via a secured USER_GET MCP tool, replacing REST user lookups. Improves readability while enforcing org-scoped access.
New Features
Refactors
Written for commit c39ca9c. Summary will update on new commits.