fix(index): cap parent index walk at git repository boundary#56
Merged
fix(index): cap parent index walk at git repository boundary#56
Conversation
Prevents lumen from adopting ancestor indexes outside the current git repository (e.g. a GOPATH-level index) when EnsureFresh is called from a subdirectory. Without this cap, the upward walk in findEffectiveRoot could reach indexes containing the entire workspace, causing excessive scanning and high GPU/fan usage. Adds git.RepoRoot() utility that resolves the repository root via git rev-parse --show-toplevel with symlink resolution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds an integration test that creates a real git repository and a fake ancestor index DB above the repo root, then asserts findEffectiveRoot does not walk above the git boundary to adopt it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
70877ad to
3325cba
Compare
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
git.RepoRoot()utility that resolves the git repository root viagit rev-parse --show-toplevelwith symlink resolutionfindEffectiveRoot()in the indexer cache to stop walking up parent directories once it reaches the git repository boundaryEnsureFreshto scan the entire workspaceWhy
When lumen was invoked from a subdirectory,
findEffectiveRootcould walk up to a parent index far outside the current git repository (e.g. a~/go/level index). Adopting such a large ancestor index would causeEnsureFreshto scan thousands of unrelated files, leading to high CPU/GPU usage and fan spin-up.Test Plan
go test ./...passesgolangci-lint runpasses with zero issues🤖 Generated with Claude Code