improvement(utils): add shared utility functions and replace inline patterns#4214
improvement(utils): add shared utility functions and replace inline patterns#4214waleedlatif1 merged 8 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Adds a few security/validation hardenings: validates Shopify Adds a new internal Reviewed by Cursor Bugbot for commit 4b89bd6. Configure here. |
bd8b16d to
db54596
Compare
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ 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 db54596. Configure here.
db54596 to
6925e53
Compare
Greptile SummaryThis PR extracts five common inline patterns — The Confidence Score: 5/5Safe to merge — all replacements are verified equivalent, and the Supabase validation is a net security improvement. No P0 or P1 issues found. The toError/sleep replacements are 1:1 equivalent to the original inline patterns. The supabaseBaseUrl change adds beneficial input validation with comprehensive tests. Documentation updates are accurate. Prior review concerns have been addressed. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Catch block] --> B[toError value]
B -->|instanceof Error| C[Return error as-is]
B -->|typeof string| D[new Error with value]
B -->|other| E[new Error with String value]
C --> F[.message]
D --> F
E --> F
G[Supabase tool url fn] --> H[supabaseBaseUrl projectId]
H --> I[validateSupabaseProjectId]
I -->|invalid| J[throw Error]
I -->|valid| K[https sanitized .supabase.co]
L[sleep ms] --> M[setTimeout resolve ms]
Reviews (4): Last reviewed commit: "chore(utils): remove unused utilities (a..." | Re-trigger Greptile |
…atterns Add sleep, toError, safeJsonParse, isNonNull helpers and invariant/assertNever assertions. Replace all inline implementations across the codebase with these shared utilities for consistency. Zero behavioral changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6925e53 to
a05b442
Compare
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ 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 a05b442. Configure here.
…ndle build Turbopack resolves .server.ts modules even for type-only imports, pulling dns/promises into client bundles. Define SecureFetchResponse locally instead.
|
@cursor review |
|
@greptile |
The SSRF upgrade to input-validation.server introduced dns/promises into client bundles via tools/registry.ts. Revert to the original client-safe validateExternalUrl + fetch. The SSRF DNS-pinning upgrade for agiloft directExecution should be done via API routes in a separate PR.
…ished file patterns
Convert retrieve_attachment from directExecution to standard API route
pattern, consistent with Slack download and Google Drive download tools.
- Create /api/tools/agiloft/retrieve with DNS validation, auth lifecycle,
and base64 file response matching the { file: { name, mimeType, data,
size } } convention
- Update retrieve_attachment tool to use request/transformResponse
instead of directExecution, removing the dependency on
executeAgiloftRequest from the tool definition
- File output type: 'file' enables FileToolProcessor to store downloaded
files in execution filesystem automatically
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…xists on tool outputs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ 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 4b89bd6. Configure here.
…ull) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
sleep,toError,safeJsonParse,isNonNullto@/lib/core/utils/helpersinvariant,assertNeverto@/lib/core/utils/assertsnew Promise(resolve => setTimeout(resolve, ms))withsleep(ms)across 29 filese instanceof Error ? e.message : String(e)withtoError(e).messageacross ~290 files.claude/rules/global.md,.cursor/rules/global.mdcType of Change
Testing
bun run lintpassesbun run type-checkpasses (sim package)toErrorfallback usesString(value)to match original inline behavior exactlyChecklist