Skip to content

fix(oracle-gaps): no wall-clock cut decides an outcome - #99

Merged
KyleAMathews merged 204 commits into
mainfrom
fix/gap-cli-deterministic-cuts
Dec 2, 2026
Merged

KyleAMathews merged 204 commits into
mainfrom
fix/gap-cli-deterministic-cuts

Conversation

@KyleAMathews

@KyleAMathews KyleAMathews commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR makes the gap CLI decide every mutant's outcome by counts and states, never by a wall-clock cut. A copy that loops is cut by its call budget, a copy that makes no progress is cut by its state, and the single wall-clock backstop that remains ends a copy as a gap (timeout), never as a kill. The oracle (model, history grammar, end-to-end driver) is extended so that its generated histories reach each of these cuts and their labels.

Head: 7009178, with two consecutive clean CI runs (74/74). The maintainer decided to land #99 at this head and to do the remaining gate-8 items as follow-up PRs.

Laws and authority

All in the decisions register:

  • Spin, no progress and the work budget are kills; count-only kills (M 2026-11-16).
  • Backstops are fine, set high (M 2026-11-23): one backstop per copy, max(10 s, 3x the longest legal wait). Its cut is a gap. The production default is 60 s.
  • A count cut's label never depends on timing (C 2026-11-23), and count-cut label precedence (C 2026-11-23): a failing law's spin blocks the mutant; otherwise a clocked count cut is indeterminate; otherwise the cut is a kill.
  • A cut is clocked only by what happened before it (C 2026-11-29).
  • A verdict before a cut still kills (C 2026-11-24). It covers any cut, a count cut included, and soft verdicts too.
  • An excluded test still runs (M 2026-11-23): its calls count toward the budgets and idleness, but it never judges.
  • Every built-in cut by an excluded test ends the copy as a gap (C 2026-11-24).
  • A history the base cannot take (M): attribution replays the history, not the seed, when the PR adds drawn fields.

What changed

Production (packages/oracles/oracle-gaps):

  • Copies are cut by their call budget (spin), by no progress (state), or by the backstop. Only the first two can kill, and only when the cut is not clocked.
  • Each early verdict, written when it is observed, survives a later cut. Since d94f907 a copy that spun and then ran to its end keeps the verdicts written before its spin row (check.mjs spunRun, earlyVerdictsOf). Before, it dropped them, so a clocked count cut after a verdict was indeterminate.
  • An excluded (nondeterministic) test's early verdict kills nothing (b37226b).
  • The CLI ending path (index.mjs end): an unsupervised stop goes through the same single ending as a refusal or an error.
  • --first-limit and --mutant-limit are retired (checked and noted, no effect). --hang-limit is the base of each copy's backstop (default 60 s). --test-timeout defaults to 65 s.

Oracle:

  • New drawn fields, appended last: hangMs, heavy, pair, per-test loops, flaky, timerWait. Constructed-only fields: pendingIo, caughtVerdict. 124+ constructed histories, each appended in order (constructed-order.json).
  • The model judges a count cut's clock at the cut (f43ee63). Each model verdict records the work done when it fired (atWork), and a spun run keeps the verdicts within the call budget (d94f907).
  • "every outcome class" pins spinData: false, as the other histories that need owner-b kills do (fe5a4a2).

CI:

  • The random, determinism and Windows fixed-seed jobs are packed from CI-measured durations (scripts/pack-shards-from-ci.mjs, ci-durations.json, ci-packed-shards.mjs). The packer takes each partition's tests from e2e-shards.mjs. A test that CI has not timed yet is charged the time of the test whose work it repeats (weighsAs), or else the mean.
  • The random-seed partition is 6 shards (pr.yml).

Evidence for the fixes since 985b804

  • Seed -1863113194 (f43ee63, model): the model counted a timer wait that came after the cut. RED: the replay on 985b804, "unregistered-kill, owed indeterminate". GREEN: the replay passes. Production was right; its clocked flag counts the test's timers (capture-setup.mjs wraps the global and node:timers timers).
  • Seed -954490119 (b37226b, production): a flaky test's early verdict before a no-progress cut killed the mutant. RED: the replay and the constructed history "a flaky test's verdict before a no-progress cut kills nothing". GREEN after. Mutant: dropping the nondeterministic filter fails that history.
  • Early verdicts at every cut (93b2f2b, d94f907):
    • Histories "a judging test's verdict before a backstop cut kills", "a judging test's verdict before a clocked count cut kills", and "a non-judging property test's later run spins into bounded work". The seed 61620462 literal now enters "a soft verdict before a property test's later spin kills".
    • RED on the production before d94f907: "delete-call#0: indeterminate, owed killed" and "loop-false#0: unregistered-kill, owed killed".
    • Mutants: classify dropping every early verdict fails the backstop and count-cut histories. The old spunRun fails the count-cut and property histories.
  • Seed -587710675 (fe5a4a2, builder): a drawn spinData made file b spin wherever it would judge, so "every outcome class" could not reach its owner-b kills. RED on d94f907, GREEN after. Dropping the pin reproduces the RED.
  • Local, on each pushed head: the unit suite (124) and the fast gap suites (33,995) pass, and both shard checks pass.

