From ccb15c4b3ceb596dbb4c23297bc9c877733b9d52 Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Thu, 9 Jul 2026 16:04:19 -0700 Subject: [PATCH] fix(selfhost): build gittensory-engine before bundling in deploy-selfhost-prebuilt.sh packages/gittensory-engine/dist/ is gitignored and built via tsc, but run_node_build() ran npm ci --ignore-scripts straight into build-selfhost.mjs --all with no step in between to build it. This was latent until packages/gittensory-miner/lib/opportunity-fanout.js and opportunity-ranker.js started importing the engine package, which the --all bundle now needs to resolve. Mirrors the existing build:miner script's ordering (engine build before miner build). Discovered while updating edge-nl-01 to current main; the fix was verified there by running the equivalent step manually before this PR landed. --- scripts/deploy-selfhost-prebuilt.sh | 2 +- test/unit/docs-selfhost-update-rollback.test.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/deploy-selfhost-prebuilt.sh b/scripts/deploy-selfhost-prebuilt.sh index 484c29aadb..0718ea169f 100755 --- a/scripts/deploy-selfhost-prebuilt.sh +++ b/scripts/deploy-selfhost-prebuilt.sh @@ -35,7 +35,7 @@ run_node_build() { -v "$PWD:/work" \ -w /work \ "$NODE_IMAGE" \ - sh -lc 'npm ci --ignore-scripts && node scripts/build-selfhost.mjs --all && node scripts/validate-selfhost-sourcemap.mjs' + sh -lc 'npm ci --ignore-scripts && npm --workspace @jsonbored/gittensory-engine run build && node scripts/build-selfhost.mjs --all && node scripts/validate-selfhost-sourcemap.mjs' } run_sentry_upload() { diff --git a/test/unit/docs-selfhost-update-rollback.test.ts b/test/unit/docs-selfhost-update-rollback.test.ts index 00a9fed397..b3fc8b155d 100644 --- a/test/unit/docs-selfhost-update-rollback.test.ts +++ b/test/unit/docs-selfhost-update-rollback.test.ts @@ -32,6 +32,17 @@ describe("self-host update + rollback docs (#1823)", () => { expect(prebuiltScript).toContain('up -d --no-deps "$SERVICE"'); }); + it("prebuilt deploy builds the gittensory-engine workspace before bundling (#4530)", () => { + // packages/gittensory-engine/dist/ is gitignored and built via `tsc`; `npm ci --ignore-scripts` + // never triggers that build on its own, so anything that imports the engine (e.g. + // packages/gittensory-miner) fails to resolve during the --all bundle unless this runs first. + const engineBuildIndex = prebuiltScript.indexOf("@jsonbored/gittensory-engine run build"); + const bundleIndex = prebuiltScript.indexOf("build-selfhost.mjs --all"); + expect(engineBuildIndex).toBeGreaterThan(-1); + expect(bundleIndex).toBeGreaterThan(-1); + expect(engineBuildIndex).toBeLessThan(bundleIndex); + }); + it("post-update script probes /ready without mutating operator-owned state", () => { expect(postUpdateScript).toContain("/ready"); expect(postUpdateScript).toContain("GITTENSORY_IMAGE");