W12.5: the three build modules answer kept-artifact with the domain SDK's judgement (issue 1966)
Design 47 lines 1888-1906 at b229f5c4 (test 60): the verb sits in every build seat's definition. Its judgement (what may be kept, the kept builds a node holds, the three refusals) is shared code of one domain's modules, so it is the domain SDK's (sdk/buildstep KeptArtifact, ADR 0634 §2): mesh-build-go keeps its store, sweep and tools and drops its own copy of the judgement and its table; mesh-build-node and mesh-build-image keep no build and answer over none, so a module claiming no oci-artifact-registry is refused and the holder is answered not kept. Their manifests serve the verb and invoke seat:mesh-catalog.module, which the judgement asks. Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ (Joined from 42d364fe.) Builds: design 47 G §271, §464 (BLD9) Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
|
||||
sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
)
|
||||
|
||||
const askCommit = "0123456789abcdef0123456789abcdef01234567"
|
||||
@@ -123,13 +124,31 @@ func TestManifestTakesTheBuildCapacity(t *testing.T) {
|
||||
t.Error("no settings file")
|
||||
}
|
||||
m0 := &Module{Node: "ace", Capacity: func() int { return 0 }}
|
||||
served := map[string]bool{}
|
||||
served := map[string]stdio.Tool{}
|
||||
for _, tool := range m0.SeatTools(m0.Puller(nil, buildstep.NewFakeAsks())) {
|
||||
served[tool.Name] = true
|
||||
served[tool.Name] = tool
|
||||
}
|
||||
for _, verb := range []string{"current", "pause", "resume"} {
|
||||
if !served[Seat+"."+verb] {
|
||||
for _, verb := range []string{"current", "pause", "resume", "kept-artifact"} {
|
||||
if _, ok := served[Seat+"."+verb]; !ok {
|
||||
t.Errorf("%s.%s is not served", Seat, verb)
|
||||
}
|
||||
}
|
||||
// Design 47 lines 1888-1906 (test 60): kept-artifact is the domain SDK's judgement over no kept build here: the
|
||||
// store's holder is not kept, any other module claims no oci-artifact-registry.
|
||||
m0.Call = func(key string, body any) (json.RawMessage, error) {
|
||||
mod, _ := body.(map[string]any)["module"].(string)
|
||||
man := `{"module":"` + mod + `"}`
|
||||
if mod == "holder" {
|
||||
man = `{"module":"holder","claims":[{"name":"oci-artifact-registry","scope":"mesh"}]}`
|
||||
}
|
||||
return json.RawMessage(`{"module":{"module":"` + mod + `","manifest":` + man + `}}`), nil
|
||||
}
|
||||
for mod, refused := range map[string]string{"holder": "not kept", "web": "claims no oci-artifact-registry"} {
|
||||
if v, ok := served[Seat+".kept-artifact"]; ok {
|
||||
out, _ := v.Run(map[string]any{"module": mod, "fp": "fp1", "digest": strings.Repeat("a", 64)})
|
||||
if a, _ := out.(sdkstep.KeptArtifactAnswer); a.Refused != refused || !strings.Contains(a.Words, mod) {
|
||||
t.Errorf("kept-artifact of %s answered %+v, want refused %q", mod, out, refused)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user