Skip to content

test(pds): call the worker directly instead of through the exports.default loopback - #258

Open
ascorbic wants to merge 2 commits into
mainfrom
pds-conformance-timeout
Open

ascorbic wants to merge 2 commits into
mainfrom
pds-conformance-timeout

Conversation

@ascorbic

@ascorbic ascorbic commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

The PDS conformance test timed out on the release PR (#227). It had passed in 58.7s against a 60s limit on #257. The cause isn't the conformance suite or Cirrus code. It's the test helper.

This PR first raised the timeout to 180s. A later commit replaces that with the fix below and puts the timeout back to 60s.

Cause

test/helpers.ts sent every request through exports.default.fetch, a loopback into the worker's own entrypoint. Each loopback call left every later one slower:

Path First requests After 1000 requests
exports.default.fetch, trivial 404 1.3ms 189ms
app.fetch called directly 0.4ms 0.1ms

The slowdown persists across test files and doesn't recover when idle. Direct calls made after a loopback run are unaffected, so it's specific to the loopback channel, not the isolate. The suite was therefore quadratic in requests made. The conformance run makes about 1000 requests, so it took about 3s alone, about 25s after the other files, and about 60s on CI.

The bisection, in order:

  1. The slowdown is per request and doesn't decay.
  2. Pure-JS and microtask timings are unchanged, so the isolate isn't busy.
  3. No DO alarms fire, and there's no per-request network traffic.
  4. A plain 404 shows it too, so it isn't the space routes.
  5. It's in exports.default and not in the app.

Fix

worker.fetch(request, env) now calls the Hono app directly, with a fresh ExecutionContext from cloudflare:test for each request. waitUntil work is left running, as in production. The signature is unchanged, so no test needed editing.

Results

  • 355 PDS tests and 128 CLI tests pass.
  • Locally, the suite's test time drops from about 60s to 14.5s, and the conformance run from 25.4s to 3.0s.
  • The e2e suite has its own helpers and is unaffected.

The leak itself is in workerd or vitest-pool-workers. I'm tracing it separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB

It takes ~10s alone but ~25s after the rest of the suite in the shared
isolate, and CI is slower again: it passed in 58.7s against the 60s
limit on #257 and timed out on the release PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
Every call through exports.default.fetch left the next one slower: 1000
requests took a trivial 404 from ~1ms to ~190ms, and the slowdown
carried across test files. Calling the Hono app directly shows no
growth. The suite was quadratic in requests made: the conformance run
(~1000 requests) took ~3s alone, ~25s after the other files, and ~60s
on CI, where it timed out on the release PR.

The helper now calls app.fetch with a fresh ExecutionContext per request,
leaving waitUntil work running as in production. All 355 tests pass,
and the run's test time drops from ~60s to ~15s locally. The conformance
timeout goes back to 60s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/create-pds@258
npm i https://pkg.pr.new/@getcirrus/oauth-provider@258
npm i https://pkg.pr.new/@getcirrus/pds@258
npm i https://pkg.pr.new/@getcirrus/spaces@258

commit: 2ae1d96

@ascorbic ascorbic changed the title test(pds): give the conformance run 180s test(pds): call the worker directly instead of through the exports.default loopback Nov 20, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
cirrusdocs 2ae1d96 Commit Preview URL

Branch Preview URL
Nov 20 2026, 08:19 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
pdscheck 2ae1d96 Nov 20 2026, 08:19 AM

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.

2 participants