Repository navigation
build(repo): keep the site's test config inside the package - #73
Merged
Merged
Conversation
Stryker copies apps/site into apps/site/.stryker-tmp/sandbox-*/ and its vitest runner loads vitest.config.ts from that copy. The config imported ../../vitest.shared.ts, which from the copy resolves to apps/site/vitest.shared.ts, a file that does not exist, so the Release gate's dry run stopped at "failed to load config" and exited 3 (run 37703593383). The site's config now states its three test settings itself, unchanged. vitest.shared.ts had no other consumer and is deleted with its tsconfig.node.json and turbo input entries. stryker.shared.ts and oxlint.shared.ts stay: Stryker and oxlint read those from the package directory, never from the sandbox. Conductor ruling, cycle 103
Contributor
There was a problem hiding this comment.
Verified: 9/9 green on b132a56, root cause cited, dryRunOnly exit 0 vs 3 on main, 0 threads, hunt clean.
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.
The Release gate's mutation job stopped in Stryker's dry run (run 37703593383, job "mutation · @endgame/site", exit 3). This makes the site's test config self-contained so the dry run can load it from Stryker's sandbox.
What failed
The job log shows a warning, then the failure:
Source references below are to stryker-js-effect at
f06f244, the flake input the starter locks.The dry-run failure: the site config imported a file outside the package
apps/site/.stryker-tmp/sandbox-*/(packages/stryker-js/src/Sandbox.service.ts:63-70) and linksnode_modulesinto the copy (Sandbox.blueprint.ts:590-649). The copy goes through two preprocessors (Sandbox.blueprint.ts:310-318). One disables type checks (:70). The other,makeTSConfigPreprocessor(:112-293), rewrites theextends,referencesand file-list paths in the package'stsconfig.json. No caller adds another (withPreprocessor,:689-692, has no call site), so nothing rewrites imports in other files.configFileto Vitest withrootset to the sandbox (packages/stryker-js-vitest-runner/src/VitestRuntime.blueprint.ts:288,293), so Vitest loads the sandbox copy ofapps/site/vitest.config.ts.../../vitest.shared.ts, which came in with build(repo): move lint, test and mutation settings to the root #37 (be6d01e). Fromapps/site/.stryker-tmp/sandbox-*/, the path resolves toapps/site/vitest.shared.ts, and that file doesn't exist. Loading the kept sandbox's config with Vitest directly prints the error that Stryker swallows:[UNRESOLVED_IMPORT] Could not resolve '../../vitest.shared.ts' in vitest.config.ts.tsconfig.jsonextends../../tsconfig.base.jsonand was not affected, because the engine rewrote it to../../../../tsconfig.base.jsonin the copy.Nothing on this path depends on the 15.0.1 → 17.0.2 bump. The import is from #37.
The warning: a stryker-js-effect bug, not a plugin-loading failure
unknownOptionWarnings(packages/stryker-js/src/run/validate-options-admission.workflow.ts:192-200) appends the "Possible causes" text even when no option is unknown.warningsdefaults totrue(packages/stryker-js-plugin-interface/src/stryker-options.schema.ts:283), so every run prints it. That's why noUnknown stryker config optionline comes before it in the log. Upstream StrykerJS prints it only when an unknown option exists (packages/core/src/config/options-validator.ts:267,if (excessPropertyNames.length))."Stryker loaded plugins from: []" prints the
pluginsoption (validate-options-admission.workflow.ts:178-182), which defaults to[](stryker-options.schema.ts:267). 17.x loads plugins fromplugins,appendPlugins,ignorers,testRunner.pluginandcheckers[].plugin(packages/stryker-js/src/plugin-loader.service.ts:511-521).stryker.shared.tsnames its three plugins in the last three fields, as bare package names, which 17.x resolves from the project directory (resolveBareSpecifierOf,plugin-loader.service.ts:409-418).All three load. In a scratch config, renaming any one of them stops the run at
phase preparewithFailed to load plugin "<name>" (ImportFailed)and exit 4. The unchanged config exits 0:@systemfsoftware/stryker-js-vitest-runner@systemfsoftware/stryker-js-typescript-checker@systemfsoftware/stryker-ignorer-effect-schema-declarationsThe warning is harmless and stays. Fixing it belongs to stryker-js-effect. Turning off
warnings.unknownOptionswould also hide real unknown options, so this PR doesn't do that.What changes
apps/site/vitest.config.tsnow states its three test settings (globals,environment: 'node', and thesrc/**andtests/**test globs) itself. The values are unchanged, and the empty alias list is gone.vitest.shared.tsis deleted, because it had no other consumer. Its entries intsconfig.node.jsonand in the//#typecheck:node,testandmutationinputs inturbo.jsongo with it.git grep vitest.sharedfinds nothing.stryker.shared.tsandoxlint.shared.tsstay. Stryker reads its config, and oxlint its own, from the package directory, never from the sandbox.Not changed:
break(100), themutateglobs, the stryker-js version, and every warning setting.Gate
Clean checkout at
b132a56, Linux, sandboxed:The same
stryker run --dryRunOnlyonmain(b2e193d) exits 3 with the CI message (failed to load config from .../.stryker-tmp/sandbox-*/vitest.config.ts).Mutation itself wasn't run. The engine's guard allows it only on main CI. Done means the next Release gate on
mainproduces the@endgame/sitereport at break 100.Alternatives not taken
configFileat the package's own file by absolute path. Vitest would then read the config from outside the sandbox, so any path the config derives from its own location, such as an alias built fromimport.meta.url, would point at the unmutated sources.tempDirNameso the sandbox sits at the package's depth, e.g.../../.stryker-tmp. This only works while every package sits exactly two levels deep. Every package's sandboxes would share one directory at the root.inPlace. Stryker would write instrumented code over the checkout's own files during every run, local dry runs included.vitest.shared.tsa private workspace package, as systemfsoftware and stryker-js-effect do with@systemfsoftware/vitest-config. That adds a package (manifest, lint, typecheck, lockfile importer) for a 13-line file with one consumer.Conductor ruling, cycle 103.