Skip to content

fix(test): stop the node suite collecting workerd-only tests - #143

Merged
chitcommit merged 4 commits into
mainfrom
fix-vitest-workers-pool
Oct 2, 2026
Merged

chitcommit merged 4 commits into
mainfrom
fix-vitest-workers-pool

Conversation

@chitcommit

Copy link
Copy Markdown
Contributor

Stacked on #142 (which is stacked on #141), so it carries those commits. Merge in order, or merge this one and close the others as contained.

The failure

CI's build job dies at the Test step:

Error: Cannot find package 'cloudflare:test' imported from tests/workers/coordinator.test.ts
Serialized Error: { code: 'ERR_MODULE_NOT_FOUND' }

vitest.config.ts collects tests/**/*.test.ts, which sweeps in tests/workers/coordinator.test.ts. That file imports the cloudflare:test virtual module, which exists only under @cloudflare/vitest-pool-workers. The node suite cannot resolve it.

Those tests already have their own config and script — vitest.workers.config.mts and npm run test:workers. This excludes tests/workers/** from the node suite so each file runs under the pool it was written for.

Test Files Tests
before 6 passed / 1 failed 68 passed, 39 skipped
after 6 passed / 0 failed 68 passed, 39 skipped

Two things this deliberately does NOT hide

  1. npm run test:workers is not wired into any CI workflow. The Durable Object suite does not run in CI at all. Excluding these files from the node suite does not change that — it was already true, and the import error was not a substitute for running them.
  2. The workers suite cannot pass locally right now either:
This Worker requires compatibility date "2026-08-07",
but the newest date supported by this server binary is "2026-08-06".

a60d0e1 set compatibility_date to 2026-08-07, one day beyond the installed workerd. Tracked separately — see the PR discussion; it needs a wrangler ≥ ~4.120, which in turn requires @cloudflare/workers-types v5 while drizzle-orm/partyserver are on v4.

Both are recorded in the commit message so they are not lost.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKKxbsxh4tozUMzBKADSTd

chitcommit and others added 4 commits September 18, 2026 01:41
a60d0e1 ("chore(devops): align compatibility date and upgrade agents SDK to
0.19.0") applied the Cloudflare Agents SDK version number to the wrong package.
`agents@0.19.0` exists; `hono-agents` has never published a 0.19.x -- it ships
on a 3.x line (currently 3.0.12). package-lock.json was never regenerated and
still resolves 3.0.7, so npm ci has failed on every PR and every Workers Build
since 2026-08-07:

    npm error notarget No matching version found for hono-agents@^0.19.0.

Restores the declaration the lockfile already names, keeping the change to a
single variable rather than also jumping to 3.0.12.

Verified locally: npm ci succeeds (274 packages, hono-agents 3.0.7 installed)
and `npm run build` (tsc --noEmit) exits clean. src/index.ts:3 imports
agentsMiddleware from hono-agents, so 3.0.7 satisfies real usage.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKKxbsxh4tozUMzBKADSTd
`npm audit --audit-level=high --omit=dev` (the CI gate) reported 5 high-severity
advisories in dependencies shipped to the Worker runtime. The gate has been
UNREACHABLE on main since a60d0e1 (2026-08-07) because npm ci failed before it,
so these went unmeasured rather than unintroduced -- three of the four advisories
checked predate that commit (2026-06-15, 07-29, 08-06).

Every fix stays within the existing major version; no breaking bumps:

  hono         ^4.12.23 -> ^4.13.8   (direct; advisory <=4.13.4)
  js-yaml      override ^4.3.2       (advisory 4.0.0-4.3.1)
  nanoid       override ^5.1.16      (advisory 4.0.0-5.1.15)
  fast-uri     override ^3.1.8       (advisory 3.0.0-3.1.5)
  ip-address   override ^10.7.2      (advisory <=10.3.0)

nanoid reached the runtime tree twice, via agents and partyserver.

`npm audit fix` could not produce this -- it crashes with an internal arborist
error ("Cannot read properties of null (reading 'edgesOut')"). The lockfile was
regenerated with npm install instead.

Verified locally:
  npm audit --audit-level=high --omit=dev  exit 0 (5 high -> 0; 5 low/2 moderate remain, below gate)
  npm ci                                   exit 0
  tsc -p tsconfig.json --noEmit            exit 0
  npm test                                 6 passed / 1 failed -- identical on the
    parent branch without these bumps; tests/workers/coordinator.test.ts cannot
    resolve the `cloudflare:test` virtual module under the default vitest pool.
    Pre-existing, untouched here.

Also corrects ci.yml's claim that "the runtime dependency tree is clean".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKKxbsxh4tozUMzBKADSTd
The Dependency Audit comment asserted all High/Moderate advisories were
dev-only. That went stale: the gate was unreachable from 2026-08-07 to
2026-09-18 because npm ci failed ahead of it, and when it next ran it found
5 high-severity advisories in the production tree -- three of which predated
the break. A comment cannot track advisory feeds; the gate is the source of
truth. Replaced with a note saying so, to stop the claim being reinstated.

Note: the preceding commit's message says it corrects this comment. It did
not -- the edit was blocked by a pre-commit hook and is landed here instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKKxbsxh4tozUMzBKADSTd
vitest.config.ts includes `tests/**/*.test.ts`, which collects
tests/workers/coordinator.test.ts. That file imports the `cloudflare:test`
virtual module, which exists only under @cloudflare/vitest-pool-workers --
so the node suite fails to resolve it and CI's `build` job dies:

    Error: Cannot find package 'cloudflare:test' imported from
    tests/workers/coordinator.test.ts
    Serialized Error: { code: 'ERR_MODULE_NOT_FOUND' }

Those tests already have their own config and script
(vitest.workers.config.mts, `npm run test:workers`). Excluding tests/workers
from the node suite puts each file under the pool it was written for.

Before: 6 passed / 1 failed. After: 6 passed / 0 failed (68 tests, 39 skipped).

Note: `npm run test:workers` is NOT wired into any CI workflow, so the Durable
Object suite does not run in CI at all. It also cannot currently pass locally --
workerd rejects compatibility_date 2026-08-07 as newer than the 2026-08-06 its
binary supports. Both are tracked separately; this commit does not hide them,
it stops them masquerading as a node-suite failure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKKxbsxh4tozUMzBKADSTd
@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.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 29 minutes.

Check out review usage here.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 33d3f311-e64f-4412-92c5-0ca2af76fbf6

📥 Commits

Reviewing files that changed from the base of the PR and between f2578a3 and badf7a1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • package.json
  • vitest.config.ts

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

Comment @coderabbitai help to get the list of available commands.

@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 failed
View logs
chittycommand badf7a1 Sep 18 2026, 03:13 AM

@chitcommit
chitcommit merged commit 0fa3cd4 into main Oct 2, 2026
16 of 17 checks passed
@chitcommit
chitcommit deleted the fix-vitest-workers-pool branch October 2, 2026 08:21
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