Skip to content

overlap_guard: a worktree on its merged PR head holds only uncommitted files - #902

Merged
paulananth merged 2 commits into
mainfrom
claude/overlap-guard-merged-prs
Oct 10, 2026
Merged

paulananth merged 2 commits into
mainfrom
claude/overlap-guard-merged-prs

Conversation

@paulananth

Copy link
Copy Markdown
Owner

What

scripts/dev/overlap_guard.sh stopped a commit to .planning/workstreams/whole-source-census/TICKET.md because Grok's grok/worker-replay worktree still exists. That branch was squash-merged as #898, so its commits look unmerged, and main has changed TICKET.md since.

With this change, a worktree whose branch still sits on the exact head commit its PR merged counts only its uncommitted files.

Checked

  • The TICKET.md case: the old guard stops (exit 1), the new guard passes (exit 0).
  • A throwaway unmerged codex/ branch in its own worktree, changing README.md, still stops a commit that touches README.md (exit 1). The probe was removed afterwards.
  • A merged branch that gains new commits, a merged worktree with uncommitted edits, and an open PR for the same branch are all still caught.
  • If merged PRs cannot be listed, or a merge is older than the 300 most recent, the guard falls back to the stricter check and may report extra overlaps, never fewer.
  • shellcheck -S warning is clean.

Review (Standards, Spec, GoF)

  • No hard violations.
  • Two review findings fixed: the branch commit is resolved as refs/heads/<name>, so a tag with the same name cannot match; and a failed listing of merged PRs prints a note.
  • GoF: leave the structure as is.
  • Not done: a fixture test for the guard. No guard tests exist yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FFKdv4nqKXKM9d5Cf2hEFk

Aneena Ananth and others added 2 commits October 10, 2026 15:48
…d files

A squash-merged branch's commits look unmerged, and once main changes the
same files again they differ from main, so the guard blamed a finished
worktree (grok/worker-replay, merged as #898) for TICKET.md. A worktree
whose branch still sits on the head its PR merged now counts only its
uncommitted files. Checked both ways: that case passes; an unmerged
codex/ probe branch touching README.md still stops the commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFKdv4nqKXKM9d5Cf2hEFk
…nnot be listed

Review fixes (Standards, Spec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFKdv4nqKXKM9d5Cf2hEFk
@paulananth
paulananth merged commit e975c91 into main Oct 10, 2026
6 checks passed
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