From 34e8441367aea1763e0d57d3ff330c5dfa99f63b Mon Sep 17 00:00:00 2001 From: AAA <35992542+TNTcraftHIM@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:46:02 -0500 Subject: [PATCH] fix(build): resolve product identity before compiling WASM Pass the selected product version and revision to Web and text-participant WASM from the existing build identity owner. This closes the ordering difference between SDK packaging and Web builds. Verified existing build-script tests and development, candidate and stable-tag argument controls; no remote build was started. --- .github/workflows/repository-hygiene.yml | 1 + package.json | 2 +- scripts/build-channel-web.mjs | 1 + scripts/check-rust.mjs | 3 ++- scripts/package-text-participant.mjs | 4 ++++ tests/channel-web-artifact.test.ts | 4 ++++ 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/repository-hygiene.yml b/.github/workflows/repository-hygiene.yml index f38cf3918..d34f47e3e 100644 --- a/.github/workflows/repository-hygiene.yml +++ b/.github/workflows/repository-hygiene.yml @@ -369,6 +369,7 @@ jobs: run: npm run check env: PIIK_BUILD_VERSION: ${{ steps.release.outputs.version }} + PIIK_BUILD_REVISION: ${{ github.sha }} VITE_PIIK_VERSION: ${{ steps.release.outputs.version }} VITE_PIIK_REVISION: ${{ github.sha }} diff --git a/package.json b/package.json index f216ccc58..89cf313ce 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build:web": "node scripts/build-channel-web.mjs", "package:app": "node scripts/assemble-app.mjs", "package:app-candidate": "node scripts/package-app-candidate.mjs", - "package:text-participant": "node prototype/channel-browser/build.mjs && node scripts/package-text-participant.mjs", + "package:text-participant": "node scripts/package-text-participant.mjs", "check:rust": "node scripts/check-rust.mjs", "check:container": "node scripts/check-container.mjs", "typecheck": "node prototype/channel-browser/build.mjs && tsc -b --pretty false && tsc -p prototype/channel-browser/tsconfig.json", diff --git a/scripts/build-channel-web.mjs b/scripts/build-channel-web.mjs index e6c6b46e9..8cbb80fb8 100644 --- a/scripts/build-channel-web.mjs +++ b/scripts/build-channel-web.mjs @@ -22,6 +22,7 @@ export function buildChannelWeb(root, { version, revision, cargoTarget }) { try { assertCleanRevision(root, revision); reusable = true; } catch {} } const env = { ...process.env, RUSTUP_TOOLCHAIN: '1.91.0', + PIIK_BUILD_VERSION: version, PIIK_BUILD_REVISION: revision, VITE_PIIK_VERSION: version, VITE_PIIK_REVISION: revision, ...(cargoTarget ? { CARGO_TARGET_DIR: cargoTarget } : {}) }; writeChannelWebLicenseNotices(root, join(root, 'public', 'third-party-licenses.txt')); diff --git a/scripts/check-rust.mjs b/scripts/check-rust.mjs index e3e6416ab..e2c2c3cdf 100644 --- a/scripts/check-rust.mjs +++ b/scripts/check-rust.mjs @@ -45,7 +45,8 @@ cargo("build", "server", "--bin", "piik-channel-prototype"); const { buildChannelWeb, verifyCheckoutWeb } = await import(pathToFileURL(join(root, "scripts/build-channel-web.mjs")).href); env.PIIK_CHANNEL_WEB_DIR = env.PIIK_CHANNEL_WEB_DIR ? verifyCheckoutWeb(root, env.PIIK_CHANNEL_WEB_DIR) - : buildChannelWeb(root, { version: "development", revision: "development", cargoTarget: target }); + : buildChannelWeb(root, { version: env.PIIK_BUILD_VERSION || "development", + revision: env.PIIK_BUILD_REVISION || "development", cargoTarget: target }); run(process.execPath, ["node_modules/typescript/bin/tsc", "-p", "prototype/channel-browser/tsconfig.json"]); run(process.execPath, ["prototype/channel-server/run-browser-check.mjs", "--protocol", "--built-server"]); process.stdout.write("Rust, Web/WASM and protocol checks passed (capture disabled).\n"); diff --git a/scripts/package-text-participant.mjs b/scripts/package-text-participant.mjs index 0f8b30cd3..d418c25dc 100644 --- a/scripts/package-text-participant.mjs +++ b/scripts/package-text-participant.mjs @@ -20,6 +20,10 @@ const dirty = Boolean(git("status", "--porcelain")); const version = productVersion === "development" ? `0.0.0-development.${revision}` : productVersion.slice(1); const { devDependencies, engines, license } = JSON.parse(readFileSync(join(root, "package.json"), "utf8")); const dependencies = { ws: devDependencies.ws, zod: devDependencies.zod }; +execFileSync(process.execPath, [join(root, browser, "build.mjs")], { + cwd: root, stdio: "inherit", windowsHide: true, + env: { ...process.env, PIIK_BUILD_VERSION: productVersion, PIIK_BUILD_REVISION: revision }, +}); const staging = mkdtempSync(join(tmpdir(), "piik-text-participant-")); try { diff --git a/tests/channel-web-artifact.test.ts b/tests/channel-web-artifact.test.ts index fa21c0868..0c9b7cac8 100644 --- a/tests/channel-web-artifact.test.ts +++ b/tests/channel-web-artifact.test.ts @@ -15,6 +15,10 @@ vi.mock("node:child_process", () => ({ throw new Error("Unexpected Git command"); }, spawnSync: (_command: string, args: string[], options: { cwd: string; env: NodeJS.ProcessEnv }) => { + expect(options.env).toMatchObject({ + PIIK_BUILD_VERSION: identity.version, PIIK_BUILD_REVISION: identity.revision, + VITE_PIIK_VERSION: identity.version, VITE_PIIK_REVISION: identity.revision, + }); build.calls.push(args); if (args.includes("build")) webFixture(join(options.cwd, "build/channel-web"), options.env.VITE_PIIK_REVISION!); return { status: 0 };