Skip to content

fix(release): bundle full dependency closure in CLI/MCP tarballs - #245

Merged
simongonzalezdc merged 1 commit into
mainfrom
fix/release-tarball-full-closure
Oct 27, 2026
Merged

simongonzalezdc merged 1 commit into
mainfrom
fix/release-tarball-full-closure

Conversation

@simongonzalezdc

@simongonzalezdc simongonzalezdc commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Defect

t_63ad6d49 countersign (growth-comms, 2026-10-27): npm install -g https://github.com/KyaniteLabs/DialectOS/releases/download/v0.3.1/dialectos-cli-0.3.1.tgz exits 0 on a clean machine (pristine NPM_CONFIG_PREFIX/NPM_CONFIG_CACHE, node v22.23.4, npm 10.9.9) but every CLI invocation crashes:

Error: Cannot find package '.../@dialectos/cli/node_modules/isomorphic-dompurify/index.js'
imported from .../@dialectos/security/dist/index.js  (esm legacyMainResolve)

Reproduced during this fix: every dependency directory except commander is installed empty.

Root cause

npm does not install dependencies it considers part of a bundleDependencies subtree ("deps of bundled deps" are assumed present). The v0.3.1 pack strategy bundled the five @dialectos/* libs but only hoisted their public deps (isomorphic-dompurify, zod, marked) onto the parent manifest, expecting npm to fetch them. npm built the correct ideal tree (placeDep [email protected] OK …) but the reify diff only ever extracted two nodes (root + commander, the one dep declared solely by the root) and exited 0. Everything co-declared by a bundled lib — plus the entire jsdom subtree — was skipped, leaving empty placeholder dirs. The MCP tarball has the same hole (zod is co-declared by every bundled lib).

The green governance re-probe (t_930420b7) only passed because a warm cache / non-pristine prefix satisfied those deps outside the tarball.

Fix

  • scripts/pack-release-tarballs.mjs: resolve the union of public runtime deps with a real npm install into a staging area, move the entire resolved tree into the tarball's node_modules/, and list every package in bundleDependencies. The tarballs now install with zero registry access.
  • Post-pack verification: the pack script asserts every bundled and nested package (npm nests conflicting versions under express/body-parser/negotiator/type-is in the MCP closure — standard bundle layout, kept) actually appears in the packed tarball.
  • New scripts/tarball-install-smoke.mjs (wired into release.yml after packing and into scripts/__tests__/pack-release-tarballs.test.mjs): pristine-prefix --offline install must succeed, then the defect bar —
    1. install exit 0
    2. dialectos --version prints 0.3.1
    3. validate --dialect xx-XX fails closed naming the dialect and dialectos dialects list
    4. validate --dialect es-MX (with --source) passes
    5. MCP tarball: JSON-RPC initialize handshake answers @dialectos/[email protected]

Evidence (local, node v22.23.4 / npm 10.9.9)

  • node --test scripts/__tests__/*.test.mjs → 66/66 pass (includes the new pack + offline smoke tests)
  • Packed: cli 49 bundled + 0 nested verified (6.2 MB), mcp 137 bundled + 4 nested verified
  • Offline four-receipt smoke: all receipts OK

Follow-up (same task lane)

After merge: rebuild both tarballs from main, replace the v0.3.1 release assets + SHA256SUMS.txt (gh release upload --clobber), and re-run the four receipts against the live release URL on a pristine prefix/cache.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

npm install -g dialectos-cli-0.3.1.tgz exited 0 but every invocation
crashed with ERR_MODULE_NOT_FOUND: isomorphic-dompurify. npm silently
skips installing dependencies co-declared by a bundleDependencies
package (deps of bundled deps are assumed present), so the previous
hoist-only strategy left isomorphic-dompurify, zod, marked and the
whole jsdom tree as empty directories on clean machines.

- pack-release-tarballs.mjs now vendors the full transitive closure
  (resolved via a real npm install) into the tarball and verifies
  every bundled/nested package is present in the packed artifact
- new tarball-install-smoke.mjs gates releases on the defect bar:
  pristine-prefix OFFLINE install, --version prints, unknown dialect
  fails closed with an actionable error, known dialect passes, MCP
  initialize handshake answers
- release.yml runs the smoke after packing; pack tests updated to the
  new bundle contract (49 packages cli, 137+4 nested mcp)
@simongonzalezdc
simongonzalezdc merged commit 8fe7e16 into main Oct 27, 2026
7 checks passed
@simongonzalezdc
simongonzalezdc deleted the fix/release-tarball-full-closure branch October 27, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant