chore(dev-env): warn when local Node major diverges from CI's pinned version - #2578
Merged
Conversation
…version A fresh worktree on a machine running a Node major version CI doesn't pin (e.g. Node 26, when CI pins 22 everywhere) can produce 200+ unrelated-looking local test failures from native-addon/V8 behavioral drift, not actual regressions -- wasting time triaging phantom failures or masking a real one in the noise. The failures reproduce identically on an untouched origin/main checkout in the same environment. Adds .nvmrc (22, mirroring every node-version: 22 in ci.yml) as a single reference point, and a new checkNodeVersion doctor check (wired into the existing pretest-gated npm run doctor) that warns -- never fails, since a mismatch doesn't mean the environment is broken, just that local results shouldn't be trusted over CI's -- when the running major doesn't match it. Documents the cross-check guidance in CLAUDE.md's Node Version section. Closes #2521 Impact: 4 functions changed, 3 affected
Contributor
Greptile SummaryAdds a non-blocking doctor diagnostic for local Node-major divergence from CI.
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The new diagnostic resolves the repository root correctly in its current source and compiled layouts, reads the tracked Node pin, reports major mismatches without making the doctor report unhealthy, and is covered across its intended input states. Important Files Changed
Reviews (1): Last reviewed commit: "chore(dev-env): warn when local Node maj..." | Re-trigger Greptile |
Contributor
Codegraph Impact Analysis4 functions changed → 3 callers affected across 2 files
|
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.
Summary
.github/workflows/ci.ymlpins Node 22 everywhere) can produce 200+ unrelated-looking local test failures from native-addon/V8 behavioral drift, not actual regressions — the failures reproduce identically on an untouchedorigin/maincheckout in the same environment, wasting time triaging phantom failures or masking a real one in the noise..nvmrc(22, mirroring everynode-version: 22inci.yml) as a single reference point, plus a newcheckNodeVersiondoctor check wired into the existingpretest-gatednpm run doctor, that warns — never fails, since a mismatch doesn't mean the environment is broken, just that local results shouldn't be trusted over CI's — when the running Node major doesn't match it.CLAUDE.md's Node Version section, per the issue's first suggested fix.ci.ymlitself to read from.nvmrc(e.g. viaactions/setup-node'snode-version-file) — that would be a genuine further step toward eliminating the duplication entirely, but is a separate, more invasive change to a critical shared workflow file that the issue didn't ask for. Filed as a follow-up.Test plan
tests/unit/doctor.test.ts: no.nvmrcpresent, unparseable.nvmrccontent, exact major match, full-semver.nvmrcwith matching major, leading-v/trailing-comment tolerance, a genuine mismatch (warns, never fails), and that the warning doesn't fliprunDoctorChecks' overall report unhealthy..nvmrcpins 22):npm run doctornow correctly prints the warning — this is the exact repro from the issue.npx vitest run(5514 tests) andnpm run lintclean.npm run build(TypeScript) clean.Closes #2521