fix(web): scope recent files to the browse revision - #1686
dipeshbabu wants to merge 4 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. WalkthroughFile search recents now include revision context. The dialog filters recent files by the active revision and current file list, and retains up to 100 entries. Tests cover revision isolation, persistence, stale paths, and history limits. ChangesFile search recents
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The change keeps recent files in browse search scoped to the active revision, so selecting one no longer navigates to a path that does not exist there. No merge-blocking risk was found. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is limited to browser recent-file history and strengthens revision isolation by checking entries against the current file list. No expanded access or navigation authority was identified. Storage behavior during repository switches and simultaneous tab updates remains incompletely verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
2 issues found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/web/src/app/(app)/browse/components/fileSearchCommandDialog.tsx">
<violation number="1" location="packages/web/src/app/(app)/browse/components/fileSearchCommandDialog.tsx:39">
P3: Each distinct (repo, revision) pair — including every commit SHA the user browses at — permanently creates a new localStorage entry that is never evicted, and legacy `recentlyOpenedFiles-<repo>` keys are intentionally left in place too. Storage clutter grows without bound over time for active browsing. Consider capping the recents array length and pruning keys for revisions no longer reachable, e.g. store one entry per repo holding a `Map`/object of revision → files instead of one key per revision.</violation>
<violation number="2" location="packages/web/src/app/(app)/browse/components/fileSearchCommandDialog.tsx:39">
P2: Scoping the key by revision closes the cross-revision case, but the "Recently opened" list is still rendered as a stored snapshot without validating any entry against the files that currently exist at that revision (`recentlyOpened.map(...)` runs with no cross-check against `files`). If the revision's content moved since the file was opened — a branch advanced and deleted/renamed the path — selecting the entry calls `navigateToPath` to a blob that no longer exists, which is the same end-user failure mode #1387 describes, just narrowed to the matching key. Filter `recentlyOpened` against the current `files` (or remove missing paths on read), e.g. `recentlyOpened.filter(r => files.some(f => f.path === r.path))`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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 (missingrevisionNameis treated asHEAD, shared with an explicitHEAD). 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 b029892. 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.
repoNameandrevisionName, with omitted revisions mapped toHEADso they share history.Written for commit ab293d7. Summary will update on new commits.
Summary by CodeRabbit