Fixes from the merge-gate reviews (gates 5 to 7)

  • Backstop (BLK-1): a copy's backstop is the base plus 300 times its file's unmutated time (C 2026-11-30). Witnesses: a legal copy at 99% of its call budget, and a ~40 s copy in the 1,000-to-100,000-site regime. Both are cut by the old formula and finish now. Vitest's per-test limit stays 65 s, and a copy it cuts is a gap (M 2026-11-30).
  • Excluded tests (BLK-2): a built-in cut caused by a flaky test is a gap (indeterminate), and one caused by a failing law blocks the mutant (C 2026-11-24). This holds for operator and authored mutants, on no-progress and spin cuts.
  • Verdicts after a spin (BLK-4): a verdict written after the copy's spin row does not kill.
  • New fields drawn (M 2026-11-16, "Randomness wins"): caughtVerdict, flakyHang, catchesBudget and callWork are drawn, gated to legal tests. The fixed-seed generated campaign's reach moved with the seed shift, and the 79 lost states are all required and entered by constructed histories.
  • Model clock at the cut (C 2026-11-29): a spinData spin is judged at its position. A property's legal wait counts every run (backstopOf).
  • Builder pins: spinData, heavy and pair, where a drawn base field defeated a constructed history's state.
  • Stop observation: it records a digest of each stream's shape (heartbeat lines dropped, scratch paths named, numbers normalized) and exact emptiness, not raw lengths. Raw lengths followed the wall clock (law 11). A same-length word mutant shows the digest still sees a changed line.
  • CI: Linux fixed-seed jobs are packed from CI times. Determinism runs in 14 jobs, random seed in 7, fixed seed in 6.
  • Main merged, with fix(oracle-gaps): a stop the supervisor has received wins over a later ending (#139) #307 ("the supervisor's stop wins"). The ending path combines main's ask with this PR's single end.

CI

7009178: run 46904318787 passed 74 of 74 on its first attempt and again on a full rerun. Failures attributed elsewhere on earlier heads are recorded on their issues: #208 (brokenVitest stream log, not reproduced) and #311 (Windows retention flake).

Follow-ups (maintainer decision, 2026-12-02)

Gate 8 was not ready. These land as separate PRs:

Limits

These are named in the gap oracle's known limits text:

This pull request and its description were written by Isaac.

KyleAMathews and others added 8 commits November 14, 2026 16:37
…s not wait

Determinism under load (2026-11-13): a run's outcome must not depend on
how long a run took. A constructed history, "a slow owner's kill and
another owner's kill", has one mutant that file a's random-route test
and file b's fixed-seed test both kill. Its driver also runs the slow
twin: the same package, where a's test waits 3 s past its first budget
wherever the output differs and then judges as before. The law compares
the two reports, `randomAlso` included.

On main, a's slow copy is cut at its first budget and queued for a
confirmation, b's kill decides the mutant first, and a's random failure
is never recorded: the twin reports `randomAlso: false` where the package
reports `true`. `slowTwin` is constructed-only (no generated history
draws it; `histories` takes it back without it).

Co-authored-by: Isaac <no-reply@databricks.com>
…t, and a timer under load

Deterministic cuts, option A (register M, 2026-11-14): no wall-clock cut
decides an outcome, so a mutant's copies are judged by count, not by time.
Three laws are added to the end-to-end oracle, each RED on the parent
commit before any production change.

- The budget witness w_slowpair becomes a work-budget witness: its two
  owners' tests call the function PAIR_LOOPS times where their output
  differs. Each copy stays inside its call budget, the two together pass
  the mutant's work budget (WORK_FLOOR), so the mutant is a timeout by
  count, whatever the clock says. The model judges the budget in owner
  order, a kill before the budget runs out still deciding.
- A slow kill whose test waits 16 s, past Vitest's 15 s per-test limit, is
  killed: no limit that the CLI leaves to Vitest decides the outcome.
- A copy whose test starts a timer, spins under load, then waits for the
  timer, is killed and never cut as idle (the idle law is state, not time).

Constructed-only test fields (slowMs, loops, busy) are held by the drawn
test record at neutral constants and taken back to them by the histories'
map, so no generated history draws them (generator rule, 2026-11-14). The
constructed histories are appended at the end of the list, and the slow
owner's history moved there from the middle of it.

Co-authored-by: Isaac <no-reply@databricks.com>
…he work budget

The first RED (9412eac) lets each copy of w_slowpair make 37,500 calls
beyond its first. At three site evaluations a call that is 112,500 per copy,
past the 100,000 call budget, so main cuts each copy by count and the mutant
is a timeout on either side; the work law is not reached. At 30,000 calls a
copy makes 60,000 to 90,000 site evaluations, inside its budget, and the two
copies together pass the work budget, so main must report survived.

Co-authored-by: Isaac <no-reply@databricks.com>
…-clock budget

Register M entry "Deterministic cuts, option A" (2026-11-14): no wall-clock
cut decides an outcome; a mutant's budget is a work count, and the wall-clock
budget is only a backstop that reports a gap. The model's wall-clock clause
(two budgets: a slow owner file's confirmations past --mutant-limit predict a
timeout) is removed as the repair the M entry requires. This is not a model
change to match production: the clause's authority is the retired confirmation
path, and the M entry retires it.

Consequence, a RED on main: the constructed history "a slow kill past Vitest's
15 s limit" (a 16 s wait where its output differs) now predicts `killed`, and
main reports `timeout` for it, because main's confirmation is cut by the
mutant budget at 15 s (diagnostic on a scratch branch: the copy's outcome is
"run time limit", not Vitest's "Test timed out").

Also: a test that awaits its busy witness is async (the emitter marks it so),
so the baseline loads.

Co-authored-by: Isaac <no-reply@databricks.com>
…states are listed apart

Register M entry "Deterministic cuts, option A" (2026-11-14), with the
coordinator's ruling 3 (fallback): a test that Vitest's own limit ends
("Test timed out") is reported as a backstop gap, like a timed-out run. It
is `timeout` after any kill, and it never keeps a kill from deciding. The
previous rule read a Vitest timeout only when every failing test had one,
so a timed-out test beside a verdict-less failure was `crashed`, and a
timed-out test beside an unregistered kill was not a timeout at all. The
`every` branch and the `!timeout` filter are now redundant and removed.

Law: a run's outcome does not depend on how long a test took (determinism
under load); a clock limit may only report a gap.
RED: the classify oracle on the parent classify.mjs (HEAD before this commit,
built from the same fixtures) fails with "mutant m0: unregistered-kill, owed
timeout", and the parent's crashed/timeout split fails the same law.
Mutant: timeout checked before the kills (scratch copy): the classify oracle
fails, "mutant m0: timeout, owed killed"; the mutant is rejected.
GREEN: the classify oracle passes (276 tests). The model counts a timeout
message only in a file that loaded, as production does (a file that fails to
load gives no tests).

The e2e oracle's states "a slow owner's kill reported as when it did not
wait", "a slow kill past fifteen seconds killed" and "a copy waiting on a
timer under load killed" are listed as separate: they have their own
histories, so "every outcome class" must not enter them.

Co-authored-by: Isaac <no-reply@databricks.com>
Register M entry "Deterministic cuts, option A" (2026-11-14). A copy runs
until it finishes, goes idle, or spins; the only wall-clock limit is a
backstop that reports a gap and never decides a kill.

- No first budget and no confirmation: a copy runs once, to its end, under
  the backstop limit (hang-limit plus three seconds per second of the file's
  unmutated time). The cut marking and the confirming run are removed.
- G1 becomes a work budget: a mutant's copies, summed in their owner files'
  report order, may do at most max(WORK_FLOOR, 10 x the owners' unmutated
  calls) site evaluations (WORK_FLOOR = CALL_FLOOR, 100,000). Past it, the
  copy that crosses and every later copy is a timeout, so a kill among them
  does not count. This is deterministic because the work is a count; the
  owner order is the report's, not the completion order.
- The wall-clock mutant budget (--mutant-limit) is a backstop checked after
  all copies: no kill and elapsed over budget is a timeout; it never decides a
  kill.
- Defaults (coordinator rulings, 2026-11-14): --hang-limit 60 s, --mutant-limit
  180 s, --test-timeout 65 s (hang-limit plus 5 s). Cost to state: an unmutated
  hang that no CLI limit cuts now fails after 65 s, not 15 s; under option A an
  idle hang is cut by `no progress` in about 500 ms, so only a busy hang with no
  instrumented site waits for the backstop.
- --first-limit is validated and retired: it prints a note and changes nothing.
- A test that Vitest's own limit ends is a backstop gap (classify.mjs; its
  RED and mutant are in the prior commit, 4b063c8).

