K1: mesh-build-go reads no kept state of the checker; the step ask carries the kept results (issue 1966)
A test step runs only the packages with no kept result for their digest, and the runner makes that carry in the checker's place (ADR 0666 section 8; design 47 *Carried, not run* line 593 at hq b229f5c4): the kept results reach the step in its ask (StepRun.kept, mesh-delivery dc0df1b5), so the module's reads lose mesh-delivery-checker.kept and the lookup of the checker's kept bucket goes. The carried and kept packages are in the step's end, on its step key. Milestone 47/G, research 086 area C (K1). Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ (Joined from 1c991294.) Builds: design 47 G §25, §27, §66, §416 (BLD5) Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -2,13 +2,10 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
|
||||
checkerseat "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshdeliverychecker"
|
||||
seat "git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildgo"
|
||||
buildrun "git.novox.be/novox/mesh-delivery/sdk/buildrun"
|
||||
sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep"
|
||||
@@ -24,13 +21,6 @@ import (
|
||||
// Seat is the node seat this module holds.
|
||||
const Seat = "node-build-go"
|
||||
|
||||
// KeptState is the checker's kept verdicts, which a check ask takes for the packages whose digest has one (issue
|
||||
// 1887's design limit 1).
|
||||
const KeptState = checkerModule + "." + checkerseat.StateKept
|
||||
|
||||
// checkerModule is the module that holds the seat mesh-delivery-checker, whose kept state a check ask reads.
|
||||
const checkerModule = "mesh-delivery-checker"
|
||||
|
||||
// askSteps are the module's step bodies for an ask, each holding its workspace while it runs, as a tool's does.
|
||||
func (m *Module) askSteps(steps []StepTool) buildstep.AskSteps {
|
||||
byName := map[string]buildstep.StepFunc{}
|
||||
@@ -52,7 +42,8 @@ func (m *Module) askSteps(steps []StepTool) buildstep.AskSteps {
|
||||
}
|
||||
return sdkstep.ToolchainUsed{Version: installed, Recipe: m.Recipe.Version()}, nil
|
||||
},
|
||||
Kept: m.KeptLookup,
|
||||
// The kept results reach a test step in its ask (design 47 *Carried, not run*, line 593 at b229f5c4; issue 1966
|
||||
// K1): this module reads no other part's kept state.
|
||||
Has: m.Has,
|
||||
Release: func(ws string) error { return m.spaces().Release(ws) },
|
||||
Logf: m.Say,
|
||||
@@ -62,29 +53,6 @@ func (m *Module) askSteps(steps []StepTool) buildstep.AskSteps {
|
||||
}
|
||||
}
|
||||
|
||||
// keptValue reads one key of the checker's kept state; nil when it is absent. Main sets it to the state's read; a test
|
||||
// its own.
|
||||
func (m *Module) keptValue(key string) (json.RawMessage, error) {
|
||||
if m.ReadKept == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return m.ReadKept(key)
|
||||
}
|
||||
|
||||
// KeptLookup is whether the checker kept a verdict for the level and digest, and how many tests it counted.
|
||||
func (m *Module) KeptLookup(ctx context.Context, level, digest string) (int, bool, error) {
|
||||
key := checkerseat.KeptByLevelDigestKey(level, digest)
|
||||
raw, err := m.keptValue(key)
|
||||
if err != nil || raw == nil {
|
||||
return 0, false, err
|
||||
}
|
||||
v, err := checkerseat.DecodeKeptByLevelDigestValue(raw)
|
||||
if err != nil {
|
||||
return 0, false, fmt.Errorf("%s holds what is not a kept verdict: %w", key, err)
|
||||
}
|
||||
return int(v.Tests), true, nil
|
||||
}
|
||||
|
||||
// Puller is the module's pull of its seat's asks, on source (the runtime's seat pull when nil).
|
||||
func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep.Puller {
|
||||
if source == nil {
|
||||
|
||||
@@ -114,15 +114,16 @@ func TestAtCapacityZeroNothingIsPulledAndTheToolsAnswer(t *testing.T) {
|
||||
|
||||
func mustJSON(v any) []byte { b, _ := json.Marshal(v); return b }
|
||||
|
||||
// 1887/A3go, A7: the manifest claims node-build-go serving its three verbs, reads the checker's kept verdicts and takes
|
||||
// 1887/A3go, A7: the manifest claims node-build-go serving its three verbs, reads no other part's state (issue 1966 K1: the kept
|
||||
// results come in the step ask) and takes
|
||||
// the node's build capacity as a setting, with the builder's default; the seat's verbs are served as its tools.
|
||||
func TestManifestClaimsTheGoBuildSeatAndReadsItsCapacity(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps"}) {
|
||||
t.Fatalf("claims = %+v", m.Claims)
|
||||
}
|
||||
if !slices.Contains(m.Reads, KeptState) {
|
||||
t.Errorf("reads = %v lack %s", m.Reads, KeptState)
|
||||
if len(m.Reads) != 0 {
|
||||
t.Errorf("reads = %v, want none: the kept results come in the step ask", m.Reads)
|
||||
}
|
||||
raw, _ := os.ReadFile(moduleDir + "/module.json")
|
||||
var doc struct {
|
||||
|
||||
@@ -61,7 +61,6 @@ func main() {
|
||||
m.Run = StepRunner(m.Home)
|
||||
m.GoSeatFile = m.Home + "/go-package-registry.json"
|
||||
m.Settings = m.Home + "/settings.json"
|
||||
m.ReadKept = readOf(stdio.State(KeptState)).Get
|
||||
m.ReadManifest = askManifest
|
||||
m.AskInput = stdio.Ask
|
||||
m.Probe = ProbeGo(m.Home, m.Cache)
|
||||
|
||||
@@ -98,10 +98,9 @@ type Module struct {
|
||||
Floor buildstep.Floor
|
||||
|
||||
// Settings is the module's settings file, which holds the node's build capacity (sdkstep.CapacitySetting); Capacity,
|
||||
// when set, answers it instead (a test). ReadKept reads a key of the checker's kept state (KeptState).
|
||||
// when set, answers it instead (a test).
|
||||
Settings string
|
||||
Capacity func() int
|
||||
ReadKept func(key string) (json.RawMessage, error)
|
||||
// SayStep says a pipeline step's end (buildstep.AskSteps.SayStep); the seat's publish on this node when nil.
|
||||
SayStep func(sdkstep.StepEnded) error
|
||||
// ReadManifest asks the delivery indexer's read tool (ManifestsTool) for one manifest by its key, which a compose ask's
|
||||
|
||||
@@ -27,9 +27,6 @@
|
||||
"consumes": [
|
||||
"mesh-conditions.findings-asked"
|
||||
],
|
||||
"reads": [
|
||||
"mesh-delivery-checker.kept"
|
||||
],
|
||||
"invokes": [
|
||||
"mesh-delivery-indexer.indexer_read_manifests",
|
||||
"seat:oci-artifact-registry.publish",
|
||||
|
||||
Reference in New Issue
Block a user