| 1 | --- |
| 2 | type: bug |
| 3 | id: bd-57f7f9f |
| 4 | status: open |
| 5 | title: Two branches whose names differ only by a separator share one request ref |
| 6 | created: 2026-08-27 |
| 7 | source: review of the request-resubmission lease, 2026-08-27 |
| 8 | --- |
| 9 | |
| 10 | # A change name cannot tell a slash from a dash |
| 11 | |
| 12 | A request ref is `refs/the-valley/integration-requests/<target>/<change>`, and the integrator |
| 13 | refuses a change segment holding a slash. So a branch name is written into that segment with its |
| 14 | slashes replaced by dashes, and `topic/x` and `topic-x` come out as the same change. They then share |
| 15 | one request ref, and nothing downstream can tell which branch a request is about. |
| 16 | |
| 17 | The mapping is many-to-one and nothing records which name went in. The ref names a commit and a |
| 18 | target, and a change is a diff targeting a stream ([[ida-93e4f91]], |
| 19 | [ideas/ida-93e4f91-changes-not-branches.md](../ideas/ida-93e4f91-changes-not-branches.md)), so the |
| 20 | branch name is not something the design keeps. That is right, and it is exactly why the lossy |
| 21 | encoding has nowhere to be undone. |
| 22 | |
| 23 | Filing a request for one of the two branches used to be an unleased push, so a collision showed up |
| 24 | as git's own non-fast-forward rejection whenever the two heads had diverged, and as a silent |
| 25 | fast-forward whenever they had not. Now that filing and replacing are both leased and both willing |
| 26 | to move the ref, a collision is a clean replacement of the other branch's pending request, reported |
| 27 | as a resubmission of this one. The evidence of both branches stands, since that namespace is keyed |
| 28 | by tree, but one branch's request is gone and the operator who filed it is not told. |
| 29 | |
| 30 | ## What holds in the meantime |
| 31 | |
| 32 | The subject line of any request being replaced is printed beside its id, so a replacement of |
| 33 | something unexpected is visible at the moment it happens rather than discovered afterwards. That is |
| 34 | a diagnostic and not a guard: it relies on someone reading the line. |
| 35 | |
| 36 | Ancestry cannot supply the guard. A sibling branch's request and this branch's own previous request |
| 37 | both point at commits that are neither ancestors nor descendants of the head being filed — that is |
| 38 | what a rebase onto a moved target produces — so the shape the collision presents is the shape the |
| 39 | ordinary case presents too. Telling them apart needs something the refs do not carry. |
| 40 | |
| 41 | ## Directions, not decisions |
| 42 | |
| 43 | - **Encode the branch name reversibly.** Percent-encoding the separator, or any escape the |
| 44 | integrator's parser learns to read, makes the segment injective. It is the smallest change and it |
| 45 | moves a format the integrator already fixes. |
| 46 | - **Name the change by something that is not a branch name.** A change is a diff targeting a stream, |
| 47 | and a name derived from the change itself would collide only where the changes are the same. This |
| 48 | is the direction that agrees with what the design already says a change is. |
| 49 | - **Refuse the ambiguous case at the boundary.** A request whose change segment could have come from |
| 50 | more than one branch on origin is refused rather than filed, which costs nothing where no such |
| 51 | pair exists and is honest where one does. |