Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
d2f5242
ci: add a non-blocking Windows job for the oracle framework and gap CLI
KyleAMathews Nov 13, 2026
0fc897b
ci(windows): diagnostic split of the fast suites, fixture package.json
KyleAMathews Nov 13, 2026
72b9495
ci(windows): diagnostic replay, error-log dump, and discovered-config…
KyleAMathews Nov 13, 2026
dacfb88
fix(oracle-gaps): one path rule for Windows, and shell-aware replay l…
KyleAMathews Nov 13, 2026
8d96432
test: portable npm spawns, a segment rule for production files, nativ…
KyleAMathews Nov 13, 2026
ef9205d
ci(windows): sharded Windows jobs in place of the diagnostic ones
KyleAMathews Nov 13, 2026
8d2d037
fix(oracle-gaps): give TypeScript and the owner map one spelling of a…
KyleAMathews Nov 13, 2026
29c6959
ci(windows): P10 done-line, refusal, early-stop, and per-shell replay…
KyleAMathews Nov 13, 2026
00456e7
fix(oracle-gaps): oracles read the platform's replay lines, and scrat…
KyleAMathews Nov 13, 2026
f79aae7
fix(windows): forward-slash report paths, cmd quotes, six shards, and…
KyleAMathews Nov 13, 2026
8697227
fix(oracle-gaps): keys and report paths are forward-slash in the CLI …
KyleAMathews Nov 13, 2026
0c9f38d
ci(windows): the replay witness runs after a failed stop witness
KyleAMathews Nov 13, 2026
dc71773
ci(windows): print the replay output the witness reads (diagnostic)
KyleAMathews Nov 13, 2026
b8b48d7
ci(windows): the replay fixture declares its fixed seed
KyleAMathews Nov 13, 2026
00a2740
Merge remote-tracking branch 'origin/main' into ci/windows
KyleAMathews Nov 13, 2026
c1c34d2
fix(windows): the stop law on win32, the stop hook, the argv cap, and…
KyleAMathews Nov 13, 2026
ee1a5fd
fix(oracle-gaps): the temporary directory's real path for state, sock…
KyleAMathews Nov 13, 2026
70b118d
fix(oracle-gaps): the e2e fixture's temporary directory by its native…
KyleAMathews Nov 13, 2026
ebc39e6
ci(windows): split the blocking Windows jobs from the non-blocking on…
KyleAMathews Nov 13, 2026
318e95e
fix(oracle-gaps): the static oracle's temp directory by its native re…
KyleAMathews Nov 13, 2026
d0ea5af
fix(oracle-gaps): the e2e driver names a scratch path in both spellin…
KyleAMathews Nov 13, 2026
09df6bb
fix(oracle-gaps): mutants' owner files are forward-slash in the e2e d…
KyleAMathews Nov 13, 2026
50b4ab5
fix(windows): stop witness, replay quoting by the shells' grammar, an…
KyleAMathews Nov 14, 2026
b904d57
fix(oracle-gaps): path-spelling oracle generates win32 separators and…
KyleAMathews Nov 14, 2026
de8a373
fix(oracle-gaps): event-triggered stop, derived hostile names, and th…
KyleAMathews Nov 14, 2026
63bf49e
fix(oracle-gaps): constructed tests keep their names (classify reach)
KyleAMathews Nov 14, 2026
c3ed569
Merge remote-tracking branch 'origin/ci/windows' into ci/windows-stat…
KyleAMathews Nov 14, 2026
2b7b7f3
fix(windows): Rerun cmd lines, ! as no-form, separators by platform, …
KyleAMathews Nov 14, 2026
abc8b45
fix(windows): the witness feeds PowerShell its line on stdin, not as …
KyleAMathews Nov 14, 2026
69c82eb
diagnostic: the replay witness reports the shell's own error for a li…
KyleAMathews Nov 14, 2026
0772447
fix(windows): the -t argument never carries a shell-hostile character…
KyleAMathews Nov 14, 2026
ae44184
Revert "diagnostic: the replay witness reports the shell's own error …
KyleAMathews Nov 14, 2026
0f49e3e
Merge remote-tracking branch 'origin/ci/windows' into ci/windows-stat…
KyleAMathews Nov 14, 2026
9698922
fix(windows): cmd env rule, exact witness matching, set-line readers,…
KyleAMathews Nov 14, 2026
257a5b0
fix(windows): the replay witness counts each printed line once, and r…
KyleAMathews Nov 14, 2026
0c42c33
fix(windows): the replay witness pairs each printed line with its cmd…
KyleAMathews Nov 14, 2026
08f028d
fix(windows): restore the replay witness's helpers that the pairing r…
KyleAMathews Nov 14, 2026
bd208ac
fix(windows): a Rerun line counts only for its own failing fixed unit…
KyleAMathews Nov 14, 2026
3b97795
fix(windows): the witness reads a fixed unit's FAIL line (`fixed seed…
KyleAMathews Nov 14, 2026
7d46701
fix(windows): the Rerun name check ignores vitest's colors
KyleAMathews Nov 14, 2026
2ee903a
Merge remote-tracking branch 'origin/ci/windows' into ci/windows-stat…
KyleAMathews Nov 14, 2026
5186cd5
Merge remote-tracking branch 'origin/main' into ci/windows-static-e2e
KyleAMathews Nov 14, 2026
f4bc85c
fix(oracle-gaps): the e2e replay check reads and runs the PowerShell …
KyleAMathews Nov 14, 2026
dd3347a
test(oracle-gaps): the greppable-stream breach names the stdout's gap…
KyleAMathews Nov 14, 2026
8721946
test(oracle-gaps): the greppable-stream breach names the stderr's gap…
KyleAMathews Nov 14, 2026
f00c2c7
fix(oracle-gaps): invalidate a patched file by its forward-slash path…
KyleAMathews Nov 14, 2026
b6085b8
fix(oracle-gaps): the CLI-directory reach state compares paths in one…
KyleAMathews Nov 14, 2026
0f9c1a5
fix(oracle-gaps): the static driver names the package in both path sp…
KyleAMathews Nov 14, 2026
957a060
ci: the Windows static oracle job blocks the preview
KyleAMathews Nov 14, 2026
8fb0b00
fix(oracle-gaps): the daemon pause and win32 stops do not need signal…
KyleAMathews Nov 14, 2026
7efe175
fix(oracle-gaps): the abort run is POSIX only; the Windows end-to-end…
KyleAMathews Nov 14, 2026
9b22c71
test(oracle-gaps): the idle profile records which condition blocked t…
KyleAMathews Nov 14, 2026
495b281
fix(oracle-gaps): the abort state is reachable on every platform again
KyleAMathews Nov 14, 2026
5d97ae8
chore(oracle-gaps): temporary daemon-history profile on Linux and Win…
KyleAMathews Nov 14, 2026
887dfe3
chore(oracle-gaps): probe the daemon-history job's startup and gap ti…
KyleAMathews Nov 14, 2026
144bc06
chore(oracle-gaps): time ps in the temporary profile job
KyleAMathews Nov 14, 2026
d0cd4fe
chore(oracle-gaps): probe ps without timeout and tolerate probe failures
KyleAMathews Nov 14, 2026
79f421e
chore(oracle-gaps): remove the temporary daemon-history profile
KyleAMathews Nov 14, 2026
d7f437b
fix(oracle-gaps): restore the idle harness; declare the abort state o…
KyleAMathews Nov 14, 2026
425d7aa
test(oracle-gaps): the daemon driver waits on marks, not on the clock…
KyleAMathews Nov 14, 2026
a489353
fix(oracle-gaps): import posix and realPathOf in the e2e driver
KyleAMathews Nov 14, 2026
7000a93
fix(oracle-gaps): the daemon steps' labels come from observations; ma…
KyleAMathews Nov 15, 2026
7cdf04f
ci(oracle-gaps): Windows end-to-end in nine shards sized by measured …
KyleAMathews Nov 15, 2026
104376d
ci(oracle-gaps): Windows end-to-end in ten shards, each pattern under…
KyleAMathews Nov 15, 2026
4d777ed
fix(oracle-gaps): daemon labels need their observations; the warm wit…
KyleAMathews Nov 15, 2026
adf7dc6
fix(oracle-gaps): restore pidOf, which the daemonsOf rewrite had removed
KyleAMathews Nov 15, 2026
e68c68c
fix(oracle-gaps): the disarmed-pause state is declared globally, not …
KyleAMathews Nov 15, 2026
6702809
fix(oracle-gaps): the disarmed-pause variant pins a clean config, so …
KyleAMathews Nov 15, 2026
3e7400e
fix(oracle-gaps): the disarmed pause reaches its state; the plan carr…
KyleAMathews Nov 15, 2026
227e2fd
ci(oracle-gaps): the Linux e2e shards list the disarmed-pause constru…
KyleAMathews Nov 15, 2026
7118fb1
fix(oracle-gaps): pauseEngages is a constant in the drawn record; onl…
KyleAMathews Nov 15, 2026
eec7a03
fix(oracle-gaps): split 'every outcome class' into two constructed hi…
KyleAMathews Nov 15, 2026
ff41711
Merge remote-tracking branch 'origin/main' into ci/windows-static-e2e
KyleAMathews Nov 15, 2026
1636e85
fix(oracle-gaps): the first half of 'every outcome class' names the S…
KyleAMathews Nov 15, 2026
522c770
ci(oracle-gaps): the Windows shards are sized by the measured duratio…
KyleAMathews Nov 15, 2026
ee2a589
fix(oracle-gaps): pauseEngages is the last field of the drawn record;…
KyleAMathews Nov 15, 2026
950b5e9
fix(oracle-gaps): append the new constructed histories to the end of …
KyleAMathews Nov 15, 2026
49be396
test(oracle-gaps): a reset check whose warm daemon was replaced carri…
KyleAMathews Nov 15, 2026
7c9fa02
ci(oracle-gaps): the second half of "every outcome class" runs in Lin…
KyleAMathews Nov 15, 2026
0404b5d
docs(oracle-gaps): record the Windows idle-state miss in the limits
KyleAMathews Nov 15, 2026
a101585
fix(oracle-gaps): a replaced warm daemon is stopped before the pause …
KyleAMathews Nov 15, 2026
8746768
fix(oracle-gaps): the disarmed-pause history pins its generated inputs
KyleAMathews Nov 15, 2026
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
16 changes: 7 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ jobs:
- test-oracle-gaps-fast
- test-oracle-gaps-end-to-end
- test-vitest-5
# The blocking Windows jobs (the non-blocking static and e2e jobs are not
# a dependency until they are green).
# The blocking Windows jobs (the non-blocking end-to-end job is not a
# dependency until it is green).
- windows-unit
- windows-gap-classify
- windows-gap-oracles
- windows-gap-cli
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -223,10 +224,6 @@ jobs:
windows-gap-oracles:
name: Windows gap report static oracle (${{ matrix.shard }}/6)
runs-on: windows-latest
# Not blocking yet: these suites fail on Windows, tracked by class in
# https://github.com/TanStack/oracles/issues/72. Remove this line when they
# are green.
continue-on-error: true
timeout-minutes: 20
strategy:
fail-fast: false
Expand Down Expand Up @@ -263,7 +260,7 @@ jobs:
working-directory: packages/oracles
run: pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-classify gap-report-probe-form gap-report-mutant-validity gap-report-path-spelling
windows-gap-end-to-end:
name: Windows gap report end-to-end oracle (fixed seed, ${{ matrix.shard }}/6)
name: Windows gap report end-to-end oracle (fixed seed, ${{ matrix.shard }}/10)
runs-on: windows-latest
# Not blocking yet: these suites fail on Windows, tracked by class in
# https://github.com/TanStack/oracles/issues/72. Remove this line when they
Expand All @@ -273,7 +270,7 @@ jobs:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6]
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -287,7 +284,8 @@ jobs:
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
run: pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-oracle -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-fixed-seed-windows "$SHARD")"
# The verbose reporter prints each test with its duration, which sizes the shards.
run: pnpm exec vitest --run --reporter=verbose --config oracle-gaps/vitest.config.mjs gap-report-oracle -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-fixed-seed-windows "$SHARD")"
windows-gap-cli:
name: Windows gap CLI on a fixture
runs-on: windows-latest
Expand Down
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,38 @@ agent.
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.