Correction to 4b063c8's message: that message said the parent's crashed/timeout
split fails the classify oracle. I did not run that case. The verified RED is
the one in 4b063c8's body: the parent gives "unregistered-kill" where the model
owes "timeout".

Co-authored-by: Isaac <no-reply@databricks.com>
… in the test

The counter-witness (register, 2026-11-13 "Determinism under load"; the
2026-11-14 entry "Deterministic cuts, option A") was a copy whose test spun
for 600 ms and then waited 2 s on a timer. Its spin kept event-loop
utilization above 5%, which alone keeps a copy from looking idle, so the
timer check never mattered: mutant 2 (elapsed-only idle, the timer checks
disabled) passed the witness. The witness now waits on one timer due 3 s
out, inside the horizon, with nothing else in the test. A copy with its
timer pending is never idle; only that check stands between it and an idle
cut. A loaded variant, if wanted, is a CPU hog outside the worker.

The state is "a copy waiting on a timer killed"; the constructed field is
timerWait (a constructed-only test field, taken back to null; no generated
test draws it).

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

# Conflicts:
#	packages/oracles/oracle-gaps/gap-report-model-oracle.mjs
#	packages/oracles/oracle-gaps/gap-report-oracle.property.test.mjs
#	packages/oracles/scripts/pr-shards.mjs
@changeset-bot

changeset-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7009178

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tanstack/oracles Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

KyleAMathews and others added 18 commits November 14, 2026 23:08
… copies

Register C entry "Deterministic cuts, outcome rule (under M option A)",
2026-11-14: a copy cut by a clock or by its call count ends the mutant's
copies; no later copy runs. The model now predicts that: a copy that spins
(a count) stops the owner files after it, so a later owner's kill does not
count and the outcome is a timeout.

