Skip to content

test(cli): the docs-scan case reads the scan's walk, not every doc - #10060

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:c04/docs-scan-walk-only
Nov 5, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:c04/docs-scan-walk-only

Conversation

@vjeux

@vjeux vjeux commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

import-hint-correctness.test.mjs's "builds its fixture where a scan of the repo's docs running at the same time never finds it" times out on main in loaded full runs of the node suite. It called collectDocs() from test/drift/docs-drift.mjs only to read which files the scan lists, so it imported all 1,482 *.doc.mjs files under the test runner. Earlier cases in the file used to leave many of them loaded. Since #10008 gated issues()'s template read, they no longer do, and the case went from about 0.8 s to 2.9 s alone, and past 30 s in a full run.

Intended invariant

The case still proves the docs scan never finds the fixture: it reads the same walk the scan imports from, and checks that the walk lists a known doc.

Change

  • test/drift/docs-drift.mjs: docFiles() returns the walk, and collectDocs() imports from it as before.
  • clients/cli/commands/import-hint-correctness.test.mjs: the case asserts on docFiles(), with component.doc.mjs as a positive control, and imports no doc.

Evidence

  • Red on main: in full vitest run --project node runs, the case times out at 30 s (twice at e657e2e, and once on another lane's tree). With this change it passes in 306 ms in a full run.
  • Count: the case imports no doc module instead of 1,482.
  • Bisect, the case alone: about 0.8 s up to e657e2e's parent, and 2.8–2.9 s from e657e2e (perf(cli): issues() reads Core templates only for integration templates #10008) on.
  • Under contained pressure (2 CPUs shared with 6 busy loops), one box, order-balanced, 6 runs each: 20.4–24.7 s on main and 0.8–1.0 s here.
  • With 12 busy loops on the same 2 CPUs, order-balanced, 2 runs each: the case fails on main at its 30 s limit both times, and passes here in 1.8–1.9 s.

Scope

  • No behavior change: test-only.
  • One cause: a case that imported every doc to read a file list.

Testing

At 6365a21 on main bfc1dcc:

  • vitest run --project node: 16,712 tests passed, at 398dc4d, which differs only in where one JSDoc line sits.
  • import-hint-correctness.test.mjs and docs-drift.test.mjs: 550 tests passed at 6365a21.
  • eslint (CI=true) and pnpm lint pass (docs-drift.mjs is lint-ignored), the CLI's pnpm typecheck passes, and pnpm review:pre reports 0 findings.

import-hint-correctness's "builds its fixture where a scan of the
repo's docs running at the same time never finds it" called
collectDocs() only to read the scanned file list, so it imported all
1,482 doc files under the test runner. Earlier cases used to leave
many of them loaded. Once they no longer did, the case took 2.9 s
alone and over 30 s in a loaded full run. docs-drift.mjs now exports
docFiles(), the walk collectDocs() imports from, and the case asserts
on it, with a known doc as a positive control. It imports no doc.
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 5, 2026 7:50am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 6365a21

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 9 rows, core 4 rows; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@astracat-bot

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 5, 2026, 7:57 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet.

The docs-scan case now reads the scan's own walk through docFiles() instead of importing every doc, and the new positive control keeps an empty walk from passing. collectDocs() and the drift gate behave as before, and both changed test files pass.

Next: mark the pull request ready for review and have a maintainer add the ci:run label so CI runs.

[Automated review]

@vjeux
vjeux marked this pull request as ready for review November 5, 2026 08:01
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 5, 2026
@cixzhang
cixzhang marked this pull request as draft November 5, 2026 08:06
@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 08:06
@cixzhang
cixzhang merged commit 159aceb into meta:main Nov 5, 2026
149 of 154 checks passed
@vjeux
vjeux deleted the c04/docs-scan-walk-only branch November 5, 2026 08:39

This branch was successfully deployed

1 active deployment
Preview — 6365a214 Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants