B14 reserve-done-goes: builder_reserve_done and its mode go whole; a build with no version names builder_build_again

Builds: design 47 H2 H-A-661, H-A-665, H-A-706 (DQ-39)
This commit is contained in:
2026-11-25 17:21:33 +01:00
parent dd78f05b56
commit b7a3d85514
15 changed files with 9 additions and 322 deletions
@@ -13,7 +13,7 @@ import (
"mesh-delivery-builder/internal/versions"
)
// reservedTools are builder_reserved, builder_reserved_drop and builder_reserve_done (A-455) (design 47 G section 369), served as tools of the bundle. The drop is a hand act: it is recorded in the hand-act log first, then written to
// reservedTools are builder_reserved and builder_reserved_drop (design 47 G section 369), served as tools of the bundle. The drop is a hand act: it is recorded in the hand-act log first, then written to
// reasks for the builder, which owns the reservations, to answer.
//
// The seat's verb reserved is the builder's process's (design 47 G A-115, A-127), not the bundle's.
@@ -52,32 +52,5 @@ func reservedTools(rr versions.Reader, ask queueAsker, now func() time.Time, act
}
return map[string]any{"key": key, "answer": a.Answer}, nil
}},
{Name: versions.ReserveDoneTool, Description: versions.ReserveDoneDescription,
Input: map[string]any{"type": "object", "required": []string{"module", "fp", "why"}, "properties": map[string]any{
"module": map[string]any{"type": "string", "description": "the module"},
"fp": map[string]any{"type": "string", "description": "the fingerprint of its done trunk build"},
"why": map[string]any{"type": "string", "description": "why, in plain words"}}},
Run: func(args map[string]any) (any, error) {
key, value, err := build.NewReserveDone(str(args, "module"), str(args, "fp"), str(args, "why"), stdio.CallerOf(args), now())
if err != nil {
return nil, err
}
if _, err := acts.Record(meshhandactsclient.Request{What: fmt.Sprintf("reserved a version for the done build of %s at %s by hand", str(args, "module"), str(args, "fp")),
Why: str(args, "why"), Cause: versions.ReserveDoneTool, Verb: "reserve-done"}); err != nil {
return nil, fmt.Errorf("the hand act was not recorded through mesh-hand-acts, so nothing was reserved: %w", err)
}
raw, err := ask(key, value)
if err != nil {
return nil, err
}
a, err := build.DecodeReAsk(raw)
if err != nil {
return nil, err
}
if a.Refused {
return nil, errors.New(a.Answer)
}
return map[string]any{"key": key, "answer": a.Answer}, nil
}},
}
}
@@ -2,7 +2,6 @@ package main
import (
"encoding/json"
"errors"
"strings"
"testing"
"time"
@@ -45,56 +44,3 @@ func TestWaitsToolsListTheWaitsAndReleaseAfterTheHandAct(t *testing.T) {
t.Fatalf("release: %v, %d recorded, asked %+v", err, recorded, asked)
}
}
// Design 47 G A-455: builder_reserve_done records the hand act first and only then asks the builder through reasks; the builder's
// answer (the version and its queued publish) is the tool's answer, its refusal the tool's error, and an act that was not
// recorded asks nothing.
func TestReserveDoneRecordsTheHandActFirstAndAnswersTheBuilders(t *testing.T) {
var order []string
var asked []build.ReAsk
reply := func(refuse bool) func(string, []byte) (json.RawMessage, error) {
return func(key string, value []byte) (json.RawMessage, error) {
order = append(order, "asked")
a, _ := build.DecodeReAsk(value)
asked = append(asked, a)
a.Answered, a.Answer, a.Refused = time.Now(), "reserved 0.1.13 for node-tools and queued 1 versions to publish: node-tools@0.1.13", refuse
if refuse {
a.Answer = "the build key is not done"
}
return json.Marshal(a)
}
}
record := func(fail bool) meshhandactsclient.Recorder {
return meshhandactsclient.Recorder{Ask: func(string, any) (json.RawMessage, error) {
order = append(order, "recorded")
if fail {
return nil, errors.New("no responders")
}
return json.RawMessage(`{}`), nil
}}
}
run := func(ask func(string, []byte) (json.RawMessage, error), acts meshhandactsclient.Recorder, args map[string]any) (any, error) {
for _, tl := range reservedTools(versions.Reader{}, ask, time.Now, acts) {
if tl.Name == versions.ReserveDoneTool {
return tl.Run(args)
}
}
t.Fatal("the bundle serves no builder_reserve_done")
return nil, nil
}
args := map[string]any{"module": "node-tools", "fp": "src2:7df8", "why": "its build ended done with no version"}
out, err := run(reply(false), record(false), args)
if err != nil || len(order) != 2 || order[0] != "recorded" || order[1] != "asked" || asked[0].Mode != build.ModeReserveDone || asked[0].Name != "node-tools" || asked[0].FP != "src2:7df8" {
t.Fatalf("answer %v, %v; order %v, asked %+v", out, err, order, asked)
}
if ans := out.(map[string]any)["answer"].(string); !strings.Contains(ans, "reserved 0.1.13") || !strings.Contains(ans, "queued 1 versions") {
t.Errorf("the answer %q names no version and queued publish", ans)
}
if _, err := run(reply(true), record(false), args); err == nil || !strings.Contains(err.Error(), "not done") {
t.Errorf("the builder's refusal is not the tool's error: %v", err)
}
order = nil
if _, err := run(reply(false), record(true), args); err == nil || len(order) != 1 || order[0] != "recorded" {
t.Errorf("an unrecorded act was asked of the builder: %v, %v", err, order)
}
}
@@ -326,8 +326,6 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
acts.PublishDrop = func(ctx context.Context, module, version, by, why string) (string, error) {
return pq.drop(ctx, items, module, version, by, why)
}
// builder_reserve_done: a done trunk build that reserved none is given a version, and its publish queued as publish again does.
acts.ReserveDone = reserveDoneAct(b.ReserveDone, republish.Republish, logger.Printf)
// The operator is asked once a key's event builds are spent (design 47 G §568): the builder's asker on the seat operator-channel.
decided := &decisions{subject: oc.SubjectDecided(cred.Module)}
retakeActed := awaitedReserved{awaitedState{b: actedKV, bucket: own.acted}}
@@ -65,7 +65,7 @@ func reAsked(ctx context.Context, b askAgainer, acts versions.Acts, items *publi
released(ctx, b, kv, e, r, logf)
return
}
if r.Mode == build.ModeRepublish || r.Mode == build.ModePublishDrop || r.Mode == build.ModeOldFormDrop || r.Mode == build.ModeReservedDrop || r.Mode == build.ModeReserveDone {
if r.Mode == build.ModeRepublish || r.Mode == build.ModePublishDrop || r.Mode == build.ModeOldFormDrop || r.Mode == build.ModeReservedDrop {
// A version's hand act (design 51 *Tools of the builder*) may build again, so it is answered beside the watch.
go versionActed(ctx, acts, kv, e, r, logf)
return
@@ -196,7 +196,7 @@ func emitBuildEnded(ctx context.Context, js jetstream.JetStream, cred process.Ac
return nil
}
// versionActed answers a reasks value of builder_publish_again, builder_publish_drop, builder_reserve_done, builder_reserved_drop or builder_old_form's drop, a hand act said in the log.
// versionActed answers a reasks value of builder_publish_again, builder_publish_drop, builder_reserved_drop or builder_old_form's drop, a hand act said in the log.
func versionActed(ctx context.Context, acts versions.Acts, kv jetstream.KeyValue, e jetstream.KeyValueEntry, r build.ReAsk, logf func(string, ...any)) {
var err error
if r.Mode == build.ModeRepublish {
@@ -215,12 +215,6 @@ func versionActed(ctx context.Context, acts versions.Acts, kv jetstream.KeyValue
} else {
r.Answer, err = act(ctx, r.Module, r.Version, r.By, r.Why)
}
} else if r.Mode == build.ModeReserveDone {
if acts.ReserveDone == nil {
err = errors.New("this builder keeps no reservations")
} else {
r.Answer, err = acts.ReserveDone(ctx, r.Name, r.FP, r.By, r.Why, r.At)
}
} else if r.Mode == build.ModeReservedDrop {
if acts.DropReserved == nil {
err = errors.New("this builder keeps no reservations")
@@ -582,25 +582,6 @@ func (rv *reservations) noMark(ctx context.Context, o versions.Outcome, read []v
return strings.Join(out, "; ") + " (" + standing + "; a published heard before the build recorded its digests is kept until it does)"
}
// reserveDoneAct is builder_reserve_done's act (design 47 G A-455): the next version of the series is reserved for a done trunk build
// that reserved none, and its publish is queued as builder_publish_again queues it. Its answer says the version and the queued
// publishes; a reservation whose publish could not be queued is said so, with the tool that queues it.
func reserveDoneAct(reserve func(ctx context.Context, module, fp string) (versions.ReservedVersion, error),
republish func(ctx context.Context, module, version string) ([]string, error), logf func(string, ...any)) func(ctx context.Context, module, fp, by, why string, at time.Time) (string, error) {
return func(ctx context.Context, module, fp, by, why string, at time.Time) (string, error) {
res, err := reserve(ctx, module, fp)
if err != nil {
return "", err
}
logf("%s at %s: version %s is reserved by hand (%s, %s) for the done build", module, fp, res.Version, by, why)
queued, err := republish(ctx, module, res.Version)
if err != nil {
return "", fmt.Errorf("%s is reserved for %s at %s, but its publish is not queued (builder_publish_again queues it): %w", res.Version, module, fp, err)
}
return fmt.Sprintf("reserved %s for %s at %s and queued %d versions to publish: %s; builder_publish_queue shows them", res.Version, module, fp, len(queued), strings.Join(queued, ", ")), nil
}
}
// ReleasedFor says whether a version was released for the build of fingerprint (design 47 G A-456a).
func (rv *reservations) ReleasedFor(ctx context.Context, module, fingerprint string) (bool, error) {
return rv.r.ReleasedFor(ctx, module, fingerprint)
@@ -20,7 +20,6 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
stdio "git.novox.be/novox/mesh-sdk/go"
"mesh-delivery-builder/internal/build"
"mesh-delivery-builder/internal/versions"
)
@@ -667,62 +666,6 @@ func (e ansEntry) Revision() uint64 { return 1 }
func (e ansEntry) Value() []byte { return e.value }
func (e ansEntry) Operation() jetstream.KeyValueOp { return jetstream.KeyValuePut }
// TestAReserveDoneIsAnsweredWithTheVersionAndItsQueuedPublish: design 47 G A-455 — the reasks value of builder_reserve_done reaches
// the act, which reserves for the done build and queues the publish as publish again does, and its answer names both; a
// refusal of the reserving queues nothing and is the answer; a publish that cannot be queued says the version is reserved.
func TestAReserveDoneIsAnsweredWithTheVersionAndItsQueuedPublish(t *testing.T) {
ctx := context.Background()
var queued []string
var logged []string
logf := func(f string, a ...any) { logged = append(logged, fmt.Sprintf(f, a...)) }
reserve := func(_ context.Context, module, fp string) (versions.ReservedVersion, error) {
if fp == "refused" {
return versions.ReservedVersion{}, fmt.Errorf("the build key of %s at %s is not done", module, fp)
}
return versions.ReservedVersion{Module: module, Version: "0.1.13", Fingerprint: fp}, nil
}
republish := func(_ context.Context, module, version string) ([]string, error) {
if module == "nope" {
return nil, fmt.Errorf("the queue is full")
}
queued = append(queued, module+"@"+version)
return []string{module + "@" + version}, nil
}
acts := versions.Acts{ReserveDone: reserveDoneAct(reserve, republish, logf)}
for _, c := range []struct {
module, fp, want string
refused bool
}{
{"node-tools", "src2:7df8", "reserved 0.1.13 for node-tools at src2:7df8 and queued 1 versions to publish: node-tools@0.1.13", false},
{"node-tools", "refused", "not done", true},
{"nope", "src2:1", "0.1.13 is reserved for nope at src2:1, but its publish is not queued", true},
} {
value, err := json.Marshal(build.ReAsk{V: 1, Why: "w", By: "me", Mode: build.ModeReserveDone, Name: c.module, FP: c.fp})
if err != nil {
t.Fatal(err)
}
kv := &ansKV{wrote: make(chan []byte, 1)}
// reAsked sends a reserve-done to the version acts (b is not asked), and the answer is written back to the key.
reAsked(ctx, nil, acts, nil, kv, ansEntry{key: "reserve-done." + c.module, value: value}, logf)
var wrote []byte
select {
case wrote = <-kv.wrote:
case <-time.After(10 * time.Second):
t.Fatalf("%s at %s: no answer was written to the key", c.module, c.fp)
}
var got build.ReAsk
if err := json.Unmarshal(wrote, &got); err != nil || got.Refused != c.refused || !strings.Contains(got.Answer, c.want) || got.Answered.IsZero() {
t.Errorf("%s at %s: written %s (%v), want refused=%v containing %q", c.module, c.fp, wrote, err, c.refused, c.want)
}
}
if !slices.Equal(queued, []string{"node-tools@0.1.13"}) {
t.Errorf("queued %v, want only node-tools@0.1.13", queued)
}
if !slices.ContainsFunc(logged, func(l string) bool { return strings.Contains(l, "0.1.13 is reserved by hand") }) {
t.Errorf("the reserving by hand is not said in the log: %q", logged)
}
}
// TestARegistrysRecordEndsOrMovesAPublish: design 47 H H-A-274 — the artifacts a registry's record holds with the built digest are
// marked published from it and package-published is said, as a heard published would; H-A-275 — a done build whose number a
// registry holds at another digest (H-A-279) has its number withdrawn, raises version-held-elsewhere naming both digests, and is
@@ -2,7 +2,6 @@ package build
import (
"context"
"errors"
"fmt"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds"
"git.novox.be/novox/mesh-sdk/go/catalogue"
@@ -182,67 +181,3 @@ func (b *Builder) reserve(ctx context.Context, module string, m meshcatalog.Modu
b.logf("%s: version %s is reserved for this build", module, res.Version)
return res, true
}
// ReserveDone is builder_reserve_done (design 47 G A-455): a done trunk build of the first watched branch that reserved no
// version (its key is done, so a look never reserves for it, and a done key cannot be built again) reserves the next version of
// its series now, with the digests the done key holds, as a build that started would, and its build ends with every digest
// recorded. It answers the reserved version; the caller queues its publish (versions.Republisher). A fingerprint whose key is not
// done, whose entry no watched branch carries now, that is no first branch's, or that holds a reservation already is refused, saying which.
func (b *Builder) ReserveDone(ctx context.Context, module, fp string) (versions.ReservedVersion, error) {
b.init()
if b.Reserved == nil {
return versions.ReservedVersion{}, errors.New("this builder reserves no versions")
}
key, err := builds.BuilderBuildKey(module, fp)
if err != nil {
return versions.ReservedVersion{}, err
}
b.mu.Lock()
var m meshcatalog.ModulesByModuleValue
found := false
for hk, v := range b.heard {
if strings.HasSuffix(hk, "\x00"+module) && v.Fp2 == fp {
m, found = v, true
}
}
trunk, first := b.trunkFP[key], b.origin[key].First
b.mu.Unlock()
switch {
case !found:
return versions.ReservedVersion{}, fmt.Errorf("no watched branch carries an entry of %s at %s now, so there is nothing to reserve it from", module, fp)
case !trunk || !first:
return versions.ReservedVersion{}, fmt.Errorf("%s at %s is not the first watched branch's build: only that one reserves a version (§371)", module, fp)
}
digests := b.doneDigests(ctx, module, fp)
if digests == nil {
return versions.ReservedVersion{}, fmt.Errorf("the build key of %s at %s is not done", module, fp)
}
plan, planErr, _ := b.planOf(ctx, m.Manifest)
switch {
case planErr != nil:
return versions.ReservedVersion{}, fmt.Errorf("the plan of %s at %s cannot be read: %w", module, fp, planErr)
case len(plan.Tasks) == 0 || strings.Count(plan.Series, ".") != 1:
return versions.ReservedVersion{}, fmt.Errorf("%s at %s builds nothing or has no MAJOR.MINOR series (%q): it reserves no version", module, fp, plan.Series)
}
if cur, ok, err := b.Reserved.ReservedFor(ctx, module, fp); err != nil {
return versions.ReservedVersion{}, err
} else if ok {
return versions.ReservedVersion{}, fmt.Errorf("%s at %s holds the reservation of %s already", module, fp, cur.Version)
}
res, ok := b.reserve(ctx, module, m, plan, b.originOf(key), false)
if !ok {
return versions.ReservedVersion{}, fmt.Errorf("no version could be reserved for %s at %s (the builder's journal says why)", module, fp)
}
refs := map[string]string{}
for _, t := range plan.Tasks {
d, have := digests[t.Artifact]
if !have {
return res, fmt.Errorf("%s is reserved for %s at %s, but the done key holds no digest of %s", res.Version, module, fp, t.Artifact)
}
refs[module+":"+t.Artifact] = d
}
if err := b.Reserved.Built(ctx, module, res.Version, refs, nil); err != nil {
return res, fmt.Errorf("%s is reserved for %s at %s, but its digests are not recorded: %w", res.Version, module, fp, err)
}
return res, nil
}
@@ -1,56 +0,0 @@
package build
import (
"context"
"slices"
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
)
// TestADoneTrunkBuildThatReservedNoneIsGivenAVersionByHand: design 47 G A-455 — builder_reserve_done reserves the series' next
// version for a done key that reserved none, with the digests the key holds; a key not done, a fingerprint no entry carries and
// a build that holds a reservation already are refused; the value it writes is a reasks value of its own key.
func TestADoneTrunkBuildThatReservedNoneIsGivenAVersionByHand(t *testing.T) {
ctx := context.Background()
r := newRig(t, goBundle)
r.mf.byDigest[mdigest('a')] = catalogue.Manifest{Module: "m", Version: "0.1", Build: &catalogue.Build{Artifacts: []catalogue.Artifact{goBundle}}}
res := &fakeReservations{}
r.b.Reserved = res
if _, err := r.b.ReserveDone(ctx, "m", fp1); err == nil {
t.Fatal("a version was reserved for a key that is not built")
}
// The build ran while the builder reserved nothing (as the live key did): done, with no reservation.
r.b.Reserved = nil
if v := r.consider(t, "modules/m"); v.State != builds.BuildDone {
t.Fatalf("build = %+v, want done", v)
}
r.b.Reserved = res
if _, err := r.b.ReserveDone(ctx, "m", "src2:"+strings.Repeat("9", 64)); err == nil || !strings.Contains(err.Error(), "no watched branch carries") {
t.Errorf("a fingerprint no entry carries: %v", err)
}
got, err := r.b.ReserveDone(ctx, "m", fp1)
if err != nil || got.Version != "0.1.5" || !slices.Equal(res.series, []string{"0.1"}) || !slices.Equal(res.reserved[0], []string{"m:tool"}) {
t.Fatalf("reserved %+v (%v) in %v for %v, want 0.1.5 of m:tool in 0.1", got, err, res.series, res.reserved)
}
if res.built["m:tool"] != digest || res.sources[0].Fingerprint != fp1 {
t.Errorf("recorded %v from %+v, want the done key's digest for the entry %s", res.built, res.sources, fp1)
}
if _, err := r.b.ReserveDone(ctx, "m", fp1); err == nil || !strings.Contains(err.Error(), "reservation") {
t.Errorf("a build that holds a reservation was given another: %v", err)
}
at := time.Unix(0, 0)
key, _, err := NewReserveDone("m", fp1, "why", "op", at)
if err != nil || !strings.HasPrefix(key, "reserve-done.") {
t.Errorf("key %q (%v)", key, err)
}
for _, args := range [][3]string{{"", fp1, "why"}, {"m", "", "why"}, {"m", fp1, " "}} {
if _, _, err := NewReserveDone(args[0], args[1], args[2], "op", at); err == nil {
t.Errorf("%q made a value", args)
}
}
}
@@ -212,7 +212,7 @@ func (b *Builder) buildEntry(ctx context.Context, pipeline string, e meshbuilds.
// passedWithItsVersion is the verdict of a build that ended done (design 47 G A-456): a build that reserves a version (a build
// of the first watched branch's trunk, with a MAJOR.MINOR series and artifacts) passes only when a version is reserved for its
// fingerprint; one that ended done with none fails loudly, naming builder_reserve_done, so no pipeline says passed for a build
// fingerprint; one that ended done with none fails loudly, naming builder_build_again, so no pipeline says passed for a build
// that can never be released, and one whose series another fingerprint took over fails saying it is stale, naming that
// fingerprint and its version (design 47 H H-A-244). A build that reserves none (a candidate's, a series of before G) passes as it did.
func (b *Builder) passedWithItsVersion(ctx context.Context, entry meshcatalog.CatalogEntry) (outcome, said string) {
@@ -257,7 +257,7 @@ func (b *Builder) passedWithItsVersion(ctx context.Context, entry meshcatalog.Ca
// H-A-244 (2): the series was taken over by a newer fingerprint, whose number it carries now: the build is stale.
return meshbuilds.StepEndedOutcomeFailed, fmt.Sprintf("%s: built at %s but its series moved to %s %s: stale", entry.Module, entry.Fp, by.Fingerprint, by.Version)
}
return meshbuilds.StepEndedOutcomeFailed, fmt.Sprintf("%s: built at %s, but no version is reserved for it; builder_reserve_done reserves one for the done build", entry.Module, entry.Fp)
return meshbuilds.StepEndedOutcomeFailed, fmt.Sprintf("%s: built at %s, but no version is reserved for it; builder_build_again builds it again under a reserved one", entry.Module, entry.Fp)
}
return meshbuilds.StepEndedOutcomePassed, ""
}
@@ -121,7 +121,7 @@ func TestAStepAskIsWokenByItsBuildsEnd(t *testing.T) {
}
// A build step passes a build that reserves a version only when a version is reserved for its fingerprint (design 47 G A-456):
// a trunk build that ended done with none fails naming builder_reserve_done, and passes once one is reserved for it; a build
// a trunk build that ended done with none fails naming builder_build_again, and passes once one is reserved for it; a build
// that reserves none (a manifest of before G, version "1") passes as it did.
func TestABuildStepPassesAReservingBuildOnlyWithItsReservedVersion(t *testing.T) {
for _, c := range []struct {
@@ -169,7 +169,8 @@ func TestABuildStepPassesAReservingBuildOnlyWithItsReservedVersion(t *testing.T)
return meshcatalog.CatalogEntry{Module: "m", Repository: "novox/m", Commit: "c1", Fp: fp1, ManifestDigest: digestOf(c.unreadable), Path: "modules/m"}, nil
}
end := r.b.BuildStep(t.Context(), "a1", meshbuilds.StepRun{Pipeline: "main.1.m", Step: meshbuilds.StepRunStepBuild, Entries: []meshbuilds.BuildEntry{{Module: "m", Fingerprint: fp1}}})
if end.Outcome != c.want || !strings.Contains(end.Said, c.said) || (c.want == meshbuilds.StepEndedOutcomeFailed && strings.Contains(end.Said, "builder_reserve_done") == c.takenOver) {
// H2 H-A-665: the failure words of a build with no version name builder_build_again, the person's tool
if end.Outcome != c.want || !strings.Contains(end.Said, c.said) || (c.want == meshbuilds.StepEndedOutcomeFailed && strings.Contains(end.Said, "builder_build_again") == c.takenOver) {
t.Errorf("end = %+v, want %s saying %q", end, c.want, c.said)
}
// The verdict of a build that ended done, as a build ended now is judged, says the same (H-A-508: the newest entry first).
@@ -149,24 +149,6 @@ func NewReservedDrop(module, series, version, why, by string, at time.Time) (str
return "reserved." + versions.ReservedKey(module, series), data, err
}
// ModeReserveDone is the Mode of a reasks value of builder_reserve_done (design 47 G A-455): Name is the module and FP the
// fingerprint of a done trunk build that reserved no version.
const ModeReserveDone = "reserve-done"
// NewReserveDone is the value builder_reserve_done writes: the key `reserve-done.<module>.<fingerprint>` (never a build key) and
// the value.
func NewReserveDone(module, fp, why, by string, at time.Time) (string, []byte, error) {
module, fp = strings.TrimSpace(module), strings.TrimSpace(fp)
if module == "" || fp == "" {
return "", nil, errors.New("module and fp are required")
}
if strings.TrimSpace(why) == "" {
return "", nil, errors.New("say why a version is reserved for the done build (why)")
}
data, err := json.Marshal(ReAsk{V: 1, Why: strings.TrimSpace(why), By: by, At: at.UTC(), Mode: ModeReserveDone, Name: module, FP: fp})
return "reserve-done." + versions.EscapeToken(module) + "." + versions.EscapeToken(fp), data, err
}
// ModeBuild is the Mode of a reasks value that asks the key to be built again, not its waiting asks to be asked again.
const ModeBuild = "build"
@@ -11,9 +11,6 @@ type Acts struct {
Republish func(ctx context.Context, module, version string) ([]string, error)
// DropOldForm drops a retired node from the old form's count by hand (builder_old_form): its answer, or why not.
DropOldForm func(ctx context.Context, node, by, why string, at time.Time) (string, error)
// ReserveDone reserves the next version for a done trunk build that reserved none and queues its publish (builder_reserve_done):
// its answer, or why not.
ReserveDone func(ctx context.Context, module, fp, by, why string, at time.Time) (string, error)
// DropReserved drops a module's reservation of one MAJOR.MINOR by hand (builder_reserved_drop): its answer, or why not.
DropReserved func(ctx context.Context, module, series, version, by, why string, at time.Time) (string, error)
// PublishDrop terminates one publish item (builder_publish_drop, design 47 H2 §793): the answer, or why not.
@@ -31,8 +31,6 @@ const (
// ReservedTool is builder_reserved, ReservedDropTool builder_reserved_drop.
ReservedTool = "builder_reserved"
ReservedDropTool = "builder_reserved_drop"
// ReserveDoneTool is builder_reserve_done (design 47 G A-455).
ReserveDoneTool = "builder_reserve_done"
// UnreleasedBound is the publish's bound: past it a built reservation with an artifact unpublished is the finding
// version-unreleased (§369).
UnreleasedBound = 10 * time.Minute
@@ -1247,10 +1245,6 @@ const (
"(it names the one that stands) and while the reservation's fingerprint is building. It forgets the key whole (the version, its fingerprint, the " +
"artifacts' recorded digests, its withdrawn numbers), its publish item and its version-unreleased, and the answer names what it forgot; what the " +
"registries hold at the version stays, a gap the next reserve skips. A hand act: it is recorded in the hand-act log."
ReserveDoneDescription = "Reserve a version for a done trunk build that reserved none (design 47 G A-455): given module and fp, the next version " +
"of the series is reserved for that fingerprint with the digests of the build's artifacts, and its publish is queued as builder_publish_again " +
"queues it; builds nothing. For a done key that cannot be built again. Refused when the key is not done, is no first watched branch's, or " +
"holds a reservation already. A hand act: it is recorded in the hand-act log."
// ReservedVerb is the seat mesh-builds' verb served as a tool of the same name.
ReservedVerb = meshbuilds.VerbReserved
)
@@ -184,7 +184,7 @@ func TestManifestDeclarations(t *testing.T) { // 1607/AC1
}
// 1945: the builder's tools (builder_seat_queue: note 62), served by its tools bundle, and the event it says when it asks an ask again.
if want := []string{"build_current", "builder_announce_again", "builder_ask_again", "builder_ask_drop", "builder_asks", "builder_bounds", "builder_build", "builder_build_again", "builder_builds_since", "builder_engine_reads", "builder_first_view_again", "builder_first_views",
"builder_health", "builder_old_form", "builder_publish_again", "builder_publish_queue", "builder_release", "builder_reserve_done", "builder_reserved", "builder_reserved_drop", "builder_seat_list", "builder_seat_list_again", "builder_seat_queue", "builder_stuck", "builder_toolchains", "builder_toolchains_drop", "builder_unbuildable", "builder_versions", "builder_waits"}; !reflect.DeepEqual(sorted(m.Tools), want) {
"builder_health", "builder_old_form", "builder_publish_again", "builder_publish_queue", "builder_release", "builder_reserved", "builder_reserved_drop", "builder_seat_list", "builder_seat_list_again", "builder_seat_queue", "builder_stuck", "builder_toolchains", "builder_toolchains_drop", "builder_unbuildable", "builder_versions", "builder_waits"}; !reflect.DeepEqual(sorted(m.Tools), want) {
t.Errorf("tools = %v, want %v", m.Tools, want)
}
// Design 47 G §672: the toolchain waits' stream, kept 7 days within 16 MiB, and the bound's setting, 60 minutes.
@@ -31,7 +31,6 @@
"builder_reserved",
"builder_release",
"builder_reserved_drop",
"builder_reserve_done",
"builder_seat_queue",
"builder_stuck",
"builder_toolchains",