SDK (A-324, A-325): one PackedOrFetched for the seed and the runner

The rule of an artifact the builder packs or fetches itself was written twice,
in the indexer's seed and in the runner's placing; both now read the one in
mesh-delivery-sdk's buildstep, the contract of a build step every delivery
part reads.

Builds: design 47 G A-324, A-325

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-13 02:33:38 +01:00
parent 59b46be0d2
commit 8af822e3fd
4 changed files with 28 additions and 16 deletions
@@ -13,6 +13,7 @@ import (
mcc "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-sdk/go/keys"
"git.novox.be/novox/mesh-sdk/go/seatdef"
)
@@ -77,7 +78,7 @@ func (ix *Indexer) SeedModulesFrom(ctx context.Context, defs map[string]seatdef.
unbuilt := map[string][]string{} // module -> each artifact of it no build seat builds, with its language or kind
for _, e := range entries {
for _, a := range e.Artifacts {
if packedOrFetched(a) {
if sdkstep.PackedOrFetched(a.Language, a.Kind) {
continue
}
seat, err := buildSeatOf(defs, a)
@@ -103,7 +104,7 @@ func (ix *Indexer) SeedModulesFrom(ctx context.Context, defs map[string]seatdef.
}
for _, a := range e.Artifacts {
name := artifactName(a.Ref)
if packedOrFetched(a) {
if sdkstep.PackedOrFetched(a.Language, a.Kind) {
// The builder packs or fetches it: no steps call, and its lint, unit and integration are bypass (A-324).
m.Artifacts = append(m.Artifacts, SeedArtifact{Name: name, Answered: true})
continue
@@ -135,12 +136,6 @@ func (ix *Indexer) SeedModulesFrom(ctx context.Context, defs map[string]seatdef.
return out, nil
}
// packedOrFetched says the artifact is one the builder packs or fetches itself, of kind archive or upstream with no
// language: it has no lint, unit or integration step, so no build seat's steps is called for it (design 47 G A-324).
func packedOrFetched(a meshcatalog.Artifact) bool {
return a.Language == "" && (a.Kind == "archive" || a.Kind == "upstream")
}
// unbuiltWords names an artifact no build seat builds, with its language, else its kind.
func unbuiltWords(a meshcatalog.Artifact) string {
if a.Language != "" {
@@ -16,6 +16,7 @@ import (
nodebuildgo "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
nodebuildimage "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildimage"
nodebuildnode "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildnode"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-sdk/go/seatdef"
)
@@ -96,7 +97,7 @@ func Place(p seat.Pipeline, reg catalog.Registration, entries map[string]catalog
for _, step := range buildSteps {
status := Status(reg, name, step)
why := "bypassed by the module's policy"
if packedOrFetched(a) {
if sdkstep.PackedOrFetched(a.Language, a.Kind) {
status, why = seat.StepResultStatusBypass, fmt.Sprintf("an artifact of kind %s has no %s step: the builder packs or fetches it", a.Kind, step)
}
s := seat.StepResult{Step: step, Artifact: a.Ref, Status: status, Fingerprint: p.Fingerprint}
@@ -147,13 +148,6 @@ func Place(p seat.Pipeline, reg catalog.Registration, entries map[string]catalog
return steps, asks
}
// packedOrFetched says the artifact is one the builder packs or fetches itself, of kind archive or upstream with no language:
// it has no lint, unit or integration step, so those are bypass whatever the policy says and no build seat is asked
// (design 47 G A-324, A-325).
func packedOrFetched(a catalog.Artifact) bool {
return a.Language == "" && (a.Kind == "archive" || a.Kind == "upstream")
}
// Asked is one ask to put on a build seat's work queue.
type Asked struct {
Seat string
@@ -0,0 +1,9 @@
package buildstep
// PackedOrFetched says an artifact of language and kind (its catalog entry's) is one the builder packs or fetches itself,
// of kind archive or upstream with no language: it has no lint, unit or integration step, so the seed calls no build seat's
// steps for it and the runner places those steps bypassed, whatever the policy says (design 47 G A-324, A-325). The
// indexer's seed and the runner read this one rule.
func PackedOrFetched(language, kind string) bool {
return language == "" && (kind == "archive" || kind == "upstream")
}
@@ -87,3 +87,17 @@ func TestParseStepKeyReadsBothFormsAndRefusesAThird(t *testing.T) {
}
}
}
// Design 47 G A-324, A-325: only an artifact of kind archive or upstream with no language is packed or fetched by the builder.
func TestPackedOrFetchedIsAnArchiveOrUpstreamWithNoLanguage(t *testing.T) {
for _, c := range []struct {
language, kind string
want bool
}{
{"", "archive", true}, {"", "upstream", true}, {"go", "archive", false}, {"", "image", false}, {"go", "", false}, {"", "", false},
} {
if got := PackedOrFetched(c.language, c.kind); got != c.want {
t.Errorf("PackedOrFetched(%q, %q) = %v, want %v", c.language, c.kind, got, c.want)
}
}
}