Skip to content

fix(index): cap parent index walk at git repository boundary#56

Merged
aeneasr merged 2 commits intomainfrom
fix-consta-index
Mar 18, 2026
Merged

fix(index): cap parent index walk at git repository boundary#56
aeneasr merged 2 commits intomainfrom
fix-consta-index

Conversation

@aeneasr
Copy link
Member

@aeneasr aeneasr commented Mar 18, 2026

Summary

  • Adds git.RepoRoot() utility that resolves the git repository root via git rev-parse --show-toplevel with symlink resolution
  • Modifies findEffectiveRoot() in the indexer cache to stop walking up parent directories once it reaches the git repository boundary
  • Prevents lumen from adopting GOPATH-level or other ancestor indexes that would cause EnsureFresh to scan the entire workspace

Why

When lumen was invoked from a subdirectory, findEffectiveRoot could 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 cause EnsureFresh to scan thousands of unrelated files, leading to high CPU/GPU usage and fan spin-up.

Test Plan

  • go test ./... passes
  • golangci-lint run passes with zero issues
  • Verify lumen invoked from a subdirectory does not adopt a parent index outside the git repo root

🤖 Generated with Claude Code

aeneasr and others added 2 commits March 18, 2026 16:01
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>
@aeneasr aeneasr enabled auto-merge (squash) March 18, 2026 15:01
@aeneasr aeneasr disabled auto-merge March 18, 2026 15:10
@aeneasr aeneasr merged commit 10e9635 into main Mar 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant