Fix roborev fix discovering jobs from unrelated branches#627
Conversation
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: Combined Review (
|
|
Intended behavior. |
Summary
filterReachableJobsrelied ongit merge-base --is-ancestorto 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.git merge-base --is-ancestorreturns exit 128 for unknown objects, triggering the fail-open path that included those jobs regardless of branch.branchMatchpreviously 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-branchesto include branchless jobs.🤖 Generated with Claude Code