-
Notifications
You must be signed in to change notification settings - Fork 36
codedb: stale index when reviewing PR branches / switching git refs #116
Copy link
Copy link
Closed
Labels
priority:p2Medium priorityMedium priority
Description
Problem
When reviewing PRs locally (e.g. gh pr checkout 109), codedb continues serving the cached snapshot from the previous branch. Tools like codedb_outline, codedb_search, and codedb_symbol return results from main instead of the checked-out PR branch.
This makes codedb unreliable during PR review workflows where you frequently switch between branches or have conflict markers in files — the index doesn't reflect what's actually on disk.
Steps to reproduce
- Have codedb indexed on
main gh pr checkout 109(switches to a PR branch with new files/changes)codedb_outline src/explore.zig— returns outline frommain, missing the PR's new parser functionscodedb_search "parseHclLine"— returns no results even though the function exists on the current branch
Expected
codedb should detect that the working tree has changed (branch switch, rebase, conflict state) and either:
- Automatically re-index, or
- Warn that the index is stale and suggest
codedb_index
Possible approaches
- Watch for HEAD changes (
.git/HEADor ref symlink) - Compare snapshot timestamp against last checkout/rebase time
- Add a
--watchmode that re-indexes on filesystem changes - At minimum, show a staleness warning when the indexed commit doesn't match HEAD
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority:p2Medium priorityMedium priority