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

Đang mở
#143 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, node.js
Lĩnh vực
backend, devtools, testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
JavaScript
Star
5
Fork
1
Merge trung bình
8 giờ 31 phút
Pull request đã merge (30 ngày)
60

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/oracles

Tất cả issue của TanStack/oracles

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.