Skip to content

fix(release): ship runtime-functions.js in the npm publish artifact - #2776

Merged
chaliy merged 1 commit into
mainfrom
eve/clever-mccarthy-klwp17
Oct 25, 2026
Merged

chaliy merged 1 commit into
mainfrom
eve/clever-mccarthy-klwp17

Conversation

@chaliy

@chaliy chaliy commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

What changed

The npm publish lane now ships runtime-functions.js / .d.ts, so Publish JS can get past its test stage and @everruns/bashkit can reach npm again.

runtime-functions.ts is declared in both tsconfigs, the two outputs are added to the js-stubs artifact, and the existing publish guard no longer has a blind spot: it checks tsconfig include against the .ts sources on disk instead of trusting it.

No library or package behavior changes — this is release plumbing.

Why

runtime-functions.ts arrived in #2740 without being added to tsconfig.json's include. tsc compiles a reachable import whether or not it is listed, so it kept emitting runtime-functions.js, and every local build and js.yml run stayed green.

Two things broke on that one omission:

  • publish-js.yml builds the package once and ships the result as the js-stubs artifact. That list is maintained by hand from include, so it never gained the file. The test jobs download the artifact rather than running tsc, so the file was simply absent.
  • scripts/tests/test_js_publish_files.py — the guard added after 0.18.2 shipped without langchain.js — reads its notion of "tsc output" out of that same include. So the guard was blind to exactly the file missing from it.

The result: v0.20.0 published to crates.io and PyPI, but both npm packages are still on 0.19.0. All fifteen Publish JS test jobs failed on ERR_MODULE_NOT_FOUND, and release-js is gated on them, so npm was never reached (run 40147171021).

wrapper.js is the package main and imports ./runtime-functions.js on its first line, so had the tests been bypassed the published tarball would have been broken for every consumer too: package.json files lists the file and the publish job never runs tsc.

Before / After

Reproducing the CI failure locally by simulating the artifact gap:

