Commit 53746cf
committed
fix(branch_sweep): stop reporting origin/HEAD as an unmerged branch
The first live run listed a branch named `origin` under KEEP with verdict
UNKNOWN. No such branch exists: `refs/remotes/origin/HEAD` is a symbolic ref,
and git renders its `%(refname:short)` as bare `origin` — which survives both
the `origin/` strip and the `!= HEAD` guard, so it fell through to
branch_contribution as `origin/origin`, came back UNKNOWN, and was filed as
outstanding work.
Nothing was ever at risk: UNKNOWN is fail-safe and never enters the delete
set. The cost is honesty. It reported PyAutoBrain as having 3 unmerged
branches when it has 2, and invited a reader to go looking for work that does
not exist — a null result dressed as a finding, which is the D1 mistake
docs/agent_failure_modes.md already names.
Iterating full refnames and stripping the real prefix removes the ambiguity at
the source rather than special-casing the rendered string.
The regression test was checked the only way worth trusting: it fails against
the old iteration and passes against the new one. It also pins the count, so a
future phantom entry fails the assertion rather than quietly inflating a total
nobody re-derives.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KwqicJpMqmcT5RVbyNwdKq1 parent 248331c commit 53746cf
2 files changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
186 | 192 | | |
187 | 193 | | |
188 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
133 | 149 | | |
134 | 150 | | |
135 | 151 | | |
| |||
0 commit comments