Say what a person's push recreates before it is sent (hq ADR 0245)
Only gated sends said which containers a move recreates; a push moved mail to a new build and recreated a container with a new image without a word. The push now lists, per machine, every module it moves and what that recreates, with the same Recreates the gated send uses.
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -694,6 +695,56 @@ func sayRecreations(ctx context.Context, open *stores, moves []inventory.Carried
|
||||
}
|
||||
}
|
||||
|
||||
// sayWhatAPushRecreates says, per machine a push is about to send, every module the send moves and what
|
||||
// the move recreates (novox/hq ADR 0245) — the same words a gated send keeps on its plan. A person's push
|
||||
// carries every module's new build, whatever its policy and whether or not a gate saw it, so it is the
|
||||
// send that most needs to say so: on 2026-10-07 a `push` of one machine moved mail to a new build and
|
||||
// recreated one of its containers with a new image, and the answer said nothing about it. A machine whose
|
||||
// last send's builds are not known is not said, and neither is a failure to read: the push goes on.
|
||||
func sayWhatAPushRecreates(ctx context.Context, open *stores, sending []readyNode, w io.Writer) {
|
||||
if len(sending) == 0 {
|
||||
return
|
||||
}
|
||||
f, err := readMoveFacts(ctx, open.inventory)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, r := range sending {
|
||||
sent, known, err := open.inventory.SentBuilds(ctx, r.node)
|
||||
if err != nil || !known {
|
||||
continue
|
||||
}
|
||||
moves := pushMoves(f, r.node, r.declared.Builds, sent)
|
||||
if len(moves) == 0 {
|
||||
continue
|
||||
}
|
||||
sayRecreations(ctx, open, moves)
|
||||
fmt.Fprintf(w, "%s moves %d module(s):\n", r.node, len(moves))
|
||||
for _, mv := range moves {
|
||||
said := mv.Recreates
|
||||
if said == "" {
|
||||
said = "recreates none of its containers, or what it ran is not in the records"
|
||||
}
|
||||
fmt.Fprintf(w, " %-28s %s → %s: %s\n", mv.Module, short(mv.From), short(mv.To), said)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pushMoves is what a send carrying these builds moves on a machine last sent `sent`: every module it ran
|
||||
// before at a build not identical to the one it is now sent. A module new to the machine is not a move.
|
||||
func pushMoves(f moveFacts, node string, carries, sent map[string]string) []inventory.CarriedMove {
|
||||
var out []inventory.CarriedMove
|
||||
for m, to := range carries {
|
||||
was, ran := sent[m]
|
||||
if !ran || was == "" || to == "" || f.identical(m, was, to) {
|
||||
continue
|
||||
}
|
||||
out = append(out, inventory.CarriedMove{Module: m, Node: node, From: was, To: to})
|
||||
}
|
||||
sort.Slice(out, func(i, j int) bool { return out[i].Module < out[j].Module })
|
||||
return out
|
||||
}
|
||||
|
||||
// recreationsSaid is every recreation a send's moves say, joined: what a plan's note carries.
|
||||
func recreationsSaid(moves []inventory.CarriedMove) string {
|
||||
var said []string
|
||||
|
||||
Reference in New Issue
Block a user