GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: address PR review comments by waleedlatif1 · Pull Request #4042 · simstudioai/sim Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PR SummaryMedium Risk Overview Adds a defensive Reviewed by Cursor Bugbot for commit 088cf23. Configure here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Routes using z.parse() were returning 500 for ZodError (client input validation failures). Added instanceof z.ZodError check to return 400 before the generic 500 handler, matching the established pattern used by 115+ other routes. Affected services: CloudWatch (7), CloudFormation (7), DynamoDB (6), Slack (3), Outlook (2), OneDrive (1), Google Drive (1). Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cursor review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
7 routes used { success: false, error: ... } in their generic error
handler but our ZodError handler only returned { error: ... }. Aligned
the ZodError response shape to match.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cursor review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 088cf23. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Greptile SummaryThis PR addresses three stated review comments: (1) wrapping Key changes:
Notable issue: The Confidence Score: 4/5Safe to merge for the API 400-fix and clipboard changes, but the claimed resolveResourceFromContext fix was never applied — the stated bug still exists in production. One P1 gap: the PR description explicitly claims to add folder and past_chat cases to resolveResourceFromContext, but home.tsx is absent from the changeset and the function still returns null for both kinds. Dragging folders and tasks from the sidebar into chat continues to silently fail. The remaining two findings (missing success: false on Athena/DynamoDB/CloudFormation/CloudWatch ZodErrors, and any in the Outlook route) are P2. Score is 4 rather than 5 due to the unfixed P1 from the PR's stated scope. apps/sim/app/workspace/[workspaceId]/home/home.tsx — the resolveResourceFromContext fix is entirely missing from this PR
|
| Filename | Overview |
|---|---|
| apps/sim/components/ui/copy-code-button.tsx | Clean implementation — navigator.clipboard.writeText() wrapped in try/catch with proper cleanup on unmount |
| apps/sim/app/api/tools/athena/create-named-query/route.ts | ZodError now correctly returns 400, but error response uses { error: ... } without success: false, inconsistent with success shape { success: true, output: ... } |
| apps/sim/app/api/tools/cloudformation/describe-stacks/route.ts | ZodError returns 400 correctly; follows the same pattern as other CloudFormation routes in this PR |
| apps/sim/app/api/tools/cloudwatch/describe-alarms/route.ts | ZodError returns 400; logic for AlarmType enum and StateValue cast looks correct |
| apps/sim/app/api/tools/dynamodb/query/route.ts | ZodError returns 400; response shape differs from Athena (no success wrapper), consistent with pre-existing DynamoDB pattern |
| apps/sim/app/api/tools/slack/send-message/route.ts | ZodError returns 400 with success: false; fully consistent with success response shape |
| apps/sim/app/api/tools/outlook/send/route.ts | ZodError returns 400 with success:false; uses any type for the message object at line 74, violating TypeScript rules |
| apps/sim/app/api/tools/google_drive/download/route.ts | ZodError returns 400 with success:false; well-structured with DNS validation and pinned-IP security checks |
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User drags item from sidebar] --> B{context.kind}
B -->|workflow / current_workflow| C[return type: workflow]
B -->|knowledge| D[return type: knowledgebase]
B -->|table| E[return type: table]
B -->|file| F[return type: file]
B -->|folder missing| G[default: return null]
B -->|past_chat missing| G
G --> H[handleContextAdd receives null]
H --> I[Resource silently NOT added to panel]
C --> J[addResource called]
D --> J
E --> J
F --> J
J --> K[Resource appears in panel]
apps/sim/app/workspace/[workspaceId]/home/home.tsx, line 264-280 (link)
folder and past_chat cases still missing from resolveResourceFromContext
The PR description states: "Add missing folder and past_chat cases in resolveResourceFromContext so dragged folders and tasks appear in the resource panel" — but home.tsx is not in the changeset and the fix was never applied. Both context kinds fall through to default: return null, so handleContextAdd receives null and the resource is silently discarded.
ChatContext defines both:
| { kind: 'past_chat'; chatId: string; label: string } | { kind: 'folder'; folderId: string; label: string }
And MothershipResourceType supports both 'folder' and 'task'. The missing cases should be:
case 'folder': return context.folderId ? { type: 'folder', id: context.folderId } : null case 'past_chat': return context.chatId ? { type: 'task', id: context.chatId } : null
Without this fix, dragging a folder or a task from the sidebar into chat still silently does nothing in the resource panel, exactly as before this PR.
apps/sim/app/api/tools/outlook/send/route.ts, line 74 (link)
any type violates TypeScript rules
const message: any = { ... } is explicitly prohibited by the project's TypeScript guidelines ("No any — Use proper types or unknown with type guards"). A local interface matching the Microsoft Graph mail message structure would make this type-safe and avoid the implicit spread of any to message.attachments, message.ccRecipients, etc.
interface GraphMailMessage { subject: string body: { contentType: string; content: string } toRecipients: Array<{ emailAddress: { address: string } }> ccRecipients?: Array<{ emailAddress: { address: string } }> bccRecipients?: Array<{ emailAddress: { address: string } }> attachments?: Array<{ '@odata.type': string name: string contentType: string contentBytes: string }> }
Reviews (1): Last reviewed commit: "fix(api): add success:false to ZodError ..." | Re-trigger Greptile
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (error instanceof z.ZodError) { | ||
| return NextResponse.json( | ||
| { error: error.errors[0]?.message ?? 'Invalid request' }, | ||
| { status: 400 } | ||
| ) | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ZodError response missing
success: false
All 8 Athena routes, 7 CloudFormation routes, 7 CloudWatch routes, and 6 DynamoDB routes return { error: ... } on ZodError without a success field. Their successful responses all include success: true, so error responses should symmetrically include success: false. The commit title (fix(api): add success:false to ZodError responses for consistency) implies this was intentional, but these 28 routes were not updated.
This same pattern is missing in:
apps/sim/app/api/tools/athena/get-named-query/route.ts:57apps/sim/app/api/tools/athena/get-query-execution/route.ts:66apps/sim/app/api/tools/athena/get-query-results/route.ts:77apps/sim/app/api/tools/athena/list-named-queries/route.ts:54apps/sim/app/api/tools/athena/list-query-executions/route.ts:54apps/sim/app/api/tools/athena/start-query/route.ts:71apps/sim/app/api/tools/athena/stop-query/route.ts:46| if (error instanceof z.ZodError) { | |
| return NextResponse.json( | |
| { error: error.errors[0]?.message ?? 'Invalid request' }, | |
| { status: 400 } | |
| ) | |
| } | |
| if (error instanceof z.ZodError) { | |
| return NextResponse.json( | |
| { success: false, error: error.errors[0]?.message ?? 'Invalid request' }, | |
| { status: 400 } | |
| ) | |
| } |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
088cf238
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.