builder: builder_floor_again refuses; it asks no floor any more

With nothing numbered of the builder's own, the tool answered that a floor
would be asked at the next claim and looked again, doing nothing.

Builds: design 47 H H-A-159, G §369
This commit is contained in:
2026-11-20 17:30:49 +01:00
parent a47c8e7922
commit d2c9dc7de6
4 changed files with 19 additions and 34 deletions
@@ -156,9 +156,9 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
conn.SetReconnectHandler(func(*nats.Conn) { hearing.Again(); heard.Nudge("") }) conn.SetReconnectHandler(func(*nats.Conn) { hearing.Again(); heard.Nudge("") })
// The builder asks the controller, as its own account, whether the artifact store still holds a done key's blobs // The builder asks the controller, as its own account, whether the artifact store still holds a done key's blobs
// (the seat verb held, novox/hq issue 1937) before it leaves the key done, on its calls connection. // (the seat verb held, novox/hq issue 1937) before it leaves the key done, on its calls connection.
// The builder numbers each trunk build at its claim (novox/hq design 51 *The versions*): its state versions, bound once // The state versions, kept from before G (design 51 *The versions*) and read through builder_versions until G §372 removes
// the bus holds it; the floor's three sources asked as its own account. // it, bound once the bus holds it; the builder numbers nothing in it (design 47 H H-A-159).
versionsKV := process.AwaitBucket(ctx, js, conn, own.versions, "no trunk build is numbered: each is built unnumbered and published by its digest", logger.Printf) versionsKV := process.AwaitBucket(ctx, js, conn, own.versions, "builder_versions answers nothing of the versions numbered before G", logger.Printf)
found := &findings{module: cred.Module, w: fw, logf: logger.Printf, now: time.Now} found := &findings{module: cred.Module, w: fw, logf: logger.Printf, now: time.Now}
floorWaits := &versions.FloorWaits{Holder: versions.HolderOf(branches), Logf: logger.Printf, Said: found.floorSaid(context.WithoutCancel(ctx))} floorWaits := &versions.FloorWaits{Holder: versions.HolderOf(branches), Logf: logger.Printf, Said: found.floorSaid(context.WithoutCancel(ctx))}
// The names waiting on their floor are kept in the state floor-waits (DLV-B4): a restarted builder takes them in, so // The names waiting on their floor are kept in the state floor-waits (DLV-B4): a restarted builder takes them in, so
@@ -103,7 +103,7 @@ type Builder struct {
Now func() time.Time Now func() time.Time
Node string Node string
// Numbers numbers each trunk build at its claim and records what it was built with (design 51 *The versions*); nil // Numbers numbers each trunk build at its claim and records what it was built with (design 51 *The versions*); nil
// numbers nothing. // numbers nothing, as the builder's program leaves it (design 47 H H-A-159: the reservation numbers, G §369).
Numbers Numbers Numbers Numbers
// Reserved reserves the version of a trunk build at its start (design 47 G §369); nil reserves nothing. // Reserved reserves the version of a trunk build at its start (design 47 G §369); nil reserves nothing.
Reserved Reservations Reserved Reservations
@@ -3,16 +3,14 @@ package versions
import ( import (
"context" "context"
"fmt" "fmt"
"strings"
"time" "time"
) )
// The tools' descriptions. // The tools' descriptions.
const ( const (
FloorAgainDescription = "Ask the floor of one name again now, by hand (design 51 *The floor*): the seat's versions, the seat git's " + FloorAgainDescription = "Refused for every name: the builder numbers nothing of its own and asks no floor (design 47 H H-A-159); " +
"git.tags and the indexer's indexer_requirements, as the builder asks them by itself when a silent source says something. " + "a version is numbered by the reservation (design 47 G §369, builder_reserved). Kept until design 47 G §372 removes it with " +
"Answers which sources were silent and whether the floor is now known. A name the builder's versions already hold needs no floor: " + "the state versions."
"refused, saying so. A hand act."
) )
// Acts are the builder's hand acts on its versions, answered by its program (the tools bundle writes them to reasks). // Acts are the builder's hand acts on its versions, answered by its program (the tools bundle writes them to reasks).
@@ -31,24 +29,9 @@ type Acts struct {
DropReserved func(ctx context.Context, module, series, by, why string, at time.Time) (string, error) DropReserved func(ctx context.Context, module, series, by, why string, at time.Time) (string, error)
} }
// FloorAgain is builder_floor_again of name: the floor counts only for a name the versions hold nothing of. // FloorAgain is builder_floor_again of name: refused, since the builder numbers nothing of its own and no claim asks a floor
func (a Acts) FloorAgain(ctx context.Context, name string) (string, error) { // (design 47 H H-A-159; the reservation numbers, G §369). The tool stays until G §372 removes it with the state versions.
entries, err := a.Numberer.Versions.Of(ctx, name) func (a Acts) FloorAgain(_ context.Context, name string) (string, error) {
if err != nil { return "", fmt.Errorf("the floor of %s is not asked: the builder numbers nothing of its own and asks no floor (design 47 H H-A-159); "+
return "", err "a version is numbered by the reservation (G §369, builder_reserved)", name)
}
if len(entries) > 0 {
return "", fmt.Errorf("%s holds %d versions: its floor counts only for its first number, so nothing is asked", name, len(entries))
}
answer := name + " waits on no floor in this builder: the floor is asked at its next claim"
if a.Numberer.Waits != nil {
for _, w := range a.Numberer.Waits.Waiting() {
if w.Name == name {
answer = fmt.Sprintf("the floor of %s is asked again (%s were silent)", name, strings.Join(w.Silent, ", "))
}
}
a.Numberer.Waits.Wake(WakeByHand, "", "", name)
}
a.Reconsider(ctx)
return answer + "; builder_versions shows its version once numbered", nil
} }
@@ -588,11 +588,13 @@ func TestTheBuildersVersions(t *testing.T) {
} }
_, _ = v.Mark(ctx, "m/p", "0.1.4", func(e *Entry) { e.State = Published }) _, _ = v.Mark(ctx, "m/p", "0.1.4", func(e *Entry) { e.State = Published })
acts := Acts{Numberer: &Numberer{Versions: v, Waits: &FloorWaits{}}, Reconsider: func(context.Context) {}} acts := Acts{Numberer: &Numberer{Versions: v, Waits: &FloorWaits{}}, Reconsider: func(context.Context) {}}
if _, err := acts.FloorAgain(ctx, "m/p"); err == nil { reconsidered := false
t.Error("a name with versions asks its floor again") acts.Reconsider = func(context.Context) { reconsidered = true }
} // H-A-159: the builder numbers nothing of its own, so no claim asks a floor: the tool refuses, saying so, and does nothing.
if ans, err := acts.FloorAgain(ctx, "m/new"); err != nil || ans == "" { for _, name := range []string{"m/p", "m/new"} {
t.Errorf("floor again of a new name: %q %v", ans, err) if ans, err := acts.FloorAgain(ctx, name); err == nil || !strings.Contains(err.Error(), "numbers nothing of its own") || reconsidered {
t.Errorf("floor again of %s: %q %v, looked again %v; want refused naming H-A-159, nothing looked at", name, ans, err, reconsidered)
}
} }
}) })
} }