Follow-up to #01M5XG8WYZ1566KZFC73WQWGX3, noted as a gap when the link was added.
Why
The link is only useful if it can be set when it is known, and it is usually known
after the request exists — the issue turns up while reviewing, or while writing the
landing note. Before this, a request created without --closes could never gain one:
the only options were a second change request or leaving the issue to drift, which is
what the link exists to prevent.
What changed
vole change update <id> now takes the links as well as the head:
vole change update <id> --closes 01M5XG8WYZ1566KZFC73WQWGX3 # set (replace)
vole change update <id> --closes A,B # several, or repeat the flag
vole change update <id> --no-closes # clear
vole change update <id> --head <rev> --closes <issue> # both, one commit
metadata.SetRequestCloses normalises, deduplicates, sorts and validates the list
against the issues tree — the ids are checked at this point as well as at creation,
because a link added later is exactly where a typo would otherwise hide until the
issue quietly never closed. An unchanged set returns without moving the branch
(ErrNoChange), so re-running is not a commit.
Only an open request may be relinked. A merged request’s list is a record of what the merge did; a closed one is not going to run. Both refuse, with the state named.
The CLI refuses a call that changes neither the head nor the links, and
--closes with --no-closes is a contradiction rather than a precedence rule.
Verification
vole workflow run verify in the pinned image: gofmt, vet, build, govulncheck
(0 reachable), packaging, links, go test -race ./... — all pass.
New tests in metadata: linking an open request sets the list, re-linking the same
set is not an edit, an unknown or malformed id is refused, and a merged request’s
links cannot be changed.
Dogfooding
This request itself is opened with --closes, so merging it closes
#01M5XG8WYZ1566KZFC73WQWGX3 through the feature the previous request added — the first
real use of the mechanism, and a check that the mark-and-close commit does what the
tests say.