Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/oracles/oracle-gaps/constructed-order.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"an authored mutant's failing-law no-progress cut blocks it",
"an authored mutant's failing-law spin cut blocks it",
"a behavioral kill decides before a later owner's copy passes the work budget",
"an unregistered soft verdict before a later calibration spin survives the cut"
"an unregistered soft verdict before a later calibration spin survives the cut",
"a test edits the helper it read twice, during checks through the daemon"
]
}
43 changes: 33 additions & 10 deletions packages/oracles/oracle-gaps/gap-report-model-oracle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5858,6 +5858,10 @@ function blockingOf(plan) {
* mid-run test is the baseline's passing test (law 14): its file reads the
* edited text only after the edit lands, so a later check may see it fail;
* the model follows the baseline here, as it does for the other baseline counts.
* After any landed edit, an odd or even number of them (`midrunFrom`), the
* test fails in every later check. The model predicts only the first state,
* where no edit has landed, and law 9 compares each later check with a cold
* run of its own state.
*
* Load reach goes to every test of an owner file that imports the module
* (M 2026-11-06). A file imports it only when a plan test calls a function of
Expand Down Expand Up @@ -6482,7 +6486,7 @@ const dataReads = {
],
}

function oracleTestFile(plan, file) {
function oracleTestFile(plan, file, state = undefined) {
const sites = sitesOf(plan)
const entries = [
...(plan.wholeFile === file ? [spell(SOURCE, plan.ownsSpelling)] : []),
Expand Down Expand Up @@ -6921,18 +6925,23 @@ function oracleTestFile(plan, file) {
// helper, or the data file, with that value and marks the edit done, so
// every later run of it, in this check or another, changes nothing. It
// calls nothing of the source under test, so no mutant reaches it. In
// file b it first reads what it edits and fails unless the helper is
// strict or the data open, as in the history's first state: the run that
// lands the edit passes, and every run that reads the edited text fails,
// so a run stored under the edited text with the old verdict shows in
// the baseline (review of #55, F1).
// file b it first reads what it edits and fails unless the helper, or the
// data's `open`, holds what it held before the latest mid-run edit
// (`midrunFrom`; before any edit, the history's first state: strict, open):
// the run that lands the edit passes, and every run that reads the edited
// text fails, so a run stored under the edited text with the old verdict
// shows in the baseline (review of #55, F1). A second mid-run edit, or one
// after the helper edit, starts from an edited text, which a guard of the
// first state would fail on, so its edit would never land (#165).
const midrunRead =
plan.midrunTarget === `data` ? `(await readData()).open` : `strict`
if (plan.midrun && file === plan.midrunBy)
out.push(
`test('${MIDRUN_EDITORS[plan.midrunTarget].test}', async () => {`,
...(file === `a`
? [` void strictAtLoad`]
: [
` if (!(${plan.midrunTarget === `data` ? `(await readData()).open` : `strict`})) throw new Error('${MIDRUN_EDITORS[plan.midrunTarget].message}')`,
` if (${(state?.midrunFrom ?? true) ? `!(${midrunRead})` : midrunRead}) throw new Error('${MIDRUN_EDITORS[plan.midrunTarget].message}')`,
]),
// The marker sits in the run's own session directory, beside the
// runner's harness (the worker's first setup file), which is no input
Expand Down Expand Up @@ -7171,6 +7180,10 @@ const initialState = (plan) => ({
dataOpen: true,
// How many mid-run edits have landed (`midrun`).
midruns: 0,
// What the mid-run edit's target held before the latest one landed, which
// file b's editing test requires (`oracleTestFile`); before any, the
// first state's.
midrunFrom: true,
seed: 1,
// Whether the check's `--config` names the second config (`altConfig`).
altConfig: false,
Expand Down Expand Up @@ -7607,7 +7620,7 @@ function fixtureFiles(plan, state = initialState(plan)) {
].join(`\n`),
}
for (const file of oracleFilesOf(plan))
files[`tests/${file}.test.ts`] = oracleTestFile(plan, file)
files[`tests/${file}.test.ts`] = oracleTestFile(plan, file, state)
// Each mid-run edit changes file a's own text too (a count of them), so
// the daemon runs file a's tests again in the check the edit lands in,
// instead of reusing their evidence: the marker sits in the daemon's
Expand Down Expand Up @@ -7771,8 +7784,18 @@ function applyEdit(state, edit) {
if (edit === `helper`) return { ...state, strict: !state.strict }
if (edit === `midrun`)
return midrunTargetOf(state.history) === `data`
? { ...state, dataOpen: !state.dataOpen, midruns: state.midruns + 1 }
: { ...state, strict: !state.strict, midruns: state.midruns + 1 }
? {
...state,
dataOpen: !state.dataOpen,
midruns: state.midruns + 1,
midrunFrom: state.dataOpen,
}
: {
...state,
strict: !state.strict,
midruns: state.midruns + 1,
midrunFrom: state.strict,
}
if (edit === `lazy`) return { ...state, lazyOpen: !state.lazyOpen }
if (edit === `fsData`) return { ...state, dataOpen: !state.dataOpen }
if (edit === `seed`) return { ...state, seed: state.seed === 1 ? 2 : 1 }
Expand Down
409 changes: 387 additions & 22 deletions packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs

Large diffs are not rendered by default.

Loading
Loading