From 8f208fad56c9394840b30b7e9321b07fdaec90eb Mon Sep 17 00:00:00 2001 From: Anilkumar Reddy Date: Sat, 28 Nov 2026 15:17:41 -0600 Subject: [PATCH] ci: use Node 26 for Sandbox builds --- .github/workflows/ci.yml | 3 +++ .node-version | 2 +- README.md | 16 ++++++++++++++-- apps/ccv2/.node-version | 1 + apps/ccv2/docs/cloudflare-deployment.md | 8 ++++++++ apps/ccv2/package.json | 2 +- apps/ccv2/vitest.config.ts | 4 ++++ package.json | 5 +++-- scripts/toolchain.test.mjs | 23 +++++++++++++++++++++++ 9 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 apps/ccv2/.node-version create mode 100644 scripts/toolchain.test.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4a5e50..6b68875 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,9 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Validate development and Cloudflare build toolchains + run: pnpm test:toolchain + - name: Audit runtime and development dependencies run: pnpm security:audit diff --git a/.node-version b/.node-version index a45fd52..a2e8115 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -24 +26.13.1 diff --git a/README.md b/README.md index c6f18b2..857cd32 100644 --- a/README.md +++ b/README.md @@ -35,14 +35,22 @@ The [service catalog](https://commercekit.tools/sandbox), ## Requirements -- Node.js 24 LTS +- Node.js 26.13.1 LTS, pinned in both repository and CCv2 build roots - pnpm 12.11.2 through Corepack ```bash +npm install --global corepack@0.36.0 corepack enable -pnpm install +pnpm install --frozen-lockfile ``` +Node 26 does not bundle Corepack. Install the pinned Corepack bootstrap above +before enabling pnpm. CI uses the existing pnpm setup action. Cloudflare Workers +Builds reads `apps/ccv2/.node-version`; keep it aligned with the repository pin +and remove or update any dashboard `NODE_VERSION` override that still selects +Node 24. This changes the build host; production continues to run on workerd +with the existing compatibility date, bindings and runtime secrets. + ## Development Start the CCv2 Worker on `http://localhost:8787`: @@ -95,6 +103,10 @@ require Cloudflare credentials. advisories. It runs in both `pnpm run ci` and GitHub CI. Development tooling is part of this check even when it is absent from the deployed Worker. +Worker tests retain per-file isolation and their existing timeouts while bounding +concurrent workerd startup to two workers. This avoids resource-contention +timeouts during local and CI builds without skipping scenarios. + GitHub Actions runs validation only. Production deployment uses Cloudflare Workers Builds, with `apps/ccv2` as the root directory. Required runtime secrets and the pre-merge checklist are in [`apps/ccv2/docs/cloudflare-deployment.md`](apps/ccv2/docs/cloudflare-deployment.md). diff --git a/apps/ccv2/.node-version b/apps/ccv2/.node-version new file mode 100644 index 0000000..a2e8115 --- /dev/null +++ b/apps/ccv2/.node-version @@ -0,0 +1 @@ +26.13.1 diff --git a/apps/ccv2/docs/cloudflare-deployment.md b/apps/ccv2/docs/cloudflare-deployment.md index afa14ec..f59400e 100644 --- a/apps/ccv2/docs/cloudflare-deployment.md +++ b/apps/ccv2/docs/cloudflare-deployment.md @@ -9,6 +9,14 @@ - Preview URLs disabled - Observability and sampled traces enabled +## Build toolchain + +Use Node.js 26.13.1 and the pinned pnpm 12.11.2. The repository and configured +Workers Builds root (`apps/ccv2`) each include an aligned `.node-version` file. +Update or remove a dashboard `NODE_VERSION` override if it still selects Node 24. +This host-tooling migration does not change the Worker compatibility date, +Durable Object bindings, signing material or production execution runtime. + ## Introduced by this change - `workers_dev = false` and a declarative custom-domain route diff --git a/apps/ccv2/package.json b/apps/ccv2/package.json index d73b870..def5764 100644 --- a/apps/ccv2/package.json +++ b/apps/ccv2/package.json @@ -5,7 +5,7 @@ "type": "module", "packageManager": "pnpm@12.11.2", "engines": { - "node": "24.x", + "node": ">=26.13.1 <27", "pnpm": "12.11.2" }, "scripts": { diff --git a/apps/ccv2/vitest.config.ts b/apps/ccv2/vitest.config.ts index b03b8eb..f20c7fd 100644 --- a/apps/ccv2/vitest.config.ts +++ b/apps/ccv2/vitest.config.ts @@ -11,6 +11,10 @@ process.env.MOCK_JWT_KID = "ccv2-test-key"; process.env.RUN_TOKEN_SIGNING_KEY = "test-only-run-token-signing-key-with-32-bytes-minimum"; export default defineConfig({ + test: { + // Each isolated file starts workerd; bound parallel startup without relaxing test timeouts. + maxWorkers: 2, + }, plugins: [ cloudflareTest({ wrangler: { diff --git a/package.json b/package.json index 6795dda..af4c580 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "packageManager": "pnpm@12.11.2", "engines": { - "node": "24.x", + "node": ">=26.13.1 <27", "pnpm": "12.11.2" }, "scripts": { @@ -18,9 +18,10 @@ "format:check": "prettier --check .", "typecheck": "pnpm --filter @commercekit/sandbox-ccv2 typecheck", "test": "pnpm --filter @commercekit/sandbox-ccv2 test", + "test:toolchain": "node --test scripts/*.test.mjs", "build:check": "pnpm --filter @commercekit/sandbox-ccv2 build:check", "security:audit": "pnpm audit --audit-level=moderate", - "ci": "pnpm security:audit && pnpm --filter @commercekit/sandbox-ccv2 types:check && pnpm format:check && pnpm lint && pnpm typecheck && pnpm --filter @commercekit/sandbox-ccv2 openapi:check && pnpm test && pnpm build:check" + "ci": "pnpm test:toolchain && pnpm security:audit && pnpm --filter @commercekit/sandbox-ccv2 types:check && pnpm format:check && pnpm lint && pnpm typecheck && pnpm --filter @commercekit/sandbox-ccv2 openapi:check && pnpm test && pnpm build:check" }, "devDependencies": { "@eslint/js": "10.0.1", diff --git a/scripts/toolchain.test.mjs b/scripts/toolchain.test.mjs new file mode 100644 index 0000000..14aa6f9 --- /dev/null +++ b/scripts/toolchain.test.mjs @@ -0,0 +1,23 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import process from "node:process"; +import { test } from "node:test"; +import { URL } from "node:url"; + +const root = new URL("../", import.meta.url); +const read = (path) => readFileSync(new URL(path, root), "utf8"); + +test("repository and Cloudflare build roots select the same Node 26 toolchain", () => { + const version = read(".node-version").trim(); + assert.match(version, /^26\.\d+\.\d+$/); + assert.equal(read("apps/ccv2/.node-version").trim(), version); + for (const path of ["package.json", "apps/ccv2/package.json"]) { + const manifest = JSON.parse(read(path)); + assert.equal(manifest.engines.node, `>=${version} <27`); + assert.equal(manifest.packageManager, "pnpm@12.11.2"); + } +}); + +test("validation executes on the pinned development runtime", () => { + assert.equal(process.versions.node, read(".node-version").trim()); +});