Repository navigation
test(pi): sandbox review-server tests from the user's config - #1624
Merged
Merged
Conversation
apps/pi-extension/server.test.ts and packages/server/review-workspace.test.ts boot real review servers that read config.json from the data dir. The root bunfig preload points PLANNOTATOR_DATA_DIR at a temp dir, but bun only loads it from the repo root; run from the package directory (apps/pi-extension's own `bun test` script, or `bun test` inside packages/server) the tests read the contributor's real ~/.plannotator/config.json. With reviewAnalysis.semanticDiff: false there, 6 tests fail in each file. Point PLANNOTATOR_DATA_DIR at a fresh temp dir in a beforeEach; the existing afterEach already restores it.
YeKc1M
pushed a commit
to YeKc1M/plannotator
that referenced
this pull request
Oct 1, 2026
…prop#1624) apps/pi-extension/server.test.ts and packages/server/review-workspace.test.ts boot real review servers that read config.json from the data dir. The root bunfig preload points PLANNOTATOR_DATA_DIR at a temp dir, but bun only loads it from the repo root; run from the package directory (apps/pi-extension's own `bun test` script, or `bun test` inside packages/server) the tests read the contributor's real ~/.plannotator/config.json. With reviewAnalysis.semanticDiff: false there, 6 tests fail in each file. Point PLANNOTATOR_DATA_DIR at a fresh temp dir in a beforeEach; the existing afterEach already restores it.
1 task
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.
Problem
apps/pi-extension/server.test.ts(Pi review server) andpackages/server/review-workspace.test.tsboot real review servers, which readconfig.jsonfrom the data dir. The rootbunfig.tomlpreload (tests/setup/feedback-archive-off.ts, #1473) pointsPLANNOTATOR_DATA_DIRat a temp dir, but bun only loads that bunfig when it runs from the repo root. When it runs from the package directory (apps/pi-extension's ownbun testscript, orbun testinsidepackages/server), the tests read the contributor's real~/.plannotator/config.json.With
{"reviewAnalysis":{"semanticDiff":false}}in that file, 6 tests fail in each file:CI passes only because CI has no config file. This breaks the CLAUDE.md Testing Rules: never read the real user config; sandbox under a temp
PLANNOTATOR_DATA_DIR.Fix
Each file gets a
beforeEachthat pointsPLANNOTATOR_DATA_DIRat a fresh temp dir. The file's existingafterEachalready restores the variable and removes temp dirs. Tests that set their own data dir still override it. Nothing changes at module scope.Proof
I ran each check with a temp
HOMEwhose.plannotator/config.jsonis{"reviewAnalysis":{"semanticDiff":false}}, and withPLANNOTATOR_DATA_DIRunset. The real~/.plannotatorwas not touched.apps/pi-extension:bun test server.test.tspackages/server:bun test review-workspace.test.tsapps/pi-extension, all ofpackages/server) with the fake-config HOME against a clean HOME. These two files were the only config-caused failures..plannotator.bun run typecheckis clean.Out of scope
Some other test files, when run from a package directory, still write drafts, history, and similar files into
$HOME/.plannotator. Their results do not depend on the config, so this PR leaves them alone.