Skip to content

Stamp the release version into the npm addon's CLI - #1300

Merged
thekevinscott merged 14 commits into
mainfrom
claude/1297-npm-version
Oct 5, 2026
Merged

thekevinscott merged 14 commits into
mainfrom
claude/1297-npm-version

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1297

Root cause

npx dirsql --version prints the core dirsql crate's CARGO_PKG_VERSION, whose committed literal is 0.2.7. putitoutthere stamps the planned version in at build time.

  • PyPI: write-version runs on packages/python, where Cargo.toml sits next to pyproject.toml, and walks its path deps into the core crate.
  • npm: write-crate-version runs for a napi build only when Cargo.toml sits at the npm package path (packages/ts). Ours was at packages/ts/napi/Cargo.toml, so the step was skipped (::notice::napi: no Cargo.toml at packages/ts — skipping the pre-build crate-version write), and the addon shipped 0.2.7.

Fix

Move the manifest to packages/ts/Cargo.toml ([lib] path and build still point into napi/) and update the paths that name it. The release's existing stamp step then runs, the same way it does for PyPI; the planned version stays the one source of truth.

Checked by hand: npx putitoutthere@latest write-crate-version --path packages/ts --version 9.9.9 rewrote packages/ts/Cargo.toml and packages/rust/Cargo.toml, and the addon built from that tree printed dirsql 9.9.9.

Test

internals/checks/tests/integration/release_globs_test.py asserts that the npm package's path in putitoutthere.toml holds a Cargo.toml, the invariant the stamp step depends on. It lives in the integration tier because that tier reads real repo files and runs in CI; the napi crate's inline tests and packages/ts/tools tests do not run in CI.

Red

Run 37355133357 (commit 2dd2b6e, internals/checks integration tests): it_keeps_the_napi_manifest_at_the_npm_package_path failed against main's layout.

Changelog / Migrations

  • Changelog fragment added under packages/ts/changelog.d/
  • Migration fragment with the same slug added under packages/ts/migrations.d/

E2E Verification

  • packages/ts: just e2e-attest-ts, passed, receipt committed.

The release-ci precheck builds the napi addon through the same matrix as
the release. A new npm-addon-version job loads the linux-x64 addon and
fails when its CLI reports the version committed in
packages/rust/Cargo.toml, i.e. when the planned version was never stamped
into the crate the CLI reads its version from.
putitoutthere stamps the planned version into a napi crate only when its
Cargo.toml sits at the npm package path. Ours lived at
packages/ts/napi/Cargo.toml, so the stamp was skipped and the addon's CLI
reported the committed core literal 0.2.7. Moving the manifest to
packages/ts/Cargo.toml lets the release stamp it and, through the path
dependency, the core crate whose version the CLI prints, the same way
the maturin path already does for PyPI.
Replaces the npm addon version probe with the one invariant the release
depends on, and returns every other file to main so the assertion runs
against main's layout.
putitoutthere stamps the planned version into a napi crate only when its
Cargo.toml sits at the npm package path. Ours lived in packages/ts/napi, so
the stamp was skipped and the addon's CLI reported the committed core
literal 0.2.7.
@thekevinscott
thekevinscott merged commit f678007 into main Oct 5, 2026
92 checks passed
@thekevinscott
thekevinscott deleted the claude/1297-npm-version branch October 5, 2026 22:06
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.

npm: dirsql --version reports crate version 0.2.7 instead of the npm version

2 participants