diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go index a8e2ce7ac..ea44f2bee 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go @@ -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. 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) } } diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go index 961b187b5..01d8aaf23 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go @@ -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 diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go index 40bd04ec8..19a2504a6 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go @@ -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 diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionruns.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionruns.go index 2e6038923..82a50ebd9 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionruns.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionruns.go @@ -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 } diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionstep_integration_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionstep_integration_test.go index c89da0004..09a0cac1c 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionstep_integration_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionstep_integration_test.go @@ -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) } diff --git a/modules/mesh-delivery-contracts/go/seats/meshwants/contract.go b/modules/mesh-delivery-contracts/go/seats/meshwants/contract.go index 5c93d9967..4e95b05e3 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshwants/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/meshwants/contract.go @@ -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 diff --git a/modules/mesh-delivery-contracts/seats/mesh-wants/seat.json b/modules/mesh-delivery-contracts/seats/mesh-wants/seat.json index 2ba3f893d..a2245fc2f 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-wants/seat.json +++ b/modules/mesh-delivery-contracts/seats/mesh-wants/seat.json @@ -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" ] } diff --git a/modules/mesh-delivery-contracts/ts/seats/meshwants/index.d.ts b/modules/mesh-delivery-contracts/ts/seats/meshwants/index.d.ts index 0990e6b10..357099d37 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshwants/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/meshwants/index.d.ts @@ -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 */