Skip to content

Fix npm package startup failure from effect peer-range skew - #113

Merged
badcuban merged 1 commit into
mainfrom
fix/npm-effect-peer-skew
Aug 6, 2026
Merged

Fix npm package startup failure from effect peer-range skew#113
badcuban merged 1 commit into
mainfrom
fix/npm-effect-peer-skew

Conversation

@badcuban

@badcuban badcuban commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Problem

Every cold install of @threadlines/server@0.3.1 exits code 1 before printing anything, on Windows and Linux. The package has been dead on arrival since it was published on Aug 5.

Root cause: the published manifest pins effect@4.0.0-beta.97 alongside @effect/platform-node@4.0.0-beta.98, whose peer range is ^4.0.0-beta.98. beta.97 cannot satisfy it, so npm auto-installs a second, newer effect (beta.104 today) at the tree root while beta.97 nests under the package. Two Effect runtimes cannot share Context/Cause objects, and the mixed state also breaks Effect's own failure reporting: the fiber's teardown misclassifies the foreign Cause and calls process.exit(1) without printing. Development never sees this because pnpm overrides force a single copy.

Fix

  • Catalog: effect and @effect/platform-node-shared to 4.0.0-beta.98, so the exact pins satisfy every peer range in the effect family and npm dedupes to one runtime regardless of future effect releases. Both pnpm patches rebased (applied cleanly; patched behavior verified present).
  • prepare-server-npm-package.ts now pins @effect/platform-node-shared in the published manifest; previously it floated on platform-node''s ^4.0.0-beta.98 range and could independently drag in another incompatible effect.
  • New startup guard in the server bin: if an install resolves two different copies of effect, print which two and where, with recovery steps, instead of dying silently.
  • npm-package workflow now smoke-tests the packed tarball: installs it into a fresh tree like a real user (registry-resolved transitives), asserts exactly one installed copy of effect, and requires the server to boot to its Listening on http line. The previous dry-run only grepped the tarball listing and could never catch runtime skew.

Verification

  • vp fmt, vp lint, vp run typecheck green.
  • Full vitest suite: 14 local failures, 13 reproduce identically on main (pre-existing Windows-local), 1 passes in isolation (load flake). Zero regressions from the bump.
  • Packed tarball cold-installed and booted to pairing URL on Windows and in a node:22-bookworm container; exactly one effect copy in both trees.
  • New guard exercised against a preserved broken 0.3.1 install: prints both copies and exits 1 instead of silence.

After merge: publish as 0.3.2.

The published manifest pinned effect@4.0.0-beta.97 next to
@effect/platform-node@4.0.0-beta.98, whose peer range (^4.0.0-beta.98)
beta.97 cannot satisfy. npm resolved a second, newer effect at the tree
root, and with two Effect runtimes in one process the server died before
printing anything: every cold install of 0.3.1 exits 1 on all platforms.
pnpm overrides hid the mismatch in development.

- Align effect and @effect/platform-node-shared to 4.0.0-beta.98 so the
  exact pins satisfy every peer range in the family (patches rebased)
- Pin @effect/platform-node-shared in the published manifest instead of
  letting platform-node's range float to an incompatible newer beta
- Fail fast with an actionable error when an install contains two copies
  of effect; the mixed-runtime state otherwise poisons Effect's own
  error reporting and the process exits silently
- Smoke-test the packed tarball in the npm-package workflow: install it
  like a real user, assert exactly one effect copy, and require the
  server to boot to its listening line
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadlines Ready Ready Preview Aug 6, 2026 3:41pm

Request Review

@github-actions github-actions Bot added size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Aug 6, 2026
@badcuban
badcuban merged commit 0b51f28 into main Aug 6, 2026
16 of 18 checks passed
@badcuban
badcuban deleted the fix/npm-effect-peer-skew branch August 6, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant