Skip to content

fix(selfhost): build gittensory-engine before bundling the self-host image - #4034

Merged
JSONbored merged 1 commit into
mainfrom
fix/selfhost-build-missing-engine-dist
Jul 7, 2026
Merged

fix(selfhost): build gittensory-engine before bundling the self-host image#4034
JSONbored merged 1 commit into
mainfrom
fix/selfhost-build-missing-engine-dist

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • The self-host Docker build (build + boot smoke test CI job) is currently failing for every open PR: esbuild can't resolve @jsonbored/gittensory-engine while bundling gittensory-miner's checked-in lib/*.js artifacts (feat(miner-foundation): extract reward-risk scoring into gittensory-engine #2281 extracted their reward-risk scoring into this workspace package).
  • Two compounding problems, confirmed by reproducing the exact failure both locally and via docker build:
    1. gittensory-engine ships no committed dist/ — nothing built it before the self-host bundle step ran.
    2. The Dockerfile copied only the root package*.json before npm ci (the usual dependency-layer caching trick), so no workspace package.json existed yet for npm to resolve — it silently skipped every workspace symlink under node_modules, including gittensory-engine's. Building the engine afterward alone wasn't enough: esbuild couldn't find the module at all (not just its dist/), since the symlink itself never existed.
  • Fix: copy the full source before npm ci so workspace symlinks resolve correctly, then explicitly build gittensory-engine before the self-host bundle step runs.

Scope

  • Single-purpose, Dockerfile-only
  • Not wantedPaths-restricted (build config)

Validation

  • Reproduced the exact CI failure locally and via docker build --target build on a clean checkout of origin/main
  • docker build --target build --no-cache — now succeeds (engine builds, self-host bundle builds, sourcemap validates)
  • Full multi-stage docker build (build + runtime-base + runtime) — succeeds end to end
  • npm run typecheck — clean

Safety

  • No secrets/private terms introduced
  • No changes to site/, CNAME, lovable/, or the changelog

…image

The self-host Docker build was failing for every open PR: esbuild
couldn't resolve "@jsonbored/gittensory-engine" while bundling
gittensory-miner's checked-in lib/*.js artifacts (#2281 extracted
their reward-risk scoring into this workspace package).

Two compounding problems, confirmed by reproducing the failure both
locally and in an actual `docker build`:
1. gittensory-engine ships no committed dist/ -- nothing built it
   before the self-host bundle step ran.
2. The Dockerfile copied only the root package*.json before running
   `npm ci` (the usual dependency-layer caching trick), so no
   workspace package.json existed yet for npm to resolve -- it
   silently skipped every workspace symlink under node_modules,
   including gittensory-engine's. Building the engine afterward was
   not enough on its own: esbuild still couldn't find the module at
   all, only its dist/ would have been missing if the symlink had
   existed.

Fix: copy the full source before `npm ci` (workspace symlinks resolve
correctly), then explicitly build gittensory-engine before the
self-host bundle step. Verified with an actual `docker build` (both
the `build` target alone and the full multi-stage image) against a
clean checkout -- fails identically to CI without this change, builds
clean with it.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 7, 2026
@JSONbored
JSONbored merged commit e68f450 into main Jul 7, 2026
9 checks passed
@JSONbored
JSONbored deleted the fix/selfhost-build-missing-engine-dist branch July 7, 2026 11:28
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 7, 2026
JSONbored added a commit that referenced this pull request Jul 8, 2026
…4081) (#4084)

src/mcp/find-opportunities.ts (since #3986) imports packages/gittensory-miner/lib/
opportunity-fanout.js (committed, pre-built), which imports @jsonbored/gittensory-engine.
That package's dist/ is gitignored and only exists after an explicit build step -- Cloudflare's
Workers Builds pipeline for gittensory-api runs npm run deploy:api directly with no such step,
so wrangler deploy's bundler has failed to resolve the import on every push to main since
487d26a (2026-07-07T09:36:46Z). Mirrors the identical fix already applied to the self-host
image build (#4034), the release build (#4063), and the backend test suite (#4036).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant