fix(web): scope recent files to the browse revision
Fixes #1387
Keep recent files scoped to repository and revision, filter out deleted paths, and cap stored history at 100 entries per repository. Tests cover revision changes, HEAD aliases, stale paths, and eviction.
Validation: application tests, lint, Docker builds, Prisma migration gate, and regression checks passed.
[!NOTE]
Low Risk
Client-side localStorage and browse file-search UI only; no auth, API, or server behavior changes.
Overview
Fixes browse file search (Cmd/Ctrl+P) showing Recently opened entries from another branch or commit, which could navigate to paths that do not exist on the current revision.
Recent history is now stored per repository in a recentlyOpenedFiles-v2- localStorage key as { revision, file } entries. The UI only shows recents for the active revision (missing revisionName is treated as HEAD, shared with an explicit HEAD). Entries are dropped when the path is no longer in the loaded file list. Legacy repo-only keys are left alone and are not imported. A CHANGELOG note and Vitest regressions cover revision switching, remounts, legacy storage, separator edge cases, and the 100-entry cap.
Reviewed by Cursor Bugbot for commit b0298926f7b2e1ea8a41bb10f8c84c0a01156a44. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes #1387 by scoping recently opened files to the current repository and revision, so switching branches no longer surfaces or navigates to files from another revision.
- Recent file history is now stored under a key that encodes both
repoNameandrevisionName, with omitted revisions mapped toHEADso they share history. - Legacy repository-only history is left untouched because its revision is unknown.
- Regression tests cover revision switching, remounts, default HEAD, legacy storage, and separator collisions.
Summary by CodeRabbit
- Bug Fixes
- Recently opened files are now kept separate for each repository revision, so files opened in one revision no longer appear in another.