Skip to content

Fix roborev fix discovering jobs from unrelated branches#627

Merged
wesm merged 3 commits intomainfrom
fix/branch-scoped-fix-discovery
Apr 6, 2026
Merged

Fix roborev fix discovering jobs from unrelated branches#627
wesm merged 3 commits intomainfrom
fix/branch-scoped-fix-discovery

Conversation

@wesm
Copy link
Copy Markdown
Collaborator

@wesm wesm commented Apr 6, 2026

Summary

  • Switch job filtering from git reachability to branch matching. filterReachableJobs relied on git merge-base --is-ancestor to scope jobs to the current branch. On feature branches, all commits in the base branch's history are ancestors of HEAD, so jobs from main and other merged branches leaked through. After 45987ff removed the API branch filter, this became the sole filter and it was too permissive.
  • Remove IsAncestor calls entirely. Jobs from squash-merged branches have SHAs that no longer exist in the local repo. git merge-base --is-ancestor returns exit 128 for unknown objects, triggering the fail-open path that included those jobs regardless of branch.
  • Exclude branchless jobs from branch-filtered discovery. branchMatch previously returned true when a job had no branch set (fail-open from before branch tracking was added), causing old unrelated jobs to appear on every branch. Now both matchBranch and jobBranch must be non-empty and equal. Use --all-branches to include branchless jobs.

🤖 Generated with Claude Code

wesm and others added 3 commits April 6, 2026 12:44
filterReachableJobs relied on commit-graph reachability (introduced
in 45987ff) to scope jobs to the current branch. On feature branches,
every commit in the base branch's history is an ancestor of HEAD, so
jobs from main and other merged branches leaked through.

Switch to branch-field matching as the primary filter. Reachability
is only checked for SHA/range refs to fail open on git errors
(unknown objects). This scopes fix/list/batch to jobs whose stored
Branch matches the current branch on all branches, including main.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Jobs from squash-merged branches have SHAs that no longer exist in
the local repo. git merge-base --is-ancestor returns exit 128 for
unknown objects, triggering the fail-open path that included those
jobs regardless of branch. Since branch matching is the correct
filter, remove the IsAncestor calls entirely — filterReachableJobs
now delegates directly to branchMatch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
branchMatch previously returned true when a job had no branch set
(fail-open), causing old unrelated jobs without branch metadata to
appear on every branch. Now both matchBranch and jobBranch must be
non-empty and equal. Use --all-branches to include branchless jobs.

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

roborev-ci bot commented Apr 6, 2026

roborev: Combined Review (11bf065)

Verdict: Changes introduce medium-severity regressions in roborev fix job discovery due to overly strict branch-based filtering.

Medium

  • cmd/roborev/fix.go:533
    Strict branchMatch filtering now rejects jobs when the current checkout is in detached HEAD (matchBranch == ""), removing the prior SHA/range reachability fallback. This means roborev fix can no longer discover jobs for the currently checked out commit in detached-commit, tag, or bisect workflows.

  • cmd/roborev/fix.go:533
    Jobs with an empty persisted Branch are now excluded from normal branch-filtered discovery. Because jobs are stored in SQLite, existing branchless rows (for example older jobs or jobs created from detached HEAD) become effectively undiscoverable unless users explicitly pass --all-branches.


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

@wesm
Copy link
Copy Markdown
Collaborator Author

wesm commented Apr 6, 2026

Intended behavior.

@wesm wesm merged commit 8039e29 into main Apr 6, 2026
8 checks passed
@wesm wesm deleted the fix/branch-scoped-fix-discovery branch April 6, 2026 18:10
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