fix(node): cache manifest under platform.CacheDir per documented layout#112
Merged
Merged
Conversation
cachePath() built its own location from os.UserCacheDir()/nodeup, diverging from platform.CacheDir() (<DataDir>/cache) — the layout CLAUDE.md documents and every other persistent artifact uses. The documented cache dir sat empty while real data accumulated in ~/Library/Caches/nodeup (macOS). Point cachePath() at platform.CacheDir(); filenames unchanged. No migration: worst case is one cold manifest fetch after upgrading. Also add a TestMain to internal/node that points HOME/XDG/APPDATA at a throwaway dir for the whole package, so no test can ever write the real user cache again (the incident behind this issue: a pre-#82 test run persisted its 2-entry fixture manifest into the real cache, and nodeup check served fixture versions until the TTL lapsed). withEmptyCache now overrides the DataDir-relevant vars for per-test isolation, and a new test pins cachePath() to platform.CacheDir(). Refs #110 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
✔️ d17d9d2 - Conventional commits check succeeded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move the nodejs.org manifest cache from
os.UserCacheDir()/nodeuptoplatform.CacheDir()(<DataDir>/cache), matching the documented on-disk layout, and add a package-levelTestMainguard so no test ininternal/nodecan ever write the real user's cache again. Closes #110Linked issues
Closes #110
Type of change
feat— new feature (MINOR bump)fix— bug fix (PATCH bump)refactor— no behavior changeperf— performance improvementdocs— documentation onlytest— tests onlychore— maintenance / dependency bumpci— CI/CD onlybuild— build system onlyChecklist
feat(scope): subject)make cilocally and it passesdocs/, inline godoc)Scope notes
os.UserCacheDir()/nodeupon sight felt too aggressive for a cache. Documented in thecachePath()godoc.dist_test.go's fixture manifest into the real cache, thennodeup checkreporting LTS v22.10.0 / Current v24.0.0 for up to 24h) is prevented two ways:TestMainredirects HOME/XDG/APPDATA for the whole package, andwithEmptyCachenow overrides theplatform.DataDir()-relevant vars per test.TestCachePathUnderPlatformCacheDirpins the location.Screenshots / output
Before (with polluted legacy cache):
nodeup check→LTS: v22.10.0 / Current: v24.0.0(test fixture data).After (fresh fetch, correct location):
LTS: v24.18.0 (released 2026-06-23) / Current: v26.4.0 (released 2026-06-24).🤖 Generated with Claude Code