gunk-dev/the-valley

bd-57f7f9f-change-name-collides-across-branch-separators.md

sourceef747ea0f748main's published tip history
3.0 KiB · Rendered
1---
2type: bug
3id: bd-57f7f9f
4status: open
5title: Two branches whose names differ only by a separator share one request ref
6created: 2026-08-27
7source: review of the request-resubmission lease, 2026-08-27
8---
9
10# A change name cannot tell a slash from a dash
11
12A request ref is `refs/the-valley/integration-requests/<target>/<change>`, and the integrator
13refuses a change segment holding a slash. So a branch name is written into that segment with its
14slashes replaced by dashes, and `topic/x` and `topic-x` come out as the same change. They then share
15one request ref, and nothing downstream can tell which branch a request is about.
16
17The mapping is many-to-one and nothing records which name went in. The ref names a commit and a
18target, 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
20branch name is not something the design keeps. That is right, and it is exactly why the lossy
21encoding has nowhere to be undone.
22
23Filing a request for one of the two branches used to be an unleased push, so a collision showed up
24as git's own non-fast-forward rejection whenever the two heads had diverged, and as a silent
25fast-forward whenever they had not. Now that filing and replacing are both leased and both willing
26to move the ref, a collision is a clean replacement of the other branch's pending request, reported
27as a resubmission of this one. The evidence of both branches stands, since that namespace is keyed
28by 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
32The subject line of any request being replaced is printed beside its id, so a replacement of
33something unexpected is visible at the moment it happens rather than discovered afterwards. That is
34a diagnostic and not a guard: it relies on someone reading the line.
35
36Ancestry cannot supply the guard. A sibling branch's request and this branch's own previous request
37both point at commits that are neither ancestors nor descendants of the head being filed — that is
38what a rebase onto a moved target produces — so the shape the collision presents is the shape the
39ordinary 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.