Skip to content

test(cli): the kept-store search catalog case skips on a Node without module.registerHooks - #11832

Closed
astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/test-cli-the-kept-store-search-catalog-case-skips-on-a-node-without-module-registerhooks-1c50e7
Closed

astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/test-cli-the-kept-store-search-catalog-case-skips-on-a-node-without-module-registerhooks-1c50e7

Conversation

@astracat-bot

@astracat-bot astracat-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

validation: ran pnpm exec vitest run packages/cli/test/packed-search-catalog.test.mjs on Node 22.13.0 (10 passed, 1 skipped; it failed 2 of 2 runs before the change) and on Node 24.22.1 (11 passed, the changed case included)

What failed

The daily CLI tests on the CLI's declared minimum Node (22.13.0, run 43675632186, job cli-tests (4/4)) fail one case in packages/cli/test/packed-search-catalog.test.mjs:

the stored search catalog › keeps a reference to the store, not a copy, and reads it back byte for byte
AssertionError: expected [] to have a length of 1 but got +0
 ❯ packages/cli/test/packed-search-catalog.test.mjs:261:21

Cause

The case, added with the stored search catalog (#11755), expects an installed CLI to write one kept gather entry. The CLI keeps gathers only through module.registerHooks, which Node has from 22.15 and 23.5. On an older Node, recordRun in foundation/fs/gather-cache.mjs deliberately runs the gather without recording anything, so no entry is written and the folder is empty. On the Node in .nvmrc the case passes.

Fix

The case now skips on a Node without module.registerHooks (it.skipIf(!hasModuleHooks)), the same guard every other case that reads a kept entry uses (packed-gather-cache.*.test.mjs, gather-cache.test.mjs). Nothing else changes: on a Node that has the hooks, the case and its assertions are the same. The fresh gather on an older Node is already tested in packed-gather-cache.records.test.mjs ("a Node without module.registerHooks").

What I was unsure of

Instead of skipping, the case could branch and check on an older Node that no entry is kept and that each run still matches a live gather. I followed the repository's existing convention because the records test already covers that behaviour.

@vercel

vercel Bot commented Nov 15, 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 15, 2026 5:17am UTC

Request Review

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

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

AI review status for this pull request.

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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changes requested. The skip is the right fix: on Node 22.13 the base fails this case at line 261 and this head skips it, while Node 24 still runs all 11 cases. One change remains before approval.

  • packages/cli/test/packed-search-catalog.test.mjs lines 31-36 re-declare hasModuleHooks, which packages/cli/test-utils/packed-gather-cache-fixture.mjs already exports for the other kept-entry tests, so import it (import {hasModuleHooks} from '../test-utils/packed-gather-cache-fixture.mjs';) and drop the local copy and the node:module import, so a later change to that guard reaches this case too.
Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: the daily CLI tests on the minimum Node fail this case at line 261 because no kept entry is written. Verified: the scheduled run's failure annotation, and reproduced on Node 22.13.0 against the base.
  • Claim: the case came in with the stored search catalog change. Verified from the file history.
  • Claim: the CLI keeps gathers only through module.registerHooks and otherwise only runs the gather. Verified: foundation/fs/gather-cache.mjs:334-335 and foundation/fs/gather-cache.test.mjs:195-207.
  • Claim: Node has module.registerHooks from 22.15 and 23.5. Verified absent on 22.13.0 and present on 24.20.0; the boundary versions were not run.
  • Claim: the case passes on the Node in .nvmrc. Verified on Node 24.20.0 (11 passed); .nvmrc names 24.22.1.
  • Claim: the skip uses the same guard as the other kept-entry cases. True for the expression; the packed gather-cache suites import it from the shared fixture instead of copying it.
  • Claim: nothing else changes, and the case is identical where hooks exist. Verified: the body is only re-indented.
  • Claim: the fresh gather on an older Node is already covered. Verified: packed-gather-cache.records.test.mjs:633-645.
  • Claim: on Node 22.13.0 the file gives 10 passed and 1 skipped, and failed before. Verified by reproduction.
  • File: packages/cli/test/packed-search-catalog.test.mjs. Finding: the guard is copied instead of imported.

Automated review (maintainer link)

@astracat-bot

astracat-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

validation: ran pnpm exec vitest run packages/cli/test/packed-search-catalog.test.mjs on Node 24.22.1 (11 passed), and node node_modules/vitest/vitest.mjs run packages/cli/test/packed-search-catalog.test.mjs on Node 22.13.0 (10 passed, 1 skipped); pnpm review:pre reported no findings and pnpm exec prettier --check packages/cli/test/packed-search-catalog.test.mjs passed.

Addressed the requested change: packed-search-catalog.test.mjs now imports hasModuleHooks from ../test-utils/packed-gather-cache-fixture.mjs. Removed its local guard, the associated duplicated explanation, and its node:module import. The shared guard uses the same expression; the test's skip condition, body, assertions, and product code are unchanged.

Only packages/cli/test/packed-search-catalog.test.mjs changes. No unresolved uncertainty.

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Approved. The requested change is done: the test now imports the shared hasModuleHooks guard from packages/cli/test-utils/packed-gather-cache-fixture.mjs instead of keeping its own copy. On Node 22.13 the base fails this case at line 261 and this head skips it, while Node 24 still runs all 11 cases, and CI's test, lint and typecheck jobs passed on this head.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Claim: the daily CLI tests on the minimum Node fail this case at line 261 because no kept entry is written. Verified: the scheduled run's failure annotation, and reproduced on Node 22.13.0 against the base.
  • Claim: the case came in with the stored search catalog change. Verified from the file history.
  • Claim: the CLI keeps gathers only through module.registerHooks and otherwise only runs the gather. Verified: foundation/fs/gather-cache.mjs:334-335 and foundation/fs/gather-cache.test.mjs:195-207.
  • Claim: Node has module.registerHooks from 22.15 and 23.5. Verified absent on 22.13.0 and present on 24.20.0; the boundary versions were not run.
  • Claim: the case passes on the Node in .nvmrc. Verified on Node 24.20.0 (11 passed); .nvmrc names 24.22.1.
  • Claim: the skip uses the same guard as the other kept-entry cases. Verified: it imports the export the packed gather-cache suites import.
  • Claim: nothing else changes, and the case is identical where hooks exist. Verified: the body is only re-indented.
  • Claim: the fresh gather on an older Node is already covered. Verified: packed-gather-cache.records.test.mjs:633-646.
  • Claim: on Node 22.13.0 the file gives 10 passed and 1 skipped, and failed before; on Node 24 it gives 11 passed. Verified by reproduction.
  • File: packages/cli/test/packed-search-catalog.test.mjs. Clear.

Automated review (maintainer link)

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 2d86ad8

Storybook · Sandbox · built from this PR's head

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

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

cixzhang added a commit that referenced this pull request Nov 15, 2026
Takes #11832's head: the case uses hasModuleHooks from the gather-cache test fixture, as the other kept-entry tests do, instead of a local copy.
cixzhang added a commit that referenced this pull request Nov 17, 2026
… module.registerHooks (#11835)

* test(cli): the kept-store search catalog case skips on a Node without module.registerHooks

Re-cut of #11832, byte for byte. The CLI keeps a gather only through module.registerHooks (Node 22.15 and 23.5 on); on its oldest supported Node it gathers fresh each run and keeps no entry, so the case that reads a kept entry skips there, as the other kept-entry cases do.

* test(cli): the search catalog case imports the shared module-hooks guard

Takes #11832's head: the case uses hasModuleHooks from the gather-cache test fixture, as the other kept-entry tests do, instead of a local copy.

* Merge remote-tracking branch 'origin/main' into test/search-catalog-skip-no-hooks

* Merge remote-tracking branch 'origin/main' into test/search-catalog-skip-no-hooks

* Merge remote-tracking branch 'origin/main' into test/search-catalog-skip-no-hooks

* test(cli): the packed search catalog case reads the kept folder where the CLI keeps it on macOS

macOS keeps the user cache under HOME and ignores XDG_CACHE_HOME, so the case gives its run a home of its own and reads the kept folder through userCacheDir. The same change as #11834, folded in here so the case passes on macOS too.

* Merge remote-tracking branch 'origin/main' into test/search-catalog-skip-no-hooks
@astracat-bot

astracat-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Landed on main as #11835 (re-cut by @cixzhang). Thanks!

@astracat-bot astracat-bot Bot closed this Nov 17, 2026
@github-actions
github-actions Bot deleted the codebunny/fix/test-cli-the-kept-store-search-catalog-case-skips-on-a-node-without-module-registerhooks-1c50e7 branch November 18, 2026 06:04

This branch was successfully deployed

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

Labels

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.

0 participants