Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

#35

Show which branch a change request came from

merged · by keenan 13d ago · merged into main at 8e1005eb by keenan 13d ago

keenan opened this 13d ago

Fixes #01M5XMWZ310Z7W7N43T997HAQ6.

Why

A change request records the exact commit under review and the page showed only that: main ← 43f98bcd. The head branch was discarded at creation — the web form resolved the chosen branch to a commit and passed only the commit to metadata.NewRequest, and vole change new --head <rev> did the same. So nothing on the page could say which branch the work was on, which is how people talk about a change, fetch it, and find it afterwards.

What changed

request.md gains an optional head_ref: beside head::

base: main
head: 43f98bcd93c6ae44d4a7e20f715408d9d324e201
head_ref: contrib/alice/fix-timeout
  • Recorded by CreateChangeRequest (the branch the form offered) and by vole change new --head <branch> when the revision really is a branch tip. A raw commit id, a tag or HEAD records nothing, and older records load unchanged.
  • Displayed in the request list’s Base ← Head column, the request sidebar’s Head row, and vole change show (branch: …).
  • The sidebar marks the branch (branch moved) or (branch deleted) when it no longer points at the reviewed commit, so the name reads as provenance rather than as a claim that the branch is what is being reviewed.

head_ref is advisory only. metadata.Request.Head remains the commit that approvals, CI, the diff and landing.Check name; nothing consults HeadRef for a decision. TestHeadRefIsAHeadingNotAnApproval pins that a request whose branch has moved cannot authorise the new tip.

The reader validates head_ref leniently — one line, no spaces, not a full ref — because git is the authority where the branch exists (Repo.ValidBranch at the writers). Refusing a name git accepts would reject a correctly written request; the writers still refuse a value git would not call a branch.

Checks

  • vole workflow check, vole workflow run verify (format, vet, build, govulncheck, packages, links, go test -race ./...).
  • New tests: TestHeadRefIsAHeadingNotAnApproval (parse, reject junk, writer round trip, writer refusal, and that the gate ignores the branch), and TestRequestRecordsTheBranchItCameFrom (open with --head feature, read the metadata, see the branch on the request page, the list and change show, then watch it labelled branch moved and branch deleted, and a --head <sha> request recording none).
  • docs/change-requests.md notes that the branch is a display hint and the commit is what is reviewed.

Relation to the other open change request

01M5XNBSAGF78RBNXRSSEAXWC9 adds a web control that moves a request’s head. The two touch different functions; whichever lands second will be rebased. This one deliberately leaves head_ref as “the branch it was opened from”, so a moved head shows the recorded branch as moved until the request is re-pointed at a branch tip.

Discussion (1)

keenan 13d ago

Deployment note: metadata.Decode uses KnownFields(true), so a server built from main refuses a request.md that carries head_ref:. Writing such a request therefore needs the new server first — the new field is optional on read, but an old reader treats it as an unknown key.

That happened on this instance while opening this request: the local vole.service runs the working-tree ./vole, so the request was written by the new client but the old server process could not list requests until it was restarted with the new build. I rebuilt ./vole from this branch and restarted vole.service; /r/vole/requests and this request page render again. No data was changed.

Reviewers should keep that order in mind for the release: upgrade the server before any request metadata that uses head_ref is pushed.