Witness: a constructed history whose one function spins in the mutant (the
until loop of w_spin) with two owners, a and b. Owner a's copy spins first;
owner b's judging test would kill. Production (main at this commit) runs
b's copy after a's spin and reports killed. The model owes timeout.

RED: on this commit, the new witness fails (the CLI reports killed where the
model owes timeout; pool run dc-rule-red-*).
Limits: the model's rule covers copies cut by a count; a wall-clock cut
(the backstop and Vitest's limit) is a backstop gap under the same rule, and
its own witness is pending (finding 4, the H1 witness).

Co-authored-by: Isaac <no-reply@databricks.com>
…ant, uncharged

Register C entry "Deterministic cuts, outcome rule (under M option A)",
2026-11-14: only counts and states decide a mutant's outcome.

- A copy cut by a clock or by its call count (its own timeout, or Vitest's
  "Test timed out") is never charged, and it ends the mutant's copies: no
  later copy runs, and a kill among later copies does not count (review B2).
- A copy's work is the calls of its deterministic, unclocked tests
  (`baseline.work`, classify.mjs), and the owner files' most-working tests
  set the budget and the call budget (review B3).
- The mutant-level elapsed-seconds backstop is removed: it summed cached
  units' stored seconds, so a daemon reuse could differ from a cold run
  (review finding 3). Each copy's own wall cut remains the backstop. Whether
  --mutant-limit still has a role is open (it now only affects identity).
- Model: a copy cut by a count or a clock ends the owner files (no later file
  runs), so the model owes the same outcome.

Witness: a constructed history with two owners, each making 30,000 extra
calls; owner a's copy is under the budget, owner b's would kill but passes
the budget, so the mutant is a timeout by count. The reversed-sum mutant
(review H2, 968bfd7) is the mutant it must fail.

Not witnessed here: a spin in an earlier owner ahead of a kill in a later
one. A spin witness was tried first and removed: the later owner runs the same
spinning function, so it spins too and never kills, and the witness passed on
the parent. Finding 4's backstop witness (H1) is pending.

Co-authored-by: Isaac <no-reply@databricks.com>
…r copy, wall cuts end the mutant

Register C entry "Deterministic cuts, outcome rule (under M option A)", as
refined by the coordinator: a copy ending in "no progress" (a state) or a spin
past its call budget (a count) is a deterministic timeout for that copy. It is
charged nothing (the rows of a cut copy are not kept, and the per-copy call
budget already bounds it), and the next owner's copy still runs, so a later
kill decides. Only a wall-clock cut (the CLI backstop, or Vitest's "Test timed
out") ends the remaining copies, as a backstop gap that is never charged.

- Model: runsOf tags each cut with its kind (wall, count, state); judge ends
  the owner files only on a wall cut.
- Check: spin and idle copies settle with spin or idle set; cutByTime covers
  wall cuts only.
- --mutant-limit is retired (validated, noted, changes nothing); the driver no
  longer passes it.
- Constructed history "a backstop cut ends the copies ahead of a later kill":
  owner a's copy waits past a 2 s backstop; owner b would kill, and does not
  run. The state "a backstop cut ends the copies ahead of a later kill" is
  entered.

Open: "a declaration fault: noTypescript" (shard 3) streams 161 gap lines where
the model expects 159; a per-mutant check is pending. It is a model and CLI
disagreement, not a duplicate line (the scratch diagnostic found no repeated
line).

Co-authored-by: Isaac <no-reply@databricks.com>
…ot in scope there)

Co-authored-by: Isaac <no-reply@databricks.com>
…p, never a silent one

Review finding 5 (register L8). The 10 s close waits in closeContexts and in
replace continued silently after a close was still pending. Now each close
waits up to the 60 s backstop; a close still pending is an error that names
the backstop gap, and no replacement is warmed while the old context is still
closing. Closes that finish are unchanged.

Witness: none. A pending close needs a context whose close never settles, which
costs 60 s per run; it is a limit of this change (the coverage is by inspection
of closeWithin and its two callers).

Co-authored-by: Isaac <no-reply@databricks.com>
…oes idle

Owner a's copy now awaits a promise that never resolves, while a repeating
timer stays due inside its horizon, so the copy is never idle and no site
spins. Only the backstop cuts it, on every machine. The witness no longer
depends on whether a 12 s wait lands inside the backstop band (register
2026-11-14, outcome rule item 5).

Co-authored-by: Isaac <no-reply@databricks.com>
…ress, or work budget

A copy's cut is now recorded as its cause and carried into the mutant's timeout
detail, results.json, and the gap line (cause: ...). The model predicts the
cause of each timeout: a backstop cut (a wall-clock limit), a spin past the
copy's call budget (a count, outcome rule item 4), no progress (a state), or
the mutant's work budget. The model had no per-copy call budget, so the
work-budget history's 4-sites-per-call mutant was a spin and not a work-budget
timeout; the model now predicts that. ORACLE_GAPS_PROFILE rows carry each
copy's cause, its file's measured time, its limit and its duration.

RED: the e2e oracle, with the cause predicted and production unchanged, fails
on the backstop history (its timeout is cut by run time limit).

Co-authored-by: Isaac <no-reply@databricks.com>
…s as constants

The deterministic-cuts constructed fields are constants in every drawn record,
so no draw changes: the tests line hashes the records without them and is
main's (e9029433a23d1f10). slowMs, loops, timerWait and pulse each get a line
after the others, with its neutral value checked on every generated test, and
hangMs is a drawn constant (null where generated) with its own line. The
constructed histories #99 adds are appended after main's 26, by name and index.

Co-authored-by: Isaac <no-reply@databricks.com>
…e current cuts

--help and the index header give the defaults (--test-timeout 65000, --hang-limit
60000) and mark --first-limit and --mutant-limit retired. The README, the
changeset and the e2e law 4 text describe the backstop, the call and work
counts, and the cause each timeout names. Stale states and names are renamed
(confirmations, the first budget, the 15 s limit): a slow kill after a 16 s
wait, and a mutant's copies past its work budget. MUTANT_LIMIT_MS, unused, is
removed. The determinism twin is described as a determinism check: it passes
on its parent, so the outcome rule's RED is the classify oracle's.

Co-authored-by: Isaac <no-reply@databricks.com>
… and counts

The README's gap section and the changeset's bullet describe the counts and the
backstop, the cause each timeout names (on the gap line too), and the retired
options, in place of the confirmation budget. The classify oracle's gap-line
law (in bfca29a) accepts a timeout's cause suffix.

Co-authored-by: Isaac <no-reply@databricks.com>
Resolves the constructed list (main's 29 histories first, then the five #99 histories at 29 to 33), the drawn record (main's pauseEngages and warmReplaced, then hangMs), the take-back, the limits text (main's Windows notes, with #99's work-budget wording), and the shard lists (#99's histories in shard 4, main's test.projects line in shard 5). The fingerprint canary passes.

Co-authored-by: Isaac <no-reply@databricks.com>
…; the Windows shards list the new histories

The constructed backstop (hangMs) is a drawn constant now, so its take-back returns
the drawn value (null), which the arbitrary can take back. The fixed-seed shards
of main are kept as they are: the new histories fall into the Linux rest shard,
and the Windows partition, which is exact, lists them in shard 10.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…n the CLI arguments

Co-authored-by: Isaac <no-reply@databricks.com>
…'d timer

An unref'd timer is not among the process's active resources, so only the copy's
own pending-timer record keeps it busy (the idle rule, held state, M 2026-11-15).
The witness is a constructed history of its own; the reach state is recorded.

Co-authored-by: Isaac <no-reply@databricks.com>
…dition

A copy is idle when no counted timer is due within its horizon, no timer is listed
beyond its test's base, and no I/O handle is open (M entry 2026-11-15). Sample
lateness and the event loop's utilization no longer reset the window: a busy
synchronous or microtask loop blocks the sampler, so it cannot look idle. The
held-state witnesses (a copy waiting on a timer, ref'd or unref'd) keep the
copy busy, and the mutants that ignore a due timer are killed.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…ef'd timer history

The e2e shard check named the removed history 'a slow kill past Vitest's 15 s limit'
and had no shard for the unref'd timer history, so CI's test:oracle-gaps:shards
failed. The check now partitions the e2e tests exactly.

Co-authored-by: Isaac <no-reply@databricks.com>
@pkg-pr-new

pkg-pr-new Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/TanStack/oracles/@tanstack/eslint-plugin-oracles@99
npm i https://pkg.pr.new/TanStack/oracles/@tanstack/oracles@99

commit: 7009178

… wall-clock cut

With the idle rule decided by state (M entry, 2026-11-15), a timer due beyond the
copy's horizon does not keep it busy, so it is idle and cut as no progress. The
model's wall-clock cut for such a wait was stale; the load experiment's 12 s copies
gave the same outcome on three repeats under a concurrent run (the model owed a
backstop cut).

Co-authored-by: Isaac <no-reply@databricks.com>
KyleAMathews and others added 18 commits December 1, 2026 07:25
…ple as open, owned by #312

Mutant copies resolve bare imports from the config root (testRoot parent,
vite.config.mjs, package-local dependencies), so every copy of file a is
a setup error. This predates #99, which does not touch copy resolution.
The maintainer ruled (register M 2026-12-01) that it stays open on #312,
is named in the gap oracle's known limits, and is fixed in its own PR
after #99. testRoot is not pinned, so the defect stays reachable.

Co-authored-by: Isaac <no-reply@databricks.com>
…izes every number

CI on 5ded600 (run 46667331764, determinism 13/14): two runs of "a stop
after the config's service refused the run" still differed in stream
shape, by 2 characters on each stream. Dumps show the cause. The `note
log` line names the run's scratch directory, whose name is random. The
duration rule (`\d+s` → `<s>`) changed its length whenever the random
name held a digit followed by s.

The shape now replaces the scratch paths with the names the other
observations use (`<package>`, `<out>`, `<cli>`), longest first because
one contains another. Then it writes every number as `<n>`: durations in
s or ms, pids, and counts of time-driven events. The stream law still
judges each line. The shape still sees a line added or dropped.

Evidence, under a load average of 14 to 21: the five stop and ask
determinism units fail 2 to 4 of 5 before the change and pass 3 runs of 3
after it. The stop, warm, ask, supervisor and abort family passes 109 of
109. Dropping the child's `written` send still fails 5 fixed-seed ask
units. tsc and the unit suite (125) pass.

Co-authored-by: Isaac <no-reply@databricks.com>
Law: a count cut is clocked only by what happened before it (C 2026-11-29,
register). The emitter (gap-report-model-oracle.mjs, oracleTestFile's
campaign) places every clock read, timer wait, and own I/O completion of a
spinData verdict test before its spin loop (6616 to 6661 before the spin at
6701 to 6706), and the loop has no exit. So the position-blind readsClock,
waited, waitsIn, and spinThrows terms of a spin cut equal the position-aware
judgment there, and the model needs no change. The verdict's re-read after
the loop runs only where the spin is not taken.

Measure: 300 generated histories (seed 20261201) sampled from the drawn
arbitrary, emitted tests/b. 30 have a spinData verdict, 316 spin copies, and
none has a clock, timer, or I/O event after its spin. A planted clock read
after the spin is flagged in 30 of 30, so the detector sees such an event.
The scratch measurement is not committed.

Behavior: none. The Known limits sentence "no history reaches that
difference" is replaced by this reasoning and its citations. Constructed
histories use the same emitter; their order is by structure, not sampled.
If an emitter change moves an event after the spin, these terms need the
position-aware judgment (clockedAtCut) again.

Co-authored-by: Isaac <no-reply@databricks.com>
…m's shape

Gate 7 of #99, B1: the stop observation stored each stream's shape length,
so two runs whose streams differed by a word of the same length compared
equal. It now stores a digest of the shape (sha1, 16 hex digits): the text
with heartbeat lines dropped, scratch paths named, and numbers normalized.
Exact emptiness stays a separate relation.

RED: a CLI mutant that writes "note log" or "note lag" at random (same
length) passed the length-based observation. With the digest, the
determinism units for the stop histories fail at observation 4 whenever
the twins draw different words. GREEN: the stop, warm, ask, supervisor and
abort determinism units pass 33 of 33, twice. tsc and the unit suite
(125) pass.

Also from gate 7:
- B4: limitFor's comment said the budget is at most 100 times the most
  calls; it is 100 times or CALL_FLOOR, whichever is larger. The comment
  and the known limits now name the band below about 333 calls, where a
  legal copy can pass the backstop and becomes a gap. The maintainer's
  words for backstops accept it ("set the timing high enough that if it
  does get hit it's a) rare and b) something is wrong"; C 2026-11-30).
- N-2: the harness comment on --test-timeout no longer claims that Vitest
  is ordered against every copy's backstop.

Co-authored-by: Isaac <no-reply@databricks.com>
Law: C 2026-11-23, "Count-cut label precedence", step 1 (applies to authored
mutants too), and C 2026-11-24, "Every built-in cut by an excluded test ends
the copy as a gap". A failing law's count or no-progress cut blocks the mutant
by that law, and a kill in a later owner's copy does not decide it.

Reach: two constructed histories, appended last: "an authored mutant's
failing-law no-progress cut blocks it" and "an authored mutant's failing-law
spin cut blocks it". File a's failing law cuts the authored copy at its start;
file b's passing law would kill the patch.

RED (4594f57 production, unshrunk): no-progress `killed`, owed `blocked`;
spin `killed`, owed `blocked`.
GREEN (this commit): both pass on fixed and random seeds, and the determinism
pair; neighbours (57 selected: authored and failing-law tests, fixed, random,
determinism) 48 passed, 0 failed.
Mutant A (units passed to blockersOf, no cut truncation): both fixed-seed
witnesses fail, `killed`, owed `blocked`. Passing units alone is not enough.

Production: authored copies are stored in owner-file order (targets sorted);
the units after the first failing-law cut are dropped before judging and
blockersOf gets the units. judgeAuthored is unchanged: blockedOr maps its
timeout to blocked, as judgeMutant does.
Model: lawSpinsUnder(fnId, active) serves operator and authored mutants; the
authored judgement passes the failing law's cut.

Limits: the authored path runs every owner copy (the cut only truncates the
judgement). Known-limits sentence on the authored no-progress cut removed.
pr-shards check fails for the 8 new names until ci-packed-shards.mjs is
repacked (not done here).

Suites (from packages/oracles): tsc --noEmit clean; unit 125/125; fast gap
suite 33,995/33,995; every outcome class (fixed seed) 3/3; e2e-shards check
passes; eslint and prettier clean on changed files.

Co-authored-by: Isaac <no-reply@databricks.com>
…ks it

Conflict: the gap oracle's known limits. This branch's backstop-band
sentence is kept, and fix99-authlaw's removal of the authored-mutant
limit is applied.

Co-authored-by: Isaac <no-reply@databricks.com>
…he cut

Conflict: the gap oracle's known limits. fix99-spinclock's measured
reasoning replaces the old spinData limit sentence, and the other
sentences are kept.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…ile (#312)

Law: a copy runs as its file does (check.mjs copy naming, "so that its
imports resolve as the file's do"; G44 mutant copy). Vite falls back to
the config root when a bare import's importer is not on disk, and a copy
is memory-only, so its bare imports resolved from the root.

Witness: random seed 1499477532 ("a declaration fault: noTypescript"),
RED on the parent commit with setup-error, owed not-observed; GREEN after
the fix, and seed -1166311135 GREEN too. The copy's origin file is recorded
when a batch starts and its bare imports resolve from that file.

Co-authored-by: Isaac <no-reply@databricks.com>
The model kept running owner copies after a behavioral kill. A later copy
whose work passed the mutant's work budget then labelled the kill as
bounded work. The CLI stops at the first kill, so the label is a behavioral
law. Counterexample: random seed 741195771, a stale authored mutant and a
reformat, mutant src/sut.ts:f0:31 value-undefined.

Law: the first kill decides the mutant, and no later copy runs. Authority:
register C 2026-11-14 "Deterministic cuts, outcome rule" (1); v21.2 C-38 (1)
and R49 "the first kill decides"; M 2026-11-06 (the CLI runs no further file
after a kill, check.mjs stopOnKill). Production is right, the model is
wrong.

Reach: a constructed history, "a behavioral kill decides before a later
owner's copy passes the work budget" (owner a judges by verdict, owner b
makes 30,000 extra calls), declared as required state "an earlier owner's
kill decides before a later owner's copy passes the work budget".

RED: the constructed history on the parent model fails in the fixed-seed
and random-seed units with "killed by a behavioral law, owed bounded work".
The seed replay fails with the same difference.

GREEN: the constructed history passes in fixed, random and determinism units;
the seed replay passes.

Mutant: a temporary check.mjs that lets copies run past a kill (no
stopOnKill break, no skip-on-kill) makes the fixed-seed unit fail with
"killed by bounded work, owed a behavioral law". The random-seed unit passes
under that mutant, so it is a weaker witness for this class.

Limits: only the first kill is covered for an operator mutant. A kill from
an early verdict of a hung copy is also treated as a decisive kill, but no
constructed history pins that case. The constructed history draws other
fields, so random units may not reach the same copy order.

Shard lists: ci-packed-shards.mjs is a generated file. I hand-placed the
four new names beside their neighbour and did not run pack, so the next
repack from CI durations rebalances them.

Co-authored-by: Isaac <no-reply@databricks.com>
…the shards

"every outcome class" required fix99-s741's new state, "an earlier owner's
kill decides before a later owner's copy passes the work budget". Only its
own constructed history reaches it, so it moves to constructedOnly, and
the fixed-seed "every outcome class" unit passes. The shards are repacked
with the new names, which fix99-s741 had placed by hand.

Co-authored-by: Isaac <no-reply@databricks.com>
Seed 1487125809 ("a daemon pause that cannot engage"), on CI run
46771643742: `reportAndPush:20:delete-call#0: unregistered-kill, owed
framework-error`. In file a, an unregistered test records soft verdicts,
then a calibration test calls past the call budget. When it cut a copy,
the model marked the whole file hung, so the verdicts of the earlier runs,
which ran to their end, were dropped. Production keeps them.

Law: the maintainer's ruling M 2026-12-02, "Any verdict observed before a
cut survives it". A cut never erases a verdict already observed, whatever
its route, and the route sets only the label (unregistered-kill is a gap).
The model now keeps the verdicts of every earlier run in the file at a
cut, not only the cut run's.

Witness, appended last, with its state in required and constructedOnly:
"an unregistered soft verdict before a later calibration spin survives
the cut".
RED: the parent model owes framework-error where production gives
unregistered-kill. That is also the mutant (only the cut run's verdicts
kept).
GREEN: the witness passes on fixed seed, random seed and determinism, and
the seed's replay passes.
Checks: tsc, the unit suite (125), the fast gap suites (33,995), 32
fixed-seed cut, verdict and outcome-class histories, the e2e shard check,
and eslint.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…nted for

The batch watchdog took the last copy that had started as the running
one, and stopped once that copy closed. Vitest starts a batch's copies
out of their given order: on the seed -1042284152 replay, copy 11 started
and closed, and copies 8 to 10 of the same batch started later, one after
another. The watchdog stopped when copy 11 closed, so the run ended in
the test's own timeout (cause backstop) instead of unregistered-kill.

Each started copy now runs until it closes or until Vitest reports its
file finished (passed, failed, a load failure, or skipped). Each running
copy is cut by its own state: spin, no progress, then the backstop. The
watchdog stops when every copy is finished.

Law: a copy that the run still owes is cut by its own state, whatever
order Vitest starts the batch in (the design register's v21.2 R50, I4
and I15: an idle copy is cut at once, by its state).

RED: seed -1042284152, path 0, "random seed: generated" on the parent
commit: "timeout, owed unregistered-kill", cause backstop (two runs).
GREEN: the same replay passes.
Mutant: the parent commit's finished() is the mutant; the replay rejects it.
Limits: no constructed witness forces out-of-order starts yet; the seed
replay is the only reproduction.

Co-authored-by: Isaac <no-reply@databricks.com>
Brings in #314 (SQLite evidence store, memoized ownership, per-copy profile
spans) and #290 (--diff-base refuses an unknown revision and judges only
changed lines; drawn history fields faults, diffBase and authoredSpan).

Conflict resolutions:

- check.mjs, index.mjs: both sides kept (cutBuiltIn with copySpans(rows);
  the combined usage comment); resolved earlier, unchanged here.
- gap-report-model-oracle.mjs, history record: main's fields first in main's
  order (..., failingLawSpins, faults, diffBase, authoredSpan), then #99's
  (hangMs, heavy, pair, failingLawHangs). failingLaw* are on main already,
  so they keep main's position.
- gap-report-model-oracle.mjs, take-back: #99's plain/takenBack path with
  main's faults and laterSteps handling. Test fields: takenBack maps slow to
  false and slowMs to a drawn value, the stricter neutral (main dropped slowMs).
  diffBase and authoredSpan default to none and false when a constructed
  history does not name them (not in constructedNeutral: a diff base is a
  drawn value).
- gap-report-model-oracle.mjs, authored result: both cause and endLine kept.
  A stray base line from main's judge() call was dropped; judgedKind stays.
- gap-report-oracle.property.test.mjs: failsALaw (#99) and diffBaseStates
  (main) both kept; statement = #99's text plus main's diff-base sentence;
  limits = #99's flaky-spin limit and main's Law 12 limit with its added
  sentence in one value (#99 had a duplicate limits key); constructed
  histories = main's block, then #99's.
- constructed-order.json: main's 117 names, then #99's 45 new names.
- history-fingerprint.json: regenerated for the merged grammar. Main's
  fields before tests are unchanged; the tests line and later lines shift
  because #99's per-test fields are drawn.
- scripts/pr-shards.mjs: #99's packed(...) for the Windows fixed-seed
  partition kept; main's new static names added to the hand-written
  oracle-gaps-static shards.
- scripts/ci-packed-shards.mjs: repacked with pack-shards-from-ci.mjs pack
  (6, 7, 14 and 11 shards; the pr.yml matrices already match).

Co-authored-by: Isaac <no-reply@databricks.com>
…ories

The constructed history "an edit sequence through the daemon" did not enter
"of two checks held in the daemon at once, one computed and the other
reused" at seed 2146183896. #290's drawn `diffBase` was truthy in that base.
The cold phase then ran a `--diff-base` check through the daemon before the
two checks at once, which filled the daemon's evidence store, so the first
of the two checks computed nothing.

Law: a constructed history reaches every state it names (oracle-gaps
history contract; register 2026-11-16 "Randomness wins for new fields",
which restores a lost state with a constructed history). Constructed
histories pin the drawn fields they depend on to neutral values, as the
other constructed histories already pin `diffBase: \`none\``.

Change: pin `diffBase: \`none\`` in "an edit sequence through the daemon" and
in the sibling constructed histories that start daemons at once and lack
the pin (a flaky owner's loop calls under the call budget, a property test's
later run spins into bounded work, a property test's count cut lands in its
first part after a run with n, a flaky test's verdict before a no-progress
cut kills nothing, a non-judging property test's later run spins into bounded
work, and the declaration faults).

Evidence:
- Law: as above.
- Reach: the failing constructed history reaches the state at the failing
  seed (replay: passes, 1 of 1). Not measured over generated histories.
- RED: on 7170bd4, `ORACLE_SEED=2146183896 ORACLE_PATH=0 ... random seed: an
  edit sequence through the daemon` fails "did not enter ... of two checks
  held in the daemon at once, one computed and the other reused". The
  debugging trace showed the store already held 11 units before the
  first check, written by the diff-base run.
- GREEN: the same replay passes. Sibling random-seed units at the same seed
  pass (four of the six siblings run; the declaration-fault template was
  not run one by one). `every outcome class` (fixed seed, 9 passed),
  `edit sequence through the daemon` (3 passed), `determinism` (3 passed),
  fast oracle-gaps suite (33998 passed), unit suite (145 passed),
  typecheck, eslint, prettier, both shard checks.
- Mutant: the failing base with a drawn `diffBase` (the unpinned history at
  seed 2146183896) is the hostile input; the oracle rejects it as above.
  No production mutant was run for this state.
- Limits: no generated-history reach measurement; the pre-existing failure
  of the calibration unit "the daemon reports another outcome than the cold
  run" on the branch is not addressed here (it fails identically without
  this change).

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@KyleAMathews
KyleAMathews marked this pull request as ready for review December 2, 2026 17:00
@KyleAMathews
KyleAMathews merged commit fee6439 into main Dec 2, 2026
145 checks passed
@KyleAMathews
KyleAMathews deleted the fix/gap-cli-deterministic-cuts branch December 2, 2026 17:00
KyleAMathews added a commit that referenced this pull request Dec 2, 2026
…s undecided

The frozen-plugin state (CR-2) read the evidence store, which the corruptStore step overwrites, and threw. After the merge of main (#99, #314) the store is corrupted in more histories, so the state now reads it through storedNoneReadable: an unreadable store decides no state.

Co-authored-by: Isaac <no-reply@databricks.com>
KyleAMathews added a commit that referenced this pull request Dec 2, 2026
fee6439 has the same tree as 7009178, this branch's parent, so the
merge keeps this branch's tree unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant