assigner: the words past a wait's bound name the package, the entry and the bound (issue 1984, review round 1)

A run past its wait's bound ended "package <path> has no published
version within <bound>", naming no entry, and two of its three paths
(the bound's expiry and the take-up at a start) read only the run's
value. The seat mesh-wants' CompositionRunWaits gains `entry`, the words
of the import-form entry the run is built from (such as "the
node-engine's entry src2:e1"), written with the package when the wait
begins; the waiting start's end, the expiry and the take-up all say
"package <path> has no published version within <bound>
(package-wait-minutes), named with no version in <entry>" from it. The
definition's form stays 3, raised by this fix; the Go and TypeScript
contracts regenerated by seatgen (seatgen -check passes).

Tests: TestTheCompositionStepRunsOneAskPerMachine, the wait's rows: the
waiting run's `waits` holds its entry; "past its bound" (the expiry) and
a new "past its bound at a take-up" (takeUpWaits) end saying package,
entry and bound (both failed first with no entry written);
TestTheCompositionStepComposesEachMachineThroughTheBuildSeat (whole,
embedded bus): the waiting run's entry, and the take-up's and the
expiry's words with it.

Builds: design 47 H2 H-A-630 (4) (hq 1cdfa6ff); H-A-631 (hq ee89b857); H-A-628 (3), (5) (hq cea6404c); H-A-629 (1) (hq 8aa70271); H2 §780
This commit is contained in:
2026-11-23 23:14:57 +01:00
parent dc2ddb871a
commit a46f14ba23
8 changed files with 54 additions and 31 deletions
@@ -234,8 +234,9 @@ func (r *compositionRuns) expired(boundKey string) {
}
// waitExpired ends a run whose wait for a package's publish passed its bound, the expiry of the bound key bound.<run key> the
// wait armed (design 47 H2 H-A-628 (3), (4)): could not run naming the package, read from the run's value (H-A-629 (1)). Its run
// ask is not put yet, so none is dropped; a bound armed again since (the marker holds no value, A-470o) ends nothing.
// wait armed (design 47 H2 H-A-628 (3), (4)): could not run naming the package, the entry and the bound, read from the run's value
// (H-A-629 (1), H-A-631). Its run ask is not put yet, so none is dropped; a bound armed again since (the marker holds no value,
// A-470o) ends nothing.
func (r *compositionRuns) waitExpired(boundKey, key string, run meshwants.CompositionRun) {
_, _, armed, err := r.boundOf(boundKey)
if err != nil {
@@ -246,7 +247,7 @@ func (r *compositionRuns) waitExpired(boundKey, key string, run meshwants.Compos
r.logf("the expiry of %s ends nothing: the bound is armed again (A-470o)", boundKey)
return
}
if _, err := r.endRun(key, run.Ask, meshwants.CompositionRunOutcomeCouldNotRun, r.pastWaitSaid(run.Machine, run.Waits.Package), nil); err != nil {
if _, err := r.endRun(key, run.Ask, meshwants.CompositionRunOutcomeCouldNotRun, r.pastWaitSaid(run.Machine, *run.Waits), nil); err != nil {
r.logf("the composition run %s past its wait for package %s is not ended: %v", key, run.Waits.Package, err)
}
}
@@ -862,7 +862,7 @@ func (r *compositionRun) awaitPins(ctx context.Context, key, ask, what string, p
}
path := waiting[0].path
published := wakes[path]
since, held, err := r.runs.waitFor(key, ask, path)
since, held, err := r.runs.waitFor(key, ask, path, what)
if err != nil {
return nil, "its wait for package " + path + " is not written: " + err.Error(), false
}
@@ -871,7 +871,7 @@ func (r *compositionRun) awaitPins(ctx context.Context, key, ask, what string, p
}
left := since.Add(r.runs.set.packageWait).Sub(r.now())
if left <= 0 {
return nil, r.runs.pastWaitSaid("", path), false
return nil, r.runs.pastWaitSaid("", meshwants.CompositionRunWaits{Package: path, Entry: what}), false
}
if !armed {
stands, err := r.runs.armBound(runBoundPrefix, key, ask, wholeSeconds(left))
@@ -962,7 +962,7 @@ func (r *compositionRun) takeUpWaits(ctx context.Context) {
}
left := run.Waits.Since.Add(r.runs.set.packageWait).Sub(r.now())
if left <= 0 {
if _, err := r.runs.endRun(key, run.Ask, meshwants.CompositionRunOutcomeCouldNotRun, r.runs.pastWaitSaid(run.Machine, run.Waits.Package), nil); err != nil {
if _, err := r.runs.endRun(key, run.Ask, meshwants.CompositionRunOutcomeCouldNotRun, r.runs.pastWaitSaid(run.Machine, *run.Waits), nil); err != nil {
r.logf("the composition run %s past its wait for package %s is not ended: %v", key, run.Waits.Package, err)
}
continue
@@ -305,9 +305,10 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
// package; at the publish heard each reads published again and puts its run ask with the pin, `waits` and the bound gone, the
// step saying run; past the bound each ends could not run naming the package and the bound, no run ask put. H-A-630 (2): a
// bind of the consumer, the publish said while it was not bound, wakes each to read it published. H-A-630 (3): the starting
// step superseded leaves the runs another step shares waiting, and that step reads them composed after the publish.
for _, how := range []string{"published", "bind", "superseded", "past its bound"} {
publish := how != "past its bound"
// step superseded leaves the runs another step shares waiting, and that step reads them composed after the publish. H-A-630 (4),
// H-A-631: past the bound, by the bound's expiry or at a take-up, the words name the package, the entry and the bound.
for _, how := range []string{"published", "bind", "superseded", "past its bound", "past its bound at a take-up"} {
publish := !strings.HasPrefix(how, "past its bound")
u := newRunStand(t, "src2:e1", "src2:e1", "d1")
u.publishedAt = nil
journal := newLogLines()
@@ -345,8 +346,9 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
kv.mu.Lock()
ttl := kv.ttl[runBoundPrefix+key]
kv.mu.Unlock()
if len(keys) != 2 || run.Waits == nil || run.Waits.Package != "git.novox.be/novox/x/go" || run.Waits.Since.IsZero() || ttl <= 9*time.Minute || ttl > 10*time.Minute {
t.Errorf("the waiting run %s of %v holds %+v, its bound %s; want x/go in waits and package-wait-minutes' bound", key, keys, run.Waits, ttl)
if len(keys) != 2 || run.Waits == nil || run.Waits.Package != "git.novox.be/novox/x/go" || !strings.HasPrefix(run.Waits.Entry, "the node-engine's entry src2:e") ||
run.Waits.Since.IsZero() || ttl <= 9*time.Minute || ttl > 10*time.Minute {
t.Errorf("the waiting run %s of %v holds %+v, its bound %s; want x/go and its entry in waits and package-wait-minutes' bound", key, keys, run.Waits, ttl)
}
}
switch how {
@@ -355,6 +357,13 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
kv.expire(runBoundPrefix + key)
u.runs.expired(runBoundPrefix + key)
}
case "past its bound at a take-up": // the wait began longer ago than package-wait-minutes, as if the assigner were down
for _, key := range keys {
if _, _, err := u.runs.change(key, func(c *meshwants.CompositionRun) bool { c.Waits.Since = c.Waits.Since.Add(-time.Hour); return true }); err != nil {
t.Fatal(err)
}
}
u.r.takeUpWaits(context.Background())
case "superseded":
second := make(chan stepOutcome, 1)
go func() {
@@ -417,13 +426,13 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
if !publish {
for _, key := range keys {
if run, _, _, _ := u.runs.read(key); run.Ended == nil || run.Waits != nil {
t.Errorf("past its bound the run %s holds ended %v, waits %+v; want it ended and its wait gone", key, run.Ended, run.Waits)
t.Errorf("%s: the run %s holds ended %v, waits %+v; want it ended and its wait gone", how, key, run.Ended, run.Waits)
}
}
for _, node := range []string{"ace", "g14"} {
if want := node + ": package git.novox.be/novox/x/go has no published version within 10m0s (package-wait-minutes)"; out.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
for node, fp := range map[string]string{"ace": "src2:e1", "g14": "src2:e2"} {
if want := node + ": package git.novox.be/novox/x/go has no published version within 10m0s (package-wait-minutes), named with no version in the node-engine's entry " + fp; out.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
!strings.Contains(out.Said, want) || strings.Contains(out.Said, "the builder pins or waits") || len(u.asks) != 0 {
t.Errorf("past its bound the step came to %+v with %d run asks put, want could not run saying %q", out, len(u.asks), want)
t.Errorf("%s: the step came to %+v with %d run asks put, want could not run saying %q", how, out, len(u.asks), want)
}
}
continue
@@ -351,10 +351,11 @@ func hearPublished(hub interface {
})
}
// waitFor writes on the run of ask the package it waits for, `waits` (design 47 H2 H-A-629 (1)), by compare-and-set: the time
// its wait began is kept where the run holds one already (a start taken up again, H-A-629 (3)), else it is now. It answers that
// time, and false when the key holds another run, or the run ended or has its program.
func (r *compositionRuns) waitFor(key, ask, path string) (time.Time, bool, error) {
// waitFor writes on the run of ask the package it waits for, `waits` (design 47 H2 H-A-629 (1)), with the words of the entry
// that names it with no version (H-A-631), by compare-and-set: the time its wait began is kept where the run holds one already (a
// start taken up again, H-A-629 (3)), else it is now. It answers that time, and false when the key holds another run, or the run
// ended or has its program.
func (r *compositionRuns) waitFor(key, ask, path, entry string) (time.Time, bool, error) {
var since time.Time
held := false
_, _, err := r.change(key, func(c *meshwants.CompositionRun) bool {
@@ -364,20 +365,21 @@ func (r *compositionRuns) waitFor(key, ask, path string) (time.Time, bool, error
since = r.now().UTC()
if c.Waits != nil {
since = c.Waits.Since
if c.Waits.Package == path {
if c.Waits.Package == path && c.Waits.Entry == entry {
return false
}
}
c.Waits = &meshwants.CompositionRunWaits{Package: path, Since: since}
c.Waits = &meshwants.CompositionRunWaits{Package: path, Entry: entry, Since: since}
return true
})
return since, held, err
}
// pastWaitSaid is the end of a run of machine whose wait for the publish of the package path passed package-wait-minutes (design
// 47 H2 H-A-628 (3)).
func (r *compositionRuns) pastWaitSaid(machine, path string) string {
said := fmt.Sprintf("package %s has no published version within %s (%s)", path, r.set.packageWait, packageWaitSetting)
// pastWaitSaid is the end of a run of machine whose wait for the publish of the package path, which the entry names with no
// version, passed package-wait-minutes: it names the package, the entry and the bound on every path that ends it, the waiting
// start's, the bound's expiry and the take-up's, each from `waits` (design 47 H2 H-A-628 (3), (5); H-A-630 (4); H-A-631).
func (r *compositionRuns) pastWaitSaid(machine string, w meshwants.CompositionRunWaits) string {
said := fmt.Sprintf("package %s has no published version within %s (%s), named with no version in %s", w.Package, r.set.packageWait, packageWaitSetting, w.Entry)
if machine != "" {
said = machine + ": " + said
}
@@ -288,8 +288,9 @@ func TestTheCompositionStepComposesEachMachineThroughTheBuildSeat(t *testing.T)
t.Fatal(err)
}
var waiting meshwants.CompositionRun
if err := json.Unmarshal(e2.Value(), &waiting); err != nil || waiting.Waits == nil || waiting.Waits.Package != pkg || waiting.Program != nil {
t.Fatalf("the waiting run of n2 holds %s (%v), want waits naming x/go and no program", e2.Value(), err)
if err := json.Unmarshal(e2.Value(), &waiting); err != nil || waiting.Waits == nil || waiting.Waits.Package != pkg ||
waiting.Waits.Entry != "the node-engine's entry src2:e1" || waiting.Program != nil {
t.Fatalf("the waiting run of n2 holds %s (%v), want waits naming x/go and its entry, and no program", e2.Value(), err)
}
waiting.Waits.Since = waiting.Waits.Since.Add(-time.Hour)
aged, _ := json.Marshal(waiting)
@@ -318,12 +319,13 @@ func TestTheCompositionStepComposesEachMachineThroughTheBuildSeat(t *testing.T)
t.Fatal(err)
}
if e := stepEnd("step-ask-2"); e.Outcome != meshwants.StepEndedOutcomeCouldNotRun || strings.Contains(e.Said, "the builder pins or waits") ||
!strings.Contains(e.Said, "n2: package "+pkg+" has no published version within 30s (package-wait-minutes)") || strings.Contains(e.Said, "n1") {
!strings.Contains(e.Said, "n2: package "+pkg+" has no published version within 30s (package-wait-minutes), named with no version in the node-engine's entry src2:e1") ||
strings.Contains(e.Said, "n1") {
t.Fatalf("the step taken up ended %+v, want could not run naming n2's package past its bound alone", e)
}
// Past the bound while running (H-A-628 (3), (4)): with package-wait-minutes at one, nothing is published, the bound's expiry
// ends each run could not run naming the package and the bound, and no run ask is put.
// ends each run could not run naming the package, the entry and the bound (H-A-630 (4), H-A-631), and no run ask is put.
stop()
b.settings["MESH_ASSIGNER_PACKAGE_WAIT_FILE"] = "1"
pub.Store(false)
@@ -335,7 +337,7 @@ func TestTheCompositionStepComposesEachMachineThroughTheBuildSeat(t *testing.T)
Revision: 5, Commit: engineCommit, Fingerprint: "src2:m1"})
e3 := stepEnd("step-ask-3")
for _, node := range []string{"n1", "n2"} {
if want := node + ": package " + pkg + " has no published version within 1s (package-wait-minutes)"; e3.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
if want := node + ": package " + pkg + " has no published version within 1s (package-wait-minutes), named with no version in the node-engine's entry src2:e1"; e3.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
!strings.Contains(e3.Said, want) || strings.Contains(e3.Said, "the builder pins or waits") {
t.Fatalf("the step past its bound ended %+v, want could not run saying %q", e3, want)
}
@@ -20,7 +20,7 @@ const Form = 3
// whose fields changed while its forms did not (design 47 H2 §780).
const (
generatedForms = "3"
generatedFieldsDigest = "Ask=6cb8b82e2fbe AskTakenEvent=6d5d3da7ac39 AsksByAssignmentsProposalValue=0bb5682c7b3b AsksByBackupNodeModuleFingerprintValue=0bb5682c7b3b AsksByHoldModuleFingerprintValue=0bb5682c7b3b AsksByOutsideNodeModuleFingerprintValue=0bb5682c7b3b AsksByRecordNodeModuleDigestValue=0bb5682c7b3b AsksByRestoreNodeModuleFingerprintValue=0bb5682c7b3b AsksByRevertNodeModuleFingerprintValue=0bb5682c7b3b AssignmentEntry=7d2549782eb2 AssignmentRevision=72c8701f7314 AssignmentRevisionCapabilitiesItem=0c89b0717762 AssignmentRevisionEvent=7faff968ce44 AssignmentRevisionsByCandidateGroupHeadsValue=8553b390118d AssignmentRevisionsByEntryDigestValue=4e5ee7a23e5b AssignmentRevisionsByTrunkRevisionValue=8553b390118d BusAnswer=7538f2f5e68e CatalogOf=7a4646fdbea7 Change=28d1f3c5cd32 ChangeAfterItem=30d718c21581 CompositionReader=5a943c1f8ef1 CompositionRun=2a08fc65e2d0 CompositionRunProgram=5a1202df3497 CompositionRunWaits=92d1d2424265 CompositionsAnswer=f8bca93c7f9c CompositionsByGroupHeadsValue=9428965fab8f CompositionsDropAnswer=52803700282a Difference=4011cff516b1 DifferenceAnswer=629237aa39f0 DifferenceEvent=49066d0dff6d DifferenceRefusedItem=0e9caa83ace7 DifferencesByNodeModuleValue=a22487ffadfd DropAnswer=7538f2f5e68e Edge=a71709025a08 EntryAnswer=05adebad70d6 Fill=80f442916429 FillingEvent=5bd4df78ed84 FullEvent=5bd4df78ed84 Held=15abbd6a1a33 HeldCandidate=04872f6afbfa InputAnswer=cd41ee65565d KeepNowAnswer=9962ab9fc051 NodeEntryRef=3888ae847653 NotRunning=279b628db0ec PipelineWanted=e1e379c21e59 PipelineWantedEvent=59946b31ab7d PolicyChangedEvent=7538f2f5e68e RevisionAnswer=39002c770cbd RoomEvent=5bd4df78ed84 Shared=c981cf6aa860 SharedAskedBy=c9b30cc4d0d0 StepAccept=18efeefb6c34 StepEnded=edd08ab1a18b StepEndedEvent=207787118dac StepProgressEvent=8215e490ea8d StepRun=b975f402601a UpgradeAnswer=7538f2f5e68e Wait=951500be820c WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0 WantedEvent=58cf7a9f646b WantsByHeldModuleFingerprintValue=ff14aa998a5d WantsByWantNodeModuleValue=ab7c6799fd5d WantsByWantNodeNodeValue=a737a2108d53"
generatedFieldsDigest = "Ask=6cb8b82e2fbe AskTakenEvent=6d5d3da7ac39 AsksByAssignmentsProposalValue=0bb5682c7b3b AsksByBackupNodeModuleFingerprintValue=0bb5682c7b3b AsksByHoldModuleFingerprintValue=0bb5682c7b3b AsksByOutsideNodeModuleFingerprintValue=0bb5682c7b3b AsksByRecordNodeModuleDigestValue=0bb5682c7b3b AsksByRestoreNodeModuleFingerprintValue=0bb5682c7b3b AsksByRevertNodeModuleFingerprintValue=0bb5682c7b3b AssignmentEntry=7d2549782eb2 AssignmentRevision=72c8701f7314 AssignmentRevisionCapabilitiesItem=0c89b0717762 AssignmentRevisionEvent=7faff968ce44 AssignmentRevisionsByCandidateGroupHeadsValue=8553b390118d AssignmentRevisionsByEntryDigestValue=4e5ee7a23e5b AssignmentRevisionsByTrunkRevisionValue=8553b390118d BusAnswer=7538f2f5e68e CatalogOf=7a4646fdbea7 Change=28d1f3c5cd32 ChangeAfterItem=30d718c21581 CompositionReader=5a943c1f8ef1 CompositionRun=2a08fc65e2d0 CompositionRunProgram=5a1202df3497 CompositionRunWaits=9cd147ddfc06 CompositionsAnswer=f8bca93c7f9c CompositionsByGroupHeadsValue=9428965fab8f CompositionsDropAnswer=52803700282a Difference=4011cff516b1 DifferenceAnswer=629237aa39f0 DifferenceEvent=49066d0dff6d DifferenceRefusedItem=0e9caa83ace7 DifferencesByNodeModuleValue=a22487ffadfd DropAnswer=7538f2f5e68e Edge=a71709025a08 EntryAnswer=05adebad70d6 Fill=80f442916429 FillingEvent=5bd4df78ed84 FullEvent=5bd4df78ed84 Held=15abbd6a1a33 HeldCandidate=04872f6afbfa InputAnswer=cd41ee65565d KeepNowAnswer=9962ab9fc051 NodeEntryRef=3888ae847653 NotRunning=279b628db0ec PipelineWanted=e1e379c21e59 PipelineWantedEvent=59946b31ab7d PolicyChangedEvent=7538f2f5e68e RevisionAnswer=39002c770cbd RoomEvent=5bd4df78ed84 Shared=c981cf6aa860 SharedAskedBy=c9b30cc4d0d0 StepAccept=18efeefb6c34 StepEnded=edd08ab1a18b StepEndedEvent=207787118dac StepProgressEvent=8215e490ea8d StepRun=b975f402601a UpgradeAnswer=7538f2f5e68e Wait=951500be820c WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0 WantedEvent=58cf7a9f646b WantsByHeldModuleFingerprintValue=ff14aa998a5d WantsByWantNodeModuleValue=ab7c6799fd5d WantsByWantNodeNodeValue=a737a2108d53"
)
const (
@@ -858,6 +858,8 @@ type CompositionRunProgram struct {
// CompositionRunWaits is the package the run waits for before its run ask is put, its publisher's build not yet published: written when the wait begins, deleted when the run ask is put or the run ends; absent while the run waits for nothing (design 47 H2 H-A-628 (3), H-A-629 (1)).
type CompositionRunWaits struct {
// the words of the import-form entry the run is built from, which names the package with no version (such as the node-engine's entry of a fingerprint), written with the package, so every end of the run past its bound names it (design 47 H2 H-A-630 (4), H-A-631)
Entry string `json:"entry"`
// the package's path
Package string `json:"package"`
// the time its wait began, which the bound package-wait-minutes counts from
@@ -1816,6 +1816,10 @@
"type": "string",
"description": "the package's path"
},
"entry": {
"type": "string",
"description": "the words of the import-form entry the run is built from, which names the package with no version (such as the node-engine's entry of a fingerprint), written with the package, so every end of the run past its bound names it (design 47 H2 H-A-630 (4), H-A-631)"
},
"since": {
"type": "string",
"format": "date-time",
@@ -1824,6 +1828,7 @@
},
"required": [
"package",
"entry",
"since"
]
}
@@ -314,6 +314,8 @@ export interface CompositionRunProgram {
/** the package the run waits for before its run ask is put, its publisher's build not yet published: written when the wait begins, deleted when the run ask is put or the run ends; absent while the run waits for nothing (design 47 H2 H-A-628 (3), H-A-629 (1)) */
export interface CompositionRunWaits {
/** the words of the import-form entry the run is built from, which names the package with no version (such as the node-engine's entry of a fingerprint), written with the package, so every end of the run past its bound names it (design 47 H2 H-A-630 (4), H-A-631) */
"entry": string;
/** the package's path */
"package": string;
/** the time its wait began, which the bound package-wait-minutes counts from */