diff --git a/.changeset/gap-cli-internal-error-prefix.md b/.changeset/gap-cli-internal-error-prefix.md new file mode 100644 index 0000000..5424f2d --- /dev/null +++ b/.changeset/gap-cli-internal-error-prefix.md @@ -0,0 +1,7 @@ +--- +'@tanstack/oracles': patch +--- + +The `oracle-gaps` CLI's internal error now prints one prefixed line, `oracle-gaps: error : a bug in oracle-gaps, not in your oracle; its stack is in `, before its `oracle-gaps: done error, log ` line. Before, its two message lines had no `oracle-gaps:` prefix. A line break in the message prints as an escape, so the message stays on one line. The stack stays in `error.log`, and the exit code stays 3. + +A path that a stream line names, such as the output directory in a done line or a note, now prints a line break or another control character as its `\uXXXX` escape, so a directory name cannot split the line. diff --git a/README.md b/README.md index 574d901..192c7c9 100644 --- a/README.md +++ b/README.md @@ -115,17 +115,24 @@ agent. | `summary` | `oracle-gaps: summary : 120 mutants, 98 killed, 12 gaps, 10 unowned (warnings). …` | | `legend` | `oracle-gaps: legend : `, once for each class of gap the run found | | `function` | `oracle-gaps: function fn () (owners: )`, the heading over that function's gap lines | + | `error` | `oracle-gaps: error : a bug in oracle-gaps, not in your oracle; its stack is in /error.log`, once, before the done line of an internal error | | `done` (last) | `oracle-gaps: done completed, 12 gaps, report /summary.md` (`(provisional)` after the count when an oracle file failed), `oracle-gaps: done refused[, report ]`, `oracle-gaps: done error, log `, or `oracle-gaps: done stopped (SIGINT)` | - Only two kinds of line have no prefix: the lines indented under a failing - baseline file (`failing:`, `law:`, `counterexample:`, `replay:`), and a - refusal's `refused:` and `fix:` block on stderr. No line is blank. The + Only these lines have no prefix: the lines indented under a failing + baseline file (`failing:`, `law:`, `counterexample:`, `replay:`), a + refusal's `refused:` and `fix:` block on stderr, `--help`'s usage text, + and lines that Node, V8, esbuild, or Vite print on the CLI's streams + (a warning, V8's out-of-memory block, esbuild's error block). The CLI + writes no blank line of its own. A path in a line, such as the output + directory, prints a line break or another control character as its + `\uXXXX` escape, so it cannot end the line. The done line is the last line of both stdout and stderr, once each, for every ending, and its status matches the exit code. A test's own output to the process's stdout and stderr goes to `test-output.log` in the output directory, which a note names; `summary.md` holds the report for reading. A run through the daemon prints the same lines, at the end of its check. - `--help` is not a check, so its usage text has no prefix. + `--help` is not a check, so its usage text has no prefix and no done + line. `--stop-daemon` prints nothing. For contributors: the `ORACLE_GAPS_TEST_` environment variables are test-only hooks for the CLI's own oracle, not settings for users. Each is inert unless @@ -168,11 +175,11 @@ agent. SIGABRT), the CLI writes `oracle-gaps: done error, the run's process exited with ` and exits 3; after an out-of-memory crash the line says to give Node more memory (`NODE_OPTIONS=--max-old-space-size=`) - or to run fewer `--contexts`. An internal error's own message lines - (`oracle-gaps internal error: …`) have no prefix. A config's syntax error + or to run fewer `--contexts`. An internal error prints one + `oracle-gaps: error` line with its message, its line breaks escaped, + and its stack goes to `error.log`. A config's syntax error is refused with its first error; a syntax error in a module the config - imports still lets esbuild print its own error block, which has no - prefix. + imports lets esbuild print its own error block before the refusal. Exit codes: 0 the check completed, whatever its gaps (its last line is `oracle-gaps: done completed, …`); 2 the run was refused, with `refused:` diff --git a/packages/oracles/README.md b/packages/oracles/README.md index d5fac0f..8b09416 100644 --- a/packages/oracles/README.md +++ b/packages/oracles/README.md @@ -29,4 +29,4 @@ Under the hook, each check also writes `check.pid` (the id of the process that r - For a settled or rejected batch: `after` (the sizes after its copies are retired), `copyNodes` (Vite module nodes that still name a copy, must be 0), and `nonCopyDup` (non-copy files with more than one module node in an environment, must be 0 beyond the measured plain-plus-`?raw` pair). - For a cut batch: `cut: true` and no `after`. Its context is replaced, not retired. -`ORACLE_GAPS_TEST_REJECT_BATCH` (a batch number from 1, unset in normal use) makes the gap CLI's n-th batch run reject, as a crash in Vitest would. It is a test-only fault: the batch's run completes, so its copies are in Vitest's and Vite's state, and then the run's promise rejects, which takes the same path a real crash takes. The run then ends as an internal error: exit 3, the done error line, and `error.log` in its output directory. The batch's copies are still retired and its retention line is still written. +`ORACLE_GAPS_TEST_REJECT_BATCH` (a batch number from 1, unset in normal use) makes the gap CLI's n-th batch run reject, as a crash in Vitest would. Its message holds a line break and a line after it that reads as a done line, so the CLI's ending must keep the message on its one error line. It is a test-only fault: the batch's run completes, so its copies are in Vitest's and Vite's state, and then the run's promise rejects, which takes the same path a real crash takes. The run then ends as an internal error: exit 3, the done error line, and `error.log` in its output directory. The batch's copies are still retired and its retention line is still written. diff --git a/packages/oracles/oracle-gaps/check.mjs b/packages/oracles/oracle-gaps/check.mjs index a295b38..631b5e8 100644 --- a/packages/oracles/oracle-gaps/check.mjs +++ b/packages/oracles/oracle-gaps/check.mjs @@ -55,6 +55,7 @@ import { import { baselineLines, blockedLines, + escapeControls, gapLine, progressLine, streamLine, @@ -191,7 +192,7 @@ function captureLines(capture, { partial = false } = {}) { const end = text.lastIndexOf(`\n`) + 1 if (!partial && end !== text.length) throw new Error( - `oracle-gaps internal error: the capture ${capture} ends in a row with no newline after its run finished`, + `the capture ${capture} ends in a row with no newline after its run finished`, ) return text.slice(0, end).split(`\n`).filter(Boolean) } @@ -2611,7 +2612,12 @@ export default async (env) => { }), ) if (existsSync(testOutput) && statSync(testOutput).size > 0) - log(streamLine(`note`, `test output in ${testOutput}`)) + log( + streamLine( + `note`, + `test output in ${escapeControls(posix(testOutput))}`, + ), + ) return renderStdout({ results, run: runIdentity, @@ -2620,7 +2626,7 @@ export default async (env) => { baseline: baselineFiles, config: options.config, paths: { - report: posix(join(options.out, `summary.md`)), + report: escapeControls(posix(join(options.out, `summary.md`))), results: join(options.out, `results.json`), out: options.out, }, diff --git a/packages/oracles/oracle-gaps/ending.mjs b/packages/oracles/oracle-gaps/ending.mjs index ff58f9b..f49adfd 100644 --- a/packages/oracles/oracle-gaps/ending.mjs +++ b/packages/oracles/oracle-gaps/ending.mjs @@ -6,15 +6,23 @@ // `refused: ` and `fix: `, and, when the run knows its // output directory, writes the refusal there as results.json and summary.md // and names its report there in its last line, `oracle-gaps: done refused`. -// Any other error is a bug in the CLI. It exits 3, -// says so, and keeps its stack in error.log, in the output directory when -// the run knows one. Each ending replaces the files of another ending that -// an earlier run left in the directory (check.mjs removes error.log when a -// check completes). +// Any other error is a bug in the CLI. It exits 3, says so in one +// `oracle-gaps: error` line, and keeps its stack in error.log, in the +// output directory when the run knows one. Every line an ending prints is +// a line of the stream (stream.mjs) or of the refusal block. Each ending +// replaces the files of another ending that an earlier run left in the +// directory (check.mjs removes error.log when a check completes). import { mkdirSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { posix, realPathOf } from './paths.mjs' +import { escapeControls, streamLine } from './stream.mjs' + +// A path as a line of the stream shows it: in forward slashes, with a line +// break or another control character as its escape, so that a path cannot +// end its line or forge another (the register's C entry "The internal-error +// line", 2026-11-16). +const shown = (path) => escapeControls(posix(path)) /** A problem the author can fix: its cause, and the one step that fixes it. */ export class Refusal extends Error { @@ -43,7 +51,7 @@ export function endRun(error, out = error?.out) { results, `Refused: ${message}\n\nFix: ${error.fix}\n`, ) - ? `oracle-gaps: done refused, report ${posix(join(out, `summary.md`))}` + ? `oracle-gaps: done refused, report ${shown(join(out, `summary.md`))}` : `oracle-gaps: done refused` return { exitCode: 2, stderr: `${[...block, done].join(`\n`)}\n`, done } } @@ -54,10 +62,13 @@ export function endRun(error, out = error?.out) { log = join(realPathOf(tmpdir()), `oracle-gaps-error-${process.pid}.log`) writeFileSync(log, stack) } - const done = `oracle-gaps: done error, log ${posix(log)}` + const done = `oracle-gaps: done error, log ${shown(log)}` + // The message stays one line: its own line breaks print as escapes. A + // message that already names the CLI does not name it twice. + const said = escapeControls(message.replace(/^oracle-gaps: /, ``)) return { exitCode: 3, - stderr: `oracle-gaps internal error: ${message}\nThis is a bug in oracle-gaps, not in your oracle. Its stack is in ${posix(log)}.\n${done}\n`, + stderr: `${streamLine(`error`, `${said}: a bug in oracle-gaps, not in your oracle; its stack is in ${shown(log)}`)}\n${done}\n`, done, } } diff --git a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs index 7150836..8837915 100644 --- a/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs +++ b/packages/oracles/oracle-gaps/gap-report-model-oracle.mjs @@ -4354,7 +4354,12 @@ const reachesRun = (history) => // (`summary`), one directive per gap class (`legend`), and each function's // heading over its gap lines (`function`) (the coordinator's decision of // 2026-11-12 on review F1: every line of either stream is a line of the -// stream). +// stream). An internal error says so on a line of its own kind (`error`, +// law 12) before its done line: P10 prefixes every line the CLI writes, +// and its declared exempt lines (v21.2 P10 and I3) do not name an internal +// error's lines. The kind is the done line's status word for exit 3 (v21.2 +// I7), and the line's form is the register's C entry "The internal-error +// line" (2026-11-16). const streamKinds = [ `config`, `note`, @@ -4366,6 +4371,7 @@ const streamKinds = [ `summary`, `legend`, `function`, + `error`, `done`, ] // The one decisive baseline line, before any mutant runs: every oracle @@ -5797,16 +5803,24 @@ function applyEdit(state, edit) { // exits 2 and prints one block on stderr with no stack frames: `refused: // `, then `fix: `. The directive is one next step, and it // offers no way around the fix (no "ignore it", no "mark it equivalent"). -// When the run knows its output directory, the block ends with `output: -// `, and the directory holds a results.json, `{ status: "refused", -// cause, directive }`, whose cause and directive are the block's, and a -// summary.md, and no error.log: every ending removes the other ending's +// When the run knows its output directory, its done line names the +// directory's summary.md (`done refused, report /summary.md`), and the +// directory holds a results.json, `{ status: "refused", cause, directive +// }`, whose cause and directive are the block's, and a summary.md, and no +// error.log: every ending removes the other ending's // files. Arguments the CLI cannot parse know their output directory only // when they name it (`--out`). // -// An internal error is a bug in the CLI. It exits 3, says so, and keeps the -// stack in an error.log rather than on stderr. No legal history reaches one, -// so this law's check judges refusals only (see each oracle's limits). +// An internal error is a bug in the CLI. It exits 3, says so in one +// `oracle-gaps: error` line on stderr and none on stdout, with the line +// breaks of its message and of its log's path escaped, and keeps the stack +// in an error.log rather than on stderr (the register's C entry "The +// internal-error line", 2026-11-16). No legal history reaches one; the +// end-to-end oracle's constructed rejected-batch history (a test-only +// fault) reaches it, and that oracle judges its exit, its error line, its +// error.log, the absence of stack frames on stderr, and the stream law (law +// 15) on both streams. This check judges refusals only (see each oracle's +// limits). /** * What a run that ended without completing printed and wrote, as the 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 0dcce7d..9f0e38d 100644 --- a/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs @@ -317,7 +317,10 @@ * run's output directory, which holds a results.json with status * `refused`, the same cause and directive, and a summary.md. A refusal * through the daemon ends the same way, in the output directory of the - * CLI that asked. + * CLI that asked. Any other error is an internal error, a bug in the + * CLI: it exits 3, says so in one `oracle-gaps: error` line on stderr + * with no stack frames, and keeps its stack in the error.log of the + * run's output directory (ending.mjs). * 13. **Stopping.** A run stopped by SIGTERM or SIGINT ends within 30 s, and * once it has ended no process it started is left: its Vitest workers, * as child processes or as threads, and the processes their tests start @@ -347,9 +350,8 @@ * run). An agent acts on a check's results as they stream, so every line * the CLI writes for the check starts with `oracle-gaps: ` and then its * kind: `config`, `note`, `baseline`, `blocked`, `progress`, `gap`, - * `busy`, or `done`. Only an indented line under a baseline failure, a - * refusal's `refused:` and `fix:` block, and a line Node writes for the - * process are not. The baseline ends with one decisive line before any + * `busy`, `error`, or `done`. Only the declared exempt lines below are + * not. The baseline ends with one decisive line before any * mutant runs: `oracle-gaps: baseline all oracle files pass`, or * `oracle-gaps: baseline of oracle files failed (provisional)`. * The stdout's baseline, blocked, and gap lines carry the same prefixes. @@ -364,8 +366,21 @@ * at its site, not counted here as a missing or extra line. * The run's last line is its done line: `completed, gaps[ * (provisional)], report ` on stdout, `refused[, report - * ]` after a refusal's block, or `stopped ()` - * after a stop. A check through the daemon streams the same lines. + * ]` after a refusal's block, `error, log ` after an internal error's one `error` line, or `stopped + * ()` after a stop. An `error` line is an internal error's one + * diagnostic (P10, one diagnostic per failure; the register's C entry + * "The internal-error line", 2026-11-16): a run that ends through its + * ending (`done error, log `) writes exactly one, on stderr, naming + * that log with its line breaks escaped, and every other run writes none. + * The law holds for every run, whatever its end: an internal error's + * lines are lines of the stream. The declared exempt lines (v21.2 P10, + * I3, R10; the register's M entries of 2026-11-16, "P10 exemptions + * ratified", "`--help` is exempt", and "Other tools' output is exempt") + * are the stdout summary (unused: the CLI prefixes it), refusal blocks, + * indented baseline lines under a prefixed head line, `--help`'s usage + * text, and the lines and blocks that Node, V8, esbuild, and Vite print; + * each is told by its own shape, and no other line is exempt. A check through the daemon streams the same lines. * * Authority: the maintainer's decisions in the gap-check design runs v11, v14, * and v19 (2026-11-04 and 2026-11-05; the design notes are kept by the project @@ -771,13 +786,27 @@ const retentionLinesOf = (file) => * Writes the fixture's files and runs the CLI on it. A file of an earlier * state that this state lacks is removed. */ +// A calibration's lines that another writer printed on the CLI's stderr +// (`foreign`), put before its last line, the done line, where a block that +// Node, V8, or esbuild prints comes before the CLI's own ending. Only the +// stream calibrations set it (streamCalibrations); with none, the stderr is +// read as the CLI wrote it. +function beforeLastLine(stderr, foreign) { + if (foreign === undefined) return stderr + const lines = `${stderr ?? ``}`.split(`\n`) + const last = lines.findLastIndex((line) => line !== ``) + lines.splice(last, 0, ...foreign) + return lines.join(`\n`) +} + function runCli(dir, files, how = {}) { writeFixture(dir, files) const before = new Set(filesUnder(dir)) const { args, out: outBase } = cliArgs(dir, files, how) // Each call has its own output directory: its retention lines are then its own, even when a - // daemon serves several checks of one test. - const out = `${outBase}-${++runSeq}` + // daemon serves several checks of one test. `outBreak` puts a line break in its name, where the + // platform allows one, so that a line that names the directory must escape it. + const out = `${outBase}-${++runSeq}${how.outBreak ? `\nbreak` : ``}` args[args.indexOf(`--out`) + 1] = out // The retention hook (ORACLE_GAPS_TEST_RETENTION): one line per batch, // written beside the run's own temporary files, not in the package. @@ -800,7 +829,7 @@ function runCli(dir, files, how = {}) { dir, out, child.status, - child.stderr, + beforeLastLine(child.stderr, how.foreign), how.cli ?? here, child.stdout, ) @@ -1164,34 +1193,86 @@ function namedScratch(text, names) { const streamedGap = /^oracle-gaps: gap (?:not-judged|extra-work|indeterminate|dead-code|outside-annotation|branch-never-taken|not-infected|not-observed|not-distinguished|unreached|random-only-kill|agreement-only-kill|unregistered-kill|framework-error|timeout|setup-error|crashed|does-not-apply|blocked) L(?:\d+|\?) (\S+) / +// The declared exempt lines that are not our own (v21.2 P10 and I3), each +// told by its own shape, never by its indentation alone: a block starts at +// a line that matches its `head` and goes on while its lines match its +// `body`. `blank` says that empty lines belong to it. +// - Under a baseline failure (`oracle-gaps: baseline fail …`), its indented +// detail lines (`failing:`, `law:`, `counterexample:`, `replay:`). +// - Node's warning, `(node:) …`, the frames that `--trace-warnings` +// adds under it (` at …`), and its hint, which starts `(Use` and names `node --trace-…`. +// - V8's fatal block, as Node prints it when the heap runs out: its +// banners (`<--- Last few GCs --->`, `<--- JS stacktrace --->`, `----- +// Native stack trace -----`, `==== JS stack trace ====`), its GC lines +// (`[:0x…] …`), `FATAL ERROR: …`, and its numbered frames, with +// empty lines between them. +// - esbuild's message block (`✘ [ERROR] …` or `▲ [WARNING] …`, `X` and `!` +// where it prints no symbols), with its indented location, code frame, and +// notes, and the empty lines between them. +// - Vite's own line (`[vite] …` or `[vite:] …`), with indented +// lines under it. +const v8Line = + /^(?:<--- .* --->|----- .* -----|==== .* =+|\[\d+:0x[0-9a-f]+\] .*|FATAL ERROR: .*|\s*\d+: .*|Security context: .*)$/ +const exemptBlocks = [ + { head: /^oracle-gaps: baseline fail /, body: /^ {2}\S/ }, + { head: /^\(node:\d+\) /, body: /^(?: {4}at \S|\(Use `node --)/ }, + { head: /^\(Use `node --/, body: /^$/ }, + { + head: /^(?:<--- Last few GCs --->|<--- JS stacktrace --->|FATAL ERROR: |----- Native stack trace -----)/, + body: v8Line, + blank: true, + }, + { + head: /^(?:✘|▲|X|!) \[(?:ERROR|WARNING)\] /, + body: /^\s+\S/, + blank: true, + }, + { head: /^\[vite(?::[\w:-]+)?\] /, body: /^\s+\S/ }, +] + /** * What law 15 judges of a run's stderr, as relations that do not depend on * the order in which its contexts finished: - * - `strays`: each line, once, that is neither a line of a stream kind - * (`oracle-gaps: `), an indented line under a baseline failure, a - * refusal's block (`refused:` up to its `fix:` line), nor a line Node - * writes for the process (a warning); + * - `strays`: each line, once, that is not a line of a stream kind + * (`oracle-gaps: `) and not one of P10's declared exempt lines + * (v21.2 P10 and I3; the register's M entries of 2026-11-16, "P10 + * exemptions ratified" and "Other tools' output is exempt"), each told by + * its own shape (`exemptBlocks`): an indented line under a baseline + * failure, a refusal's block (`refused:` up to its `fix:` line), a block + * that Node or V8 prints, or a block that esbuild or Vite prints. An + * empty line is a stray unless it lies in or right before such a block; + * the text after the last line break is no line; * - `verdicts`: the decisive baseline lines; * - `mutantBeforeVerdict`: whether a gap line, a count of judged mutants, * or a heartbeat that names a mutant came before the first verdict; - * - `last`: the last line, which ends a run that did not complete. + * - `last`: the last line, which ends a run that did not complete; + * - `errors`: how many internal error lines (`oracle-gaps: error `) it has, + * and `errorLogs`, the log each of them names (`its stack is in `). */ function streamOf(lines, name) { const kinds = new RegExp(`^oracle-gaps: (?:${streamKinds.join(`|`)}) `) const strays = new Set() + // The exempt block the line before belongs to, if any (exemptBlocks). + let block let inRefusal = false - for (const line of lines) { - if (line === ``) continue + const end = lines.findLastIndex((line) => line !== ``) + for (const [at, line] of lines.entries()) { + if (line === `` && at > end) continue if (line.startsWith(`refused: `)) inRefusal = true const ending = inRefusal if (line.startsWith(`fix: `)) inRefusal = false - if ( - ending || - kinds.test(line) || - line.startsWith(` `) || - /^\((?:node:\d+|Use `node)/.test(line) - ) + if (line === ``) { + // An empty line belongs to a block that holds empty lines, or comes + // right before the head of one (V8's fatal block starts so). + const next = lines.slice(at + 1).find((l) => l !== ``) ?? `` + const opens = exemptBlocks.find((b) => b.blank && b.head.test(next)) + if (ending || block?.blank || opens) continue + strays.add(`(an empty line)`) continue + } + if (!block?.body.test(line)) block = undefined + block ??= exemptBlocks.find((b) => b.head.test(line)) + if (ending || block || kinds.test(line)) continue strays.add(name(line).slice(0, 300)) } const verdict = (line) => baselineVerdict.test(line) @@ -1209,6 +1290,14 @@ function streamOf(lines, name) { last: name(lines.filter((line) => line !== ``).at(-1) ?? ``), // How many done lines the stream has: exactly one, its last. dones: lines.filter((line) => line.startsWith(`oracle-gaps: done `)).length, + // How many internal error lines: at most one, and only in a run that + // exits 3 (law 12). + errors: lines.filter((line) => line.startsWith(`oracle-gaps: error `)) + .length, + errorLogs: lines.flatMap((line) => { + const log = line.match(/^oracle-gaps: error .*; its stack is in (.*)$/) + return log ? [name(log[1])] : [] + }), // The notes, each once, named as the trace names paths, and with the // output directory's name left out: a cold run and a check through the // daemon name different ones. @@ -2101,9 +2190,17 @@ async function driver(plan, observe) { budget: plan.budget, cli: plan.cliPath === `spaced` ? copy : here, ...configArgs(plan), + // A rejected batch ends through the internal error's ending, the one ending a history reaches that + // names its log, so its output directory's name holds a line break where the platform allows one + // (not on win32): its error line and done line must escape it (the register's C entry "The + // internal-error line"). ...(plan.rejectBatch > 0 - ? { env: { ORACLE_GAPS_TEST_REJECT_BATCH: String(plan.rejectBatch) } } + ? { + env: { ORACLE_GAPS_TEST_REJECT_BATCH: String(plan.rejectBatch) }, + outBreak: process.platform !== `win32`, + } : {}), + foreign: plan.foreign, } const { replay, retention, checkPid, ...cli } = runCli( dir, @@ -2142,8 +2239,9 @@ async function driver(plan, observe) { // How many units were computed or reused says how the result was // produced, not what it is, so it is not observed. A rejected batch's run ends in an internal error: // the baseline lines printed before its batch come in no fixed order, so it observes its exit, its - // last line and the laws that judge the run before retention (the register: the order of streamed - // lines is not part of the contract). + // last line, the laws that judge the run before retention (the register: the order of streamed + // lines is not part of the contract), both streams as law 15 reads them (relations that do not + // depend on that order), and where its ending put its stack (law 12). observe( `cli`, plan.rejectBatch > 0 @@ -2155,6 +2253,11 @@ async function driver(plan, observe) { configLines: cli.configLines, strayWrites: cli.strayWrites, warnings: cli.warnings, + stream: cli.stream, + stdoutStream: cli.stdoutStream, + outDir: cli.outDir, + errorLog: cli.ending?.errorLog, + stackFrames: cli.ending?.stackFrames, } : { ...cli, evidence: undefined }, ) @@ -2185,6 +2288,10 @@ async function driver(plan, observe) { ) ) states.add(`a rejected batch retired its copies and logged them`) + // Law 12's internal error, where law 15 judges its lines: the run's own + // ending (ending.mjs), not a process the supervisor saw end. + if (cli.exit === 3 && cli.ending?.errorLog) + states.add(`a run ended in an internal error`) if (retention.length > 1) states.add(`a check that ran more than one batch`) if (tornRead && cli.reported) states.add(`a capture row read while the worker wrote it`) @@ -2902,12 +3009,10 @@ function check(plan, observations, expected) { `config`, { actual: cli.configLines, expected: expected.configLines }, ) - // A rejected batch's run ends with the internal error's lines, which are not stream lines: its ending is - // judged below, after retention (the constructed fault only). - const stream = - expected.rejectedBatch === undefined - ? streamBreach(`cli`, cli, expected, plan) - : undefined + // Law 15 holds for every run, an internal error's included: its error line and its done line are lines of + // the stream (v21.2 P10, I3, I7, R10). The rest of a rejected batch's ending is judged below, after + // retention. + const stream = streamBreach(`cli`, cli, expected, plan) if (stream) return stream // Bounded retention (retentionBreaches): every call's lines are its own // check's, or a daemon's that the driver killed, one per batch, and each @@ -2926,7 +3031,9 @@ function check(plan, observations, expected) { { actual: breached.map((o) => [o.checkpoint, o.value]), expected: [] }, ) // A rejected batch (the constructed fault) ends the run as an internal error: exit 3 and its done line - // (ending.mjs). Retention was judged above, so only the ending is judged here, and the run is then done. + // (ending.mjs), no stack frame on stderr, and its stack in the output directory's error.log (law 12). + // Retention and the stream law, with its one error line that names that log (endsBreach), were judged + // above, so only the rest of the ending is judged here, and the run is then done. if (expected.rejectedBatch !== undefined) { if ( cli.exit !== 3 || @@ -2938,6 +3045,12 @@ function check(plan, observations, expected) { `the rejected batch owes exit 3 and an internal error's done line on both streams, got exit ${cli.exit} ending stdout with ${JSON.stringify(cli.lastLine)} and stderr with ${JSON.stringify(cli.stderrLast)}`, `internal error`, ) + if (cli.stackFrames || !cli.errorLog) + return violation( + `cli`, + `the rejected batch owes its stack in error.log and none on stderr, got ${cli.stackFrames ? `stack frames on stderr` : `no stack frames on stderr`} and ${cli.errorLog ? `an` : `no`} error.log`, + `internal error`, + ) return pass } // Through the daemon, each check streams the same kinds of line, and a @@ -3467,11 +3580,30 @@ const showsCode = (shown, text) => { ) } +// A path as a line of the stream spells it: forward slashes, and each +// control character, a line break included, as its `\uXXXX` escape, so a +// path stays on its line (the register's C entry "The internal-error line", +// 2026-11-16). +const lineSpelling = (path) => + path + .replaceAll(`\\`, `/`) + .replace( + /[\u0000-\u001f\u007f\u2028\u2029]/g, + (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, `0`)}`, + ) + /** * What law 15 judges of every run, on both streams, whatever its outcome: * no stray line, and exactly one done line, which ends each stream, the * same on both, of the kind its exit status says (0 completed, 2 refused, - * 3 error, and a signal's code stopped). Undefined when it holds. + * 3 error, and a signal's code stopped). And law 12's one diagnostic per + * failure (v21.2 P10 and R10; the register's C entry "The internal-error + * line", 2026-11-16): an internal error that ends through its own ending, + * whose done line names its log (`done error, log `), wrote exactly one + * error line, on stderr, which names the same log, the error.log of the + * run's output directory when the run names one; every other run, the + * supervisor's own exit 3 included (`done error, the run's process exited + * …`), wrote none. Undefined when it holds. */ function endsBreach(run) { const streams = [ @@ -3481,7 +3613,7 @@ function endsBreach(run) { for (const [where, stream] of streams) if (stream.strays.length > 0) return { - difference: `the run wrote a line on ${where} that is not a line of the stream: ${stream.strays[0]}`, + difference: `the run wrote ${stream.strays.length} lines on ${where} that are not lines of the stream: ${JSON.stringify(stream.strays)}`, extra: { actual: stream.strays, expected: [] }, } for (const [where, stream] of streams) @@ -3502,6 +3634,23 @@ function endsBreach(run) { return { difference: `the run exited ${run.exit} and its done line says ${kind}, not ${owed}`, } + const logged = run.stream.last.match(/^oracle-gaps: done error, log (.*)$/) + const owedLogs = logged ? [logged[1]] : [] + if ( + JSON.stringify(run.stream.errorLogs) !== JSON.stringify(owedLogs) || + run.stream.errors !== owedLogs.length || + run.stdoutStream.errors !== 0 + ) + return { + difference: `the run ended with ${JSON.stringify(run.stream.last)} and wrote ${run.stream.errors} internal error lines on stderr (naming ${JSON.stringify(run.stream.errorLogs)}) and ${run.stdoutStream.errors} on stdout, owed ${owedLogs.length} on stderr naming ${JSON.stringify(owedLogs)} and none on stdout`, + } + if (logged && run.outDir !== undefined) { + const log = `${lineSpelling(run.outDir)}/error.log` + if (logged[1] !== log) + return { + difference: `the run's internal error names its log as ${JSON.stringify(logged[1])}, owed ${JSON.stringify(log)}, its output directory's error.log`, + } + } return undefined } @@ -4126,6 +4275,69 @@ calibrations.push( }, ) +// Law 15's exempt lines are told by their own shapes (exemptBlocks): another +// writer's block on the CLI's stderr is no stray, and the CLI's own line with +// no prefix is one, indented or not. Each calibration runs the rejected-batch +// history with lines that another writer printed before its done line +// (`foreign`, beforeLastLine) and one line of our own with no prefix, and the +// stream law must name that line alone as a stray: so the block's lines are +// exempt, and our line is not (the register's M entries of 2026-11-16, "P10 +// exemptions ratified" and "Other tools' output is exempt"). +const ownLine = `judged 25 of 100 mutants` +const foreignBlocks = { + // V8's fatal block, as Node 22 prints it when the heap runs out. + [`a V8 fatal block`]: [ + ``, + `<--- Last few GCs --->`, + ``, + `[4242:0x7f8b5c008000] 1234 ms: Mark-Compact 2040.5 (2083.4) -> 2039.9 (2083.4) MB, pooled: 0 MB, 1033.97 / 0.00 ms (average mu = 0.112, current mu = 0.029) allocation failure; scavenge might not succeed`, + ``, + ``, + `<--- JS stacktrace --->`, + ``, + `FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory`, + `----- Native stack trace -----`, + ``, + ` 1: 0x1001b3a7c node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/local/bin/node]`, + ` 2: 0x10036d2e4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node]`, + ], + // A warning under --trace-warnings: its frames instead of its hint. + [`a traced warning's frames`]: [ + `(node:4242) Warning: a warning a test raised`, + ` at emitWarning (node:internal/process/warning:190:3)`, + ` at file:///tmp/package/tests/a.test.ts:3:9`, + ], + // esbuild's block for a syntax error in a module the config imports, as + // Vite 7.3.7 with esbuild 0.28.2 prints it. + [`an esbuild block`]: [ + `✘ [ERROR] Unexpected end of file`, + ``, + ` helper.ts:2:0:`, + ` 2 │ `, + ` ╵ ^`, + ``, + ], +} +calibrations.push( + ...Object.entries(foreignBlocks).map(([block, lines]) => ({ + name: `${block} beside our own line with no prefix`, + law: `greppable stream`, + difference: `that are not lines of the stream: ${JSON.stringify([ownLine])}`, + history: { constructed: `a batch whose run rejects` }, + driver: (plan, observe) => + driver({ ...plan, foreign: [ownLine, ...lines] }, observe), + })), + { + // Indentation alone exempts no line: only a baseline failure's details. + name: `our own indented line with no prefix`, + law: `greppable stream`, + difference: `that are not lines of the stream: ${JSON.stringify([` ${ownLine}`])}`, + history: { constructed: `a batch whose run rejects` }, + driver: (plan, observe) => + driver({ ...plan, foreign: [` ${ownLine}`] }, observe), + }, +) + // 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 @@ -4349,6 +4561,7 @@ const required = [ `edit lazy changed the cold result`, `a lazy edit changed the cold result after a batch was cut off`, `a rejected batch retired its copies and logged them`, + `a run ended in an internal error`, ] // The faults the CLI analyzes anyway: a package's TypeScript is no input. const analyzedFaults = [`noTypescript`, `apiLessTypescript`] @@ -4435,6 +4648,7 @@ const separate = [ `edit lazy changed the cold result`, `a lazy edit changed the cold result after a batch was cut off`, `a rejected batch retired its copies and logged them`, + `a run ended in an internal error`, ] // A stop by SIGTERM exists only where Node can deliver it: on win32 kill is // TerminateProcess, so there the stop law is judged by SIGINT (the test stop @@ -4557,7 +4771,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. The one internal error a history reaches is the constructed rejected-batch history (rejectBatch, a test-only fault that rejects a batch's run after its copies are in Vitest's and Vite's state). Its run is judged in this order: the output namespace, process warnings, and config lines, as for any run; then bounded retention, which owes the rejected batch's own line with its state after retirement; then exit 3 with an internal error's done line last on both streams. The stream law is not applied to it, and the stack in its error.log is not judged. Bounded retention reads the hook's lines (retention-hook.mjs). Its count of one line per batch (runner law L2) rests on the index the hook takes when a batch starts, so a CLI that skipped a batch's index and its line together, or that omitted only the line of a check's last batch, keeps the indices 0..n-1 and is not seen; a check that ended before its report (the rejected batch, a stopped run) and a daemon the driver killed are judged for at most one line per index, since the batches they were running at their end owe none. A line's process is told by check.pid, which the check writes, and the driver itself knows only the daemon it killed. The cold store's law (held) counts the entries given to the store's put that a full collection leaves reachable, so a store that kept only a part of an entry (its unit without the entry) is not seen; staleOpen reads Vitest's own close state (closingPromise, set when close starts), so a close that starts and never resolves is the runner oracle's (L8); and a context replaced after a check's last batch is observed only by a later check's first batch through the daemon. 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. 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; probe code is never work (maintainer decision, 2026-11-16), so the model and the capture count no probe-only site, and only a constructed history (a probe branch under a generated test's work bound) reaches a probe branch beside a bound: the fixed seeds' generated histories reach neither that state nor \`killed by a work bound in a generated function\`, which stays measured; work counts are observed only through a bound's ratio and a rise, never as numbers (v21.2 O1), so a counter that skips every site on a probe's line, which drops only the condition sites of an elseIf that run once on both sides, survives (mutant M6, equivalent under these observations), while one that skips every site of a function that holds probe code is killed (M7), 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: `Law 12 judges refusals. The one internal error a history reaches is the constructed rejected-batch history (rejectBatch, a test-only fault that rejects a batch's run after its copies are in Vitest's and Vite's state). Its run is judged in this order: the output namespace, process warnings, and config lines, as for any run; then bounded retention, which owes the rejected batch's own line with its state after retirement; then the stream law (law 15) on both streams, as for any run, so its error line and its done line carry the prefix, and no other line does not, which the state \`a run ended in an internal error\` declares; then exit 3 with an internal error's done line last on both streams, no stack frame on stderr, and an error.log in its output directory. What the error.log's stack says is not judged. An internal error that no fault constructs is a completion failure, reported before the stream law; an internal error through the daemon is reached by no history, and its ending is the same function's (endRun), by inspection. The internal error's lines follow the register's C entry "The internal-error line" (2026-11-16): the general law (endsBreach) owes every run that ends through endRun one error line on stderr naming the done line's log, the output directory's error.log, and none on stdout, and owes the supervisor's own exit 3 none. The message's escape is witnessed by the fault's message, which holds a line break and a forged done line after it; the log path's escape only on POSIX, where the rejected batch's output directory holds a line break (a name on win32 cannot). Paths in a completed run's lines (the results note, the done line's report, the test-output note) are escaped the same way, by inspection: no completed history names such a directory. P10's exempt lines (v21.2 P10 and I3) are read by their own shapes (exemptBlocks), never by indentation alone: a baseline failure's indented details, a refusal's block, Node's warning with its \`--trace-warnings\` frames and its hint, V8's fatal block, esbuild's message block, and Vite's own \`[vite]\` line. The V8, traced-warning, and esbuild blocks are calibrated beside our own line with no prefix (the stream calibrations put them before the rejected-batch run's done line, and the law must name our line alone); no generated history prints any of them or a Vite line, and a shape of those tools that exemptBlocks does not name is read as a stray. The stdout summary's exemption is unused and not exercised: the CLI prefixes every summary line (its summary, legend, and function kinds). \`--help\` prints its usage text with no prefix and no done line, exempt by the register's M entry "\`--help\` is exempt" (2026-11-16), and the static oracle's Help law owes exactly that text; \`--stop-daemon\` prints nothing and exits 0, read the same way as a command outside the run protocol (C, pending ratification), and this oracle runs it without observing its streams. A syntax error in a module that the config imports lets the esbuild that Vite bundles configs with print its block before the refusal (trace, Vite 7.3.7, esbuild 0.28.2: \`✘ [ERROR] Unexpected end of file\`, an empty line, \` helper.ts:2:0:\`, the code frame, then the refused block): its lines are exempt by the register's M entry "Other tools' output is exempt" (2026-11-16), the refusal and the done line around them keep the prefix, and no history generates it. Bounded retention reads the hook's lines (retention-hook.mjs). Its count of one line per batch (runner law L2) rests on the index the hook takes when a batch starts, so a CLI that skipped a batch's index and its line together, or that omitted only the line of a check's last batch, keeps the indices 0..n-1 and is not seen; a check that ended before its report (the rejected batch, a stopped run) and a daemon the driver killed are judged for at most one line per index, since the batches they were running at their end owe none. A line's process is told by check.pid, which the check writes, and the driver itself knows only the daemon it killed. The cold store's law (held) counts the entries given to the store's put that a full collection leaves reachable, so a store that kept only a part of an entry (its unit without the entry) is not seen; staleOpen reads Vitest's own close state (closingPromise, set when close starts), so a close that starts and never resolves is the runner oracle's (L8); and a context replaced after a check's last batch is observed only by a later check's first batch through the daemon. 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. 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; probe code is never work (maintainer decision, 2026-11-16), so the model and the capture count no probe-only site, and only a constructed history (a probe branch under a generated test's work bound) reaches a probe branch beside a bound: the fixed seeds' generated histories reach neither that state nor \`killed by a work bound in a generated function\`, which stays measured; work counts are observed only through a bound's ratio and a rise, never as numbers (v21.2 O1), so a counter that skips every site on a probe's line, which drops only the condition sites of an elseIf that run once on both sides, survives (mutant M6, equivalent under these observations), while one that skips every site of a function that holds probe code is killed (M7), 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 @@ -5971,7 +6185,10 @@ oracleProperty({ // internal error, exit 3 and its done error line (ending.mjs). The batch's copies are retired, and its // retention line is written with its state after retirement (the bounded retention law). name: `a batch whose run rejects`, - enters: [`a rejected batch retired its copies and logged them`], + enters: [ + `a rejected batch retired its copies and logged them`, + `a run ended in an internal error`, + ], build: (generated) => ({ ...generated, functions: [[{ kind: `push`, quote: `'` }]], diff --git a/packages/oracles/oracle-gaps/gap-report-static-oracle.property.test.mjs b/packages/oracles/oracle-gaps/gap-report-static-oracle.property.test.mjs index 5ccab44..e8d30d9 100644 --- a/packages/oracles/oracle-gaps/gap-report-static-oracle.property.test.mjs +++ b/packages/oracles/oracle-gaps/gap-report-static-oracle.property.test.mjs @@ -44,7 +44,10 @@ * the whole mutant list before any selection, so a partial run and a full * run agree on every key they share. * - **Help.** `index.mjs --help` prints the usage text (args.mjs) for any - * package directory, with no `--package`, and exits 0. + * package directory, with no `--package`, and exits 0. The usage text is + * plain, with no `oracle-gaps:` prefix and no done line: `--help` is an + * exempt line of P10 (the register's M entry "`--help` is exempt", + * 2026-11-16), so this law owes exactly that text on stdout. * - **Report-shaped ending** (law 12 of the end-to-end oracle, stated in * gap-report-model-oracle.mjs). Bad arguments refuse the run through the * real CLI, with or without `--daemon`: it exits 2 and prints a @@ -1444,7 +1447,7 @@ oracleProperty({ law: { statement: `The gap report's static half keeps every Svelte rune where Svelte allows it, gives each run's default output a directory of its own under its package's state, so runs of one package and of two packages never collide, enumerates the promised operator mutants, marks exactly the probe-only code, refuses broken owns declarations, reads no owns from an assertion's arguments (an expect chain, Vitest's assert or chai, or expectTypeOf), gives each function the owners whose call trees contain it, anchors each mutant's key, keeps keys, probe marks, and ownership stable under unrelated edits, and keeps each derived class's \`super(...)\` call unconditional. In a derived constructor, no mutant site lies before the first statement that calls super or inside that statement (an arrow inherits super, so an arrow's call counts), and statements after it keep their sites. So no mutant, when active, prevents or delays the super call. With no mutant active the instrumented class behaves as its source does, and under every mutant the constructor completes with its base class's tag unless an early return ends it first. Bad arguments (a missing --package or --source, a --package that does not exist, a source outside the package, a bad --env-prefix, --seed, count, or limit, an unknown --pool, a --mutants directory that does not exist, an option with no value, an unknown option, one long past a pipe's buffer included, a --source that is missing or is a directory, a --config that is missing or is a directory, and a --mutants file that is not JSON, lacks a field, or repeats an id) refuse the real CLI, cold or with --daemon, with exit 2 and a refused: block that names the cause, then one fix: directive that offers no way around the fix, and no stack trace, and a last line oracle-gaps: done refused, which names the refusal's summary.md with --out; with --out, the refusal replaces an earlier run's results.json there and removes its error.log.`, authority: `The maintainer's gap-check decisions in design runs v11, v14, and v19 (2026-11-04 and 2026-11-05), as for oracle-gaps.report; the frozen design's plan for an oracle over the checker's pure core (v19 P10, F4); the maintainer's few-seconds budget for an incremental test run (2026-11-05); for rune placement, Svelte 5's placement rule for runes (state_invalid_placement, effect_invalid_placement) and the maintainer's report of svelte-db's useLiveQuery.svelte.ts failing to compile under instrumentation (2026-11-08); for derived classes, the gap report's contract that instrumentation with no mutant active does not change behavior and that a mutant is a legal program variant (the operator contract in schemata.mjs), ECMAScript's rule that a derived constructor calls \`super\` before it reads \`this\` and before it returns, the maintainer's report of TanStack DB's subscription.ts failing with no mutant active (G11, 2026-11-09), and the maintainer's decision of 2026-11-09 on the derived constructor's site region (every shape of super, including an early return before it, is covered by the one rule); for the report-shaped ending, the maintainer's decision of 2026-11-10 ("we should never just crash -- the cli should also return something sensible") and the usage text in args.mjs, the CLI's documented interface; for the done line, the maintainer's request for a greppable stream (2026-11-12, relayed by the coordinator).`, - limits: `The grammar and model of oracle-gaps.report, with its limits. Outcomes that need test runs, and the failing-owner refusal, belong to oracle-gaps.report. Same-named functions, accessors, and field arrows are judged for ownership only; runes only as $state, $state.raw, $derived, $derived.by, $effect, and $effect.pre in a .svelte.ts module, judged by a restatement of Svelte's placement rule rather than the compiler. A derived class is judged in this oracle's in-process run and in the end-to-end oracle's static half: the end-to-end oracle instruments its file and judges its sites as unowned, but no test imports or constructs the class, so no test runs it. The in-process run transpiles the file to CommonJS at ES2022; other downlevel targets and Vitest's own transform are not exercised. The mutant switch (switchFor) is a hand copy of the switch's contract in schemata.mjs, not the capture setup's runtime: the capture setup imports Vitest and installs timers and globals when it loads, so it cannot run in-process. The derived grammar has one derived class per history, with parameter properties, a field, statements before and after super, an early return before it, and the four forms of the super call (a statement, an arrow argument, and the right operand of \`&&\` or \`||\`). It has no super call in a method, a nested class, or a \`super.method()\` call, and no default parameter. Module-level data is four \`const\` declarations of the main source (an object literal, an array that holds \`devBuild\` as a value, a boolean, and an object of two methods), and a top-level loop of the \`..gen/\` file whose variable is no unit, each read in place by generated or witness functions or named by an owns entry; data imported from another file, \`let\` data, enums, and default exports are not generated. A destructured declaration (\`const { a } = obj\`) stays \`\`, and a function made by a call (\`const h = memo(() => …)\`) now belongs to the unit \`h\`; neither is generated. Unnamed exports are seven files of a helper and one exported function each (an ES default function, a default arrow bare and in parentheses, CommonJS \`module.exports\` alone and chained through \`exports\`, \`exports.default\`, and \`exports.run\`), each calling its helper, owned through an owns entry that names them or through an importer that imports and calls each but \`exports.default\` (a default import of a CommonJS module resolves to the module, not its \`default\`, so a reference to \`exports.default\` through an import is not judged). TypeScript's \`export = \` is named \`default\` by the same rule but is not generated, nor is \`export default class {}\` or \`module.exports = { ... }\` (whose methods are named by their properties). A mutant of these forms was keyed \`\` before and is keyed \`default\` (or its export's name) now: a one-time change of saved keys. A method that module data holds references nothing, so whether a method's references stay out of the declaration's tree is not judged. The ending law is judged here only for argument refusals, one fault per history; refusals from the analysis and the runner, and the daemon's own path, are the end-to-end oracle's. No legal history reaches an internal error, so its shape (exit 3, the stack in error.log) is not judged; a calibration shows that the check rejects a stack trace on stderr.`, + limits: `The grammar and model of oracle-gaps.report, with its limits. Outcomes that need test runs, and the failing-owner refusal, belong to oracle-gaps.report. Same-named functions, accessors, and field arrows are judged for ownership only; runes only as $state, $state.raw, $derived, $derived.by, $effect, and $effect.pre in a .svelte.ts module, judged by a restatement of Svelte's placement rule rather than the compiler. A derived class is judged in this oracle's in-process run and in the end-to-end oracle's static half: the end-to-end oracle instruments its file and judges its sites as unowned, but no test imports or constructs the class, so no test runs it. The in-process run transpiles the file to CommonJS at ES2022; other downlevel targets and Vitest's own transform are not exercised. The mutant switch (switchFor) is a hand copy of the switch's contract in schemata.mjs, not the capture setup's runtime: the capture setup imports Vitest and installs timers and globals when it loads, so it cannot run in-process. The derived grammar has one derived class per history, with parameter properties, a field, statements before and after super, an early return before it, and the four forms of the super call (a statement, an arrow argument, and the right operand of \`&&\` or \`||\`). It has no super call in a method, a nested class, or a \`super.method()\` call, and no default parameter. Module-level data is four \`const\` declarations of the main source (an object literal, an array that holds \`devBuild\` as a value, a boolean, and an object of two methods), and a top-level loop of the \`..gen/\` file whose variable is no unit, each read in place by generated or witness functions or named by an owns entry; data imported from another file, \`let\` data, enums, and default exports are not generated. A destructured declaration (\`const { a } = obj\`) stays \`\`, and a function made by a call (\`const h = memo(() => …)\`) now belongs to the unit \`h\`; neither is generated. Unnamed exports are seven files of a helper and one exported function each (an ES default function, a default arrow bare and in parentheses, CommonJS \`module.exports\` alone and chained through \`exports\`, \`exports.default\`, and \`exports.run\`), each calling its helper, owned through an owns entry that names them or through an importer that imports and calls each but \`exports.default\` (a default import of a CommonJS module resolves to the module, not its \`default\`, so a reference to \`exports.default\` through an import is not judged). TypeScript's \`export = \` is named \`default\` by the same rule but is not generated, nor is \`export default class {}\` or \`module.exports = { ... }\` (whose methods are named by their properties). A mutant of these forms was keyed \`\` before and is keyed \`default\` (or its export's name) now: a one-time change of saved keys. A method that module data holds references nothing, so whether a method's references stay out of the declaration's tree is not judged. The ending law is judged here only for argument refusals, one fault per history; refusals from the analysis and the runner, and the daemon's own path, are the end-to-end oracle's. No legal history reaches an internal error, so its shape (exit 3, the stack in error.log) is not judged; a calibration shows that the check rejects a stack trace on stderr. \`--help\` prints its usage text with no prefix and no done line, which the register's M entry "\`--help\` is exempt" (2026-11-16) adds to P10's exemptions, and this oracle owes exactly that text; \`--stop-daemon\`, read the same way as a command outside the run protocol (C, pending ratification), prints nothing and exits 0, which no oracle judges here (the end-to-end oracle runs it and does not observe its streams).`, }, histories: { arbitrary: argumentHistories, diff --git a/packages/oracles/oracle-gaps/report.mjs b/packages/oracles/oracle-gaps/report.mjs index 34858c4..17e746c 100644 --- a/packages/oracles/oracle-gaps/report.mjs +++ b/packages/oracles/oracle-gaps/report.mjs @@ -468,7 +468,9 @@ export function renderStdout({ `left out, failing with no mutant active: ${excluded.join(`, `)}`, ), ) - lines.push(streamLine(`note`, `results ${posix(paths.results)}`)) + lines.push( + streamLine(`note`, `results ${escapeControls(posix(paths.results))}`), + ) // The last line says the check ran to its end, how many gaps it found, // and where its full report is (G6, and the stream's done line): exit 0 // means the run completed, not that it found none. diff --git a/packages/oracles/oracle-gaps/retention-hook.mjs b/packages/oracles/oracle-gaps/retention-hook.mjs index 0061e63..a6557d8 100644 --- a/packages/oracles/oracle-gaps/retention-hook.mjs +++ b/packages/oracles/oracle-gaps/retention-hook.mjs @@ -162,8 +162,12 @@ export function retentionHook(session) { fault(batch, running) { return batch.index + 1 === rejected ? running.then(() => { + // Its message holds a line break and, after it, a line that + // reads as a done line: the ending must keep the message on its + // one error line (the register's C entry "The internal-error + // line"), so the oracle sees a message that is not escaped. throw new Error( - `oracle-gaps test fault: batch ${batch.index + 1} rejected`, + `oracle-gaps test fault: batch ${batch.index + 1} rejected\noracle-gaps: done completed, 0 gaps, report forged`, ) }) : running diff --git a/packages/oracles/oracle-gaps/stream.mjs b/packages/oracles/oracle-gaps/stream.mjs index bae8a95..280bc7f 100644 --- a/packages/oracles/oracle-gaps/stream.mjs +++ b/packages/oracles/oracle-gaps/stream.mjs @@ -8,10 +8,12 @@ // // Every line the CLI writes for a check starts with `oracle-gaps: ` and // then its kind: `config`, `note`, `baseline`, `blocked`, `progress`, `gap`, -// `busy`, or `done` (the maintainer's request of 2026-11-12: an agent acts -// on the results as they stream, and one `grep '^oracle-gaps: '` finds -// them, on stdout and stderr alike). Only the indented lines under a -// baseline failure, and a refusal's `refused:` and `fix:` block, are not. +// `busy`, `error` (an internal error, ending.mjs), or `done` (the +// maintainer's request of 2026-11-12: an agent acts on the results as they +// stream, and one `grep '^oracle-gaps: '` finds them, on stdout and stderr +// alike). Only the indented lines under a baseline failure, a refusal's +// `refused:` and `fix:` block, `--help`'s usage text, and what Node, V8, +// esbuild, or Vite print are not. /** A line of the stream: its kind after the prefix, then its text. */ export const streamLine = (kind, text) => `oracle-gaps: ${kind} ${text}` diff --git a/packages/oracles/scripts/e2e-shards.mjs b/packages/oracles/scripts/e2e-shards.mjs index 2c1b72d..30f2d96 100644 --- a/packages/oracles/scripts/e2e-shards.mjs +++ b/packages/oracles/scripts/e2e-shards.mjs @@ -174,6 +174,11 @@ export const shards = { `fixed seed 20261105: a batch whose run rejects`, `random seed: a batch whose run rejects`, `determinism: constructed history: a batch whose run rejects`, + // The stream calibrations: two runs of the rejected batch each. + `calibration: a V8 fatal block beside our own line with no prefix`, + `calibration: a traced warning's frames beside our own line with no prefix`, + `calibration: an esbuild block beside our own line with no prefix`, + `calibration: our own indented line with no prefix`, `random seed: a .ts config in a package with no module type that calls require`, `random seed: a declaration fault: configThrows`, `random seed: a declaration fault: noTypescript`,