Skip to content

fix(durable-objects): match close codes, SQL refusals, and abort retries - #78

Merged
eersnington merged 6 commits into
mainfrom
test/standalone-engine-retry
Nov 24, 2026
Merged

eersnington merged 6 commits into
mainfrom
test/standalone-engine-retry

Conversation

@eersnington

@eersnington eersnington commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Fixes the Durable Object differences that the workerd parity job reports, makes that job able to fail, and removes two causes of flaky e2e runs.

What changes

Area Before After
WebSocket close webSocketClose gets 1001 "gateway disconnected" for every client close, awake or hibernated Gets the client's code and reason with wasClean: true, as on workerd. A close with no code arrives as 1005.
SQL refusals Reading a _cf_ table fails with not authorized. ATTACH and PRAGMA writable_schema run. Reading a _cf_ table fails with workerd's access to _cf_KV.key is prohibited. ATTACH, DETACH and writable_schema fail, also in D1.
Calls around ctx.abort() A call can get Rivet's raw 503 guard.actor_stopped_while_waiting Orange resends it until the next generation starts, as it already does for a retired generation
pnpm upstream --baseline bin.ts overwrites its exit code, so the CI gate always passes Exits with an error that lists each new failure
Test Engines deploy-image.ts starts its own Engine and drops its output One shared starter restarts an Engine that exits at startup, and a failing test prints the Engine's output

Decisions

  • The client close code goes over Orange's existing private close route, after the socket opens, so messages the client sent first still arrive first.
  • Orange allows sqlite_version() in a default expression, so the synthetic test no longer checks workerd's refusal. Refusals that protect Orange's own tables stay.
  • 6 SQL tests still fail because they need changes in Rivet's SQLite build: DELETE ... LIMIT, row counters (workerd patch 0001), and the internal-function guard (patch 0005).
  • The hibernation file still takes about 125 s. The test sleeps 12 s five times on each runtime. It does not hang.

Proof: workerd parity goes from 79/88 to 81/88 on CI with the SQL fixes. The hibernation file passes 3/3 locally. The gate exits 0 with results/latest.json and 1 with a baseline that leaves out the known SQL failures.

…s, ATTACH, and writable_schema

- Reading a `_cf_` or `_rivet_` table fails with workerd's
  `access to <table>.<column> is prohibited`. Other uses still fail with
  `not authorized`.
- `ATTACH`, `DETACH`, and `PRAGMA writable_schema` fail with `not authorized`,
  as in workerd. This applies to D1 too.
- The synthetic `authorizerDefaultExpressions` test no longer asserts that
  `sqlite_version()` is refused. That is workerd's function allow-list, which
  Orange does not copy.
- Document the deviations that are left: internal functions in DEFAULT
  expressions, and DELETE/UPDATE ... LIMIT.
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Preview removed; R2 assets deleted.

…lose route

- The Engine reports `1001 "gateway disconnected"` to the actor for every client close, so the stub now sends each close's code and reason over the private disconnect route.
- The actor reports that code when the raw transport closes, so frames the client sent first still arrive before `webSocketClose`.
- The stub waits for its raw transport to open before it sends the notice, so a close right after connect is not lost.
- Drop the close-code deviation from the Durable Objects page and the compat matrix.

Proof: `synthetic--do-websocket-hibernation-test` 3/3 (was 2/3), `synthetic--do-websocket-test` 11/11, and the accepted-websockets e2e now asserts the client's code.
…s passing

- Re-run the `lifecycle` probe on f96bfc1, on `orange dev` and `wrangler dev`.
- `open socket: webSocketClose gets the client's close code` now passes on Orange. No other step changed.
- Drop the `1001 "gateway disconnected"` drawback from the WebSocket hibernation claim and rebuild the truth table.

Proof: `pnpm real-projects --probes --filter '^lifecycle$' --jobs 1`, then `pnpm truth-table`.
@eersnington eersnington changed the title test(harness): restart a standalone Engine that loses a port fix(durable-objects): match close codes, SQL refusals, and abort retries Nov 24, 2026
@eersnington
eersnington merged commit de02bae into main Nov 24, 2026
13 checks passed
@eersnington
eersnington deleted the test/standalone-engine-retry branch November 24, 2026 22:35
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.

1 participant