builder: name a publish again's transfer as a valid transfer id

The registry refused builder_publish_again of mesh-delivery-pipeline 0.1.6 with 'transfer ... is no transfer id':
the name carried the version's dots, which mesh-sdk's parts receiver refuses. The transfer stays the builder's own
name (the registry part's publish), with the refused characters made dashes.

Builds: design 47 G §588, A-73
This commit is contained in:
2026-11-15 02:36:13 +01:00
parent e75112baec
commit 2394dec1c5
2 changed files with 10 additions and 2 deletions
@@ -41,6 +41,13 @@ const (
VerbPublish = "publish"
)
// RepublishTransfer is a publish again's transfer name, the builder's own (the registry part's publish: the caller names its
// transfer): safe as a transfer id, which holds none of "/", ".", " ", "*" or ">" (mesh-sdk's parts receiver refuses them), so a
// version's dots are dashes (design 47 G §588).
func RepublishTransfer(module, version, artifact string) string {
return strings.NewReplacer("/", "-", ".", "-", " ", "-", "*", "-", ">", "-", "@", "-").Replace("republish-" + module + "-" + version + "-" + artifact)
}
// RegistrySeats are the four registry seats a version is published to.
var RegistrySeats = []string{SeatImages, SeatArtifacts, SeatGoPackages, SeatNPM}
@@ -612,7 +619,7 @@ func (r *Republisher) send(ctx context.Context, q QueuedPublish) {
kind := art.Kind
bound, cancel := context.WithTimeout(ctx, UnreleasedBound) // a context's bound, no timer (ADR 0437 §8)
err := r.Send(bound, Publish{Seat: seat, Kind: kind, Name: name, Version: v.Version, Digest: q.Artifacts[ref], Fingerprint: v.Fingerprint,
Commit: v.Commit, Transfer: "republish-" + q.Module + "-" + v.Version + "-" + strings.TrimPrefix(ref, q.Module+":")})
Commit: v.Commit, Transfer: RepublishTransfer(q.Module, v.Version, strings.TrimPrefix(ref, q.Module+":"))})
cancel()
if err == nil {
r.logf("publish again: %s %s: %s sent to %s as %s %s, digest %s; the package-published is said when the seat says published", q.Module, q.Version, ref, seat, name, v.Version, q.Artifacts[ref])
@@ -105,7 +105,8 @@ func TestRepublish(t *testing.T) {
}
}
p := b.sent[0]
if p.Seat != SeatArtifacts || p.Name != "m/prog" || p.Kind != "bundle" || p.Version != v.Version || p.Digest != "sha256:aa" || p.Fingerprint != "src2:m" {
if p.Seat != SeatArtifacts || p.Name != "m/prog" || p.Kind != "bundle" || p.Version != v.Version || p.Digest != "sha256:aa" || p.Fingerprint != "src2:m" ||
p.Transfer != "republish-m-"+strings.ReplaceAll(v.Version, ".", "-")+"-prog" || strings.ContainsAny(p.Transfer, "/. *>") {
t.Errorf("sent %+v, want the bundle by digest to the oci seat, the Go package left to its own seat's holder", p)
}
if _, err := b.Heard(ctx, subject, data, 5); err != nil || len(b.sent) != 1 {