fix(ci): drop natives globalSetup from vitest ci project - #2549
Merged
Conversation
flora131
enabled auto-merge
August 20, 2026 05:15
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
npm run test:ci-contractsis the only test command on the Linuxstatic-checksjob, and that job deliberately carries no Rust toolchain. It was nonetheless compiling@bastani/atomic-nativeson every run.The cause was in
vitest.config.ts: the sharedproject()helper appliedglobalSetup: ["./test/global-setup-natives.ts"]to all three projects, so theciproject inherited a native build it never uses. Thetest/cisuites only inspect workflow and source state; none of them load the native binding.project()now takes ausesNativeSetupparameter. Theciproject passesfalse, so theglobalSetupkey is absent from its resolved config entirely — a spread, not an empty array, and no env-var opt-out inside the setup file.unitandintegrationare unchanged.Changes
vitest.config.ts(+7 −4) —usesNativeSetupparameter on theproject()helper;ciopts out. Two comment blocks corrected so they no longer claim the setup runs for every project.test/ci/ci-workflow-contracts.test.ts(+21) — new contractnative global setup stays on unit and integration projects only. It imports the config and asserts the resolvedciproject has noglobalSetup, whileunitandintegrationeach still carry exactly["./test/global-setup-natives.ts"]. Deleting the setup for everyone fails the contract too, not just re-wiringci.No other file is touched. No changelog entry: per
AGENTS.md, CI configuration is infrastructure-level and does not change shipped package behavior. No version bump, no release tags, no Rust added tostatic-checks.Acceptance criteria and evidence
cidoes not runtest/global-setup-natives.tscrates/atomic-natives/build.rswas touched so the on-disk.nodebecame older than the Rust sources, which makes the setup print a staleness warning. Acitest file then ran clean with zero occurrences of that line.unitandintegrationstill run itstatic-checksstill has no rust-toolchain; topology test still forbids ittest-workflow-topology.test.tspasses 9/9 includingassert.doesNotMatch(staticChecks, /rust-toolchain/u); the job block contains 0rust-toolchainoccurrences and its only test step isnpm run test:ci-contracts.ciis wired backfalseargument fails the new test withAssertionError: ci must not run the native global setup(1 failed / 24 passed).test:ci-contractspasses without compiling natives.nodewas moved aside, leaving the trackedindex.js/index.d.tsin place — exactly the state CI has afternpm ci --ignore-scripts. The suite ran 8 files / 47 tests green in 105 s and the directory still contained no.node. Binding restored and checksum-verified.Validation
npm run test:ci-contractswith the compiled binding removed — 47 passed, no.nodeproducednpm run check— biome (2558 files) clean,tsc --noEmitclean,tsgoclean, shrinkwrap up to datenpm run check,test:unit,test:integrationandtest:ci-contracts— all passedReview notes
Three independent reviewers signed off with no blocking findings. Two related P3 observations, both classified
beyond_objectiveand recorded for future maintainers rather than as defects in this change:test.globalSetupin the samedefineConfigcall would still reach theciproject and would not be seen by this assertion. That path is outside the stated criterion, which speaks about theciproject being wired back.ciproject'sglobalSetupalso drops its incidental guard against a futuretest/cifile importingpackages/subagents, which imports the binding statically. A static closure probe over the currenttest/cisuites and their setup files (674 files visited) found zero such imports, so this is forward-looking only.One cosmetic note:
usesNativeSetupis a positional boolean at the call site (project("ci", "test/ci", false)). Legible in a 60-line config with three call sites; switching to an options object was judged out of contract.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Greptile Summary
This change prevents the CI workflow contract tests from invoking the native Rust binding setup, while preserving that setup for unit and integration tests.
The behavior was exercised with no compiled native binding and an intercepted native build command. A configuration equivalent to the previous CI setup attempted the native build, whereas the updated CI project completed its targeted contract test with zero native-build invocations. The resolved configuration also verifies that unit and integration retain the native setup and CI does not.
Confidence Score: 5/5
Safe to merge: the CI-only configuration now avoids the native build dependency without changing setup for native-dependent test projects.
The relevant behavior was directly exercised under the intended failure condition: without a compiled binding and with native build commands intercepted. The CI contract completed without a build invocation, and the resolved configuration assertion confirmed the required setup assignments for all three projects.
Files Needing Attention: No files need follow-up. The exercised behavior is contained in vitest.config.ts and test/ci/ci-workflow-contracts.test.ts.
What T-Rex did
Reviews (1): Last reviewed commit: "fix(ci): drop natives globalSetup from v..." | Re-trigger Greptile