Skip to content

fix(selfhost): deploy-selfhost-prebuilt.sh doesn't build packages/gittensory-engine before bundling, breaking every future self-host update #4530

Description

@JSONbored

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 builddeploy-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

  • Insert the missing engine build step into run_node_build() in scripts/deploy-selfhost-prebuilt.sh
  • Test: a clean checkout (no pre-existing packages/gittensory-engine/dist/) successfully runs deploy-selfhost-prebuilt.sh end to end
  • Consider whether packages/gittensory-miner's own build also needs to run here, or whether the engine alone is sufficient for everything --all bundles today

Surfaced while executing the #4325 GPU-host migration's server update.

Metadata

Metadata

Assignees

Labels

gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.maintainer-onlyOwner-only work — yields no Gittensor points.orbGittensory Orb related - maintainer self-hosting analytics.

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions