Skip to content

projector: answer unhandled route errors with a JSON 500 - #10904

Merged
dezren39 merged 1 commit into
mainfrom
claude/projector-json-500
Nov 17, 2026
Merged

dezren39 merged 1 commit into
mainfrom
claude/projector-json-500

Conversation

@dezren39

@dezren39 dezren39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Before: when a projector route hit a store or database error it did not handle itself (for example SQLITE_BUSY on /items, /comments, /links or /hot), the exception escaped handleRequest and Bun answered with its default non-JSON 500, so callers that parse JSON failed with a confusing parse error.

After: every unhandled route error is logged as projector: <METHOD> <path> failed: <message> and answered as a 500 with a JSON body {"error": "internal_error", "message": "..."}. Routes that already return their own status (400, 404, 409 and so on) are unchanged.

How: the existing router became a private routeRequest, and the exported handleRequest wraps it in a try/catch. The reconcile route's finally still runs inside the router. New test test/error-boundary.test.ts drives the read routes with a client whose every statement throws.

Testing: bun install can't fetch packages in this environment, so I ran the new test with @libsql/client stubbed by mock.module. It passes against this branch (2 pass) and fails against main (the read-route case gets a non-JSON response), as expected. CI will run it with the real dependency.

Fixes #10540


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

handleRequest now wraps the router in an error boundary. A store or
database failure a route does not handle itself is logged and answered
as {error: "internal_error", message} with a JSON content-type,
instead of escaping to Bun's default non-JSON 500.

Fixes #10540

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 marked this pull request as ready for review November 17, 2026 02:13
@dezren39
dezren39 requested a review from a team as a code owner November 17, 2026 02:13
@dezren39
dezren39 merged commit cfca4a9 into main Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e0b1bd7-d295-4e82-91fb-955a8869fdaf
Commits

Reviewing files that changed from the base of the PR and between 7dc679b and 5757dba.

Files selected for processing: 2

  • pm-stack/projector/src/server.ts
  • pm-stack/projector/test/error-boundary.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@dezren39
dezren39 deleted the claude/projector-json-500 branch November 17, 2026 02:13
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T02:13:15.822902Z
We couldn’t complete this review. Comment @codex review to try again.
5757dba Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

projector: read/reconcile routes return unstructured 500s on store or runtime failures

2 participants