diff --git a/.changeset/oracle-gaps-test-root-copies.md b/.changeset/oracle-gaps-test-root-copies.md new file mode 100644 index 00000000..dc1aa493 --- /dev/null +++ b/.changeset/oracle-gaps-test-root-copies.md @@ -0,0 +1,5 @@ +--- +'@tanstack/oracles': patch +--- + +The `oracle-gaps` CLI judges the mutants of a package whose Vitest config sets `test.root`. Before, the CLI resolved each in-memory copy of a test file to its path, so Vite named the copy from its root and imported it again by that name. Under a test root other than the package, that name (`/.oracle-gaps-…`) matched no copy, the copy failed to load, and the mutants of an owner there reported `setup-error`. The CLI now leaves a copy unresolved: Vite keeps the absolute path that Vitest imports it by, and the CLI serves the copy from that path. This works for a test root inside the package, above it, a root that holds no test file, and a root that is a symbolic link. diff --git a/packages/oracles/oracle-gaps/check.mjs b/packages/oracles/oracle-gaps/check.mjs index 8b0eac0b..2e548ecb 100644 --- a/packages/oracles/oracle-gaps/check.mjs +++ b/packages/oracles/oracle-gaps/check.mjs @@ -122,8 +122,11 @@ function alive(pid) { * process to find its per-file pragmas (`@vitest-environment`, * `@module-tag`; cli-api's `promises.readFile(filepath)`, which gives "" for * a file that is not there), so a copy would run in the config's default - * environment instead of its file's. The read of a copy's path returns its - * text; any other read is Node's own. + * environment instead of its file's. The wrapper's plugin serves the copy to + * Vite, by the absolute path that Vitest imports it by: no plugin resolves a + * copy, since Vite would name a resolved copy from its root, the config's + * test root, and import it again by that name (issue #101). The read of a + * copy's path returns its text; any other read is Node's own. */ let copiesServed = false function serveCopies() { @@ -133,9 +136,7 @@ function serveCopies() { promises.readFile = function (path, options, ...rest) { const text = typeof path === `string` - ? globalThis.__oracleGapsCopies?.get( - path.replaceAll(String.fromCharCode(92), '/'), - ) + ? globalThis.__oracleGapsCopies?.get(posix(path)) : undefined if (text === undefined) return readFile.call(this, path, options, ...rest) const encoded = @@ -500,6 +501,8 @@ export async function openSession(pkg) { wrapper, `import { realpathSync } from 'node:fs' import { mergeConfig } from 'vitest/config' +// The path rule beside this wrapper, by which copies are keyed. +import { posix } from './paths.mjs' ${ config ? `import * as config from ${JSON.stringify(specifierOf(home, join(pkg, config)))} @@ -521,14 +524,11 @@ export default async (env) => { plugins: [{ name: 'oracle-gaps-schemata', enforce: 'pre', - // A copy of a test file (runBatch) exists only here, so no other Vitest - // run finds it; Vite names a file in the package by its path from the - // package. A workspace dependency loads from its one-file bundle - // (workspaceBundles). + // A workspace dependency loads from its one-file bundle + // (workspaceBundles). A copy of a test file is not resolved here, so + // Vite keeps the absolute path that Vitest imports it by, and \`load\` + // serves it. resolveId(source) { - const copies = globalThis.__oracleGapsCopies - for (const path of [source, ${JSON.stringify(pkg)} + source]) - if (copies?.has(path.replaceAll(String.fromCharCode(92), '/'))) return path return globalThis.__oracleGapsBundles?.get(source) }, // Each module this context transforms, so a run is stored under the @@ -546,7 +546,9 @@ export default async (env) => { const at = id.indexOf('?') if (at >= 0 && [...new URLSearchParams(id.slice(at + 1)).keys()].every((key) => ['raw', 'url', 'worker', 'sharedworker', 'inline'].includes(key))) return undefined const path = at < 0 ? id : id.slice(0, at) - const copy = globalThis.__oracleGapsCopies?.get(path.replaceAll(String.fromCharCode(92), '/')) + // A copy of a test file (runBatch) exists only in memory, so this + // plugin, which loads before the config's own, answers for it. + const copy = globalThis.__oracleGapsCopies?.get(posix(path)) if (copy !== undefined) return copy // This context's authored patch, or else the instrumented source of the // current check, both set by the runner in this process. diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 6c886733..e1d42725 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -848,6 +848,15 @@ const drawn = fc.record({ // Whether the warm daemon is replaced after the warm check (review of #73, B2). // Only the constructed history of a replaced warm daemon sets it. warmReplaced: fc.constant(false), + // Where the config's `test.root` sits (issue #101, `testRoots`): `none`, the + // package, or a shape that only a constructed history sets. The constant + // draws nothing, so generated histories keep their values; `histories` + // takes a constructed one back as this constant, as `tornRows` does. + testRoot: fc.constant(`none`), + // Whether the config has a plugin whose own \`load\` reads each test file + // with a sync read (\`LOAD_PLUGIN\`, review of #103). Only a constructed + // history sets it; \`histories\` takes it back as this constant. + loadPlugin: fc.constant(false), }) // The edit sequence over the witness module, the one list of steps that a @@ -888,14 +897,15 @@ const keepsSteps = (history) => { // steps (`laterStepsOf`). Taking a history back returns it unchanged, // except a constructed one whose `steps` hold a later edit, which the // steps grammar cannot draw: its later edits move to `laterSteps`. A -// constructed history may also set `tornRows` (issue #83), which `drawn` -// cannot produce, so its take-back reads it as the drawn constant `false` -// (as `claimScenario` does): a shrink is torn-row-free. +// constructed history may also set `tornRows` (issue #83) or `testRoot` +// (issue #101), which `drawn` cannot produce, so its take-back reads each as +// its drawn constant (as `claimScenario` does): a shrink is torn-row-free and +// runs with the package as the config's root. const histories = drawn.map( (history) => (keepsSteps(history) ? history : { ...history, steps: null }), (value) => { const history = - /** @type {{ witness: unknown, steps: unknown[] | null, tornRows: unknown }} */ ( + /** @type {{ witness: unknown, steps: unknown[] | null, tornRows: unknown, testRoot: unknown }} */ ( value ) if (!keepsSteps(history)) @@ -904,7 +914,11 @@ const histories = drawn.map( // only the constructed history sets it) comes back as engaged, so the // arbitrary can shrink it. The disarm is therefore not kept by a shrink. const taken = - history.tornRows === false ? value : { ...history, tornRows: false } + history.tornRows === false && + history.testRoot === `none` && + history.loadPlugin === false + ? value + : { ...history, tornRows: false, testRoot: `none`, loadPlugin: false } const later = (history.steps ?? []).filter((step) => laterEdits.includes(step), ) @@ -2951,6 +2965,11 @@ function resolveHistory(history) { tornRows: history.tornRows === true, ...configOf(history), configEnv: history.configEnv === true, + // Where the config's `test.root` sits (`testRoots`, issue #101): only a + // constructed history sets it, so a generated one runs with the package + // as the root. + testRoot: history.testRoot ?? `none`, + loadPlugin: history.loadPlugin === true, native: history.native ?? `none`, // A prebuilt addon in the workspace dependency's build/Release // (`addRelease`). @@ -5183,6 +5202,12 @@ const altConfigPath = (plan) => // package that it transforms, keeping what the module does. const PRE_PLUGIN = `{ name: 'gap-pre-rewrite', enforce: 'pre', transform(code, id) { const path = id.split('?')[0]; return /\\.(ts|js|mjs)$/.test(path) && !path.includes('/node_modules/') ? code + '\\n// rewritten by a pre plugin\\n' : undefined } }` +// The config's own plugin with a \`load\` hook (\`loadPlugin\`): it loads each +// test file itself, with a sync read of its path, as a plugin that reads a +// module's source does. The runner's copy of a test file exists only in +// memory, so only the runner's own \`load\` can answer for it (review of #103). +const LOAD_PLUGIN = `{ name: 'gap-own-load', load(id) { const path = id.split('?')[0]; return path.endsWith('.test.ts') ? readFileSync(path, 'utf8') : undefined } }` + /** * The text of the package's config, in its syntax (`configOf`), with the * fault, the top-level await, or the `require` calls the plan holds. `test` @@ -5190,6 +5215,10 @@ const PRE_PLUGIN = `{ name: 'gap-pre-rewrite', enforce: 'pre', transform(code, i */ function configText(plan, test) { const commonjs = plan.configSyntax === `cjs` + const plugins = [ + ...(plan.prePlugin ? [PRE_PLUGIN] : []), + ...(plan.loadPlugin ? [LOAD_PLUGIN] : []), + ] const config = `defineConfig(${ { object: ``, function: `() => (`, async: `async () => (`, promise: `` }[ plan.config @@ -5198,7 +5227,7 @@ function configText(plan, test) { plan.fault === `projects` ? `{ projects: [{ test: { name: 'unit', ...${test} } }] }` : test - }${plan.prePlugin ? `, plugins: [${PRE_PLUGIN}]` : ``} }${plan.config === `object` || plan.config === `promise` ? `` : `)`})` + }${plugins.length > 0 ? `, plugins: [${plugins.join(`, `)}]` : ``} }${plan.config === `object` || plan.config === `promise` ? `` : `)`})` // A promise of the config, a null default, or a config cut off mid-object. const body = plan.fault === `configNull` @@ -5212,6 +5241,11 @@ function configText(plan, test) { commonjs ? `const { defineConfig } = require('vitest/config')` : `import { defineConfig } from 'vitest/config'`, + ...(plan.testRoot === `none` + ? [] + : [`import { fileURLToPath } from 'node:url'`]), + // Only an ES module config has the load plugin (its constructed history). + ...(plan.loadPlugin ? [`import { readFileSync } from 'node:fs'`] : []), ...(plan.fault === `configThrows` ? [`throw new Error('the fixture config broke')`] : []), @@ -5259,6 +5293,54 @@ const parentModules = (plan, state) => ? `../node_modules` : `node_modules` +/** + * Where a config's `test.root` sits (issue #101), as a path from the config, + * with the test files' glob and the setup file as Vitest reads them: relative + * to that root. `none` sets no root, so the root is the package. `tests` is + * the directory that holds the tests, as the repository's own oracle-gaps + * config sets it. `parent` is the directory above the package, which the + * driver places in a directory `pkg` of its scratch directory, so the glob + * names it. `outside` is a directory of the package that holds no test file, + * so the test files lie outside the root. `link` is `tests`, where the + * package's `tests` is a symbolic link to the directory that holds them + * (`linkedTests`), so the root's path is a link's. Vite names a module that + * a plugin resolves inside its root by its path from the root, and one + * outside it by its absolute path, so each shape names a copy of a test file + * differently if the runner resolves it. Every shape names each test file by + * its path in the package, so the model's keys are the same in all of them. + * Vitest resolves the package of a pragma's environment from the root (its + * init chunk's `vitest-environment-` resolution), so under `parent` that + * package lies in the root's node_modules (`environments`); every other shape + * finds the package's own. + * Only an ES module config sets a root (it reads its own URL), and only the + * constructed histories set one, each as an ES module config. + */ +const inTests = { + root: `./tests`, + include: `**/*.test.ts`, + setup: `./setup.ts`, +} +const testRoots = { + none: { include: `tests/**/*.test.ts`, setup: `./tests/setup.ts` }, + tests: inTests, + parent: { + root: `..`, + include: `pkg/tests/**/*.test.ts`, + setup: `./pkg/tests/setup.ts`, + environments: `../node_modules`, + }, + outside: { + root: `./src`, + include: `../tests/**/*.test.ts`, + setup: `../tests/setup.ts`, + }, + link: inTests, +} + +// The directory that the package's `tests` links to under the `link` test +// root. +const linkedTests = `tests-target` + function fixtureFiles(plan, state = initialState(plan)) { const manifest = (fields) => `${JSON.stringify({ private: true, type: `module`, ...fields })}\n` @@ -5269,11 +5351,18 @@ function fixtureFiles(plan, state = initialState(plan)) { : `${JSON.stringify({ private: true, ...fields })}\n` // A symbolic link, as a package manager links a workspace package. const link = (target) => ({ link: target }) - const test = `{ include: ${ + // The config's test root, and the test files' glob and the setup file, + // which Vitest reads relative to it (`testRoots`, issue #101). + const testRoot = testRoots[plan.testRoot] + const testRootOption = + testRoot.root === undefined + ? `` + : `root: fileURLToPath(new URL('${testRoot.root}', import.meta.url)), ` + const test = `{ ${testRootOption}include: ${ plan.configEnv - ? `process.env.VITEST === 'true' && process.env.TEST === 'true' && process.env.NODE_ENV === 'test' ? ['tests/**/*.test.ts'] : []` - : `['tests/**/*.test.ts']` - }${plan.setupGlobal || plan.fault === `setupThrows` ? `, setupFiles: ['./tests/setup.ts']` : ``} }` + ? `process.env.VITEST === 'true' && process.env.TEST === 'true' && process.env.NODE_ENV === 'test' ? ['${testRoot.include}'] : []` + : `['${testRoot.include}']` + }${plan.setupGlobal || plan.fault === `setupThrows` ? `, setupFiles: ['${testRoot.setup}']` : ``} }` // A history that installs a scoped addon later declares it from the // start, beside a scoped package already installed in its scope. const scoped = plan.steps.includes(`addScopedAddon`) @@ -5453,21 +5542,22 @@ function fixtureFiles(plan, state = initialState(plan)) { : {}), 'tests/c.test.ts': ordinaryTestFile(plan), // The environment oracle file a's pragma names (`pragma`), a package - // as Vitest finds one (`vitest-environment-`). + // as Vitest finds one (`vitest-environment-`) from the test root. ...(plan.pragma ? { - 'node_modules/vitest-environment-marked/package.json': `${JSON.stringify({ name: `vitest-environment-marked`, type: `module`, exports: `./index.js` })}\n`, - 'node_modules/vitest-environment-marked/index.js': [ - `export default {`, - ` name: 'marked',`, - ` viteEnvironment: 'ssr',`, - ` setup(global) {`, - ` global.__gapEnvironment = 'marked'`, - ` return { teardown() { delete global.__gapEnvironment } }`, - ` },`, - `}`, - ``, - ].join(`\n`), + [`${testRoot.environments ?? `node_modules`}/vitest-environment-marked/package.json`]: `${JSON.stringify({ name: `vitest-environment-marked`, type: `module`, exports: `./index.js` })}\n`, + [`${testRoot.environments ?? `node_modules`}/vitest-environment-marked/index.js`]: + [ + `export default {`, + ` name: 'marked',`, + ` viteEnvironment: 'ssr',`, + ` setup(global) {`, + ` global.__gapEnvironment = 'marked'`, + ` return { teardown() { delete global.__gapEnvironment } }`, + ` },`, + `}`, + ``, + ].join(`\n`), } : {}), // A copy that a check which died left behind (the runner names its @@ -5519,7 +5609,18 @@ function fixtureFiles(plan, state = initialState(plan)) { intent: `pushes a different label`, author: `gap-report oracle`, }) - return files + if (plan.testRoot !== `link`) return files + // The `link` test root: the files of `tests` live in `linkedTests`, and + // `tests` links to it. + return Object.fromEntries([ + ...Object.entries(files).map(([path, text]) => [ + path.startsWith(`tests/`) + ? `${linkedTests}/${path.slice(`tests/`.length)}` + : path, + text, + ]), + [`tests`, link(linkedTests)], + ]) } /** @@ -5554,7 +5655,8 @@ function writeFixture(dir, files) { `deps/state-dep`, `node_modules`, ]) - mkdirSync(join(dir, sub), { recursive: true }) + // A directory that the state links elsewhere is the link's. + if (!(sub in files)) mkdirSync(join(dir, sub), { recursive: true }) if (!existsSync(join(dir, `node_modules/state-dep`))) symlinkSync(`../deps/state-dep`, join(dir, `node_modules/state-dep`), `dir`) for (const path of written.get(dir) ?? []) diff --git a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs index 31b94b29..d7856d77 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -1862,7 +1862,9 @@ async function driver(plan, observe) { // A package that resolves no TypeScript, has no config, or has its // config in its parent directory lives outside this repository // (`outsideRepository`); the last in a directory `pkg` of the scratch - // directory, which holds its config. + // directory, which holds its config. A package whose config's test root is + // the directory above it (`testRoots`) lies in `pkg` too, so the root holds + // only the package. const scratch = realpathSync( mkdtempSync( outsideRepository(plan) @@ -1870,7 +1872,10 @@ async function driver(plan, observe) { : join(here, `.scratch-`), ), ) - const dir = plan.configPlace === `parent` ? join(scratch, `pkg`) : scratch + const dir = + plan.configPlace === `parent` || plan.testRoot === `parent` + ? join(scratch, `pkg`) + : scratch mkdirSync(dir, { recursive: true }) // A history with steps runs its own copy of the CLI, which the `cli` edit // changes; a history that installs the CLI under a path with a space and @@ -2324,6 +2329,7 @@ async function driver(plan, observe) { states.add(`a package with no config ran`) if (plan.configPlace === `parent`) states.add(`a package whose parent directory has its config ran`) + if (plan.loadPlugin) states.add(loadPluginState) if (plan.packageType === `commonjs` && plan.configAwait) states.add(`an awaiting config in a package with no module type ran`) // A CommonJS config that calls `require` and `require.resolve`: by @@ -2346,6 +2352,9 @@ async function driver(plan, observe) { states.add(`a file whose pragma names another environment judged`) if (plan.configEnv) states.add(`a config that reads Vitest's environment ran`) + // The config sets `test.root` (issue #101), the root Vite names the + // modules it resolves from. + if (plan.testRoot !== `none`) states.add(testRootStates[plan.testRoot]) if (plan.native === `gyp`) states.add(`a package with a native addon ran in child processes`) if (plan.native === `deep`) @@ -3763,6 +3772,17 @@ calibrations.push( }, ) +// The states of a config's test root, one for each shape (`testRoots` in the +// model, issue #101). Each shape has its own constructed history. +// The state of a config plugin that loads test files itself, with a sync read +// (`loadPlugin`), which its own constructed history reaches. +const loadPluginState = `a config whose plugin loads test files with a sync read ran` +const testRootStates = { + tests: `a config whose test root is a subdirectory ran`, + parent: `a config whose test root is above the package ran`, + outside: `a config whose test root holds no test file ran`, + link: `a config whose test root is a symbolic link ran`, +} // Law 9's states: reuse, a mix of reuse and recomputation, reuse from disk // after a restart, and each content edit changing the cold result, without // which a stale cache would match the cold run by chance. @@ -3934,6 +3954,8 @@ const required = [ `a second daemon check of the budget witness's state`, `a failing owner replayed under a config that --config names`, `a config that reads Vitest's environment ran`, + ...Object.values(testRootStates), + loadPluginState, `a package with a native addon ran in child processes`, `a setup file that defines a fixed global ran in every copy`, `a package with a prebuilt addon deep in its tree ran in child processes`, @@ -4034,6 +4056,8 @@ const separate = [ `a refused run whose package lies inside the CLI's directory`, // The config and contexts states have constructed histories of their own. `a config that --config names ran`, + ...Object.values(testRootStates), + loadPluginState, `a package with no config ran`, `a package whose parent directory has its config ran`, `a failing owner replayed under its parent's config`, @@ -4094,6 +4118,56 @@ const witnessedRest = witnessed.filter( (state) => !stopsFirst.includes(state) && !stopsSecond.includes(state), ) +// A constructed history of one owned function, judged by one fixed-seed test of +// file a, in an ES module config that Vitest discovers: the base of the +// test-root histories (`testRoots` in the model) and of the load plugin's. +// `fields` sets the config's test root, a setup file that defines a fixed +// global (which Vitest reads from the root as well), and the load plugin. The +// history sets `tornRows: false`, because the torn-row witness needs a batch +// hold that it does not produce. +const oneOwnerHistory = (generated, fields) => ({ + ...generated, + functions: [[{ kind: `if`, op: `>`, k: 4, not: false, quote: `'` }]], + containers: [], + overloads: [], + owners: [`a`], + library: [], + libraryOwners: [], + runes: [], + derived: null, + dotGen: false, + dataOwners: [], + exportOwners: [], + importer: `none`, + wholeFile: `none`, + template: false, + tests: [{ ...judging(`a`, `fixed seed`, 1), fn: 0 }], + witness: false, + authored: null, + secondAuthored: false, + fault: `none`, + stability: `none`, + steps: null, + ordinary: false, + native: `none`, + boot: false, + budget: `two`, + cliPath: `plain`, + concurrentStart: false, + contexts: 1, + tornRows: false, + prePlugin: false, + testRoot: `none`, + configPlace: `discovered`, + configFile: `vitest.config.ts`, + packageType: `module`, + config: `object`, + configEnv: false, + setupGlobal: false, + loadPlugin: false, + ...fields, +}) + // A constructed history builds from a generated base whose first function is // owned by file a (one owned function, not a whole file), so a random // `ownerless` or an all-unowned base cannot refuse a state it names. Where @@ -4117,7 +4191,7 @@ oracleProperty({ law: { statement: `The gap report enumerates the promised operator mutants, leaves out exactly the probe-only code, discovers every oracle that owns a function's call tree and refuses broken ownership, judges each mutant only by its owners' tests on their registered routes and counts only law verdicts on reproducible routes as kills, which outrank a run that never ends, anchors each mutant by its function and normalized statement, lists every gap and unowned mutant once with consistent counts, keeps keys stable under unrelated edits, reports through one daemon per package what a cold run reports at every state of a sequence of edits, and bounds the runs that confirm a mutant's cut-off copies by one budget per mutant and names each busy mutant in a heartbeat while it runs, leaves nothing in the package and writes nothing where Vitest's include could find it while it runs, leaves no process running once it is stopped, runs the package as Vitest does from any install path and any --source spelling: one instance of each workspace dependency, no refusal over an unbuildable devDependency, child processes for a native addon anywhere in the tree, a capture that a test's builtin spies cannot see, and a refusal of test.projects; leads its report with every test file's baseline, blocks only the mutants a failing oracle file owns and judges the rest, prints every line of its stream with the prefix oracle-gaps: and its kind, one decisive baseline line before any mutant, and a done line last, and every run that does not complete ends, cold or through the daemon, with a refusal that exits 2, prints a refused: block and one fix: directive with no stack trace, and writes the refusal to the run's output directory.`, authority: `The maintainer's decisions in design runs v11, v14, and v19 (2026-11-04 and 2026-11-05), not in this package's records, including that a kill by reach agreement alone is a gap and that an incremental run through the daemon equals a cold one (v19.3); the project's oracle guide on quiet exclusions; the oracle rubric's outcome kinds (ORC-006); the CLI's documented operator list in schemata.mjs; the maintainer's dispositions G1, G2, G4, G5, G6, and G13 of the framework papercut ledger (2026-11-11) and the v20 freeze's namespacing, one-loop, and provisional-report decisions (2026-11-10); the maintainer's request for a greppable stream (2026-11-12, relayed by the coordinator with its decisions of that day: the same prefixes on stdout and stderr, a done line for a stopped run, and no --max-gaps).`, - limits: `The run whose process aborts is declared on every platform. Its win32 witness (process.abort through ORACLE_GAPS_TEST_ABORT_AT, under the win32 supervisor) lands in #79; until then the Windows end-to-end job is non-blocking (C entry (c)). On win32 Node cannot deliver SIGTERM (its kill is TerminateProcess, which ends the process with no stopped line), so the stop states that name SIGTERM are required on POSIX only, and a stop there goes through the CLI's test stop hook and is observed as SIGINT; every SIGINT state stays required on win32. Law 12 judges refusals only: no legal history reaches an internal error, so its shape (exit 3, the stack in error.log) is not judged; argument refusals are the static oracle's; the check's rejection of a stack trace, a missing fix, and a wrong exit code is calibrated in the static oracle, through the same refusalBreach, and here only a refused run reported as complete is calibrated, because each calibration here runs real CLI histories. Law 15's stdout gap lines are judged against each completed run's own results.json, by id: the cold run, and each check through the daemon (every step's check and the check that a mid-run edit overlaps); a stopped run and a refusal list no gaps and are not judged so. A line's change is read loosely: its code on one line, whole or cut after a kept part and ended with \`...\`; where the printer cuts (60 code points, kept 57) is the classify oracle's law 8 (\`shortened\`), in-process. A line with any text after its change does not read and fails loudly: the \` (cause: )\` suffix that #99 adds to timeout lines is not read yet, so whichever of #99 and #115 lands second extends readGapLine. Hangs only as an owner test that awaits a promise that never settles, under a 1 s first budget and a 20 s full limit, and a slow run only as two witnesses whose tests wait where the output changed, 3 s in one that then judges and 10 s in two one-test owners of one that does not; busy loops only on instrumented code (cut by the call budget), no slow runs past the full limit that would end, hangs in ordinary or nondeterministic tests, setup errors other than a throw at module load, loops, multi-line conditions, two functions on one line, or await, new, and void statements; nested functions, object-literal methods, accessors, and class-field arrows only where no test calls them (their ownership is the static oracle's); two source files of one package, with no re-exports, namespace imports, or calls into another package; --only only in a stopped run and a partial run of one function's mutants, and no --sample or --diff-base; the baseline's failures only as one failing owner test that throws an error and a setup file that throws, so a baseline law violation's law and counterexample lines are the classify oracle's; a derived class's file is instrumented and its sites are judged as unowned, but no test imports or constructs the class, so its no-mutant and super-region behavior is the static oracle's (in-process), not this oracle's; package configs only as vite.config or vitest.config with one of the extensions .ts, .mts, .cts, .js, .mjs, and .cjs (not every pair), as config/gap-vitest with the same extension through --config, or none, as an object or a sync or async function, with no plugins of their own except one enforce: 'pre' transform that appends a comment to each module of the package (prePlugin); a plugin whose output depends on anything but the module's text (a sidecar file it reads) and an environment variable that changes between checks are not generated, since the runner tracks neither yet and the daemon's environment is fixed when it starts (F-A1: the maintainer decided on 2026-11-13 that the daemon tracks both and restarts when they change, in the next pull request); and test.projects only as a refusal, and only under the package's own package.json; a top-level await only in an ES module config and require only in a CommonJS one, as Vitest itself loads no other; a --config outside the package is refused by design, through the rule for paths outside the package (args.mjs), and no history generates one; contexts only one, four, or eleven, and process warnings judged only as MaxListenersExceededWarning on the CLI's own stderr (a daemon's process warnings go to its log); a context that fails to open gives back its listener allowance, which no observation shows (a kept allowance only raises the limit, so no warning follows), so that accounting is fixed by inspection; no probe-bound states, so reach agreement's killing of probe mutants is not checked; no gap answers or gate; law 9 judges the witness module's outcome classes along one constructed edit sequence only (a test edit, a helper edit, and a revert), and the budget witness's along one constructed second check with nothing changed, because a generated history with the witness module or the budget witness takes no steps (maintainer decision, 2026-11-11, and the runtime review's P1-a, 2026-11-12; this oracle owns the gap); law 9's edits come between checks, except one, midrun, which lands during a check through the daemon: a test of file a, whose context has loaded file b's helper, rewrites the helper in the baseline's first run of file a, before file b's runs read it, in one context or several; or a test of file b rewrites its own helper, or the data file that its verdict read through a sync fs read, after file b's judged tests read them, in the run that judges with the old text (review of #55, F1); that check must report, for each mutant, what a cold run of the state before the edit or of the state after it reports, and exit as one of them does (third review of #55, F-C), compared per mutant result rather than per file; when file b's own test lands the edit, b's baseline reads the old text and b's mutant runs read the new one, so b's own mutants in that check are not judged, since their results legitimately mix the two texts (maintainer decision, 2026-11-13), while every other mutant there is judged against both cold runs, with the check's exit code, its mutants' keys, and its stream; the stronger follow-up compares each run's raw outcome with the cold outcome of the state that run read; and the next check, with nothing changed, must equal a cold run of the state after the edit, compared for equality of results only, not for what the daemon reused or computed (the runner's rule: a run whose input changed after the run read it is invalidated and not stored, settleIn); a check through the daemon of a state that nothing changed must compute no run that was not cut off, judged where no test reads the clock (F-A, F-A2), and a test's fs read of a file and the module that the context serves from it are two inputs, each under its own hash (F-A2); an edit during a mutant run is not generated, and a file is edited mid-run only by the run's own tests, not by another process at an arbitrary time; a file that a test reads through fs is edited only as one JSON file that file b's verdict reads by a sync, a promise, or a callback read, or by a sync read after it stats its own directory and tests that it exists (statDir: the directory is an input as a directory, not by its content, and is not itself edited), each read first checking that its fs function keeps its own name and length (the runner stores a run under the files in the package that its copy reads with readFileSync, readFile, existsSync, or statSync, or the fs/promises readFile or stat, each with its hash at the copy's first read; a read outside the package or under node_modules, from a worker thread or a child process that a test starts, or through any other fs API, which includes readdir, opendir, glob, globSync, createReadStream, realpath, lstat, access, open, a read through a file descriptor (read, readSync, readv, fstat, fstatSync, and readFileSync or readFile given a file descriptor), copyFile and copyFileSync, cp and cpSync, openAsBlob, statfs, readlink, the callback stat, exists, watch, watchFile, and the fs/promises access, open, and glob, is no input, and none is generated: the maintainer decided on 2026-11-13 that every fs read except watch and watchFile is an input, which a follow-up of #55 implements, and until then this oracle owns the gap); a run cut off by its clock writes no closing row, so it is stored under its file's known inputs only, while a run that spun ends and keeps the inputs it named (F-D); no history makes a cut run read a file that its file's unmutated run does not read, so this is fixed by inspection; a test that rewrites a file it read with the same text makes the next check compute that run again (1 run in the self-edit histories), since the edit changes the file's modification time: the daemon is conservative there, nothing goes stale, and content keys (D10) remove it, with a selfWrite dimension in that pull request; the mid-run marker sits in the daemon's session directory, .oracle-gaps-, whose location predates #55; the runner's hash memo knows a file by its size and modification time, so an edit that keeps both is not seen, and no history makes one (D10, planned in phase 2, A5); law 9's edits leave out other environment variables, new files that change how an unchanged import resolves, Vite config and installed-package changes, and concurrent checks other than two that start the daemon; cut-off charging judged only under one budget; native addons only as a binding.gyp or a prebuilt .node file, not as optional platform packages; daemon races (two CLIs reading one error file, a CLI hearing closing from the failing daemon it started, a reset connection on macOS) fixed by inspection; the runner's copies of the test files exist only in memory, and its harness and Vitest configs sit in the package's .oracle-gaps-, which the next run removes once a killed run has left it (judged after two stopped runs, not after a SIGKILL); a default --out is judged by the static oracle, and these runs name --out in the package; the namespace is checked after each run and, in a stopped run, while the run runs; a slow kill in a later owner, after earlier owners' confirmations spent the budget, becomes a timeout (owner order; not generated); the Vitest 5 path of the copies' pragma read and of the runner is verified from Vitest 5's source only, since the Vitest 5 CI job runs no gap oracle; a batch whose run reports an error outside any test reruns each copy alone (unitsBatch, runAlone) with its first budget, and a copy cut there is kept as a timeout with no confirmation, a defect older than this oracle's budget work that no history reaches (no history has an error outside any test beside a slow copy), recorded here with that trace for the maintainer; stale-session removal is scoped to this host's session directories (a host file), and is not judged across pid namespaces; the stop law covers SIGTERM and SIGINT sent to the CLI, not a SIGKILL of the CLI (its group then ends at the next check of its parent, by inspection) or a signal sent to the daemon, and its witness is one test that spins synchronously and starts one child process; the mutant budget is witnessed as two slow owners whose confirmations pass the --mutant-limit floor, not through its multiple of the owners' unmutated time, and authored mutants have no confirmations to budget; the witness w_slowpair is a wall-clock window, since the CLI's budget has no controlled clock and a fixture cannot see the time the CLI measures for its file: with one-test owner files p and q of measured unmutated time t each (a file first in its context pays the instrumented transform too), a wait W of 10 s, a 20 s --hang-limit and a 15 s --mutant-limit, it tells a budget from none only while (a) its first attempt is cut, W > 1 s + 3t, (b) its two confirmations do not fit the budget, 2W > max(15 s, 10 x 2t), and (c) each would fit its own full limit, W < 20 s + 3t; (b) is the binding one, so it holds while the two files' time stays under about 2 s together (about 1 s each, some 20 times the authoring machine's idle and 5 to 10 times its loaded measurements), and under one budget a run's overhead must stay under 10 s + 3t; CI runners measure 1.5 to 2.3 times the idle machine; beyond that w_slowpair would read not-judged; a heartbeat is owed only where a slow test waits 3 s against a 2 s interval, twice the first budget, so that no copy cut at its first budget beats, and each beat is observed as its mutant and file, not how long or how often it beat; a config only in the package's parent directory is generated one level up, in a temporary directory with no package.json (so its .js or .ts name is CommonJS), as a plain config, one that throws, one with no default export, or one that defines test.projects; a config two or more levels up, or a parent config beside a package config, is not generated, and the order in one directory follows Vitest's configFiles list by inspection; a package with no config lives in a temporary directory, where no parent has a config; a counterexample shrinks through at most six histories, so it can be larger than the smallest that fails; module-level data only as four \`const\` declarations of the main source (an object literal, an array that holds a function, a boolean, and an object of two methods), read in place, with no data imported from another file, destructured, reassigned, or declared as an enum or a default export; the work law only through shortcut witnesses (an early return before a counting loop with a bound twin of ratio 2, and a push beside one that calls String with a bound twin of ratio 1), the early return in tests that reach the clock by each watched path and in tests that wait a turn, a generated test's bound of 1 derived from its plan (which no generated function's mutant reached in the 36 fixed-seed units at main's bases; the disarmed-pause history's base, appended at its index, does reach it, so that history pins its generated inputs to ones that declare no bound, and the model predicts no work verdict for a generated test, a model gap for the maintainer to decide whether to model work counts), and one warm-cache witness whose selection reproduces observations but not work; work is the capture's count of site evaluations per test, so code with no site (a plain assignment, a for...of pass, a builtin's own work) counts nothing and a test's histories are summed, and a test whose work varies between the unmutated runs while its observations agree is not generated. Open Limits, owned by the in-process runner oracle (L1, state \"torn tail at a cut-off read\"; RED: captureLines without the guard): (a) the batch's cut-off read (runBatch's rowsOf after the cut-off) drops a partial last row, and no witness reaches that drop yet, because a copy held half written across the cut-off did not observe its release in the harness; (b) a short fragment on the strict path, which the no-newline mutant does not reach. The strict read after a finished run (a fragment is an internal error) is witnessed by the no-newline mutant. Windows idle gap (recorded, not witnessed): the state \`a hang cut off for idleness\` is required on every platform, and win32 reaches it (run 43683794816, job 132719872988), so it is not platform-scoped. The sampler (capture-setup.mjs) counts a copy idle only after 500 ms with no late tick, no non-quiet handle, utilization at most 5%, and no timer due, so \`every outcome class\` reaches the state only when the sampler sees that window. On win32 the check missed it once (run 43683794816, job 132719872940); the cause is not confirmed (a late tick on a shared runner, or a stdio handle outside \`quiet\` for this file's console output, are the candidates). Its witness, a test-only hold at the hang until the window is seen, is owed, and that is a timing dependency the determinism-under-load rule forbids; the maintainer decides whether it lands before the Windows job becomes blocking.`, + limits: `The run whose process aborts is declared on every platform. Its win32 witness (process.abort through ORACLE_GAPS_TEST_ABORT_AT, under the win32 supervisor) lands in #79; until then the Windows end-to-end job is non-blocking (C entry (c)). On win32 Node cannot deliver SIGTERM (its kill is TerminateProcess, which ends the process with no stopped line), so the stop states that name SIGTERM are required on POSIX only, and a stop there goes through the CLI's test stop hook and is observed as SIGINT; every SIGINT state stays required on win32. Law 12 judges refusals only: no legal history reaches an internal error, so its shape (exit 3, the stack in error.log) is not judged; argument refusals are the static oracle's; the check's rejection of a stack trace, a missing fix, and a wrong exit code is calibrated in the static oracle, through the same refusalBreach, and here only a refused run reported as complete is calibrated, because each calibration here runs real CLI histories. Law 15's stdout gap lines are judged against each completed run's own results.json, by id: the cold run, and each check through the daemon (every step's check and the check that a mid-run edit overlaps); a stopped run and a refusal list no gaps and are not judged so. A line's change is read loosely: its code on one line, whole or cut after a kept part and ended with \`...\`; where the printer cuts (60 code points, kept 57) is the classify oracle's law 8 (\`shortened\`), in-process. A line with any text after its change does not read and fails loudly: the \` (cause: )\` suffix that #99 adds to timeout lines is not read yet, so whichever of #99 and #115 lands second extends readGapLine. Hangs only as an owner test that awaits a promise that never settles, under a 1 s first budget and a 20 s full limit, and a slow run only as two witnesses whose tests wait where the output changed, 3 s in one that then judges and 10 s in two one-test owners of one that does not; busy loops only on instrumented code (cut by the call budget), no slow runs past the full limit that would end, hangs in ordinary or nondeterministic tests, setup errors other than a throw at module load, loops, multi-line conditions, two functions on one line, or await, new, and void statements; nested functions, object-literal methods, accessors, and class-field arrows only where no test calls them (their ownership is the static oracle's); two source files of one package, with no re-exports, namespace imports, or calls into another package; --only only in a stopped run and a partial run of one function's mutants, and no --sample or --diff-base; the baseline's failures only as one failing owner test that throws an error and a setup file that throws, so a baseline law violation's law and counterexample lines are the classify oracle's; a derived class's file is instrumented and its sites are judged as unowned, but no test imports or constructs the class, so its no-mutant and super-region behavior is the static oracle's (in-process), not this oracle's; package configs only as vite.config or vitest.config with one of the extensions .ts, .mts, .cts, .js, .mjs, and .cjs (not every pair), as config/gap-vitest with the same extension through --config, or none, as an object or a sync or async function, with no plugins of their own except one enforce: 'pre' transform that appends a comment to each module of the package (prePlugin) and, in one constructed history, a plugin whose load reads each test file with a sync read (loadPlugin); a plugin whose output depends on anything but the module's text (a sidecar file it reads) and an environment variable that changes between checks are not generated, since the runner tracks neither yet and the daemon's environment is fixed when it starts (F-A1: the maintainer decided on 2026-11-13 that the daemon tracks both and restarts when they change, in the next pull request); and test.projects only as a refusal, and only under the package's own package.json; a config's test.root only in four shapes, each in one constructed history of an ES module config that Vitest discovers, with one owner and one context, where the test files' globs and the setup file are relative to the root (issue #101): the directory that holds the tests, the directory above the package, a directory of the package that holds no test file, and the package's tests as a symbolic link to the directory that holds them (required on every platform, since Windows creates the link as the driver's other links); not under --config, a CommonJS config, test.projects, several contexts with different roots, or a root that is the filesystem's root; the runner serves each copy of a test file by its absolute path, through its pre plugin's load (which answers before the config's own plugins) and through its read of the copy's path for Vitest's pragma read (serveCopies), and histories run copies only in Vite's server environments (node and the pragma's ssr environment): jsdom and happy-dom, Vite's client environment, are not generated (the #103 merge-gate review ran jsdom by hand under all five root shapes, and the copies loaded in each); a top-level await only in an ES module config and require only in a CommonJS one, as Vitest itself loads no other; a --config outside the package is refused by design, through the rule for paths outside the package (args.mjs), and no history generates one; contexts only one, four, or eleven, and process warnings judged only as MaxListenersExceededWarning on the CLI's own stderr (a daemon's process warnings go to its log); a context that fails to open gives back its listener allowance, which no observation shows (a kept allowance only raises the limit, so no warning follows), so that accounting is fixed by inspection; no probe-bound states, so reach agreement's killing of probe mutants is not checked; no gap answers or gate; law 9 judges the witness module's outcome classes along one constructed edit sequence only (a test edit, a helper edit, and a revert), and the budget witness's along one constructed second check with nothing changed, because a generated history with the witness module or the budget witness takes no steps (maintainer decision, 2026-11-11, and the runtime review's P1-a, 2026-11-12; this oracle owns the gap); law 9's edits come between checks, except one, midrun, which lands during a check through the daemon: a test of file a, whose context has loaded file b's helper, rewrites the helper in the baseline's first run of file a, before file b's runs read it, in one context or several; or a test of file b rewrites its own helper, or the data file that its verdict read through a sync fs read, after file b's judged tests read them, in the run that judges with the old text (review of #55, F1); that check must report, for each mutant, what a cold run of the state before the edit or of the state after it reports, and exit as one of them does (third review of #55, F-C), compared per mutant result rather than per file; when file b's own test lands the edit, b's baseline reads the old text and b's mutant runs read the new one, so b's own mutants in that check are not judged, since their results legitimately mix the two texts (maintainer decision, 2026-11-13), while every other mutant there is judged against both cold runs, with the check's exit code, its mutants' keys, and its stream; the stronger follow-up compares each run's raw outcome with the cold outcome of the state that run read; and the next check, with nothing changed, must equal a cold run of the state after the edit, compared for equality of results only, not for what the daemon reused or computed (the runner's rule: a run whose input changed after the run read it is invalidated and not stored, settleIn); a check through the daemon of a state that nothing changed must compute no run that was not cut off, judged where no test reads the clock (F-A, F-A2), and a test's fs read of a file and the module that the context serves from it are two inputs, each under its own hash (F-A2); an edit during a mutant run is not generated, and a file is edited mid-run only by the run's own tests, not by another process at an arbitrary time; a file that a test reads through fs is edited only as one JSON file that file b's verdict reads by a sync, a promise, or a callback read, or by a sync read after it stats its own directory and tests that it exists (statDir: the directory is an input as a directory, not by its content, and is not itself edited), each read first checking that its fs function keeps its own name and length (the runner stores a run under the files in the package that its copy reads with readFileSync, readFile, existsSync, or statSync, or the fs/promises readFile or stat, each with its hash at the copy's first read; a read outside the package or under node_modules, from a worker thread or a child process that a test starts, or through any other fs API, which includes readdir, opendir, glob, globSync, createReadStream, realpath, lstat, access, open, a read through a file descriptor (read, readSync, readv, fstat, fstatSync, and readFileSync or readFile given a file descriptor), copyFile and copyFileSync, cp and cpSync, openAsBlob, statfs, readlink, the callback stat, exists, watch, watchFile, and the fs/promises access, open, and glob, is no input, and none is generated: the maintainer decided on 2026-11-13 that every fs read except watch and watchFile is an input, which a follow-up of #55 implements, and until then this oracle owns the gap); a run cut off by its clock writes no closing row, so it is stored under its file's known inputs only, while a run that spun ends and keeps the inputs it named (F-D); no history makes a cut run read a file that its file's unmutated run does not read, so this is fixed by inspection; a test that rewrites a file it read with the same text makes the next check compute that run again (1 run in the self-edit histories), since the edit changes the file's modification time: the daemon is conservative there, nothing goes stale, and content keys (D10) remove it, with a selfWrite dimension in that pull request; the mid-run marker sits in the daemon's session directory, .oracle-gaps-, whose location predates #55; the runner's hash memo knows a file by its size and modification time, so an edit that keeps both is not seen, and no history makes one (D10, planned in phase 2, A5); law 9's edits leave out other environment variables, new files that change how an unchanged import resolves, Vite config and installed-package changes, and concurrent checks other than two that start the daemon; cut-off charging judged only under one budget; native addons only as a binding.gyp or a prebuilt .node file, not as optional platform packages; daemon races (two CLIs reading one error file, a CLI hearing closing from the failing daemon it started, a reset connection on macOS) fixed by inspection; the runner's copies of the test files exist only in memory, and its harness and Vitest configs sit in the package's .oracle-gaps-, which the next run removes once a killed run has left it (judged after two stopped runs, not after a SIGKILL); a default --out is judged by the static oracle, and these runs name --out in the package; the namespace is checked after each run and, in a stopped run, while the run runs; a slow kill in a later owner, after earlier owners' confirmations spent the budget, becomes a timeout (owner order; not generated); the Vitest 5 path of the copies' pragma read and of the runner is verified from Vitest 5's source only, since the Vitest 5 CI job runs no gap oracle; a batch whose run reports an error outside any test reruns each copy alone (unitsBatch, runAlone) with its first budget, and a copy cut there is kept as a timeout with no confirmation, a defect older than this oracle's budget work that no history reaches (no history has an error outside any test beside a slow copy), recorded here with that trace for the maintainer; stale-session removal is scoped to this host's session directories (a host file), and is not judged across pid namespaces; the stop law covers SIGTERM and SIGINT sent to the CLI, not a SIGKILL of the CLI (its group then ends at the next check of its parent, by inspection) or a signal sent to the daemon, and its witness is one test that spins synchronously and starts one child process; the mutant budget is witnessed as two slow owners whose confirmations pass the --mutant-limit floor, not through its multiple of the owners' unmutated time, and authored mutants have no confirmations to budget; the witness w_slowpair is a wall-clock window, since the CLI's budget has no controlled clock and a fixture cannot see the time the CLI measures for its file: with one-test owner files p and q of measured unmutated time t each (a file first in its context pays the instrumented transform too), a wait W of 10 s, a 20 s --hang-limit and a 15 s --mutant-limit, it tells a budget from none only while (a) its first attempt is cut, W > 1 s + 3t, (b) its two confirmations do not fit the budget, 2W > max(15 s, 10 x 2t), and (c) each would fit its own full limit, W < 20 s + 3t; (b) is the binding one, so it holds while the two files' time stays under about 2 s together (about 1 s each, some 20 times the authoring machine's idle and 5 to 10 times its loaded measurements), and under one budget a run's overhead must stay under 10 s + 3t; CI runners measure 1.5 to 2.3 times the idle machine; beyond that w_slowpair would read not-judged; a heartbeat is owed only where a slow test waits 3 s against a 2 s interval, twice the first budget, so that no copy cut at its first budget beats, and each beat is observed as its mutant and file, not how long or how often it beat; a config only in the package's parent directory is generated one level up, in a temporary directory with no package.json (so its .js or .ts name is CommonJS), as a plain config, one that throws, one with no default export, or one that defines test.projects; a config two or more levels up, or a parent config beside a package config, is not generated, and the order in one directory follows Vitest's configFiles list by inspection; a package with no config lives in a temporary directory, where no parent has a config; a counterexample shrinks through at most six histories, so it can be larger than the smallest that fails; module-level data only as four \`const\` declarations of the main source (an object literal, an array that holds a function, a boolean, and an object of two methods), read in place, with no data imported from another file, destructured, reassigned, or declared as an enum or a default export; the work law only through shortcut witnesses (an early return before a counting loop with a bound twin of ratio 2, and a push beside one that calls String with a bound twin of ratio 1), the early return in tests that reach the clock by each watched path and in tests that wait a turn, a generated test's bound of 1 derived from its plan (which no generated function's mutant reached in the 36 fixed-seed units at main's bases; the disarmed-pause history's base, appended at its index, does reach it, so that history pins its generated inputs to ones that declare no bound, and the model predicts no work verdict for a generated test, a model gap for the maintainer to decide whether to model work counts), and one warm-cache witness whose selection reproduces observations but not work; work is the capture's count of site evaluations per test, so code with no site (a plain assignment, a for...of pass, a builtin's own work) counts nothing and a test's histories are summed, and a test whose work varies between the unmutated runs while its observations agree is not generated. Open Limits, owned by the in-process runner oracle (L1, state \"torn tail at a cut-off read\"; RED: captureLines without the guard): (a) the batch's cut-off read (runBatch's rowsOf after the cut-off) drops a partial last row, and no witness reaches that drop yet, because a copy held half written across the cut-off did not observe its release in the harness; (b) a short fragment on the strict path, which the no-newline mutant does not reach. The strict read after a finished run (a fragment is an internal error) is witnessed by the no-newline mutant. Windows idle gap (recorded, not witnessed): the state \`a hang cut off for idleness\` is required on every platform, and win32 reaches it (run 43683794816, job 132719872988), so it is not platform-scoped. The sampler (capture-setup.mjs) counts a copy idle only after 500 ms with no late tick, no non-quiet handle, utilization at most 5%, and no timer due, so \`every outcome class\` reaches the state only when the sampler sees that window. On win32 the check missed it once (run 43683794816, job 132719872940); the cause is not confirmed (a late tick on a shared runner, or a stdio handle outside \`quiet\` for this file's console output, are the candidates). Its witness, a test-only hold at the hang until the window is seen, is owed, and that is a timing dependency the determinism-under-load rule forbids; the maintainer decides whether it lands before the Windows job becomes blocking.`, }, histories: { // A failing history shrinks through at most six smaller ones. Each runs @@ -5471,6 +5545,72 @@ oracleProperty({ warmReplaced: true, }), }, + { + // The config sets `test.root` to the directory that holds the tests + // (issue #101), as the repository's own oracle-gaps config does. Vite + // names a module that a plugin resolves inside its root by its path + // from that root, so a runner that resolved a copy of a test file would + // import it again by a root-relative name. The owned mutant is judged; + // a setup error is no verdict (law 4). + name: `a config whose test root is a subdirectory that holds the tests`, + enters: [`a config whose test root is a subdirectory ran`], + build: (generated) => oneOwnerHistory(generated, { testRoot: `tests` }), + }, + { + // The config's test root is the directory above the package, which + // holds only the package (the driver places it in `pkg`): a resolved + // copy would be named from that root, by a path that starts with the + // package's own directory name. A runner that resolves copies from the + // root only when it lies in the package misses it. The setup file is + // named from the root too. + name: `a config whose test root is above the package`, + enters: [ + testRootStates.parent, + `a setup file that defines a fixed global ran in every copy`, + ], + build: (generated) => + oneOwnerHistory(generated, { testRoot: `parent`, setupGlobal: true }), + }, + { + // The config's test root is a directory of the package that holds no + // test file (src), and the globs reach the tests from it: the test + // files and their copies lie outside the root. A runner that takes only + // the test files under the root runs none of them. + name: `a config whose test root holds no test file`, + enters: [ + testRootStates.outside, + `a setup file that defines a fixed global ran in every copy`, + ], + build: (generated) => + oneOwnerHistory(generated, { + testRoot: `outside`, + setupGlobal: true, + }), + }, + { + // The config's test root is the package's `tests`, a symbolic link to + // the directory that holds the tests. The root's path is spelled + // through the link, so a runner that resolves copies from the root's + // real path misses them. Windows creates the link too (the driver's + // other links run there), so the state is required on every platform. + name: `a config whose test root is a symbolic link`, + enters: [ + testRootStates.link, + `a setup file that defines a fixed global ran in every copy`, + ], + build: (generated) => + oneOwnerHistory(generated, { testRoot: `link`, setupGlobal: true }), + }, + { + // The config's own plugin loads each test file in its \`load\` hook, + // with a sync read of the path (review of #103, F1). The runner's copy + // of a test file exists only in memory, so the runner's \`load\`, which + // runs first (\`enforce: 'pre'\`), must answer for it: a sync read of + // the copy's path finds no file, and the copy would not load. + name: `a config whose plugin loads test files with a sync read`, + enters: [loadPluginState], + build: (generated) => oneOwnerHistory(generated, { loadPlugin: true }), + }, ]), }, resolve: resolveHistory, diff --git a/packages/oracles/oracle-gaps/history-fingerprint.json b/packages/oracles/oracle-gaps/history-fingerprint.json index ead6dcce..cfe3fa9b 100644 --- a/packages/oracles/oracle-gaps/history-fingerprint.json +++ b/packages/oracles/oracle-gaps/history-fingerprint.json @@ -54,7 +54,9 @@ ["laterSteps", "fb28f2575c00f223"], ["tornRows", "ed6866229ecc4969"], ["pauseEngages", "c93e2e40cd0c4b9f"], - ["warmReplaced", "ed6866229ecc4969"] + ["warmReplaced", "ed6866229ecc4969"], + ["testRoot", "e18db063421a75f1"], + ["loadPlugin", "ed6866229ecc4969"] ], "histories": [ ["functions", "66c0e9c56951c377"], @@ -111,6 +113,8 @@ ["laterSteps", "fb28f2575c00f223"], ["tornRows", "ed6866229ecc4969"], ["pauseEngages", "c93e2e40cd0c4b9f"], - ["warmReplaced", "ed6866229ecc4969"] + ["warmReplaced", "ed6866229ecc4969"], + ["testRoot", "e18db063421a75f1"], + ["loadPlugin", "ed6866229ecc4969"] ] } diff --git a/packages/oracles/scripts/e2e-shards.mjs b/packages/oracles/scripts/e2e-shards.mjs index d85fb067..4a95cb9d 100644 --- a/packages/oracles/scripts/e2e-shards.mjs +++ b/packages/oracles/scripts/e2e-shards.mjs @@ -149,6 +149,21 @@ export const shards = { `fixed seed 20261105: a reset check after its warm daemon was replaced`, `random seed: a reset check after its warm daemon was replaced`, `determinism: constructed history: a reset check after its warm daemon was replaced`, + `fixed seed 20261105: a config whose test root is a subdirectory that holds the tests`, + `random seed: a config whose test root is a subdirectory that holds the tests`, + `determinism: constructed history: a config whose test root is a subdirectory that holds the tests`, + `fixed seed 20261105: a config whose test root is above the package`, + `random seed: a config whose test root is above the package`, + `determinism: constructed history: a config whose test root is above the package`, + `fixed seed 20261105: a config whose test root holds no test file`, + `random seed: a config whose test root holds no test file`, + `determinism: constructed history: a config whose test root holds no test file`, + `fixed seed 20261105: a config whose test root is a symbolic link`, + `random seed: a config whose test root is a symbolic link`, + `determinism: constructed history: a config whose test root is a symbolic link`, + `fixed seed 20261105: a config whose plugin loads test files with a sync read`, + `random seed: a config whose plugin loads test files with a sync read`, + `determinism: constructed history: a config whose plugin loads test files with a sync read`, `fixed seed 20261105: a config fault in a run that owns nothing`, `fixed seed 20261105: a declaration fault: brokenOwner`, `fixed seed 20261105: a declaration fault: configThrows`, diff --git a/packages/oracles/scripts/pr-shards.mjs b/packages/oracles/scripts/pr-shards.mjs index 24a91921..f030ffa2 100644 --- a/packages/oracles/scripts/pr-shards.mjs +++ b/packages/oracles/scripts/pr-shards.mjs @@ -537,6 +537,11 @@ export const partitions = { "test.projects in a parent's config", 'a declaration fault: projects', 'a declaration fault: outsideSource', + 'a config whose test root is a subdirectory that holds the tests', + 'a config whose test root is above the package', + 'a config whose test root holds no test file', + 'a config whose test root is a symbolic link', + 'a config whose plugin loads test files with a sync read', ]), 7: anyOf([ 'a daemon pause that cannot engage',