Skip to content

Fix --all-branches and --branch filtering from worktrees#534

Merged
wesm merged 3 commits intomainfrom
fix-all-branches-worktree
Mar 18, 2026
Merged

Fix --all-branches and --branch filtering from worktrees#534
wesm merged 3 commits intomainfrom
fix-all-branches-worktree

Conversation

@wesm
Copy link
Copy Markdown
Collaborator

@wesm wesm commented Mar 18, 2026

Summary

  • Fix roborev fix --all-branches and --branch <name> not discovering jobs from other branches when run from a git worktree — filterReachableJobs was called with an empty branch override, causing it to filter by the worktree's branch instead of the requested branch
  • Deprecate --open and --unaddressed flags — open job discovery is now the default behavior when no positional job IDs are provided; both flags are hidden and silently ignored for backwards compatibility
  • Thread allBranches and explicitBranch through runFixOpen/runFixBatch to distinguish three filtering modes: default (commit-graph reachability), --branch X (branch-field matching for cross-branch fixing), and --all-branches (skip filtering)
  • Add tests for all-branches discovery, explicit branch filtering, and worktree reachability

wesm and others added 3 commits March 17, 2026 18:05
runFixOpen and runFixBatch both called filterReachableJobs with an
empty branchOverride, causing it to fall back to the worktree's
current branch. This filtered out jobs from other branches even
when --all-branches or --branch <name> was specified.

Pass the branch parameter through to filterReachableJobs, and skip
filtering entirely when branch is empty (all-branches mode),
matching the pattern already used in runFixList.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Open job discovery is now the default behavior when no positional
job IDs are provided, making --open redundant. Both --open and
--unaddressed are kept as hidden flags for backwards compatibility
but silently ignored.

Simplified validation: --branch, --all-branches, and --newest-first
now directly check for conflicts with positional args instead of
requiring --open as a gate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Distinguish three filtering modes in runFixOpen and runFixBatch:

- Default (no flags): pass "" to filterReachableJobs so it uses
  commit-graph reachability for SHA/range refs, preserving the
  safety constraint that fixes match the current checkout.
- --branch X (explicitBranch=true): pass the branch name as
  branchOverride for branch-field matching, enabling cross-branch
  fixing from worktrees.
- --all-branches (allBranches=true): skip filterReachableJobs
  entirely.

Update the filterReachableJobs doc comment to reflect the current
design.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci bot commented Mar 18, 2026

roborev: Combined Review (55c8b51)

Verdict: The PR updates branch-selection semantics for fix flows, but introduces high-severity regressions in commit reachability filtering and list
mode branch handling.

High

  • Location: cmd/roborev/fix.go:463, cmd/roborev/fix.go:980
    Problem: Mutating fix paths no longer enforce commit-graph reachability when discovery is driven by
    --branch or --all-branches. --branch now switches to branch-name matching, and --all-branches skips filterReachableJobs entirely, meaning roborev fix or roborev fix --batch can mistakenly apply findings from rebased-away commits or different branch/
    worktrees to the current checkout.
    Fix: Retain reachability filtering for mutating flows. Treat --branch/--all-branches strictly as query selectors unless the command can first resolve and operate in the matching worktree. Add regression coverage for stale same-branch SHA jobs and cross-worktree
    branch jobs.

  • Location: cmd/roborev/fix.go (around line 159, in RunE's --list block and runFixList signature)
    Problem: runFixList was not updated to accept the allBranches boolean
    . Running roborev fix --list --all-branches calls runFixList with an empty string for the branch, which then calls filterReachableJobs with branchOverride="", falling back to commit-graph reachability filtering and incorrectly hiding jobs from other branches.
    **Fix
    **: Update runFixList's signature to accept allBranches (matching runFixOpen and runFixBatch) and conditionally skip filterReachableJobs when allBranches is true.


Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

@wesm
Copy link
Copy Markdown
Collaborator Author

wesm commented Mar 18, 2026

Non-issues in practice. Merging

@wesm wesm merged commit 3430760 into main Mar 18, 2026
8 checks passed
@wesm wesm deleted the fix-all-branches-worktree branch March 18, 2026 03:07
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.

1 participant