Skip to content

Scope git query invalidation by cwd#1670

Merged
juliusmarminge merged 1 commit intomainfrom
feature/scoped-git-query-invalidation
Apr 1, 2026
Merged

Scope git query invalidation by cwd#1670
juliusmarminge merged 1 commit intomainfrom
feature/scoped-git-query-invalidation

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Apr 1, 2026

Summary

  • Limit git query invalidation to the active cwd instead of invalidating all git queries globally.
  • Add a status-only invalidation helper for menu opens so branch queries are left alone.
  • Cover the new scoped invalidation behavior with Vitest tests.

Testing

  • Not run (PR description only).

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 cwd rather than global. invalidateGitQueries accepts an optional { cwd } to invalidate only that repo’s status/branches, and a new invalidateGitStatusQuery helper invalidates only status.

GitActionsControl now uses these scoped helpers: it invalidates only the active repo when status/branch drift is detected, and on menu open it refreshes just git status instead of blasting all git queries. Adds Vitest coverage to ensure invalidation doesn’t affect other cwd query 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 invalidateGitQueries and invalidateGitStatusQuery

  • Updates invalidateGitQueries in gitReactQuery.ts to accept an optional cwd parameter; when provided, only the status and branches queries for that directory are invalidated instead of all git queries.
  • Adds a new invalidateGitStatusQuery export that invalidates only the status query for a given cwd, with a no-op when cwd is null.
  • Updates GitActionsControl.tsx to pass gitCwd to both invalidation calls so out-of-sync detection and menu open only affect the current repository.

Macroscope summarized 7281c73.

- Invalidate only status/branches for the active cwd
- Add tests for cwd-scoped invalidation
- Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 20004f9e-a91e-4352-bc11-82a450b8dabb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/scoped-git-query-invalidation

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 1, 2026
@juliusmarminge juliusmarminge enabled auto-merge (squash) April 1, 2026 23:51
@juliusmarminge juliusmarminge merged commit b92c78f into main Apr 1, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the feature/scoped-git-query-invalidation branch April 1, 2026 23:52
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 1, 2026

Approvability

Verdict: 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.

gigq pushed a commit to gigq/t3code that referenced this pull request Apr 6, 2026
Chrono-byte pushed a commit to Chrono-byte/t3code that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant