Shape storage error messages and classify connection faults - #1784
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | f7112f6 | Commit Preview URL Branch Preview URL |
Aug 27 2026, 10:27 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | f7112f6 | Aug 27 2026, 10:29 PM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
RhysSullivan
force-pushed
the
fix/storage-error-shaping
branch
from
August 27, 2026 20:32
901accb to
bf5263f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the database was unreachable or a query was issued on a pool that had already been torn down, the failure surfaced with the driver's raw text as its message:
Failed query: <sql>\nparams: <bound values>. Two consequences in production:Nothing classified the underlying faults either: a lost socket, a pool that had already been ended, and a socket belonging to a different request context all melted into the same generic storage failure.
Fix
fumaFailureFromCausebuilds the message from stable inputs only — the call-site label plus the driver's error code, e.g.FumaDB plugin_storage.findFirst failed: CONNECTION_ENDED. The full driver error stays oncause, so nothing diagnostic is lost.StorageConnectionErrorto theStorageFailureunion. A code-walk beside the existing unique-violation walk recognisesCONNECTION_ENDED/CONNECTION_CLOSED/CONNECTION_DESTROYED/CONNECT_TIMEOUT/ECONNREFUSED/ECONNRESETand the workerd cross-request I/O rejection, and carries the faultcodeplus aretryableflag so a transient socket loss can be told apart from a pool-lifetime bug.StorageError: capture the cause, fail with an opaque 500.Testing
e2e/cloud/storage-error-report-shape.test.ts— "Storage · a rejected write is reported without its SQL or the caller's data". The failure is induced through the public typed API alone: PostgreSQL cannot store a NUL byte in a text column, so a connection whose description carries one is rejected with SQLSTATE 22021 after the statement and its bound parameters are assembled — the same class of failure the production reports came from, with no database or process manipulation. The scenario then asserts both public surfaces:InternalErrorcarrying only a trace id, and no driver text in the payload.Verified red against the pre-fix code (headline is
StorageError: Failed query: insert into "connection" … params: …, org_…) and green after; green three consecutive times.Connection-fault classification stays unit-only. Inducing a real connection fault needs the shared database taken down mid-request, and a database that is down fails first in the auth layer, which never reaches this code — so there is no black-box path to it.
packages/core/sdk/src/fuma-runtime.test.tspins the code matrix against synthetic reconstructions of the driver error shapes, andpackages/core/api/src/observability.test.tspins that the edge translates a connection fault into the same opaque 500 as any other storage failure.Repo
format:check,lintandtypecheckpass.Deliberately not in this PR
The actual escape — a
use()callback outliving its request-scoped pool — needs its own designed fix, as does any retry that consumesretryable. This PR only stops one cause from looking like six and stops customer identifiers reaching error-report titles.