Repository navigation
fix(cli): record asynchronous reads of doc dependencies - #11848
astracat-bot[bot] wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested for one release-note fix; the recorder change itself looks correct. The new regression test fails on main and passes on this branch, and the name-index test that fails on the minimum-Node job now passes under Node 22.13.0 and 24.
.changeset/record-async-doc-inputs.mdcredits no contributor, sopnpm check:changesetsfails the required Lint job; add an@handleline under the summary, aspnpm changeset:new --contributor <handle>writes it.
Once the credit line is in and CI is green, this is ready for another look.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- Changeset: the not-found hint refreshes its name index after an imported doc dependency changes on the minimum supported Node version — verified: the docs-routes name-index test fails on
mainunder Node 22.13.0 (the imported module is missing from the stamps) and passes on this branch; the CLI's engines floor is Node 22.13.0. - Before the fix, the kept index left out files a code doc imports on the minimum Node version — verified by the same test and by a plain-Node import probe that records nothing on
mainunder 22.13.0. - Node 22.13.0 loads native ES modules through the promise
readFile— verified: the probe records the importing and imported modules only once that function is wrapped. - The recorder wrapped synchronous reads only; the route assertions passed and the dependency-stamp assertion failed — verified: the failure is at
name-index.test.mjs:511onmain. - The fix reuses the content-read wrapper and first-read stamps, keeps nested runs, and returns the original promise — verified in
read-record.mjs:105-139and by the nested-run test. - No module hooks, policy changes, retries, waits or assertion changes — verified from the diff.
- The global-mode record requires a kept value to be used only while every input its gather read is unchanged — verified in AST-081 FR7.
- No public API or Node floor change — verified: exports, command docs and the engines field are unchanged.
- The minimum-Node scheduled job fails on
main— verified: its Node 22.13.0 test leg failed. - The target test fails on
mainunder 22.13.0 and already passes under Node 24 — verified (run under 24.20.0). - Both full test files pass on both Node versions after the fix — verified: 21 of 21 under 22.13.0 and 24.20.0.
- The existing test still checks every dependency stamp, reuse after an unrelated edit and a rebuild after a dependency edit — verified in
name-index.test.mjs:448-547. - The new regression covers a promise read by file URL, nested recording, edit detection and nothing recorded outside a run — verified in
read-record.test.mjs:55-77; it fails onmainunder both versions. - Prettier and targeted ESLint pass — verified on the three files.
pnpm review:prereported no findings — not reproduced; its changeset checks do not cover contributor credit, so this does not contradict the lint failure.- Only the recorder, its test and a CLI patch changeset change — verified: three files.
Files:
.changeset/record-async-doc-inputs.md— no contributor credit; required lint fails.packages/cli/foundation/fs/read-record.mjs— clear.packages/cli/foundation/fs/read-record.test.mjs— clear.
PR Analysis Report🔎 Preview ·
|
|
validation: ran Adds the contributor credit line What I was unsure of: which handle to credit. This change was written by the bot, so I followed the earlier bot fix #11186, whose changeset credits No code or test changes. |
There was a problem hiding this comment.
Approved pending CI: the required test jobs have not finished on this head yet.
The recorder now also records promise reads, so on Node 22.13.0 the kept name index notices edits to the modules a code doc imports; the new regression test and the name-index test fail on main and pass on this branch under Node 22.13.0 and Node 24. The changeset credit line resolves the earlier Lint failure, and nothing else is needed from you.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Changeset: the not-found hint refreshes its name index after an imported doc dependency changes on the minimum supported Node version — verified: the docs-routes name-index test fails on
mainunder Node 22.13.0 (the imported module is missing from the stamps) and passes on this branch. - Changeset credit: the entry credits a contributor — verified:
@astracat-boton its own line;check:changesetsreports all 289 changesets valid and the Lint job passes. - Both test files pass on Node 22.13.0 and Node 24 — verified: 21 of 21 under 22.13.0 and 24.20.0.
- Prettier, targeted ESLint and
pnpm review:prepass — verified: formatting and lint are clean, andreview:prereports zero findings. - Before the fix, the kept index left out files a code doc imports on the minimum Node version, so an edit could leave the hint stale — verified by the same test and a plain-Node import probe that records nothing on
mainunder 22.13.0. - Node 22.13.0 loads native ES modules through the promise
readFile— verified: its loader reads each module's source with the promisereadFile, looked up on every load, which the head's wrapper intercepts. - The recorder wrapped synchronous reads only; the route assertions passed and the dependency-stamp assertion failed — verified at
name-index.test.mjs:511onmain. - The fix reuses the content-read wrapper and first-read stamps, keeps nested runs, and returns the original promise — verified in
read-record.mjs:105-139and the nested-run test. - No module hooks, policy changes, retries, waits or assertion changes — verified from the diff.
- The global-mode spec requires a kept value to be reused only while every input its gather read is unchanged — verified in its FR7.
- No public API or Node floor change — verified: exports, command docs and the engines field are unchanged.
- The scheduled minimum-Node workflow fails on
mainin its Node 22.13.0 leg — verified. - The target test fails on
mainunder 22.13.0 and already passes under Node 24 — verified (run under 24.20.0). - The existing test still checks every dependency stamp, reuse after an unrelated edit and a rebuild after a dependency edit — verified in
name-index.test.mjs:448-547. - The new regression covers a promise read by file URL, nested recording, edit detection and nothing recorded outside a run — verified in
read-record.test.mjs:55-77; it fails onmainunder both versions. - Only the recorder, its test and a CLI patch changeset change — verified: three files.
- Follow-up: the credit follows an earlier bot fix whose release already lists that handle — verified in the CLI changelog.
Files:
.changeset/record-async-doc-inputs.md— clear.packages/cli/foundation/fs/read-record.mjs— clear.packages/cli/foundation/fs/read-record.test.mjs— clear.
|
validation: ran Resolved the merge conflict with main This follow-up changes only three header lines in |
There was a problem hiding this comment.
Approved pending CI: the CI run on this head was cancelled because CI had no free capacity, so build, docsite-test and test still need a re-run here.
The recorder now also records promise reads, so on Node 22.13.0 the kept name index notices edits to the modules a code doc imports. The new regression test and the name-index test fail on main and pass on this branch, and both test files also pass on a trial merge with current main. Nothing else is needed from you.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Changeset: the not-found hint refreshes its name index after an imported doc dependency changes on the minimum supported Node version — verified: the docs-routes name-index test fails on the base under Node 22.13.0 (the imported module is missing from the stamps) and passes on this branch.
- Changeset credit: the entry credits a contributor — verified:
@astracat-boton line 7; the changeset check reports all 289 changesets valid and Lint passes. - Both test files pass on Node 22.13.0 and Node 24 — verified: 21 of 21 under 22.13.0, 24.20.0 and 24.22.1.
- Prettier, targeted ESLint and the pre-review script pass — verified: formatting and lint are clean on the three files, and pre-review reports a clean merge and zero findings.
- On the minimum Node version the kept index left out files a code doc imports, so an edit could leave the hint stale — verified by the same test and by a plain-Node import probe that records nothing on the base under 22.13.0.
- Node 22.13.0 loads native ES modules through the promise
readFile— verified: the probe records the importing and imported modules under 22.13.0 only once that function is wrapped. - The recorder wrapped synchronous reads only; the route assertions passed and the dependency-stamp assertion failed — verified at
name-index.test.mjs:511on the base. - The fix reuses the content-read wrapper and first-read stamps, keeps nested runs, and passes the original promise through — verified in
read-record.mjs:105-139and the nested-run test. - No module hooks, compatibility-policy changes, retries, waits or assertion changes — verified from the diff.
- The global-mode spec requires a kept value to be reused only while every input its gather read is unchanged — verified in its FR7.
- No public API or Node floor change — verified: exports, command docs and the engines field are unchanged.
- The scheduled minimum-Node workflow failed on
mainin its Node 22.13.0 test leg — verified from that run. - The target test failed on
mainunder 22.13.0 before the fix and already passed under Node 24.22.1 — verified (also under 24.20.0). - The existing name-index test still checks every dependency stamp, reuse after an unrelated edit and a rebuild after a dependency edit — verified in
name-index.test.mjs:448-547. - The new regression covers a promise read by file URL, nested recording, edit detection and nothing recorded outside a run — verified in
read-record.test.mjs:55-77; it fails on the base under all three Node versions. - Only the recorder, its test and a CLI patch changeset change, with no existing test or workflow changed — verified: three files.
- Follow-up: the merge conflict with
mainis resolved by matchingmain's header, with no behaviour change, and both test files pass on the combined merge — verified: the header ismain's wording, the trial merge is clean, and 44 of 44 tests pass under 22.13.0 and 24.20.0.
Files:
.changeset/record-async-doc-inputs.md— clear.packages/cli/foundation/fs/read-record.mjs— clear; its header now matchesmain's and is accurate once merged.packages/cli/foundation/fs/read-record.test.mjs— clear.
* fix(cli): record asynchronous reads of doc dependencies Re-cut of #11848, byte for byte. Node 22.13 loads native ES modules through fs.promises.readFile, which the read recorder did not wrap, so a kept name index omitted the files a code doc imports and an edit to one left the hint unchanged. The recorder now wraps fs.promises.readFile with the same content-read logic. * chore(changeset): credit the contributor on record-async-doc-inputs Takes #11848's head. * Merge remote-tracking branch 'origin/main' into fix/record-async-doc-reads # Conflicts: # packages/cli/foundation/fs/read-record.mjs * Merge remote-tracking branch 'origin/main' into fix/record-async-doc-reads * Merge remote-tracking branch 'origin/main' into fix/record-async-doc-reads * test(cli): read-record's temp root is its real path, so macOS matches realpath On macOS the temporary folder is behind a symlink (/var to /private/var), so a realpath answer did not match the expected path built from os.tmpdir(), and one case failed on every Mac. The test resolves its temp root once.
validation: ran
pnpm exec vitest run packages/cli/foundation/suggest/name-index.test.mjs packages/cli/foundation/fs/read-record.test.mjs --project node --maxWorkers=1on Node 22.13.0 and Node 24.22.1; all 21 tests passed on each. Prettier, targeted ESLint, andpnpm review:prepassed.User impact
On the minimum supported Node version, the not-found hint's kept name index omitted the files imported by a code doc. Editing one of those files could therefore leave the stored hint unchanged.
Problem and solution fit
Node 22.13.0 loads native ES modules through
fs.promises.readFile. The read recorder wrapped synchronous filesystem reads only, so it stamped the doc itself but missed its importedlib/name.mjs. The route assertions passed; the dependency-stamp assertion failed atname-index.test.mjs:511.Record
fs.promises.readFilewith the same existing content-read wrapper and first-read stamp logic. This also preserves nested recording contexts and passes through the original promise and result. No module hooks, compatibility-policy changes, retries, waits, or assertion changes are needed.Expected behavior and authority
Current AST-081 FR7, in
docs/specs/AST-081-global-mode/spec.md, requires a kept value to be reused only while every input its gather read is unchanged. The change restores that requirement without changing the public API or the Node floor.Evidence
cli-minimum-node.yml, scheduled run 43689891007, job 132738152938, commitd182a5b0fc298c6da569660a95b554040aca599c.pnpm exec vitest run packages/cli/foundation/suggest/name-index.test.mjs --project node --maxWorkers=1 -t 'keeps the docs routes'. An earlier setup collision was excluded from the counts.fe00cdcf7421746120a240ad838aeb4352bae3d5before the fix. On Node 24.22.1 the unchanged target already passed.Scope
Only the read recorder, its regression test, and the CLI patch Changeset change. No existing tests or workflow files change.
pnpm review:prereported zero findings, and the submitted-path check found no other changed files.