Scope git query invalidation by cwd#1670
Conversation
- Invalidate only status/branches for the active cwd - Add tests for cwd-scoped invalidation - Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR refines query cache invalidation to be scoped by directory (cwd) rather than invalidating all git queries globally. The change is backwards-compatible, well-tested, and authored by the code owner. It's a straightforward performance/correctness improvement with no new features or runtime behavior changes. You can customize Macroscope's approvability policy. Learn more. |
Summary
cwdinstead of invalidating all git queries globally.Testing
Note
Medium Risk
Changes React Query invalidation behavior for git status/branches, which could lead to stale or unexpectedly refreshed UI state if callers rely on global invalidation. Covered by new unit tests, but behavior shifts may surface in multi-repo/worktree scenarios.
Overview
Git React Query invalidation is now scoped by
cwdrather than global.invalidateGitQueriesaccepts an optional{ cwd }to invalidate only that repo’sstatus/branches, and a newinvalidateGitStatusQueryhelper invalidates onlystatus.GitActionsControlnow uses these scoped helpers: it invalidates only the active repo when status/branch drift is detected, and on menu open it refreshes justgit statusinstead of blasting all git queries. Adds Vitest coverage to ensure invalidation doesn’t affect othercwdquery scopes and that status-only invalidation leaves branches untouched.Written by Cursor Bugbot for commit 7281c73. This will update automatically on new commits. Configure here.
Note
Scope git query invalidation by cwd in
invalidateGitQueriesandinvalidateGitStatusQueryinvalidateGitQueriesin gitReactQuery.ts to accept an optionalcwdparameter; when provided, only the status and branches queries for that directory are invalidated instead of all git queries.invalidateGitStatusQueryexport that invalidates only the status query for a givencwd, with a no-op whencwdis null.gitCwdto both invalidation calls so out-of-sync detection and menu open only affect the current repository.Macroscope summarized 7281c73.