fix(tests): isolate integration caches from user state#1067
Open
tmonestudio wants to merge 1 commit into
Open
Conversation
Run the test process under a private temporary HOME and clear inherited CBM_CACHE_DIR so production index paths and legacy fixtures resolve to the same isolated cache. Make lang-contract fixtures honor an explicit cache override and remove the sentinel tree at process exit, including after early assertion returns. Validated on Windows with the full runner: 5828 passed, 22 skipped; a 500-project user cache had zero files added or removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: tmonestudio <tmonestudio@users.noreply.github.com>
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.
What does this PR do?
Prevents the C test runner from reading or writing a user's real codebase-memory cache.
Several integration fixtures exercise the production
index_repositoryflow. The production cache resolver prefersCBM_CACHE_DIR, while older fixtures derive the expected database path fromHOME/.cache/codebase-memory-mcp. When the runner inherited a real cache, early assertion returns could leave fixture databases behind. Setting onlyCBM_CACHE_DIRwas also insufficient because those legacy paths diverged.Fix
HOMEfor every normal test-runner process;CBM_CACHE_DIR, so production code and legacy fixtures converge on the private HOME cache;atexit, including after early test returns;CBM_CACHE_DIRwhen a test intentionally sets one.Worker/probe subprocess modes still exit before the sentinel setup.
Validation
Windows GCC build after rebasing onto current
main:The same run previously left
cbm_seq898_*,cbm_lc_*, andcbm_fcw_*fixture databases in the inherited cache.Checklist
git commit -s)