Skip to content

fix: skip permission-denied files instead of aborting index/search#84

Merged
aeneasr merged 2 commits intomainfrom
worktree-fix-79
Apr 2, 2026
Merged

fix: skip permission-denied files instead of aborting index/search#84
aeneasr merged 2 commits intomainfrom
worktree-fix-79

Conversation

@aeneasr
Copy link
Copy Markdown
Member

@aeneasr aeneasr commented Apr 2, 2026

Summary

  • Skip permission-denied files (internal/merkle, internal/index): instead of aborting, collectFilePaths now returns filepath.SkipDir for inaccessible directories and skips inaccessible files; indexWithTree continues past permission errors rather than surfacing them
  • Normalize cwd/projectPath to git root (cmd/hook.go, cmd/index.go): both the SessionStart hook and lumen index now call git.RepoRoot so a subdirectory always resolves to the same DB as the repo root
  • Skip nested git repos in non-git parent (internal/index, internal/git): new IsGitRoot/DiscoverNestedGitRepos helpers; makeSkip excludes nested repos from the parent walk; lumen index indexes each nested repo separately first

Refactoring

Extracted runIndexer (lock → signal-context → setup → index → elapsed) from the now-deleted indexSingleProject, eliminating ~50 lines of duplication. Both the main project path and nested repos share the helper; callers handle their own log/output.

Test plan

  • go test ./... passes
  • golangci-lint run returns 0 issues
  • lumen index <subdirectory> produces the same DB as lumen index <repo-root>
  • lumen index <non-git-dir-with-nested-repos> indexes each nested repo separately
  • Files/dirs with permission errors are skipped without aborting indexing

🤖 Generated with Claude Code

aeneasr and others added 2 commits April 2, 2026 19:20
A single inaccessible file previously caused the entire indexing and
search pipeline to fail. Now os.IsPermission errors are treated as
graceful skips at all three affected points: WalkDir in collectFilePaths,
os.ReadFile in hashFilesInParallel, and os.ReadFile in indexWithTree.

Closes #79

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… boilerplate

indexSingleProject duplicated ~50 lines from runIndex (db dir creation, lock
acquisition, signal context, setupIndexer, performIndexing). Replace both with
a shared runIndexer helper that returns (stats, elapsed, skipped, err), letting
callers handle their own log/output formatting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aeneasr aeneasr enabled auto-merge (squash) April 2, 2026 17:32
@aeneasr aeneasr merged commit fde97b4 into main Apr 2, 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