Skip to content

test(cli): packed search catalog test reads the kept folder where the CLI keeps it on macOS - #11834

Closed
cixzhang wants to merge 1 commit into
mainfrom
test/cli-packed-search-macos-tmp
Closed

cixzhang wants to merge 1 commit into
mainfrom
test/cli-packed-search-macos-tmp

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

On macOS, packages/cli/test/packed-search-catalog.test.mjs › "keeps a reference to the store, not a copy, and reads it back byte for byte" fails on main, so a local CLI test run on a Mac shows a red that Linux CI never shows. The failing check looks for the kept catalog under $XDG_CACHE_HOME/astryx/catalogs, but on macOS the CLI's user cache folder is ~/Library/Caches/astryx and it does not read XDG_CACHE_HOME (userCacheDir in packages/cli/foundation/env/user-dirs.mjs, as its doc comment says). On main the run keeps its catalog under the run's temporary home (the node test project's global setup points HOME there on macOS), and the test's own cache folder stays empty (ENOENT on its catalogs folder, or an empty list where it exists).

It is not a linked temp folder (/var → /private/var): isPrivateDir reads only the final folder with lstat, and with the fix the same temp root passes.

Intended invariant

The CLI's per-user cache folder stays as userCacheDir defines it on each platform. The test reads the kept catalog from the folder the CLI uses.

Change

Test only. The run gets a HOME of its own beside its XDG_CACHE_HOME, and the test finds the kept folder with the CLI's own userCacheDir({home, env}): $XDG_CACHE_HOME/astryx/catalogs on Linux, as before, and $HOME/Library/Caches/astryx/catalogs on macOS. The case's own HOME gives it a folder only its two runs write, so the one-entry check does not depend on other cases. No changeset: test-only.

Evidence

  • Failure before the change (macOS, Node 26): × keeps a reference to the store… with ENOENT: no such file or directory, scandir '…/packed-search-catalog-…/cache-…/astryx/catalogs'; 1 failed, 10 skipped.
  • Success after the change (macOS): all 11 tests in the file pass.
  • Product/runtime behavior verified unchanged: no file outside the test changes.

Scope

Components: cli (test only)

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm exec vitest run packages/cli/test/packed-search-catalog.test.mjs on macOS, before and after; Linux CI runs it at the head.

Overlap checked: #11832 (it skips the same case on a Node without module.registerHooks, a different cause; this change fixes where the case looks on macOS with a Node that has the hooks. Both edit the same lines, so whichever merges second rebases.)

@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:32am 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

AI review status for this pull request.

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

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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.

Changes requested on the description only: the test change itself is right and passes on Linux at this head.

  • The description says main keeps the catalog under the real home folder on macOS and that this change stops writes to the real user cache, but the node test project's global setup already points HOME at a temporary folder of the run on macOS (vitest.global-setup.node.mjs, lines 84-87), so please reword those two sentences, for example: "on main the run keeps its catalog under the run's temporary home, and the case's own HOME gives it a folder only its two runs write."

No code change is needed. CI has not run on this head yet (draft).

Claims and files checked

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

  • Claim: on macOS the case fails on main because it reads $XDG_CACHE_HOME/astryx/catalogs while the CLI's macOS cache folder is under the home folder and ignores XDG_CACHE_HOME: verified (user-dirs.mjs:60, gather-cache.mjs:249).
  • Claim: on main the run keeps its catalog under the real home folder: false (vitest.global-setup.node.mjs:84-87 moves HOME to a run folder on macOS; packed-search-catalog.test.mjs:79 passes it to the CLI).
  • Claim: a linked temp root is not the cause, since isPrivateDir checks only the final folder with lstat: verified (private-dir.mjs:28-38).
  • Claim: the run gets its own HOME and the case reads userCacheDir({home, env}), the XDG folder on Linux and the home folder's cache on macOS: verified (packed-search-catalog.test.mjs:258-263, user-dirs.mjs:60-64).
  • Claim: the macOS run stops writing into the real user cache: false, for the same reason as above.
  • Claim: test only, no changeset: verified (one test file changed).
  • Claim: fails before and passes after on macOS: not reproducible in this review; consistent with the code.
  • Claim: Linux CI runs it at the head: not yet, every CI job at this head was skipped; the file passes on Linux in this review.
  • Claim: #11832 edits the same lines: verified.
  • File packages/cli/test/packed-search-catalog.test.mjs: clear.

Automated review (maintainer link)

cixzhang added a commit that referenced this pull request Nov 17, 2026
… 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.
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
@cixzhang

Copy link
Copy Markdown
Contributor Author

(Posted by Cindy's agent.) Superseded by #11835, which merged the packed search catalog fix.

@cixzhang cixzhang closed this Nov 17, 2026
@github-actions
github-actions Bot deleted the test/cli-packed-search-macos-tmp branch November 18, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 1e3f3198 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.

1 participant