J25 A-293: a placed module's failed newest build said as refused in by-entries mode, on the builder's build-ended event
Reading the catalog half by fingerprint, the node-engine no longer reads the builder's builds, so #224's refused key was never written there and a reader waited on a build that will never be done. The engine now hears the builder's build.ended stream, read whole at start then followed (as the assigner hears it); the last trunk end of a placed module that ended failed is written as the refused key with the event's words, a later done end deletes it, an end naming a branch moves nothing. The manifest consumes mesh-delivery-builder.build.ended.**. Builds: design 47 G A-293 (with §421, §628), ADR 0593 §6, issue 1966 U1/U8 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -2,6 +2,8 @@ package selfcompose
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
"git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
@@ -12,6 +14,7 @@ import (
|
||||
"github.com/novox/mesh-host/internal/buckets"
|
||||
"github.com/novox/mesh-host/internal/buckets/bucketstest"
|
||||
engcomp "github.com/novox/mesh-host/internal/compositions"
|
||||
"maps"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -258,4 +261,46 @@ func TestTheNodePublishesItsCompositions(t *testing.T) {
|
||||
if past := keep.pastKeeping(); len(past) != 0 {
|
||||
t.Errorf("past keeping with a want naming the oldest: %v, want none", past)
|
||||
}
|
||||
|
||||
// Design 47 G A-293: reading the catalog half by fingerprint, a placed module's newest build that ended is the last trunk
|
||||
// build.ended heard of it; a failed one is said refused with the event's words once the first read ended, an end naming a
|
||||
// branch moves nothing, a module with no end (queued or running) stays unpublished, and a later done end, at any
|
||||
// fingerprint, deletes the refused key.
|
||||
byEnv := b.env()
|
||||
byEnv.Entry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
|
||||
return nil, errors.New("nothing is asked")
|
||||
})
|
||||
byState := &fakeComposed{kv: map[string]ComposedEntry{}}
|
||||
byEnv.ComposedState = byState
|
||||
by := New(byEnv)
|
||||
byAt := &published{fps: map[string]string{}, placed: []string{"broken", "waiting", "branched"}}
|
||||
words := `refused kind: package of language "go"`
|
||||
by.NoteBuildEnded(builds.BuildEnded{Module: "broken", Fingerprint: bfp, Outcome: builds.BuildFailed, Error: words})
|
||||
by.NoteBuildEnded(builds.BuildEnded{Module: "branched", Fingerprint: wfp, Outcome: builds.BuildFailed, Error: "no", Branch: "feature"})
|
||||
for _, step := range []struct {
|
||||
name string
|
||||
do func()
|
||||
holds map[string]string // by key, the refusal it says
|
||||
}{
|
||||
{"before the first read ended", func() {}, map[string]string{}},
|
||||
{"once the first read ended", by.BuildEndsRead, map[string]string{brokenKey: words}},
|
||||
{"a later done end", func() {
|
||||
by.NoteBuildEnded(builds.BuildEnded{Module: "broken", Fingerprint: wfp, Outcome: builds.BuildDone})
|
||||
}, map[string]string{}},
|
||||
} {
|
||||
step.do()
|
||||
if _, _, err := by.writeComposed(ctx, byAt); err != nil {
|
||||
t.Fatalf("%s: %v", step.name, err)
|
||||
}
|
||||
byState.mu.Lock()
|
||||
got := map[string]string{}
|
||||
for k, v := range byState.kv {
|
||||
comp, _ := engcomp.Decode(v.Value)
|
||||
got[k] = comp.Refused
|
||||
}
|
||||
byState.mu.Unlock()
|
||||
if !maps.Equal(got, step.holds) {
|
||||
t.Errorf("%s: the state holds %v, want %v", step.name, got, step.holds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user