$ mv runtime-functions.js /tmp/ && node __test__/fixtures/runtime-functions-shutdown.mjs
node:internal/modules/esm/resolve:274
    throw new ERR_MODULE_NOT_FOUND(
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
  '.../crates/bashkit-js/runtime-functions.js'
  imported from .../crates/bashkit-js/wrapper.js

With the file present, resolution moves past it to the native binding that CI supplies via the js-bindings-* artifact — i.e. the reported failure is exactly this missing file.

The new guard fails on the pre-fix tree:

AssertionError: 'runtime-functions.ts' not found in {'scripted.ts', 'langchain.ts',
'internal.ts', 'anthropic.ts', 'wrapper.ts', 'ai.ts', 'openai.ts'}
: runtime-functions.ts is a package source but is not in tsconfig.json include

Restoring include alone then makes the two pre-existing checks fail independently on the artifact gap, which confirms the chain end to end:

AssertionError: 'runtime-functions.js' not found in {...}
: package.json lists runtime-functions.js but publish never receives it
AssertionError: 'runtime-functions.js' not found in {...}
: runtime-functions.js is built by tsc but not uploaded to publish

After the fix, every tsc output is covered by the artifact (verified by parsing the workflow against tsconfig.json): tsc outputs missing from artifact: none.

Validation:

  • 181/181 script tests pass.
  • tsc --noEmit -p tsconfig.check.json reports an identical error set before and after the change (11 errors, all environmental — the napi-generated index.d.ts is absent without a Rust napi build); no new type errors.
  • prettier --check, check-okf, check-doc-links, check-workflow-parity, check-capability-parity, check-changelog all pass.
  • Workflow YAML parses; stub list goes from 22 to 24 entries.

Risk

  • Low. Touches release plumbing, two tsconfig include lists, a test, and knowledge. No interpreter, builtin, or package runtime code. Adding an already-compiled file to include changes no emit (confirmed by the identical error sets), and widening an upload list cannot remove anything.
  • The new guard is deliberately strict: a future top-level .ts that is not an entry point (a config file, say) would fail it and need an explicit exclusion. That is the intended trade — the failure message names the file.

This PR does not republish 0.20.0. Only a refs/tags/vX.Y.Z ref publishes as npm latest, so a failed publish cannot be recovered by re-dispatching from main; npm needs a patch release once this lands.

Separately, and not fixed here: Publish Web (run 40147172644) failed for an unrelated reason — npm error 404 PUT @everruns/bashkit-wasm after provenance signing. The workflow is structurally identical to the one that published 0.19.0 successfully, so this looks like the NPM_TOKEN secret having expired or lost publish scope. That needs a credential rotation, not a code change.

Checklist

  • Tests added or updated — new include-completeness guard, written failing first
  • Backward compatibility considered — no public surface change

https://claude.ai/code/session_01RE65s6DTUE7LzZgc1o6Hzi


Generated by Claude Code

`runtime-functions.ts` arrived in #2740 without being added to
`tsconfig.json`'s `include`. tsc compiles a reachable import whether or
not it is listed, so it kept emitting `runtime-functions.js` and every
local build and `js.yml` run stayed green.

Two things broke on that omission. `publish-js.yml` builds the package
once and ships the result as the `js-stubs` artifact, and that list is
derived by hand from `include`, so it never gained the file. And
`scripts/tests/test_js_publish_files.py`, the guard added after 0.18.2
shipped without `langchain.js`, reads its notion of "tsc output" out of
the same `include` -- so the guard was blind to exactly the file that
was missing from it.

v0.20.0 therefore published to crates.io and PyPI while all fifteen
`Publish JS` test jobs failed on `ERR_MODULE_NOT_FOUND` for
runtime-functions.js, which `wrapper.js` (the package `main`) imports at
its first line. `release-js` is gated on those jobs, so npm was never
reached and both npm packages remain on 0.19.0. Had the tests been
bypassed, the published tarball would have omitted the file too:
`package.json` `files` lists it and the publish job never runs tsc.

Fixes the root omission in both tsconfigs, adds the two outputs to the
artifact, and closes the guard's blind spot by checking `include`
against the sources on disk instead of trusting it. `tsconfig.check.json`
overrides `include` rather than extending it, so it needs the entry too.

Before / After, reproducing the CI failure locally:

  $ mv runtime-functions.js /tmp/ && node __test__/fixtures/runtime-functions-shutdown.mjs
  Error [ERR_MODULE_NOT_FOUND]: Cannot find module
    '.../crates/bashkit-js/runtime-functions.js'
    imported from .../crates/bashkit-js/wrapper.js

With the file present, resolution moves past it to the native binding
that CI supplies via the `js-bindings-*` artifact.

The new guard fails on the pre-fix tree:

  AssertionError: 'runtime-functions.ts' not found in {'scripted.ts',
  'langchain.ts', 'internal.ts', 'anthropic.ts', 'wrapper.ts', 'ai.ts',
  'openai.ts'} : runtime-functions.ts is a package source but is not in
  tsconfig.json include

and restoring `include` alone then makes the two pre-existing checks
fail independently on the artifact gap, confirming the chain.

Verified: 181/181 script tests pass; `tsc --noEmit -p tsconfig.check.json`
reports an identical error set before and after (11 environmental errors
from the absent napi-generated `index.d.ts`, no new ones); prettier,
check-okf, check-doc-links, check-workflow-parity, check-capability-parity
and check-changelog pass; the artifact now covers every tsc output.

This does not republish 0.20.0. A failed npm publish cannot be recovered
by re-dispatching from `main`, since only a `refs/tags/vX.Y.Z` ref
publishes as `latest`; npm needs a patch release once this has landed.

Claude-Session: https://claude.ai/code/session_01RE65s6DTUE7LzZgc1o6Hzi
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit d247e14 Commit Preview URL

Branch Preview URL
Oct 25 2026, 09:17 AM

@chaliy
chaliy merged commit 4771867 into main Oct 25, 2026
34 checks passed
@chaliy
chaliy deleted the eve/clever-mccarthy-klwp17 branch October 25, 2026 09:48
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