fix: skip permission-denied files instead of aborting index/search#84
Merged
fix: skip permission-denied files instead of aborting index/search#84
Conversation
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>
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
internal/merkle,internal/index): instead of aborting,collectFilePathsnow returnsfilepath.SkipDirfor inaccessible directories and skips inaccessible files;indexWithTreecontinues past permission errors rather than surfacing themcmd/hook.go,cmd/index.go): both the SessionStart hook andlumen indexnow callgit.RepoRootso a subdirectory always resolves to the same DB as the repo rootinternal/index,internal/git): newIsGitRoot/DiscoverNestedGitReposhelpers;makeSkipexcludes nested repos from the parent walk;lumen indexindexes each nested repo separately firstRefactoring
Extracted
runIndexer(lock → signal-context → setup → index → elapsed) from the now-deletedindexSingleProject, 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 ./...passesgolangci-lint runreturns 0 issueslumen index <subdirectory>produces the same DB aslumen index <repo-root>lumen index <non-git-dir-with-nested-repos>indexes each nested repo separately🤖 Generated with Claude Code