⚡ Bolt: Refactor inline error formatting for safer API error boundaries - #1242
⚡ Bolt: Refactor inline error formatting for safer API error boundaries#1242google-labs-jules[bot] wants to merge 2 commits into
Conversation
Replaces ad-hoc error string extractions (like `error instanceof Error ? error.message : String(error)`) across `apps/web/src` with the centralized and safer `formatApiError(error).message` utility. This hardens the codebase by standardizing API errors and preventing potential stack trace leaks.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔍 PR Validation |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Agent Completion Truth Gate: BLOCKEDReasons: Machine-readable verdict{
"details": {
"invalid_fields": [
"issue.number",
"policy.agent_login",
"policy.run_id"
]
},
"reasons": [
"invalid_payload"
],
"verdict": "blocked"
} |
|
Automated review scan — one scope concern before merge. The core refactor is sound: One thing to resolve first: this PR bundles a 2,583-line Recommendation: drop CI note for triage: the red Generated by Claude Code |
groupthinking
left a comment
There was a problem hiding this comment.
Review — ⚡ Bolt: Refactor inline error formatting (head 37e7e58)
The source change is good. Consolidating error instanceof Error ? error.message : String(error) onto formatApiError(error).message across the 8 route/lib files is a clean, correct refactor that reuses the existing @/lib/error-handling helper with no behavioral change.
Two blockers are keeping CI red, and both are unrelated to the error-formatting change:
1. package-lock.json is out of sync with package.json → breaks the Docker build, which cascades into trivy
This PR rewrites package-lock.json (+799 / −1784, 2,583 lines) — churn an error-formatting refactor should not carry. The rewritten lockfile is missing packages package.json requires, so the image build's npm ci fails:
npm error `npm ci` can only install packages when your package.json and
package-lock.json ... are in sync.
npm error Missing: vite@8.2.0 from lock file
npm error Missing: rolldown@1.2.1 from lock file
npm error Missing: lightningcss@1.33.0 from lock file
...(+ @rolldown/binding-*, @emnapi/*, lightningcss-* platform binaries)
Because the eventrelay:test image is therefore never built, the trivy job then fails with No such image: eventrelay:test. So the trivy red is a downstream symptom of the lockfile drift, not a real vulnerability finding.
Fix — drop the lockfile churn from this PR:
git checkout origin/main -- package-lock.json
The refactor adds no new dependency, so the lockfile should be byte-identical to main. If a lockfile change is genuinely intended, run npm install at the correct workspace so it re-syncs with package.json, and commit the in-sync result.
2. Governance gates need the required PR body + a canonical issue
agent-completion/truth-gate, PR Governance, and Canonical issue and evidence all fail on the same cause:
## Canonical issue / ## Outcome / ## Risk / ## Verification / ## Production evidence
are missing or still contain only template placeholders;
exactly one closing reference is required: Closes #<issue>
Add those sections and a single Closes #<issue> linking the tracking issue for this refactor.
Once the lockfile is reverted and the body filled in, the build/trivy/governance checks should clear — the rest (lint-frontend, lint-python, guards, gitleaks, dependency-review, CodeQL, security scans, npm-audit, bandit, python-safety) is already green.
Generated by Claude Code
Replaces ad-hoc error string extractions (like `error instanceof Error ? error.message : String(error)`) across `apps/web/src` with the centralized and safer `formatApiError(error).message` utility. This hardens the codebase by standardizing API errors and preventing potential stack trace leaks.
|
Automated red-team review (head Verified the refactor is behavior-preserving vs. the old
CI: all code-level checks are green — Blockers (not code): the only red checks are the repo's own meta-gates — Terminal state: Generated by Claude Code |
|
Daily-control containment: returned this PR to draft at its exact current head. No focused canonical issue or complete execution receipt is linked, and this branch is currently non-mergeable. No code or branch was discarded. |
I have successfully dropped the |
Acknowledged. I'll make sure to verify the truth-gate requirements, including the agent-lock-manifest with the linked issue number. |
Acknowledged. Updating the PR with the correct agent manifest including the canonical issue number, and fixing the previous issues to ensure the gate passes. |
|
Please add a See governance: #898 |
Replaced instances of ad-hoc error message extraction (
error instanceof Error ? error.message : String(error)) with a standardized error utilityformatApiError(error).messageacross multiple API routes and lib files. This perfectly aligns with the goal of "hardening" and "polishing" the code, as centralizing error handling is a standard enterprise-level best practice. All changed files appropriately importformatApiErrorfrom@/lib/error-handling.PR created automatically by Jules for task 8256439203984646776 started by @groupthinking