daemon inputs: reads from a test's worker threads and child processes are no input yet

未關閉
#143 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, node.js

研究方向

Start with packages/oracles/oracle-gaps/inputs.mjs (watchReads) and how capture-setup.mjs records reads; compare that with the CLI path in check.mjs. The issue gives an oracle-first sequence: add childRead and workerRead gates and histories, then run the named Vitest command and shard 4. Done means child and worker reads reach the copy's reads, the regression history passes against a cold run, and the mutant check fails only for that history; the non-Node child behavior still needs a maintainer ruling.

由索引模型根據 Issue 內容生成。

描述

Family: reads from a test's worker threads and child processes. The recorder runs in the Vitest worker only (capture-setup.mjs). A new Worker(...) or child_process.spawn/fork/exec started by a test reads files and variables in another thread or process, and none of those reads is an input. Today a test that spawns a child does make env:* and every variable an input, because spawning lists the environment. The child's own fs reads are missing.

Gate kinds childRead and workerRead: file b runs spawnSync(process.execPath, ['-e', "process.stdout.write(require('fs').readFileSync(<gate path>, 'utf8'))"]) and parses its stdout. The workerRead kind does the same through new Worker(..., { eval: true }) and receiveMessageOnPort. The edit changes only tests/gate.json.

Fix (larger): inject the recorder into the child and the worker, and carry their reads back into the copy's reads.

  • Children: wrap child_process spawn calls in the worker so that a Node child gets --import <session>/inputs-child.mjs through NODE_OPTIONS. That module calls watchReads and appends { key, hash } rows to a file named by an ORACLE_GAPS_CHILD_READS variable. The copy merges those rows before its closing row. A non-Node child (a shell, a binary) cannot be watched. Such a run has to be treated as reading everything, which is not reusable: it is stored under a key that never matches, so the daemon recomputes it, the conservative choice. This needs a maintainer ruling on whether that cost is acceptable.
  • Workers: Node Worker takes execArgv and env. Do the same with a MessageChannel, or with the same rows file.
  • Cost to measure: NODE_OPTIONS reaches grandchildren too. The rows file needs the torn-row care from #83.

Authority: maintainer decision M 2026-11-16 "Every read is a daemon input" (the user ruled it with no exceptions), v21.2 R46, G42, I8. The watch family (watch, watchFile) stays no input (C-19).

Context: #133 records the six #55 fs calls on any path, node_modules included, plus environment variables, plugin inputs and directory listings (readdir/opendir, dir:/dirs: keys). The recorder is packages/oracles/oracle-gaps/inputs.mjs (watchReads), shared by the worker (capture-setup.mjs) and the CLI process (check.mjs). Keys are hashed by inputHash and looked up through servedHash. This family is still unbuilt, so I8 does not hold for it.

Oracle-first plan (the pattern from #133):

  1. Add a value to inputRead (drawn, appended; update the canary's inputRead line) and one constructed history appended at the end, with steps [inputGate, recheck]. It enters edit inputGate changed the cold result, an edit to the <kind> gate input changed the cold result and an unchanged check through the daemon computed nothing. Add it to scripts/pr-shards.mjs shard 4 (and a Windows shard) and to scripts/e2e-shards.mjs.
  2. RED: run pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-oracle -t "fixed seed 20261105: <name>" on the oracle-only commit. Expect incremental equals cold: "after inputGate, the daemon's report differs from the cold run's", with the daemon reusing killed where the cold run says survived.
  3. Fix in inputs.mjs (see below), then show GREEN on shard 4.
  4. Mutant: remove the new wrapper or key from watchReads. Only this history should fail.
主要語言
JavaScript
星號
5
分支
1
平均合併
8 小時 31 分鐘
30 天內合併 PR
60

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TanStack/oracles 的其他 Issue

查看 TanStack/oracles 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。