Files
mesh-catalog/modules/mesh-build-node/cmd/mesh-build-node/keptartifact.go
T
jschoubben d3781fd840 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
2026-11-11 14:35:53 +01:00

46 lines
2.5 KiB
Go

package main
// **The artifact store's holder takes its own new build even when its seat is the one broken** (novox/hq design 47,
// lines 1888-1906 at b229f5c4; test 60; milestone 47/G W12.5, issue 1966): the verb kept-artifact sits in every build
// seat's definition, so this module serves it too. It keeps no build of its own: its answer is the domain SDK's
// judgement (sdk/buildstep KeptArtifact, ADR 0634 §2) over no kept build, so a module that claims no
// oci-artifact-registry is refused as such and the store's holder is answered not kept here. Who may call it is the
// seat definition's (the node-engines alone), granted by the grants part (ADR 0666 §20): this module checks no caller.
import (
seat "git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildnode"
sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep"
stdio "git.novox.be/novox/mesh-sdk/go"
)
// keptArtifact is the verb kept-artifact's answer for in: this node keeps no build.
func (m *Module) keptArtifact(in seat.KeptArtifactInput) sdkstep.KeptArtifactAnswer {
return sdkstep.KeptArtifact(in.Module, in.Fp, in.Digest, nil, "", func(module string) (bool, error) {
call := m.Call
if call == nil {
call = stdio.Ask
}
raw, err := call(sdkstep.CatalogModuleVerb, map[string]any{"module": module})
if err != nil {
return false, err
}
return sdkstep.ClaimsStoreOf(module, raw)
})
}
// keptArtifactVerb serves `<seat>.kept-artifact`.
func (m *Module) keptArtifactVerb() stdio.Tool {
return stdio.Tool{Name: Seat + "." + seat.VerbKeptArtifact,
Description: "Where the build this node kept for the artifact store's holder (the holder of " + sdkstep.StoreSeat +
") is. This build module keeps none: it refuses a module that claims no " + sdkstep.StoreSeat +
" and answers the holder's build not kept here, naming the module.",
Input: map[string]any{"type": "object", "required": []string{"module", "fp", "digest"}, "properties": map[string]any{
"module": map[string]any{"type": "string", "description": "the module, the holder of " + sdkstep.StoreSeat},
"fp": map[string]any{"type": "string", "description": "its build's fingerprint"},
"digest": map[string]any{"type": "string", "description": "the artifact's sha256, 64 lowercase hex digits"}}},
Run: func(args map[string]any) (any, error) {
str := func(k string) string { s, _ := args[k].(string); return s }
return m.keptArtifact(seat.KeptArtifactInput{Module: str("module"), Fp: str("fp"), Digest: str("digest")}), nil
}}
}