From a9650db62d942880514a6125e676dcd28e01486a Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 00:40:06 -0700 Subject: [PATCH 01/15] test(oracle-gaps): constructed history for a config whose root is a subdirectory Vitest names a copy of a test file by its path from the config's root. A config that sets root to the directory holding the tests makes every copy's id root-relative, so the wrapper's resolver must find the copy there too. Adds one constructed history (appended last, so existing histories keep their positions) with a config whose root is the tests directory, and declares the state it reaches. The owned mutant must be judged, never a setup error. Refs #101. Co-authored-by: Isaac --- .../oracle-gaps/gap-report-model-oracle.mjs | 20 ++++++- .../gap-report-oracle.property.test.mjs | 57 ++++++++++++++++++- 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 36a093a0..93cc555e 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -2935,6 +2935,10 @@ function resolveHistory(history) { tornRows: history.tornRows === true, ...configOf(history), configEnv: history.configEnv === true, + // Whether the config sets `root` to the directory that holds the tests + // (issue #101): only a constructed history sets it, so a generated one + // runs with the package as the root. + configRoot: history.configRoot === true, native: history.native ?? `none`, // A prebuilt addon in the workspace dependency's build/Release // (`addRelease`). @@ -5174,11 +5178,15 @@ const PRE_PLUGIN = `{ name: 'gap-pre-rewrite', enforce: 'pre', transform(code, i */ function configText(plan, test) { const commonjs = plan.configSyntax === `cjs` + // The directory that holds the tests, as the config's `root` (issue #101). + const root = plan.configRoot + ? `root: ${commonjs ? `require('node:path').join(__dirname, 'tests')` : `fileURLToPath(new URL('./tests', import.meta.url))`}, ` + : `` const config = `defineConfig(${ { object: ``, function: `() => (`, async: `async () => (`, promise: `` }[ plan.config ] - }{ test: ${ + }{ ${root}test: ${ plan.fault === `projects` ? `{ projects: [{ test: { name: 'unit', ...${test} } }] }` : test @@ -5196,6 +5204,9 @@ function configText(plan, test) { commonjs ? `const { defineConfig } = require('vitest/config')` : `import { defineConfig } from 'vitest/config'`, + ...(plan.configRoot && !commonjs + ? [`import { fileURLToPath } from 'node:url'`] + : []), ...(plan.fault === `configThrows` ? [`throw new Error('the fixture config broke')`] : []), @@ -5253,10 +5264,13 @@ 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 }) + // The test files' glob, relative to the config's root: the package, or the + // directory that holds the tests when the config sets it (issue #101). + const glob = plan.configRoot ? `**/*.test.ts` : `tests/**/*.test.ts` const test = `{ include: ${ plan.configEnv - ? `process.env.VITEST === 'true' && process.env.TEST === 'true' && process.env.NODE_ENV === 'test' ? ['tests/**/*.test.ts'] : []` - : `['tests/**/*.test.ts']` + ? `process.env.VITEST === 'true' && process.env.TEST === 'true' && process.env.NODE_ENV === 'test' ? ['${glob}'] : []` + : `['${glob}']` }${plan.setupGlobal || plan.fault === `setupThrows` ? `, setupFiles: ['./tests/setup.ts']` : ``} }` // A history that installs a scoped addon later declares it from the // start, beside a scoped package already installed in its scope. 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 547f4e36..439473b3 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -2194,6 +2194,10 @@ 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 `root` to the directory that holds the tests, so + // Vitest names each copy from that root (issue #101). + if (plan.configRoot) + states.add(`a config whose root is a subdirectory ran`) if (plan.native === `gyp`) states.add(`a package with a native addon ran in child processes`) if (plan.native === `deep`) @@ -3537,6 +3541,7 @@ 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`, + `a config whose root is a subdirectory ran`, `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`, @@ -3637,6 +3642,7 @@ 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`, + `a config whose root is a subdirectory ran`, `a package with no config ran`, `a package whose parent directory has its config ran`, `a failing owner replayed under its parent's config`, @@ -3680,7 +3686,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: `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. 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), 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.`, + limits: `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. 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 config's root only as the directory that holds the tests, in one constructed history, where the test files' globs are relative to it (issue #101); 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), 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.`, }, histories: { // A failing history shrinks through at most six smaller ones. Each runs @@ -4950,6 +4956,55 @@ oracleProperty({ config: `object`, }), }, + { + // The config sets `root` to the directory that holds the tests (issue + // #101). Vitest names a copy of a test file by its path from that root, + // so the copy's id is root-relative, and the wrapper's resolver must + // find the copy there as it does under the package root. The owned + // mutant is judged; a setup error is no verdict (law 4). + name: `a config whose root is a subdirectory that holds the tests`, + enters: [`a config whose root is a subdirectory ran`], + build: (generated) => ({ + ...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: true, + prePlugin: false, + configRoot: true, + configPlace: `discovered`, + configFile: `vitest.config.ts`, + packageType: `module`, + config: `object`, + configEnv: false, + setupGlobal: false, + }), + }, ]), }, resolve: resolveHistory, From 1c1e8280f3564a328af5c1a13f651b9abfb943dc Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 00:42:08 -0700 Subject: [PATCH 02/15] test(oracle-gaps): declare the constructed config-root field in the generator The constructed history for a config whose root is a subdirectory sets configRoot, which the histories arbitrary could not take back, so the campaign failed before running. Declare it as a drawn constant (it draws nothing, so generated histories keep their values) and take a constructed history back as false, as tornRows is. Refs #101. Co-authored-by: Isaac --- .../oracle-gaps/gap-report-model-oracle.mjs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 93cc555e..6d04114d 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -840,6 +840,11 @@ const drawn = fc.record({ // `histories` takes a constructed one back as this constant (as // `claimScenario` does). Its neutral value is recorded by the canary. tornRows: fc.constant(false), + // A constructed history may set the config's `root` to the directory that + // holds the tests (issue #101). The constant draws nothing, so generated + // histories keep their values; `histories` takes a constructed one back as + // this constant, as `tornRows` does. + configRoot: fc.constant(false), }) // The edit sequence over the witness module, the one list of steps that a @@ -880,20 +885,23 @@ 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 `configRoot` +// (issue #101), which `drawn` cannot produce, so its take-back reads each as +// the drawn constant `false` (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, configRoot: unknown }} */ ( value ) if (!keepsSteps(history)) throw new Error(`a history with the witness module takes no steps`) const taken = - history.tornRows === false ? value : { ...history, tornRows: false } + history.tornRows === false && history.configRoot === false + ? value + : { ...history, tornRows: false, configRoot: false } const later = (history.steps ?? []).filter((step) => laterEdits.includes(step), ) From b6522a67179a3bf7c35e1aaa965c0ae7a04c617e Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 00:50:11 -0700 Subject: [PATCH 03/15] test(oracle-gaps): set the constructed history's root through test.root Vitest names a copy by its path from the test root (test.root), not from the Vite root the CLI forces to the package. The constructed history must set test.root to the directory holding the tests, as the repository's own oracle-gaps config does, and the fixture must reach that state. The field is renamed testRoot to match. Refs #101. Co-authored-by: Isaac --- .../oracle-gaps/gap-report-model-oracle.mjs | 32 +++++++++---------- .../gap-report-oracle.property.test.mjs | 31 +++++++++--------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 6d04114d..5bc8da86 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -844,7 +844,7 @@ const drawn = fc.record({ // holds the tests (issue #101). The constant draws nothing, so generated // histories keep their values; `histories` takes a constructed one back as // this constant, as `tornRows` does. - configRoot: fc.constant(false), + testRoot: fc.constant(false), }) // The edit sequence over the witness module, the one list of steps that a @@ -885,7 +885,7 @@ 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) or `configRoot` +// constructed history may also set `tornRows` (issue #83) or `testRoot` // (issue #101), which `drawn` cannot produce, so its take-back reads each as // the drawn constant `false` (as `claimScenario` does): a shrink is // torn-row-free and runs with the package as the config's root. @@ -893,15 +893,15 @@ const histories = drawn.map( (history) => (keepsSteps(history) ? history : { ...history, steps: null }), (value) => { const history = - /** @type {{ witness: unknown, steps: unknown[] | null, tornRows: unknown, configRoot: unknown }} */ ( + /** @type {{ witness: unknown, steps: unknown[] | null, tornRows: unknown, testRoot: unknown }} */ ( value ) if (!keepsSteps(history)) throw new Error(`a history with the witness module takes no steps`) const taken = - history.tornRows === false && history.configRoot === false + history.tornRows === false && history.testRoot === false ? value - : { ...history, tornRows: false, configRoot: false } + : { ...history, tornRows: false, testRoot: false } const later = (history.steps ?? []).filter((step) => laterEdits.includes(step), ) @@ -2946,7 +2946,7 @@ function resolveHistory(history) { // Whether the config sets `root` to the directory that holds the tests // (issue #101): only a constructed history sets it, so a generated one // runs with the package as the root. - configRoot: history.configRoot === true, + testRoot: history.testRoot === true, native: history.native ?? `none`, // A prebuilt addon in the workspace dependency's build/Release // (`addRelease`). @@ -5186,15 +5186,11 @@ const PRE_PLUGIN = `{ name: 'gap-pre-rewrite', enforce: 'pre', transform(code, i */ function configText(plan, test) { const commonjs = plan.configSyntax === `cjs` - // The directory that holds the tests, as the config's `root` (issue #101). - const root = plan.configRoot - ? `root: ${commonjs ? `require('node:path').join(__dirname, 'tests')` : `fileURLToPath(new URL('./tests', import.meta.url))`}, ` - : `` const config = `defineConfig(${ { object: ``, function: `() => (`, async: `async () => (`, promise: `` }[ plan.config ] - }{ ${root}test: ${ + }{ test: ${ plan.fault === `projects` ? `{ projects: [{ test: { name: 'unit', ...${test} } }] }` : test @@ -5212,7 +5208,7 @@ function configText(plan, test) { commonjs ? `const { defineConfig } = require('vitest/config')` : `import { defineConfig } from 'vitest/config'`, - ...(plan.configRoot && !commonjs + ...(plan.testRoot && !commonjs ? [`import { fileURLToPath } from 'node:url'`] : []), ...(plan.fault === `configThrows` @@ -5272,10 +5268,14 @@ 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 }) - // The test files' glob, relative to the config's root: the package, or the - // directory that holds the tests when the config sets it (issue #101). - const glob = plan.configRoot ? `**/*.test.ts` : `tests/**/*.test.ts` - const test = `{ include: ${ + // The test files' glob, relative to the test root: the package, or the + // directory that holds the tests when the config sets `test.root` to it + // (issue #101), as the repository's own oracle-gaps config does. + const glob = plan.testRoot ? `**/*.test.ts` : `tests/**/*.test.ts` + const testRootOption = plan.testRoot + ? `root: ${plan.configSyntax === `cjs` ? `require('node:path').join(__dirname, 'tests')` : `fileURLToPath(new URL('./tests', import.meta.url))`}, ` + : `` + const test = `{ ${testRootOption}include: ${ plan.configEnv ? `process.env.VITEST === 'true' && process.env.TEST === 'true' && process.env.NODE_ENV === 'test' ? ['${glob}'] : []` : `['${glob}']` 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 439473b3..afb624c8 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -2194,10 +2194,10 @@ 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 `root` to the directory that holds the tests, so - // Vitest names each copy from that root (issue #101). - if (plan.configRoot) - states.add(`a config whose root is a subdirectory ran`) + // The config sets `test.root` to the directory that holds the tests, + // so Vitest names each copy from that root (issue #101). + if (plan.testRoot) + states.add(`a config whose test root is a subdirectory ran`) if (plan.native === `gyp`) states.add(`a package with a native addon ran in child processes`) if (plan.native === `deep`) @@ -3541,7 +3541,7 @@ 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`, - `a config whose root is a subdirectory ran`, + `a config whose test root is a subdirectory ran`, `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`, @@ -3642,7 +3642,7 @@ 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`, - `a config whose root is a subdirectory ran`, + `a config whose test root is a subdirectory ran`, `a package with no config ran`, `a package whose parent directory has its config ran`, `a failing owner replayed under its parent's config`, @@ -3686,7 +3686,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: `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. 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 config's root only as the directory that holds the tests, in one constructed history, where the test files' globs are relative to it (issue #101); 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), 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.`, + limits: `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. 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 config's test.root only as the directory that holds the tests, in one constructed history, where the test files' globs are relative to it (issue #101); 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), 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.`, }, histories: { // A failing history shrinks through at most six smaller ones. Each runs @@ -4957,13 +4957,14 @@ oracleProperty({ }), }, { - // The config sets `root` to the directory that holds the tests (issue - // #101). Vitest names a copy of a test file by its path from that root, - // so the copy's id is root-relative, and the wrapper's resolver must - // find the copy there as it does under the package root. The owned - // mutant is judged; a setup error is no verdict (law 4). - name: `a config whose root is a subdirectory that holds the tests`, - enters: [`a config whose root is a subdirectory ran`], + // The config sets `test.root` to the directory that holds the tests + // (issue #101), as the repository's own oracle-gaps config does. Vitest + // names a copy of a test file by its path from that root, so the copy's + // id is root-relative, and the resolver must find the copy from the + // root Vitest uses. 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) => ({ ...generated, functions: [[{ kind: `if`, op: `>`, k: 4, not: false, quote: `'` }]], @@ -4996,7 +4997,7 @@ oracleProperty({ contexts: 1, tornRows: true, prePlugin: false, - configRoot: true, + testRoot: true, configPlace: `discovered`, configFile: `vitest.config.ts`, packageType: `module`, From 4e2c233863675fa4f017722b3477edbdb11bfd0b Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 00:51:09 -0700 Subject: [PATCH 04/15] test(oracle-gaps): the test-root history holds no torn row The constructed history copied tornRows from its template. Its witness needs a batch hold this history does not produce, so the campaign failed on the torn-row witness before the law that the history exists for. Its state is the test root, so it sets tornRows false. Refs #101. Co-authored-by: Isaac --- .../oracles/oracle-gaps/gap-report-oracle.property.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 afb624c8..12760a07 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -4995,7 +4995,7 @@ oracleProperty({ cliPath: `plain`, concurrentStart: false, contexts: 1, - tornRows: true, + tornRows: false, prePlugin: false, testRoot: true, configPlace: `discovered`, From ce7776504f361410f34f28716848ff341b2b3fb9 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 00:50:47 -0700 Subject: [PATCH 05/15] fix(oracle-gaps): copies resolve when the vitest config sets root A copy of a test file is named beside its file, but Vitest names a module by its path from the test root (test.root), so a config that sets the test root to a subdirectory gave every copy an id the resolver did not map back, and each mutant failed with setup-error. The wrapper's resolver now also tries the copy from the root Vitest names modules from, recorded per context after it resolves, and spells paths as the copies are keyed (on Windows, forward slashes and an uppercase drive; on POSIX, unchanged). Closes #101. Co-authored-by: Isaac --- packages/oracles/oracle-gaps/check.mjs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/oracles/oracle-gaps/check.mjs b/packages/oracles/oracle-gaps/check.mjs index 8a6d0a8a..b843fc60 100644 --- a/packages/oracles/oracle-gaps/check.mjs +++ b/packages/oracles/oracle-gaps/check.mjs @@ -517,18 +517,25 @@ export default async (env) => { const loaded = typeof base === 'function' ? await base(env) : await base if (loaded === null || typeof loaded !== 'object') throw new Error(${JSON.stringify(`${config ?? `the config`}: config must export or return an object.`)}) + // A path as copies are keyed: on Windows, forward slashes and an uppercase + // drive letter (paths.mjs \`posix\`); on POSIX, as it is. + const spelled = (path) => process.platform !== 'win32' ? path : path.replaceAll(String.fromCharCode(92), '/').replace(/^[a-z]:/, (drive) => drive.toUpperCase()) const merged = mergeConfig(loaded, { 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). + // run finds it. Vitest names a module by its path from the package, or, + // when the test root is a directory of the package (test.root), from that + // root (globalThis.__oracleGapsRoots, issue #101). A workspace dependency + // loads from its one-file bundle (workspaceBundles). 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 + const root = globalThis.__oracleGapsRoots?.[${index}] ?? '' + for (const path of [source, ${JSON.stringify(pkg)} + source, root + source]) { + const copy = spelled(path) + if (copies?.has(copy)) return copy + } return globalThis.__oracleGapsBundles?.get(source) }, // Each module this context transforms, so a run is stored under the @@ -546,7 +553,7 @@ 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), '/')) + const copy = globalThis.__oracleGapsCopies?.get(spelled(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. @@ -566,6 +573,10 @@ export default async (env) => { ) } globalThis.__oracleGapsServe = [] + // Per context: the root that Vitest names its modules from (the test root, + // which a config sets as `test.root`), set once the context has resolved it + // (warmContext). A copy's id is named from that root (issue #101). + globalThis.__oracleGapsRoots = [] // Per context: the hash of each module's text when it last transformed it. globalThis.__oracleGapsLoads = [] // The text of each copy of a test file that a batch runs, by its path. @@ -760,6 +771,7 @@ export default async (env) => { throw error }), ) + globalThis.__oracleGapsRoots[index] = context.getRootProject().config.root // Vitest 3 calls this step `init`; Vitest 4 renamed it `standalone`. await fromConfig( index, From b0d97be30f3cd90c48c81d9384f94d5b793b13f5 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 00:57:27 -0700 Subject: [PATCH 06/15] chore: changeset for the test-root copy fix Co-authored-by: Isaac --- .changeset/oracle-gaps-test-root-copies.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/oracle-gaps-test-root-copies.md diff --git a/.changeset/oracle-gaps-test-root-copies.md b/.changeset/oracle-gaps-test-root-copies.md new file mode 100644 index 00000000..0dbacaaf --- /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` to a subdirectory. Vitest names each copy of a test file by its path from that root, but the copy resolver only tried the package, so every copy in the subdirectory failed to load with `Cannot find module '/.oracle-gaps-…'`, and every mutant of an owner there reported `setup-error`. The resolver now also tries the copy from the root Vitest names modules from, and it spells paths as the copies are keyed (on Windows, forward slashes and an uppercase drive letter; on POSIX, unchanged). From 5ac152e0cfafd321c8aba776ad29bb53f9d60c27 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 01:22:05 -0700 Subject: [PATCH 07/15] ci(oracle-gaps): place the test-root history in a Windows fixed-seed shard The Windows fixed-seed partition lists every test by name, so the new history must be named in one shard; shard 6 is the lightest. Refs #101. Co-authored-by: Isaac --- packages/oracles/scripts/pr-shards.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/oracles/scripts/pr-shards.mjs b/packages/oracles/scripts/pr-shards.mjs index 24a91921..2c7229d2 100644 --- a/packages/oracles/scripts/pr-shards.mjs +++ b/packages/oracles/scripts/pr-shards.mjs @@ -537,6 +537,7 @@ 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', ]), 7: anyOf([ 'a daemon pause that cannot engage', From ff1705dcb2379970ad66ae779bc59eae5ccc00e7 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 01:59:33 -0700 Subject: [PATCH 08/15] ci(oracle-gaps): place the test-root history's units in an e2e shard The e2e partition lists every unit by name: the fixed-seed, random, and determinism units of the new history go in shard e2e-3, beside the other constructed histories of #73. Refs #101. Co-authored-by: Isaac --- packages/oracles/scripts/e2e-shards.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/oracles/scripts/e2e-shards.mjs b/packages/oracles/scripts/e2e-shards.mjs index 77f72982..cb7eff5e 100644 --- a/packages/oracles/scripts/e2e-shards.mjs +++ b/packages/oracles/scripts/e2e-shards.mjs @@ -149,6 +149,9 @@ 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 fault in a run that owns nothing`, `fixed seed 20261105: a declaration fault: brokenOwner`, `fixed seed 20261105: a declaration fault: configThrows`, From 12a2981ef0da130e880bf042bad50bcd42b6b0c8 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 18:45:38 -0600 Subject: [PATCH 09/15] test(oracle-gaps): constructed histories for each shape of a config's test root The test root dimension (testRoot) becomes a set of shapes: the directory that holds the tests, the directory above the package, a directory that holds no test file, and a tests directory that is a symbolic link. Each new shape has its own constructed history, appended after the existing ones, and runs a setup file named from the root. Co-authored-by: Isaac --- .../oracle-gaps/gap-report-model-oracle.mjs | 103 ++++++++---- .../gap-report-oracle.property.test.mjs | 156 ++++++++++++------ .../oracle-gaps/history-fingerprint.json | 4 +- 3 files changed, 184 insertions(+), 79 deletions(-) diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 99b00fd1..fcf06b05 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -848,11 +848,11 @@ 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), - // A constructed history may set the config's `test.root` to the directory that - // holds the tests (issue #101). 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(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`), }) // The edit sequence over the witness module, the one list of steps that a @@ -895,8 +895,8 @@ const keepsSteps = (history) => { // steps grammar cannot draw: its later edits move to `laterSteps`. A // constructed history may also set `tornRows` (issue #83) or `testRoot` // (issue #101), which `drawn` cannot produce, so its take-back reads each as -// the drawn constant `false` (as `claimScenario` does): a shrink is -// torn-row-free and runs with the package as the config's root. +// 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) => { @@ -910,9 +910,9 @@ 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 && history.testRoot === false + history.tornRows === false && history.testRoot === `none` ? value - : { ...history, tornRows: false, testRoot: false } + : { ...history, tornRows: false, testRoot: `none` } const later = (history.steps ?? []).filter((step) => laterEdits.includes(step), ) @@ -2959,10 +2959,10 @@ function resolveHistory(history) { tornRows: history.tornRows === true, ...configOf(history), configEnv: history.configEnv === true, - // Whether the config sets `root` to the directory that holds the tests - // (issue #101): only a constructed history sets it, so a generated one - // runs with the package as the root. - testRoot: history.testRoot === 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`, native: history.native ?? `none`, // A prebuilt addon in the workspace dependency's build/Release // (`addRelease`). @@ -5224,9 +5224,9 @@ function configText(plan, test) { commonjs ? `const { defineConfig } = require('vitest/config')` : `import { defineConfig } from 'vitest/config'`, - ...(plan.testRoot && !commonjs - ? [`import { fileURLToPath } from 'node:url'`] - : []), + ...(plan.testRoot === `none` + ? [] + : [`import { fileURLToPath } from 'node:url'`]), ...(plan.fault === `configThrows` ? [`throw new Error('the fixture config broke')`] : []), @@ -5274,6 +5274,41 @@ 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. The ids Vitest gives a + * copy differ by shape: from the root for a file inside it, and absolute for + * one outside 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. + */ +const testRoots = { + none: { include: `tests/**/*.test.ts`, setup: `./tests/setup.ts` }, + tests: { root: `./tests`, include: `**/*.test.ts`, setup: `./setup.ts` }, + parent: { + root: `..`, + include: `pkg/tests/**/*.test.ts`, + setup: `./pkg/tests/setup.ts`, + }, + outside: { + root: `./src`, + include: `../tests/**/*.test.ts`, + setup: `../tests/setup.ts`, + }, + link: { root: `./tests`, include: `**/*.test.ts`, setup: `./setup.ts` }, +} + +// 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` @@ -5284,18 +5319,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 }) - // The test files' glob, relative to the test root: the package, or the - // directory that holds the tests when the config sets `test.root` to it - // (issue #101), as the repository's own oracle-gaps config does. - const glob = plan.testRoot ? `**/*.test.ts` : `tests/**/*.test.ts` - const testRootOption = plan.testRoot - ? `root: ${plan.configSyntax === `cjs` ? `require('node:path').join(__dirname, 'tests')` : `fileURLToPath(new URL('./tests', import.meta.url))`}, ` - : `` + // 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' ? ['${glob}'] : []` - : `['${glob}']` - }${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`) @@ -5541,7 +5576,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)], + ]) } /** @@ -5576,7 +5622,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 0ffcf7ac..db8df220 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -1847,7 +1847,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) @@ -1855,7 +1857,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 @@ -2331,10 +2336,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` to the directory that holds the tests, - // so Vitest names each copy from that root (issue #101). - if (plan.testRoot) - states.add(`a config whose test root is a subdirectory ran`) + // The config sets `test.root` (issue #101), so Vitest names each copy + // from that root, or absolutely when the copy lies outside it. + 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`) @@ -3510,6 +3514,14 @@ 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. +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. @@ -3681,7 +3693,7 @@ 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`, - `a config whose test root is a subdirectory ran`, + ...Object.values(testRootStates), `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`, @@ -3782,7 +3794,7 @@ 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`, - `a config whose test root is a subdirectory ran`, + ...Object.values(testRootStates), `a package with no config ran`, `a package whose parent directory has its config ran`, `a failing owner replayed under its parent's config`, @@ -3843,6 +3855,53 @@ const witnessedRest = witnessed.filter( (state) => !stopsFirst.includes(state) && !stopsSecond.includes(state), ) +// A constructed history of a config's test root (`testRoots` in the model): +// one owned function, judged by one fixed-seed test of file a, in an ES module +// config that Vitest discovers, with or without a setup file that defines a +// fixed global, which Vitest reads from the root as well. The history sets +// `tornRows: false`, because the torn-row witness needs a batch hold that it +// does not produce. +const testRootHistory = (generated, testRoot, setupGlobal) => ({ + ...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, + configPlace: `discovered`, + configFile: `vitest.config.ts`, + packageType: `module`, + config: `object`, + configEnv: false, + setupGlobal, +}) + // 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 @@ -3866,7 +3925,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. 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 config's test.root only as the directory that holds the tests, in one constructed history, where the test files' globs are relative to it (issue #101); 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. 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 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; 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 @@ -5229,46 +5288,45 @@ oracleProperty({ // 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) => ({ - ...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: true, - configPlace: `discovered`, - configFile: `vitest.config.ts`, - packageType: `module`, - config: `object`, - configEnv: false, - setupGlobal: false, - }), + build: (generated) => testRootHistory(generated, `tests`, false), + }, + { + // The config's test root is the directory above the package, which + // holds only the package (the driver places it in `pkg`): Vitest names + // a copy from that root, a path that starts with the package's own + // directory name. A resolver that takes 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) => testRootHistory(generated, `parent`, 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 copies + // lie outside the root, so Vitest names each by its absolute path. A + // resolver that only joins an id to a root misses it. + 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) => testRootHistory(generated, `outside`, true), + }, + { + // The config's test root is the package's `tests`, a symbolic link to + // the directory that holds the tests. Vitest names a copy from the + // root as its path is spelled, through the link, not from the real + // path. 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) => testRootHistory(generated, `link`, true), }, ]), }, diff --git a/packages/oracles/oracle-gaps/history-fingerprint.json b/packages/oracles/oracle-gaps/history-fingerprint.json index 855528ca..f44a9e11 100644 --- a/packages/oracles/oracle-gaps/history-fingerprint.json +++ b/packages/oracles/oracle-gaps/history-fingerprint.json @@ -55,7 +55,7 @@ ["tornRows", "ed6866229ecc4969"], ["pauseEngages", "c93e2e40cd0c4b9f"], ["warmReplaced", "ed6866229ecc4969"], - ["testRoot", "ed6866229ecc4969"] + ["testRoot", "e18db063421a75f1"] ], "histories": [ ["functions", "66c0e9c56951c377"], @@ -113,6 +113,6 @@ ["tornRows", "ed6866229ecc4969"], ["pauseEngages", "c93e2e40cd0c4b9f"], ["warmReplaced", "ed6866229ecc4969"], - ["testRoot", "ed6866229ecc4969"] + ["testRoot", "e18db063421a75f1"] ] } From 7bdef53293e8eb2c57efe52472e1528a80727276 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 18:59:24 -0600 Subject: [PATCH 10/15] test(oracle-gaps): share the test-root fixture row of the linked root, and state the copy read's limit Co-authored-by: Isaac --- .../oracle-gaps/gap-report-model-oracle.mjs | 20 +++++++++++++------ .../gap-report-oracle.property.test.mjs | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index fcf06b05..5ad9244b 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -5284,14 +5284,22 @@ const parentModules = (plan, state) => * 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. The ids Vitest gives a - * copy differ by shape: from the root for a file inside it, and absolute for - * one outside 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. + * (`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. + * 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: { root: `./tests`, include: `**/*.test.ts`, setup: `./setup.ts` }, + tests: inTests, parent: { root: `..`, include: `pkg/tests/**/*.test.ts`, @@ -5302,7 +5310,7 @@ const testRoots = { include: `../tests/**/*.test.ts`, setup: `../tests/setup.ts`, }, - link: { root: `./tests`, include: `**/*.test.ts`, setup: `./setup.ts` }, + link: inTests, } // The directory that the package's `tests` links to under the `link` test 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 db8df220..257b4572 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -3925,7 +3925,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. 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 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; 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. 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 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; Vite reads each copy of a test file through the runner's read of its path (serveCopies), judged only in environments that Vite transforms for the server (node and the pragma's environment), since no history runs a browser-like environment such as jsdom; 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 From 6adb42d19ad4fe8f7420f0e64145dc957731087f Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 18:59:27 -0600 Subject: [PATCH 11/15] ci(oracle-gaps): place the new test-root histories in Windows shard 6 and e2e-3 Co-authored-by: Isaac --- packages/oracles/scripts/e2e-shards.mjs | 9 +++++++++ packages/oracles/scripts/pr-shards.mjs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/packages/oracles/scripts/e2e-shards.mjs b/packages/oracles/scripts/e2e-shards.mjs index cb7eff5e..9a5591f5 100644 --- a/packages/oracles/scripts/e2e-shards.mjs +++ b/packages/oracles/scripts/e2e-shards.mjs @@ -152,6 +152,15 @@ export const shards = { `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 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 2c7229d2..92755c26 100644 --- a/packages/oracles/scripts/pr-shards.mjs +++ b/packages/oracles/scripts/pr-shards.mjs @@ -538,6 +538,9 @@ export const partitions = { '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', ]), 7: anyOf([ 'a daemon pause that cannot engage', From 7e08435fed4f99e560b350875b76f2f596d5d247 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 18:59:28 -0600 Subject: [PATCH 12/15] fix(oracle-gaps): serve copies of test files only through the read of their path No plugin resolves a copy any more, so Vite keeps the absolute path that Vitest imports it by and reads it through serveCopies, under every test root. This removes the per-context roots, the package and root candidates, the load hook's copy lookup, and the wrapper's second copy of the path rule. serveCopies uses paths.mjs's posix. Co-authored-by: Isaac --- .changeset/oracle-gaps-test-root-copies.md | 2 +- packages/oracles/oracle-gaps/check.mjs | 50 ++++++++-------------- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.changeset/oracle-gaps-test-root-copies.md b/.changeset/oracle-gaps-test-root-copies.md index 0dbacaaf..dc1aa493 100644 --- a/.changeset/oracle-gaps-test-root-copies.md +++ b/.changeset/oracle-gaps-test-root-copies.md @@ -2,4 +2,4 @@ '@tanstack/oracles': patch --- -The `oracle-gaps` CLI judges the mutants of a package whose Vitest config sets `test.root` to a subdirectory. Vitest names each copy of a test file by its path from that root, but the copy resolver only tried the package, so every copy in the subdirectory failed to load with `Cannot find module '/.oracle-gaps-…'`, and every mutant of an owner there reported `setup-error`. The resolver now also tries the copy from the root Vitest names modules from, and it spells paths as the copies are keyed (on Windows, forward slashes and an uppercase drive letter; on POSIX, unchanged). +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 c8e8a54e..68fb4da4 100644 --- a/packages/oracles/oracle-gaps/check.mjs +++ b/packages/oracles/oracle-gaps/check.mjs @@ -117,13 +117,17 @@ function alive(pid) { } /** - * Serves a copy of a test file (runBatch) to Vitest's own read of it. Each - * copy exists only in memory, and Vitest reads every test file in its main - * 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. + * Serves a copy of a test file (runBatch) to every read of its path in this + * process, the one place a copy's text is served from. Each copy exists only + * in memory. Vitest reads every test file in its main 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 otherwise run in the config's default environment + * instead of its file's. Vite loads the copy through the same read: no plugin + * resolves a copy, so Vite keeps the absolute path that Vitest imports it by + * as its id. A copy that a plugin resolved, Vite would name from its root, + * the config's test root, and import 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 +137,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 = @@ -517,25 +519,14 @@ export default async (env) => { const loaded = typeof base === 'function' ? await base(env) : await base if (loaded === null || typeof loaded !== 'object') throw new Error(${JSON.stringify(`${config ?? `the config`}: config must export or return an object.`)}) - // A path as copies are keyed: on Windows, forward slashes and an uppercase - // drive letter (paths.mjs \`posix\`); on POSIX, as it is. - const spelled = (path) => process.platform !== 'win32' ? path : path.replaceAll(String.fromCharCode(92), '/').replace(/^[a-z]:/, (drive) => drive.toUpperCase()) const merged = mergeConfig(loaded, { plugins: [{ name: 'oracle-gaps-schemata', enforce: 'pre', - // A copy of a test file (runBatch) exists only here, so no other Vitest - // run finds it. Vitest names a module by its path from the package, or, - // when the test root is a directory of the package (test.root), from that - // root (globalThis.__oracleGapsRoots, issue #101). 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, and + // Vite reads it through serveCopies. resolveId(source) { - const copies = globalThis.__oracleGapsCopies - const root = globalThis.__oracleGapsRoots?.[${index}] ?? '' - for (const path of [source, ${JSON.stringify(pkg)} + source, root + source]) { - const copy = spelled(path) - if (copies?.has(copy)) return copy - } return globalThis.__oracleGapsBundles?.get(source) }, // Each module this context transforms, so a run is stored under the @@ -553,8 +544,6 @@ 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(spelled(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. try { @@ -573,10 +562,6 @@ export default async (env) => { ) } globalThis.__oracleGapsServe = [] - // Per context: the root that Vitest names its modules from (the test root, - // which a config sets as `test.root`), set once the context has resolved it - // (warmContext). A copy's id is named from that root (issue #101). - globalThis.__oracleGapsRoots = [] // Per context: the hash of each module's text when it last transformed it. globalThis.__oracleGapsLoads = [] // The text of each copy of a test file that a batch runs, by its path. @@ -771,7 +756,6 @@ export default async (env) => { throw error }), ) - globalThis.__oracleGapsRoots[index] = context.getRootProject().config.root // Vitest 3 calls this step `init`; Vitest 4 renamed it `standalone`. await fromConfig( index, @@ -1095,8 +1079,8 @@ export default async (env) => { async function runBatch(context, out, items, seed) { const capture = join(out, `run-${process.pid}-${++runCounter}.jsonl`) // Each copy is named beside its file, so that its imports resolve as the - // file's do, and the wrapper's plugin serves its text: nothing is - // written there. + // file's do, and serveCopies serves its text: nothing is written + // there. const copies = items.map((item) => { const copy = posix( join( From 6fa802fac58891304f77dd03bef0bac464ad5fb5 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 19:02:38 -0600 Subject: [PATCH 13/15] test(oracle-gaps): install a pragma's environment where a root above the package resolves it Vitest resolves vitest-environment- from the test root. A random base of the root-above-the-package history drew a pragma, and the environment in the package's node_modules was not found from the root, so the fixture's baseline failed in Vitest itself (seed 837819645). Co-authored-by: Isaac --- .../oracle-gaps/gap-report-model-oracle.mjs | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 5ad9244b..7ed79e1f 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -5289,6 +5289,10 @@ const parentModules = (plan, state) => * 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. */ @@ -5304,6 +5308,7 @@ const testRoots = { root: `..`, include: `pkg/tests/**/*.test.ts`, setup: `./pkg/tests/setup.ts`, + environments: `../node_modules`, }, outside: { root: `./src`, @@ -5518,21 +5523,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 From 17fceb95ca44c53f0c44b6cb81707df585a65e2d Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 22:09:38 -0600 Subject: [PATCH 14/15] test(oracle-gaps): a constructed history whose config plugin loads test files with a sync read The merge-gate review of #103 (F1) found that a config plugin whose own load hook reads each test file with readFileSync gets ENOENT on the runner's in-memory copy, once the runner's load no longer answers for it. No history had a plugin with a load hook. The new field loadPlugin is a drawn constant, set only by the new constructed history, appended after the test-root histories. Also corrects the test-root comments, which still described a copy resolver, and the Limits text on Vite's client environment. Co-authored-by: Isaac --- .../oracle-gaps/gap-report-model-oracle.mjs | 25 +++++- .../gap-report-oracle.property.test.mjs | 90 ++++++++++++------- .../oracle-gaps/history-fingerprint.json | 6 +- packages/oracles/scripts/e2e-shards.mjs | 3 + packages/oracles/scripts/pr-shards.mjs | 1 + 5 files changed, 88 insertions(+), 37 deletions(-) diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 7155e540..e1d42725 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -853,6 +853,10 @@ const drawn = fc.record({ // 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 @@ -910,9 +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 && history.testRoot === `none` + history.tornRows === false && + history.testRoot === `none` && + history.loadPlugin === false ? value - : { ...history, tornRows: false, testRoot: `none` } + : { ...history, tornRows: false, testRoot: `none`, loadPlugin: false } const later = (history.steps ?? []).filter((step) => laterEdits.includes(step), ) @@ -2963,6 +2969,7 @@ function resolveHistory(history) { // 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`). @@ -5195,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` @@ -5202,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 @@ -5210,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` @@ -5227,6 +5244,8 @@ function configText(plan, test) { ...(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')`] : []), 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 1c7fb5e2..d7856d77 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -2329,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 @@ -2351,8 +2352,8 @@ 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), so Vitest names each copy - // from that root, or absolutely when the copy lies outside it. + // 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`) @@ -3773,6 +3774,9 @@ 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`, @@ -3951,6 +3955,7 @@ const required = [ `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`, @@ -4052,6 +4057,7 @@ const separate = [ // 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`, @@ -4112,13 +4118,14 @@ const witnessedRest = witnessed.filter( (state) => !stopsFirst.includes(state) && !stopsSecond.includes(state), ) -// A constructed history of a config's test root (`testRoots` in the model): -// one owned function, judged by one fixed-seed test of file a, in an ES module -// config that Vitest discovers, with or without a setup file that defines a -// fixed global, which Vitest reads from the root as well. The history sets -// `tornRows: false`, because the torn-row witness needs a batch hold that it -// does not produce. -const testRootHistory = (generated, testRoot, setupGlobal) => ({ +// 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: [], @@ -4150,13 +4157,15 @@ const testRootHistory = (generated, testRoot, setupGlobal) => ({ contexts: 1, tornRows: false, prePlugin: false, - testRoot, + testRoot: `none`, configPlace: `discovered`, configFile: `vitest.config.ts`, packageType: `module`, config: `object`, configEnv: false, - setupGlobal, + setupGlobal: false, + loadPlugin: false, + ...fields, }) // A constructed history builds from a generated base whose first function is @@ -4182,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 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; Vite reads each copy of a test file through the runner's read of its path (serveCopies), judged only in environments that Vite transforms for the server (node and the pragma's environment), since no history runs a browser-like environment such as jsdom; 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 @@ -5538,52 +5547,69 @@ oracleProperty({ }, { // The config sets `test.root` to the directory that holds the tests - // (issue #101), as the repository's own oracle-gaps config does. Vitest - // names a copy of a test file by its path from that root, so the copy's - // id is root-relative, and the resolver must find the copy from the - // root Vitest uses. The owned mutant is judged; a setup error is no - // verdict (law 4). + // (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) => testRootHistory(generated, `tests`, false), + 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`): Vitest names - // a copy from that root, a path that starts with the package's own - // directory name. A resolver that takes the root only when it lies in - // the package misses it. The setup file is named from the root too. + // 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) => testRootHistory(generated, `parent`, true), + 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 copies - // lie outside the root, so Vitest names each by its absolute path. A - // resolver that only joins an id to a root misses it. + // 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) => testRootHistory(generated, `outside`, true), + 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. Vitest names a copy from the - // root as its path is spelled, through the link, not from the real - // path. Windows creates the link too (the driver's other links run - // there), so the state is required on every platform. + // 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) => testRootHistory(generated, `link`, true), + 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 }), }, ]), }, diff --git a/packages/oracles/oracle-gaps/history-fingerprint.json b/packages/oracles/oracle-gaps/history-fingerprint.json index f44a9e11..cfe3fa9b 100644 --- a/packages/oracles/oracle-gaps/history-fingerprint.json +++ b/packages/oracles/oracle-gaps/history-fingerprint.json @@ -55,7 +55,8 @@ ["tornRows", "ed6866229ecc4969"], ["pauseEngages", "c93e2e40cd0c4b9f"], ["warmReplaced", "ed6866229ecc4969"], - ["testRoot", "e18db063421a75f1"] + ["testRoot", "e18db063421a75f1"], + ["loadPlugin", "ed6866229ecc4969"] ], "histories": [ ["functions", "66c0e9c56951c377"], @@ -113,6 +114,7 @@ ["tornRows", "ed6866229ecc4969"], ["pauseEngages", "c93e2e40cd0c4b9f"], ["warmReplaced", "ed6866229ecc4969"], - ["testRoot", "e18db063421a75f1"] + ["testRoot", "e18db063421a75f1"], + ["loadPlugin", "ed6866229ecc4969"] ] } diff --git a/packages/oracles/scripts/e2e-shards.mjs b/packages/oracles/scripts/e2e-shards.mjs index fc479758..4a95cb9d 100644 --- a/packages/oracles/scripts/e2e-shards.mjs +++ b/packages/oracles/scripts/e2e-shards.mjs @@ -161,6 +161,9 @@ export const shards = { `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 92755c26..f030ffa2 100644 --- a/packages/oracles/scripts/pr-shards.mjs +++ b/packages/oracles/scripts/pr-shards.mjs @@ -541,6 +541,7 @@ export const partitions = { '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', From fc02a638b8127a9344a669b940dc369dd70c7f6b Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sun, 15 Nov 2026 22:11:31 -0600 Subject: [PATCH 15/15] fix(oracle-gaps): the wrapper's load serves a copy before the config's own plugins The pre plugin's load answers for an in-memory copy of a test file again, by its absolute id, so a config plugin whose load reads test files with a sync read never reads a copy's path (review of #103, F1). No plugin resolves a copy, so #101 stays fixed. Co-authored-by: Isaac --- packages/oracles/oracle-gaps/check.mjs | 36 +++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/packages/oracles/oracle-gaps/check.mjs b/packages/oracles/oracle-gaps/check.mjs index 68fb4da4..2e548ecb 100644 --- a/packages/oracles/oracle-gaps/check.mjs +++ b/packages/oracles/oracle-gaps/check.mjs @@ -117,17 +117,16 @@ function alive(pid) { } /** - * Serves a copy of a test file (runBatch) to every read of its path in this - * process, the one place a copy's text is served from. Each copy exists only - * in memory. Vitest reads every test file in its main 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 otherwise run in the config's default environment - * instead of its file's. Vite loads the copy through the same read: no plugin - * resolves a copy, so Vite keeps the absolute path that Vitest imports it by - * as its id. A copy that a plugin resolved, Vite would name from its root, - * the config's test root, and import again by that name (issue #101). The - * read of a copy's path returns its text; any other read is Node's own. + * Serves a copy of a test file (runBatch) to Vitest's own read of it. Each + * copy exists only in memory, and Vitest reads every test file in its main + * 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 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() { @@ -502,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)))} @@ -524,8 +525,9 @@ export default async (env) => { name: 'oracle-gaps-schemata', enforce: 'pre', // A workspace dependency loads from its one-file bundle - // (workspaceBundles). A copy of a test file is not resolved here, and - // Vite reads it through serveCopies. + // (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) { return globalThis.__oracleGapsBundles?.get(source) }, @@ -544,6 +546,10 @@ 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) + // 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. try { @@ -1079,8 +1085,8 @@ export default async (env) => { async function runBatch(context, out, items, seed) { const capture = join(out, `run-${process.pid}-${++runCounter}.jsonl`) // Each copy is named beside its file, so that its imports resolve as the - // file's do, and serveCopies serves its text: nothing is written - // there. + // file's do, and the wrapper's plugin serves its text: nothing is + // written there. const copies = items.map((item) => { const copy = posix( join(