test: add findRepoRoot and findDbPath ceiling boundary tests#475
Merged
carlos-alm merged 3 commits intomainfrom Mar 17, 2026
Merged
test: add findRepoRoot and findDbPath ceiling boundary tests#475carlos-alm merged 3 commits intomainfrom
carlos-alm merged 3 commits intomainfrom
Conversation
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Contributor
Greptile SummaryThis PR makes a single comment-only change inside
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["finds DB within the ceiling boundary<br/>(test)"] --> B["mkdirSync worktreeRoot/.codegraph"]
B --> C["writeFileSync .../graph.db (empty)"]
C --> D["mock process.cwd → innerDir"]
D --> E["_resetRepoRootCache()"]
E --> F["findDbPath()"]
F --> G["findRepoRoot() → ceiling = worktreeRoot<br/>(via git rev-parse + realpathSync)"]
G --> H{"walk up from innerDir"}
H -->|"found worktreeRoot/.codegraph/graph.db"| I["return candidate path"]
I --> J["expect fs.existsSync(result) → true"]
J --> K["expect result matches /\\.codegraph[/\\\\]graph\\.db$/"]
K --> L["expect result NOT to contain<br/>basename(outerDir) + sep + .codegraph"]
L --> M["finally: restore process.cwd<br/>rmSync worktreeRoot/.codegraph"]
Last reviewed commit: ef09f9f |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
findRepoRootunit tests: git toplevel resolution, non-git fallback, caching behavior, explicit dir bypassfindDbPathceiling boundary tests: stops at git ceiling (doesn't escape worktree), finds DB within boundary, graceful non-git fallbackfindDbPathtests with_resetRepoRootCachecalls and mock isolationSplit out from #473 (docs PR) where these test changes were out of scope.
Test plan