For contributors: four environment variables in the `ORACLE_GAPS_TEST_`
namespace are test-only hooks for the CLI's own oracle, not settings for
users. `ORACLE_GAPS_TEST_HOLD_EXIT_MS` holds the run's exit after its done
line, and `ORACLE_GAPS_TEST_WARM_PROBE` makes the first config warm-up
wait where a stop signal can reach it. `ORACLE_GAPS_TEST_STOP` names a
file: when it appears, an unsupervised run takes the same stop as a
SIGINT. `ORACLE_GAPS_TEST_TORN_ROWS` names a directory where each batch's
watchdog counts its polls, and a batch's closing row is held half written
until the watchdog has polled twice. The directory holds a `.begun` marker
per batch and a `.reached` or `.unreached` marker per hold (`.unreached`
after 60 s with no two polls).
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
set, and none changes an outcome by itself.
- `ORACLE_GAPS_TEST_HOLD_EXIT_MS` holds the run's exit after its done line.
- `ORACLE_GAPS_TEST_WARM_PROBE` makes the first config warm-up wait where a
stop signal can reach it.
- `ORACLE_GAPS_TEST_STOP` names a file whose appearance makes the CLI take a
stop as a SIGINT would (the win32 stop, which has no signal to deliver).
- `ORACLE_GAPS_TEST_PAUSE_AT` names one point at which the CLI blocks, with
`ORACLE_GAPS_TEST_PAUSE_MARK` naming a file the blocked process writes its
pid to: `daemon-reply` holds a daemon's reply after the check, and
`daemon-read` holds its first connection unread, once `ORACLE_GAPS_TEST_PAUSE_ARM`
names an existing file. The test kills the process by that pid, so no signal
is needed to pause on win32. Both marks are written whole (a temp file, then
a rename), and the test parses the pid as a positive integer before it sends
any signal.
- `ORACLE_GAPS_TEST_WAIT_MARK` names a file a request writes when its reply has
not come `ORACLE_GAPS_TEST_WAIT_MS` after it was sent. A request has no
timeout of its own: this timer starts with the request, and is cleared when
the request settles, whether it resolves or rejects. The test acts on the
CLI's wait, not on the clock.
- `ORACLE_GAPS_TEST_WAIT_MS` (milliseconds, default 60000) is the CLI's wait
for a daemon to start or to close; a test shortens it to outlast a paused
daemon. It is a test-only knob, not a setting for users.
- `ORACLE_GAPS_TEST_SERVED_MARK` names a file the daemon writes its pid to
after it answers a check, so a test can tell which daemon served an
earlier check (the warm daemon that a later check's pause must match).
- `ORACLE_GAPS_TEST_TORN_ROWS` names a directory where each batch's watchdog
counts its polls, and a batch's closing row is held half written until the
watchdog has polled twice. The directory holds a `.begun` marker per batch and
a `.reached` or `.unreached` marker per hold (`.unreached` after 60 s with no
two polls).

A few endings print no done line, or one more line: a SIGKILL of the CLI,
or a signal that comes while Node is still starting the CLI, before its
Expand Down
15 changes: 2 additions & 13 deletions packages/oracles/oracle-gaps/capture-setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,7 @@ const thisFile = globalThis.__vitest_worker__?.filepath
// outside the wrappers, such as `node:timers/promises`), nothing but the
// channel and stdio is open, and its event loop is under 5% busy. After
// `idleMs` of that it writes an idle row, and the batch's watchdog cuts it
// off as a hang. A late sample means the thread was busy. With
// ORACLE_GAPS_IDLE set, each test's longest idle stretch is recorded
// (profiling).
// off as a hang. A late sample means the thread was busy.
const quiet = new Set([
`MessagePort`,
`PipeWrap`,
Expand All @@ -1048,30 +1046,22 @@ const quiet = new Set([
const timersListed = (kinds) =>
kinds.filter((kind) => kind === `Timeout` || kind === `Immediate`).length
let sawIo = false
const idleProfile = process.env.ORACLE_GAPS_IDLE
if (state.capture || idleProfile) {
if (state.capture) {
let baseTimers
let since
let last
let longest = 0
let use = realUse()
let reported = false
beforeEach(() => {
if (continuing) return
baseTimers = timersListed(process.getActiveResourcesInfo())
since = undefined
longest = 0
sawIo = false
})
beforeEach((context) => {
if (continuing) return
context.onTestFinished(() => {
baseTimers = undefined
if (idleProfile)
appendFileSync(
idleProfile,
`${JSON.stringify({ key: testKey(context.task), longest })}\n`,
)
})
})
realInterval(() => {
Expand Down Expand Up @@ -1100,7 +1090,6 @@ if (state.capture || idleProfile) {
return
}
since ??= now
longest = Math.max(longest, now - since)
if (!state.idleMs || now - since < state.idleMs) return
reported = true
appendFileSync(
Expand Down
4 changes: 2 additions & 2 deletions packages/oracles/oracle-gaps/check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ export default async (env) => {
for (const path of paths) {
const hash = servedHash(path, index)
if (served.get(path) === hash) continue
context.invalidateFile(path)
context.invalidateFile(posix(path))
// Its next transform records the text it then serves.
globalThis.__oracleGapsLoads[index]?.delete(path)
served.set(path, hash)
Expand Down Expand Up @@ -1543,7 +1543,7 @@ export default async (env) => {
const read = served.get(path) ?? hash
// The context may hold other text than the path's text now.
if (read !== now || hash !== now) {
context.invalidateFile(path)
context.invalidateFile(posix(path))
loads?.delete(path)
}
if (hash !== now) stable = false
Expand Down
78 changes: 71 additions & 7 deletions packages/oracles/oracle-gaps/daemon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import { spawn } from 'node:child_process'
import { randomUUID } from 'node:crypto'
import {
existsSync,
linkSync,
mkdirSync,
openSync,
Expand Down Expand Up @@ -69,8 +70,33 @@ export const received = ({ message, fix, stack }) =>
{ stack },
)

// A test mark is written whole or not at all: its file exists only once it
// holds its full text (written to a temp file, then renamed).
const writeMark = (path, text) => {
const temp = `${path}.${process.pid}.tmp`
writeFileSync(temp, text)
renameSync(temp, path)
}

function send(pkg, message) {
return new Promise((resolvePromise, reject) => {
return new Promise((settle, reject) => {
// Test-only (ORACLE_GAPS_TEST_WAIT_MARK, a path): this request has no timeout
// of its own. Here a timer starts when the request is sent and, if the reply
// has not come after WAIT_MS, writes the path, so a test acts on the CLI's
// wait rather than on the clock. The timer is cleared on every settle.
const mark = process.env.ORACLE_GAPS_TEST_WAIT_MARK
const timer =
mark === undefined
? undefined
: setTimeout(() => writeMark(mark, ``), WAIT_MS)
const resolvePromise = (value) => {
clearTimeout(timer)
settle(value)
}
const fail = (error) => {
clearTimeout(timer)
reject(error)
}
const socket = connect(socketOf(pkg))
let reply = ``
socket.on(`connect`, () => socket.write(`${JSON.stringify(message)}\n`))
Expand All @@ -83,14 +109,14 @@ function send(pkg, message) {
try {
resolvePromise(JSON.parse(reply))
} catch (error) {
reject(error)
fail(error)
}
})
socket.on(`error`, (error) =>
// A daemon that exits under a request resets its connection.
[`ECONNRESET`, `EPIPE`].includes(error.code)
? resolvePromise({ died: true })
: reject(error),
: fail(error),
)
})
}
Expand Down Expand Up @@ -221,10 +247,10 @@ export async function stopDaemon(pkg) {
}

const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
// How long a CLI waits for a daemon to start or to finish closing; the CLI
// oracle shortens it (ORACLE_GAPS_WAIT_MS) to outlast it with a paused
// daemon.
const WAIT_MS = Number(process.env.ORACLE_GAPS_WAIT_MS ?? 60_000)
// How long a CLI waits for a daemon to start or to finish closing. The oracle
// shortens it (ORACLE_GAPS_TEST_WAIT_MS, a test-only knob) to outlast it with a
// paused daemon.
const WAIT_MS = Number(process.env.ORACLE_GAPS_TEST_WAIT_MS ?? 60_000)
// This daemon's lock token, which no other process can hold.
const token = `${process.pid}:${randomUUID()}`
// How long a lock's holder has to listen before the lock counts as left by
Expand Down Expand Up @@ -326,6 +352,24 @@ async function serve(pkg) {
connection.end(`${JSON.stringify(value)}\n`, resolvePromise)
})
const server = createServer((connection) => {
// Test-only (ORACLE_GAPS_TEST_PAUSE_AT=daemon-read): once the arm file named by
// ORACLE_GAPS_TEST_PAUSE_ARM exists, the first connection is accepted and never
// read; this daemon's pid goes to ORACLE_GAPS_TEST_PAUSE_MARK for the test,
// which kills it. The mark exists only once the pause has happened, so a
// restarted daemon serves; a daemon started before the arm serves too.
const readMark = process.env.ORACLE_GAPS_TEST_PAUSE_MARK
const armMark = process.env.ORACLE_GAPS_TEST_PAUSE_ARM
if (
process.env.ORACLE_GAPS_TEST_PAUSE_AT === `daemon-read` &&
readMark !== undefined &&
armMark !== undefined &&
existsSync(armMark) &&
!existsSync(readMark)
) {
writeMark(readMark, `${process.pid}`)
connection.pause()
return
}
let request = ``
connection.on(`data`, (chunk) => {
request += chunk
Expand Down Expand Up @@ -370,6 +414,21 @@ async function serve(pkg) {
stderr.push(`${line}\n`),
)
await store.flush()
// A test-only pause (ORACLE_GAPS_TEST_PAUSE_AT=daemon-reply): the check
// is done and its reply is held, so the CLI waits as it would for a
// daemon that is slow and dies. The pause writes this daemon's pid to
// ORACLE_GAPS_TEST_PAUSE_MARK, for the oracle to kill it by (no signal
// pauses a process on win32). Once: a daemon the CLI restarts after this
// one died inherits the variable, and must answer.
const mark = process.env.ORACLE_GAPS_TEST_PAUSE_MARK
if (
process.env.ORACLE_GAPS_TEST_PAUSE_AT === `daemon-reply` &&
mark !== undefined &&
!existsSync(mark)
) {
writeMark(mark, `${process.pid}`)
await new Promise(() => {})
}
} catch (error) {
failed = sent(error)
}
Expand All @@ -379,6 +438,11 @@ async function serve(pkg) {
stderr: stderr.join(``),
failed,
})
// Test-only (ORACLE_GAPS_TEST_SERVED_MARK, a path): this daemon's pid is
// written after it answers a check, so a test can tell which daemon
// served an earlier check (a warm daemon, review of #73).
const served = process.env.ORACLE_GAPS_TEST_SERVED_MARK
if (served !== undefined) writeMark(served, `${process.pid}`)
closeAfter(idleMs)
})
})
Expand Down
18 changes: 17 additions & 1 deletion packages/oracles/oracle-gaps/gap-report-model-oracle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,14 @@ const drawn = fc.record({
// `histories` takes a constructed one back as this constant (as
// `claimScenario` does). Its neutral value is recorded by the canary.
tornRows: fc.constant(false),
// Whether the daemon's pause engages in the daemon steps (dieMidCheck and
// resetBeforeRead). Always true in drawn histories, so the seeds' histories are
// unchanged; only the constructed history "a daemon pause that cannot engage" sets
// it false.
pauseEngages: fc.constant(true),
// Whether the warm daemon is replaced after the warm check (review of #73, B2).
// Only the constructed history of a replaced warm daemon sets it.
warmReplaced: fc.constant(false),
})

// The edit sequence over the witness module, the one list of steps that a
Expand Down Expand Up @@ -892,15 +900,21 @@ const histories = drawn.map(
)
if (!keepsSteps(history))
throw new Error(`a history with the witness module takes no steps`)
// Take-back into the drawn language: a disarmed pause (pauseEngages false,
// only the constructed history sets it) comes back as engaged, so the
// arbitrary can shrink it. The disarm is therefore not kept by a shrink.
const taken =
history.tornRows === false ? value : { ...history, tornRows: false }
const later = (history.steps ?? []).filter((step) =>
laterEdits.includes(step),
)
if (later.length === 0) return taken
if (later.length === 0)
return { ...taken, pauseEngages: true, warmReplaced: false }
const earlier = history.steps.filter((step) => !laterEdits.includes(step))
return {
...taken,
pauseEngages: true,
warmReplaced: false,
steps: earlier.length > 0 ? earlier : null,
laterSteps: later,
}
Expand Down Expand Up @@ -2907,6 +2921,8 @@ function resolveHistory(history) {
fault: history.fault,
stability: history.stability,
steps: [...(history.steps ?? []), ...laterStepsOf(history)],
pauseEngages: history.pauseEngages !== false,
warmReplaced: history.warmReplaced === true,
lazyGate: history.lazyGate === true,
fsRead: history.fsRead ?? `none`,
// Whether a step edits file b's helper during a check (`midrun`): then
Expand Down
Loading
Loading