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

オープン
#143 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
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分
マージ済み PR(30日)
60

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/oracles のほかの issue

TanStack/oracles の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。