Skip to content

chore(ci): inject npm versions at publish time + add hyperdb-api-node to CI#47

Merged
StefanSteiner merged 4 commits into
tableau:mainfrom
StefanSteiner:ssteiner/fix-npm-release-versioning
May 27, 2026
Merged

chore(ci): inject npm versions at publish time + add hyperdb-api-node to CI#47
StefanSteiner merged 4 commits into
tableau:mainfrom
StefanSteiner:ssteiner/fix-npm-release-versioning

Conversation

@StefanSteiner
Copy link
Copy Markdown
Contributor

Summary

  • Stops tracking platform npm package.json versions in git. The publish workflow injects them from the git tag, eliminating the recurring "release-please bumped Cargo but skipped npm" failure that took 0.2.0 and 0.2.1 down.
  • Adds hyperdb-api-node to CI (Linux-only build + smoke test) so napi-rs regressions surface on PRs instead of mid-release.
  • Adds CI guards: tag-vs-Cargo.toml mismatch detection, in-source version field detection.
  • Slims release-please config to track only the workspace root.

Test plan

  • CI green on this branch
  • Run npm-build-publish workflow_dispatch on a scratch branch with npm publish --dry-run to verify the inject + publish path end-to-end
  • First post-merge release-please PR diff: zero edits under npm/, manifest only at .
  • First post-merge release: npm view hyperdb-mcp-darwin-arm64 versions --json lists the new version

Strip the `version` field from all platform-specific and umbrella
npm package.json files (10 platform packages plus 2 umbrellas), and
strip the `optionalDependencies` block from the umbrellas. Slim
release-please-config.json to track only the root component (`.`),
removing the linked-versions plugin and 8 optionalDependencies
extra-files entries that were being patched but never reliably
propagated. Reduce .release-please-manifest.json to a single entry.

Why: release-please's linked-versions plugin requires each registered
"package" to receive scope-specific commits to bump. The npm platform
directories only contain a static package.json plus binaries injected
by CI — they never get real commits, so release-please skipped them
("No user facing commits found") and the linked sync never fired.
The result was platform package.json `version` fields stuck at 0.1.3
while the workspace bumped to 0.2.1, causing npm publish to fail
with E404 when the workflow tried `npm publish` from those dirs.

This commit removes the source-controlled versioning. The next commit
adds runtime injection in the publish workflow, making the version
field derived from the git tag instead.
Replace the "Determine npm dist-tag" step in npm-build-publish.yml
with a single "Resolve version and dist-tag from event" step that
sources VERSION from the workflow trigger (release tag or
workflow_dispatch input) instead of reading the now-absent version
field from package.json. Validate the version string against a strict
semver shape before it flows into npm pkg set / npm publish (defense
in depth against malformed workflow_dispatch inputs).

Add a new "Inject version into all npm package.json files" step that
runs `npm pkg set` to materialize the version field on all 8 platform
packages (3 mcp + 5 api-node) plus both umbrella packages, and pin
each umbrella's optionalDependencies to the exact version. Bash
arrays MCP_PLATFORMS and NODE_PLATFORMS are the single source of
truth for which platforms are published; they must stay in sync with
the build-npm matrix and the publish loops.

Mirror the same logic in scripts/assemble-npm.sh for local pack
testing: derive VERSION from the workspace Cargo.toml and apply the
same npm pkg set injection before each `npm pack`. The script's
header now warns that it mutates the working tree and shows the
`git restore` incantation to discard.

Also add the new "hyperdb-api-node (build + smoke)" check name to
the verify-ci REQUIRED regex so future releases block on it (the CI
job itself lands in the next commit).
Add a Linux-only `node-bindings` job to ci.yml that builds the
napi-rs native addon (debug profile for speed) and runs the
existing __test__/smoke.mjs against a freshly-downloaded hyperd.
Catches regressions in the Node.js bindings on PRs instead of at
release time inside npm-build-publish.yml, which has been silently
the only coverage for this crate to date.

The job reuses the existing `test-ubuntu-latest` Cargo cache key
and the `hyperd-${{ runner.os }}-${{ runner.arch }}-...` cache key
shape from the existing test matrix, so it's warm on the second
run. Cold ~15 min, warm ~5 min. Runs in parallel with the existing
test matrix; doesn't extend wall-clock CI (bounded by the 45-min
test (windows-latest) slot).

Cross-platform napi compatibility continues to be exercised by the
per-platform build matrix in npm-build-publish.yml at release time.
The check name `hyperdb-api-node (build + smoke)` was added to the
verify-ci REQUIRED regex in the previous commit so future releases
block on it.
Adversarial review (BOTH reviewers in parallel) flagged platform-list
drift and missing guardrails. This commit folds the fixes back into
the same PR before pushing.

Critical (CRITICAL severity from both reviewers):
- npm-build-publish.yml had a 5-element NODE_PLATFORMS array but only
  iterated 3 platforms in the publish loop, so the umbrella was being
  published with optionalDependencies pointing at 2 platform packages
  (linux-arm64-gnu, linux-x64-musl) that were never built or
  published. Collapse MCP_PLATFORMS / NODE_PLATFORMS into a single
  PLATFORMS array (the 3 platforms actually built and published) and
  comment that splitting is required if the two ever diverge.
- hyperdb-api-node/package.json `napi.targets` listed 5 targets to
  match the now-removed NODE_PLATFORMS aspirational list. Trim to the
  3 targets actually built. Pre-existing drift, but with --ignore-scripts
  on the umbrella publish, the misalignment had become silent.

Major:
- Add a "Verify tag matches workspace Cargo.toml version" step in
  npm-build-publish.yml that aborts publish if the tag-derived
  $VERSION doesn't match Cargo.toml's [workspace.package].version.
  Without this, a hand-created tag could ship npm at version X while
  cargo publish ships crates.io at version Y.
- Add an EXIT trap to scripts/assemble-npm.sh that always runs
  `git restore` on the in-source package.json files, so a contributor
  can't accidentally `git add -A` and re-introduce the `version` field
  the codebase is deliberately keeping out of git.
- Extend the `version-consistency` CI job with an "in-source version"
  guard that fails CI if any of the 12 npm package.json files grows a
  `version` field. Locks in the invariant introduced by this PR.
@StefanSteiner StefanSteiner merged commit a5c91a4 into tableau:main May 27, 2026
11 checks passed
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