Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9865b62
fix(oracle-gaps): every read is a daemon input
KyleAMathews Dec 2, 2026
8c770da
test(oracle-gaps): daemon inputs read by stat, append, child process …
KyleAMathews Dec 2, 2026
150d047
fix(oracle-gaps): an append to the run's own capture or log reads not…
KyleAMathews Dec 2, 2026
92aa0e4
Merge origin/main into fix/daemon-every-read
KyleAMathews Dec 2, 2026
0d8474d
test(oracle-gaps): a constructed history kills the runner's own-appen…
KyleAMathews Dec 2, 2026
f7a95db
fix(oracle-gaps): a worker thread's reads are inputs
KyleAMathews Dec 2, 2026
dce21b3
fix(oracle-gaps): a require's package.json main and type are inputs
KyleAMathews Dec 2, 2026
38655e6
perf(oracle-gaps): a child fold reads only what the tree wrote since …
KyleAMathews Dec 2, 2026
f2a09af
fix(oracle-gaps): repair the CodeRabbit findings that hold on the head
KyleAMathews Dec 2, 2026
0c1c683
fix(oracle-gaps): a file the session wrote and then removed is no change
KyleAMathews Dec 2, 2026
a7600bb
fix(oracle-gaps): a mid-run edit of a gate that a test reads lands in…
KyleAMathews Dec 2, 2026
ef8ea60
test(oracle-gaps): witnesses for the write, link, worker and log repairs
KyleAMathews Dec 2, 2026
3e3458d
test(oracle-gaps): witnesses for the worker directive and the large-f…
KyleAMathews Dec 2, 2026
b3b00f2
test(oracle-gaps): a config plugin's scratch file is no input (CR-3)
KyleAMathews Dec 2, 2026
2d1ec51
fix(oracle-gaps): a frozen plugin hook is checked cold and stores no …
KyleAMathews Dec 2, 2026
36e9579
fix(oracle-gaps): a constructed history takes no drawn frozen plugin …
KyleAMathews Dec 2, 2026
f973aa7
fix(oracle-gaps): a daemon check writes only what its state changed
KyleAMathews Dec 2, 2026
7166a03
test(oracle-gaps): the restart rule's calibrations kill a kept and a …
KyleAMathews Dec 2, 2026
e16c8e5
Merge origin/main into fix/daemon-every-read
KyleAMathews Dec 2, 2026
241ee5a
fix(oracle-gaps): a frozen plugin's state reads an unreadable store a…
KyleAMathews Dec 2, 2026
6d7abf6
fix(oracle-gaps): a unit a daemon check does not store names its move…
KyleAMathews Dec 2, 2026
3b32dc7
fix(oracle-gaps): a file a run's own tree made is its output, not an …
KyleAMathews Dec 2, 2026
f2709e5
test(oracle-gaps): the restart law's mid-run scoping is accepted 2026…
KyleAMathews Dec 2, 2026
d3aa405
fix(oracle-gaps): a Vite resolution stat of a test file is a kind rea…
KyleAMathews Dec 2, 2026
fc60b54
fix(oracle-gaps): the scratch-plugin config fixture is valid in a Com…
KyleAMathews Dec 2, 2026
0be6030
fix(oracle-gaps): Vitest's results caches are the runner's output, no…
KyleAMathews Dec 2, 2026
cd44ff9
fix(oracle-gaps): a check records a daemon pid only where the restart…
KyleAMathews Dec 2, 2026
843b134
fix(oracle-gaps): narrow the Vitest cache exclusion to the metadata f…
KyleAMathews Dec 2, 2026
326a73e
fix(oracle-gaps): a directory a run makes is its own output, from the…
KyleAMathews Dec 2, 2026
c11836a
fix(oracle-gaps): the reset step's daemon is a new process by its own…
KyleAMathews Dec 2, 2026
db16e36
fix(oracle-gaps): the restart law judges no pair across a daemon the …
KyleAMathews Dec 2, 2026
92933b6
docs(oracle-gaps): the own-output rule is accepted, with its limit (2…
KyleAMathews Dec 3, 2026
b65773b
fix(oracle-gaps): a pluginWrite gate's warm leaves the file open, so …
KyleAMathews Dec 3, 2026
a10189e
fix(oracle-gaps): a child's stat or listing of a path its tree wrote …
KyleAMathews Dec 3, 2026
f6c3180
Merge origin/main into fix/daemon-every-read
KyleAMathews Dec 3, 2026
5bb02b7
Merge remote-tracking branch 'origin/fix/daemon-every-read' into pr13…
KyleAMathews Dec 3, 2026
6f8c47c
fix(oracle-gaps): a check that edits no gate starts on the text the l…
KyleAMathews Dec 3, 2026
17940ca
test(oracle-gaps): the restart trace writes no file, so the tree hold…
KyleAMathews Dec 3, 2026
f594771
test(bug-search): restore main's non-null assertions that the merge c…
KyleAMathews Dec 3, 2026
361d9d5
fix(oracle-gaps): a leading directive keeps the eval worker strict, a…
KyleAMathews Dec 3, 2026
13c20e9
test(oracle-gaps): the numeric-flag unit opens with flag combinations…
KyleAMathews Dec 3, 2026
aaadc84
test(oracle-gaps): the held-check violation names the refusal its CLI…
KyleAMathews Dec 3, 2026
100e19e
test(oracle-gaps): a check at once records the environment its CLI se…
KyleAMathews Dec 3, 2026
3a3d54b
fix(oracle-gaps): a Vitest that fails to load names where it resolved…
KyleAMathews Dec 3, 2026
d1df42a
test(oracle-gaps): a classification violation names a crash's error, …
KyleAMathews Dec 3, 2026
e91c0d6
fix(oracle-gaps): a Vitest load refusal names its layout on its first…
KyleAMathews Dec 3, 2026
6a0d1a1
test(oracle-gaps): the kill-reported-as-crash calibration is in an e2…
KyleAMathews Dec 3, 2026
5db6b8e
fix(oracle-gaps): the daemon's log names each restart, each declined …
KyleAMathews Dec 3, 2026
a7e17a4
test(oracle-gaps): a restart violation names each daemon's real pid, …
KyleAMathews Dec 3, 2026
31b5b0b
fix(oracle-gaps): a package reached through a symbolic link is import…
KyleAMathews Dec 3, 2026
f1b8e82
fix(oracle-gaps): the daemon's log names each shutdown, lock transiti…
KyleAMathews Dec 3, 2026
2928a6a
fix(oracle-gaps): on win32 the gate of a linkDotDot read is the file …
KyleAMathews Dec 3, 2026
e209f63
fix(oracle-gaps): a transform-time gate change owes a restart only af…
KyleAMathews Dec 3, 2026
44cb62a
fix(oracle-gaps): the reset step awaits its warm daemon's served mark
KyleAMathews Dec 3, 2026
551472f
test(oracle-gaps): the evidence store's two size tests get a 60 s tim…
KyleAMathews Dec 3, 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
15 changes: 15 additions & 0 deletions .changeset/gap-cli-daemon-every-read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@tanstack/oracles': patch
---

A check through `--daemon` now treats each tracked read as an input of the runs that made it, so after any change to a tracked input it reports what a cold run reports. Reads that stay untracked are listed below. Before, the daemon reused a run that read the old input. The new inputs are a file that a test reads through `fs` outside the package or under `node_modules`, or through `createReadStream`; a directory that a test lists (`readdir`, `opendir`, and their sync and `fs/promises` forms), by its entries; an environment variable that a test reads (or the set of variable names, when a test lists them); and a file or variable that Vitest, Vite, or the config reads in the CLI's process, while it loads or in a hook of any plugin, Vite's own included, such as the `tsconfig.json` that Vite's esbuild plugin reads or a sidecar file that a plugin writes into the code it transforms.

The daemon now runs each check in the environment of the CLI that asked for it. A check from another environment, or after a file that Vitest, the config, or a plugin read or wrote has changed, starts a new daemon. Because Vitest and Vite read every environment variable while they start, any change to the environment runs every unit again, as a cold run does.

Each check now hashes every file input from its content, so an edit that keeps a file's size and modification time, as `cp -p`, `rsync -t`, or `touch -r` leave it, is no longer missed. A test that stats a file by its size or times has that metadata as an input too, while a directory's stat is an input by its kind alone.

A file that a test, or a Node process or worker thread it started at any depth, wrote before the test read it is the test's own output and no input, so a test whose child writes a temporary file is reused on an unchanged check.

Not every read is tracked yet. These stay untracked, and the README lists them: a read through a file descriptor, a link's target, the other stat calls, `glob`, `copyFile` and `cp`; a directory's own metadata; a child process started with an environment that drops `NODE_OPTIONS`, and a writer that is not Node. Run the check cold after an edit to one of them. Vitest's own discovery listings are left out on purpose.

The CLI sends its environment to its daemon's socket only when this user owns that socket, so another user's listener in the shared temporary directory cannot receive it.
110 changes: 77 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,39 +266,83 @@ runs cold` and runs the check in its own process, which reports what the
run's output directory, and serves the next check. On Windows, which has no process groups, the run is not
supervised.

A check through the daemon reuses a run while its inputs are unchanged:
the modules the run loaded, and the files in the package that its tests
read through `fs` (`readFileSync`, `readFile`, `existsSync`, `statSync`,
and `fs/promises` `readFile` and `stat`), each by the content that the
run read. A run that an edit overlapped, because a file changed after the
run read it, is not reused. A directory that a test stats or tests for is
an input as a directory, not by its content.

Two kinds of input are not tracked yet. A Vite plugin whose output depends
on anything but a module's text, such as a sidecar file that it reads, can
make the daemon serve a run that read the plugin's old output. And the
daemon's environment is fixed when it starts, so an environment variable
that a later check sets does not reach the daemon's runs. After such a
change, run the check cold (without `--daemon`), or stop the daemon with
`oracle-gaps --stop-daemon --package <dir>`. The maintainer decided on
2026-11-13 that the daemon tracks both and restarts when they change; a
later release does that.

These reads are no input, so an edit to the file alone does not rerun the
tests that read it: a read outside the package or under `node_modules`; a
read from a worker thread or child process that the test starts; and a
read through any `fs` or `fs/promises` function other than the six above,
or through one of those six given a file descriptor. That catch-all
includes, for example, `readdir`, `opendir`, `glob`, `globSync`,
`createReadStream`, `realpath`, `lstat`, `access`, `open`, `read`,
`readSync`, `readv`, `fstat`, `fstatSync`, `copyFile`, `copyFileSync`, `cp`,
`cpSync`, `openAsBlob`, `statfs`, `readlink`, the callback `stat`,
`exists`, `watch`, and `watchFile`, and the `fs/promises` `readdir`,
`opendir`, `glob`, `lstat`, `realpath`, `readlink`, `access`, `open`,
`copyFile`, `cp`, `statfs`, and `watch`. Run the check cold (without
`--daemon`) after an edit to a file read that way. A later release records
all of them except `watch` and `watchFile`, which wait for future changes
and stay no input (maintainer decision, 2026-11-13, with `watchFile` in the
A check through the daemon reuses a run while its inputs are unchanged.
Every read is an input (maintainer decision, 2026-11-16): the modules the
run loaded; the files its tests read through `fs` on any path, inside the
package or outside it, `node_modules` included (`readFileSync`,
`readFile`, `createReadStream`, and `fs/promises` `readFile`), each by the
content that the run read; the files its tests stat, by their existence
and kind (`existsSync`), or by their size, times, identity, and mode
(`statSync`, `stat` with or without a callback, and `fs/promises` `stat`),
where a directory's stat is an input by its kind alone, so a directory's
own size or times are not (a limit, CR-13); the directories its tests list
(`readdir`, `readdirSync`, `opendir`,
`opendirSync`, and `fs/promises` `readdir` and `opendir`), each by its
entries' names and kinds; the environment variables its tests read, by
value, or all of them when a test lists them; and what Vitest, Vite, and
the config read in the CLI's process, while Vitest loads and the contexts
warm, and in each hook of every plugin, Vite's own (such as the
`tsconfig.json` that its esbuild plugin reads) and the config's alike. A
file that a reader wrote earlier in the check, before it read it or tested
whether it exists, is its own output and no input (maintainer decision,
2026-11-17). For a test, that includes a file that a Node process it
started wrote, at any depth: each such process preloads the runner's
write log through `NODE_OPTIONS` (maintainer decision, 2026-11-19). A
child started with an environment that drops `NODE_OPTIONS`, or a writer
that is not Node, is not seen, so its file stays an input. A file the
session wrote that is edited by hand afterwards is seen. Each check hashes
every file input from its content, so an edit that keeps a file's size and
modification time (`cp -p`, `rsync -t`, `touch -r`) is seen. A run that an
edit overlapped, because a file changed after the run read it, is not
reused. A directory that a test stats or tests for is an input as a
directory, not by its content.

A path that a run's own process tree wrote, created or copied before the
read, is no input, and a directory the run added entries to is no input;
mkdir and mkdtemp count as writes (accepted 2026-12-02, maintainer). A path
the run read present and then changed, which the tree did not write first,
is an input that moved. Limit, accepted 2026-12-02 (maintainer): a later run
that finds a leftover of an earlier run at such a path reuses the stored run,
so a test whose outcome depends on that leftover is not hermetic.

The CLI sends its environment with each request, so it sends it only to a
daemon socket that this user owns; a socket another user made in the
shared temporary directory is refused, and no request goes to it. On
Windows, a named pipe has no owner check here.

The daemon runs every check in the environment that the CLI asking for it
has. While a context warms, Vitest and Vite read every environment
variable by value, so a check from an environment that differs in any
variable, even one no test reads (`OLDPWD`, `SHLVL`, a terminal's session
id), starts a new daemon and runs every unit again, as a cold run does.
So does a check after a file that Vitest, the config, or a plugin read or
wrote has changed.

The harness gives each worker thread and each child process that a test
starts its preload, at any depth (a worker started by a worker included),
so their reads are inputs too. A `require` in a test
consults the `package.json` files that decide a package's `main` and
`type`; Node reads them itself, so the harness records them through a
wrapper on `Module._resolveFilename`, a private Node API (check.mjs says
what changes if a Node version alters it). A child process that
the test starts with an environment that drops `NODE_OPTIONS` is not
watched (#143). A file that the runner created for the run (its capture
rows and its `test-output.log`) is the runner's output: an append to one
of them reads nothing first, and a plain read of either is still an input.

These reads are no input yet, so an edit to the file alone does not rerun
the tests that read it: a read through a file descriptor, after `open`,
`openSync`, or the `fs/promises` `open` (#141); a link's target, or the
rest of the stat family, `lstat`, `readlink`, `realpath`, `access`, and
`exists` (#142); `glob`, `globSync`, `copyFile`,
`copyFileSync`, `cp`, `cpSync`, `openAsBlob`, `statfs`, and the
`fs/promises` `glob`, `copyFile`, `cp`, and `statfs` (#152); the
module-level reads of a test file whose tests are all skipped (#153); and
the earlier content of a file that a test partly writes or fails to write,
then reads. Run the check cold (without `--daemon`)
after an edit to a file read that way. A later release records all of
them except `watch` and `watchFile`, which wait for future changes and
stay no input (maintainer decision, 2026-11-13, with `watchFile` in the
family of `watch`).

- `packages/eslint-plugin-oracles` (`@tanstack/eslint-plugin-oracles`): the
Expand Down
Loading
Loading