Skip to content

fix: pr-bug-scan validated finding from #4580#4738

Open
buf0-bot[bot] wants to merge 1 commit into
mainfrom
bot/pr-bug-scan-4580-1780718083
Open

fix: pr-bug-scan validated finding from #4580#4738
buf0-bot[bot] wants to merge 1 commit into
mainfrom
bot/pr-bug-scan-4580-1780718083

Conversation

@buf0-bot
Copy link
Copy Markdown
Contributor

@buf0-bot buf0-bot Bot commented Jun 6, 2026

Automated fix-PR from pr-bug-scan for parent #4580.

Fixer status: FIXED_WITH_CODE_PROOF
Summary: Tag cached ignoredPaths with their (worktreeId, worktreePath) source key; effectiveIgnoredPaths returns empty when the cached key doesn't match the current worktree.
Blocked proof link: src/renderer/src/components/right-sidebar/useFileExplorerGitIgnoredRows.ts:75 — effectiveIgnoredPaths now returns EMPTY_IGNORED_PATHS when the cached state's sourceKey does not equal the current worktree's sourceKey, so on canLoadIgnoredPaths false→true into a new worktree the prior worktree's ignoredPaths can no longer be read.
Typecheck: skipped

Proof (from validator)

  • C2 — proof_type: code_analysis
    • trigger: User toggles between worktrees: git worktree A → non-git worktree B (canLoadIgnoredPaths flips true→false) → git worktree C (canLoadIgnoredPaths flips false→true).
    • observable: For a brief window after switching to a new git worktree (length = ignored-paths IPC round-trip), the explorer hides files matching the previously-loaded worktree's gitignore patterns rather than the current worktree's, causing wrong files to be hidden/shown.
    • path:
      • src/renderer/src/components/right-sidebar/useFileExplorerGitIgnoredRows.ts:35 useState<string[]>([]) — ignoredPaths state persists across worktree switches
      • src/renderer/src/components/right-sidebar/useFileExplorerGitIgnoredRows.ts:41 effect early-returns when !canLoadIgnoredPaths and no longer calls setIgnoredPaths([]) (pre-diff did)
      • src/renderer/src/components/right-sidebar/useFileExplorerGitIgnoredRows.ts:44 fetch starts via getRuntimeGitIgnoredPaths but is async; ignoredPaths state still holds worktree A's values until it resolves
      • src/renderer/src/components/right-sidebar/useFileExplorerGitIgnoredRows.ts:75 effectiveIgnoredPaths = canLoadIgnoredPaths ? ignoredPaths : EMPTY_IGNORED_PATHS — once canLoadIgnoredPaths flips back to true for worktree C, the read returns the stale ignoredPaths from A
      • src/renderer/src/components/right-sidebar/useFileExplorerGitIgnoredRows.ts:76 buildIgnoredSet(effectiveIgnoredPaths) feeds getVisibleFileExplorerRows, which hides/shows files based on those stale paths

Generated by pr-bug-scan (proof-machine architecture). Human approval required before merge.

Tag cached ignoredPaths with their (worktreeId, worktreePath) source key; effectiveIgnoredPaths returns empty when the cached key doesn't match the current worktree.
Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — keys ignoredPaths state by worktree identity so effectiveIgnoredPaths returns empty when the cached state doesn't belong to the current worktree, preventing stale gitignore patterns from the previous worktree from leaking into the file explorer during a worktree switch.

  • Tag ignoredPaths state with a worktree source keyignoredPathsState now carries a sourceKey (${activeWorktreeId}\n${worktreePath}) alongside the paths array, and effectiveIgnoredPaths gates its read on sourceKey equality.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants