Context
Discovered while bringing edge-nl-01 (the self-host GPU host from #4325) up to date with main (154 commits behind at the time). ./scripts/selfhost-update.sh failed at the build step with:
✘ [ERROR] Could not resolve "@jsonbored/gittensory-engine"
packages/gittensory-miner/lib/opportunity-fanout.js:2:39
packages/gittensory-miner/lib/opportunity-ranker.js:5:7
The module "./dist/index.js" was not found on the file system
Root cause
packages/gittensory-engine/dist/ is gitignored (built via tsc, not committed). scripts/deploy-selfhost-prebuilt.sh's run_node_build() runs:
npm ci --ignore-scripts && node scripts/build-selfhost.mjs --all && node scripts/validate-selfhost-sourcemap.mjs
--ignore-scripts skips whatever would otherwise build the linked workspace package, and this command never runs packages/gittensory-engine's own build script before build-selfhost.mjs --all tries to bundle everything (including packages/gittensory-miner, which now imports the engine). The root package.json already has the correct sequence for a different entry point — build:miner: npm --workspace @jsonbored/gittensory-engine run build && npm --workspace @jsonbored/gittensory-miner run build — deploy-selfhost-prebuilt.sh just never calls it.
This was latent (nothing in the self-host app bundle needed the engine's dist/ before), and only surfaced now because newly-merged code (packages/gittensory-miner/lib/opportunity-fanout.js / opportunity-ranker.js) added the first import that requires it during an --all bundle. It will reproduce on every self-host instance's next ./scripts/selfhost-update.sh run against current main until fixed — not specific to this one host.
Fix
Add a npm --workspace @jsonbored/gittensory-engine run build step inside run_node_build() in scripts/deploy-selfhost-prebuilt.sh, before the build-selfhost.mjs --all call, inside the same throwaway-container invocation.
Workaround used on edge-nl-01 (2026-07-09)
Ran the missing build step manually, once, via a standalone docker run using the exact same image/user/mount pattern as run_node_build(), then re-ran ./scripts/selfhost-update.sh normally, which succeeded. No repo files were changed to work around this — purely an out-of-band step on the host. packages/gittensory-engine/dist/ now persists on that host's disk going forward, so this exact host won't hit it again, but every other self-host instance (and this one, if packages/gittensory-engine/dist/ is ever cleaned) still will.
Deliverables
Surfaced while executing the #4325 GPU-host migration's server update.
Context
Discovered while bringing
edge-nl-01(the self-host GPU host from #4325) up to date withmain(154 commits behind at the time)../scripts/selfhost-update.shfailed at the build step with:Root cause
packages/gittensory-engine/dist/is gitignored (built viatsc, not committed).scripts/deploy-selfhost-prebuilt.sh'srun_node_build()runs:--ignore-scriptsskips whatever would otherwise build the linked workspace package, and this command never runspackages/gittensory-engine's ownbuildscript beforebuild-selfhost.mjs --alltries to bundle everything (includingpackages/gittensory-miner, which now imports the engine). The rootpackage.jsonalready has the correct sequence for a different entry point —build:miner:npm --workspace @jsonbored/gittensory-engine run build && npm --workspace @jsonbored/gittensory-miner run build—deploy-selfhost-prebuilt.shjust never calls it.This was latent (nothing in the self-host app bundle needed the engine's
dist/before), and only surfaced now because newly-merged code (packages/gittensory-miner/lib/opportunity-fanout.js/opportunity-ranker.js) added the first import that requires it during an--allbundle. It will reproduce on every self-host instance's next./scripts/selfhost-update.shrun against currentmainuntil fixed — not specific to this one host.Fix
Add a
npm --workspace @jsonbored/gittensory-engine run buildstep insiderun_node_build()inscripts/deploy-selfhost-prebuilt.sh, before thebuild-selfhost.mjs --allcall, inside the same throwaway-container invocation.Workaround used on edge-nl-01 (2026-07-09)
Ran the missing build step manually, once, via a standalone
docker runusing the exact same image/user/mount pattern asrun_node_build(), then re-ran./scripts/selfhost-update.shnormally, which succeeded. No repo files were changed to work around this — purely an out-of-band step on the host.packages/gittensory-engine/dist/now persists on that host's disk going forward, so this exact host won't hit it again, but every other self-host instance (and this one, ifpackages/gittensory-engine/dist/is ever cleaned) still will.Deliverables
run_node_build()inscripts/deploy-selfhost-prebuilt.shpackages/gittensory-engine/dist/) successfully runsdeploy-selfhost-prebuilt.shend to endpackages/gittensory-miner's own build also needs to run here, or whether the engine alone is sufficient for everything--allbundles todaySurfaced while executing the #4325 GPU-host migration's server update.