fix(ci): anchor native-change detection to package.json's version, not the latest tag#2128
Merged
Merged
Conversation
…t the latest tag The v3.16.0 release attempt tagged the release but failed its pre-publish benchmark gate (#2127) before publish ran, so package.json on main is still 3.15.0 and nothing was actually published under that tag. detect-changes picked the dangling v3.16.0 tag as "last published release" and diffed it against itself, finding no native-relevant changes and skipping the fresh native build — causing every PR's Engine-parity/Test jobs to fall back to the real published 3.15.0 binary, which is 56 native-relevant files behind HEAD. Anchoring to package.json's declared version instead of "the most recent semver-shaped tag" ties the check to what's actually checked out.
Contributor
| # matching publish, which made this job wrongly report "unchanged" | ||
| # against a fallback binary that was actually several releases | ||
| # stale (#2127). | ||
| CURRENT_VERSION=$(grep -m1 '"version"' package.json | sed -E 's/.*: *"([^"]*)".*/\1/') |
Contributor
There was a problem hiding this comment.
Using
grep -m1 '"version"' could theoretically match an embedded "version" key in a non-standard package.json section (e.g., inside an engines object or a pre-fields comment block) before the top-level field. node -p or jq would parse the JSON unambiguously and is guaranteed to be available on every GitHub-hosted runner.
Suggested change
| CURRENT_VERSION=$(grep -m1 '"version"' package.json | sed -E 's/.*: *"([^"]*)".*/\1/') | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Contributor
Author
There was a problem hiding this comment.
Fixed — replaced the grep/sed extraction with node -p "require('./package.json').version" for unambiguous JSON parsing.
Contributor
Author
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
All 8 currently-open dependabot PRs (#2119-#2126) are failing CI identically on Engine parity (all 3 OSes) and Test Node 22 (all 3 OSes), regardless of what each PR actually bumps — including PRs that only touch GitHub Actions versions (
setup-go,setup-node,claude-code-action) with zero npm/Rust changes.Root cause
v3.16.0release attempt (commit2e0e94f, 2026-07-17) tagged the release, but its Pre-publish benchmark gate failed on a genuine build-time regression (filed as build-perf regression blocking v3.16.0: full build +42%, incremental rebuild +53-83% #2127), sopublish/publish-devnever ran.package.jsononmainis still3.15.0, and npm still serves3.15.0— nothing was actually published under thev3.16.0tag.detect-changesinci.ymlpicks "the most recentvX.Y.Zgit tag" as its proxy for "last published release." That's now the danglingv3.16.0tag, which is currentmainHEAD — diffing HEAD against itself trivially finds zero native-relevant changes, sonative-host-buildgets skipped.test/parityjobs fall back to whatevernpm installresolves for the platform packages — the actually published3.15.0binary, which is 56 native-relevant files (extractors, builder pipeline, db layer) behind HEAD.Fix
Anchor
detect-changes's diff base to the versionpackage.jsoncurrently declares, instead of "the most recent semver-shaped tag." A tag can exist without a successful publish (exactly what happened here);package.json's version cannot drift from what's published without the release job itself changing it.Verified against the current repo state: the fix now correctly resolves to
v3.15.0and detects the 56 native-relevant files changed since, which would setnative_changed=trueand restore the fresh-native-build path.Not in scope here
The underlying build-perf regression that blocked the v3.16.0 release is tracked separately in #2127.