From 001a7ae2cecc0d48342de209eda188d34778df1d Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 14:54:24 -0600 Subject: [PATCH] fix(id): smoke asserts the live schema version instead of a literal 2 (#13673) The hosted-worker smoke asserted schema_version === 2 while user-do.ts bumped SCHEMA_VERSION to 3 in cb40903e8ce (bridge v1, #3818), so the UserDO leg failed on main. Read SCHEMA_VERSION from src/user-do.ts in the smoke instead of repeating a literal, so a future bump moves both sides together, and assert the state route against it. Verified locally: npm run smoke -> SMOKE OK (all checks pass, state reports schema_version 3). --- pkgs/id/hosted-worker/smoke/smoke.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/id/hosted-worker/smoke/smoke.mjs b/pkgs/id/hosted-worker/smoke/smoke.mjs index d50675b4a0..ac5e587594 100644 --- a/pkgs/id/hosted-worker/smoke/smoke.mjs +++ b/pkgs/id/hosted-worker/smoke/smoke.mjs @@ -14,8 +14,19 @@ // // Usage: node smoke/smoke.mjs import { spawn } from "node:child_process"; +import { readFileSync } from "node:fs"; const PKG = new URL("..", import.meta.url).pathname; + +// The schema version has one source: SCHEMA_VERSION in src/user-do.ts. +// Reading it here rather than repeating a literal means a future bump +// updates the DO, the bootstrap and this assertion together (#13673). +const SCHEMA_VERSION = (() => { + const src = readFileSync(new URL("../src/user-do.ts", import.meta.url), "utf8"); + const m = src.match(/export const SCHEMA_VERSION = (\d+);/); + if (!m) throw new Error("smoke: SCHEMA_VERSION not found in src/user-do.ts"); + return Number(m[1]); +})(); const A = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; const B = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; let failures = 0; @@ -79,7 +90,7 @@ async function waitUp(port, tries) { check("harness + DO start, lazy create", up); let r = await fetch(base + q(A, A, "us")); let body = await r.json(); - check("state reports binding, jurisdiction, schema v2", body.binding_id === A && body.jurisdiction === "us" && body.schema_version === 2, JSON.stringify(body)); + check("state reports binding, jurisdiction, current schema version (source: SCHEMA_VERSION)", body.binding_id === A && body.jurisdiction === "us" && body.schema_version === SCHEMA_VERSION, JSON.stringify(body)); const many = await Promise.all(Array.from({ length: 8 }, () => fetch(base + q("cccccccccccccccccccccccccccccccc", "cccccccccccccccccccccccccccccccc", "eu")))); check("concurrent first requests all 200 (idempotent bootstrap)", many.every((x) => x.status === 200));