From aef8632d95d7436cc6c5069320bdf2d4b1f11554 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 11:30:35 +0100 Subject: [PATCH 1/4] Design 47 H1: the indexer's writer owns the kinds its code raises, held by a test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon's writer owned every kind while the tool runner's writer shares the state `findings`; under G §580 each bundle states only its own kinds. The daemon's writer is now made with FindingKinds, the ten kinds its code raises, and a unit test reads the daemon's code for every kind it gives the writer and fails on one the list does not declare. Builds: design 47 H H-A-240, H-A-242 (2), H-A-233, G §580 --- .../cmd/mesh-delivery-indexer/main.go | 4 +- .../internal/index/finding_kinds_test.go | 151 ++++++++++++++++++ .../internal/index/findings.go | 6 + 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go index 76a24231..7045cdec 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go @@ -289,7 +289,9 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro // The indexer's findings are the seat mesh-conditions' generated finding, written through mesh-sdk's held finding writer // (design 47 G §689, A-29): it holds what is written before the state is bound, and starts once the state is. writer, err := views.NewHeldWriter(views.WriterConfig[mcseat.Finding, mcseat.FindingCleared, mcseat.FindingsStated, mcseat.FindingsAskedEvent]{ - Module: cred.Module, State: calls.State(index.FindingsState), Node: cred.Node, Asked: mcseat.SubjectFindingsAsked, JS: js, Conn: conn, Logf: logger.Printf}) + Module: cred.Module, State: calls.State(index.FindingsState), Node: cred.Node, Asked: mcseat.SubjectFindingsAsked, JS: js, Conn: conn, Logf: logger.Printf, + // its own kinds only (G §580, H-A-242): the tool runner's writer states its kinds over the same state + Kinds: index.FindingKinds}) if err != nil { return fmt.Errorf("the indexer's finding writer cannot be made: %w", err) } diff --git a/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go new file mode 100644 index 00000000..31310d7f --- /dev/null +++ b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go @@ -0,0 +1,151 @@ +package index + +import ( + "go/ast" + "go/parser" + "go/token" + "os" + "path/filepath" + "slices" + "strconv" + "strings" + "testing" + + mcc "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient" + "git.novox.be/novox/mesh-sdk/go/views" +) + +// Design 47 H H-A-240, H-A-242, G §580: every finding kind the daemon's code raises or clears is one its writer owns +// (FindingKinds, and a views reader's views.ViewKinds), so the writer never refuses a kind of the indexer's own. The test +// reads the daemon's code (this package and cmd/mesh-delivery-indexer) for every place a kind is given to the writer: the +// kind argument of observed, finding, clearFinding, clearHeld and a writer's Clear, and the Kind of a Finding literal. A +// kind there is a string, a constant of the package or a constant named in imported below; any other form fails the test, +// naming its place, but for the pass-through parameter `kind`, a held finding's `.Kind` and the kind cut from a key a views +// reader names, which carry a kind given elsewhere. +func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { + imported := map[string]string{"mcc.KindCallUnanswered": mcc.KindCallUnanswered, "views.ViewWaitsKind": views.ViewWaitsKind} + // kindArg is the place of the kind among a raising call's arguments. + kindArg := map[string]int{"observed": 2, "finding": 2, "clearFinding": 3, "clearHeld": 4, "Clear": 3} + fset := token.NewFileSet() + var files []*ast.File + consts := map[string]string{} + for _, dir := range []string{".", filepath.Join("..", "..", "cmd", "mesh-delivery-indexer")} { + entries, err := os.ReadDir(dir) + if err != nil { + t.Fatal(err) + } + for _, e := range entries { + if !strings.HasSuffix(e.Name(), ".go") || strings.HasSuffix(e.Name(), "_test.go") { + continue + } + f, err := parser.ParseFile(fset, filepath.Join(dir, e.Name()), nil, 0) + if err != nil { + t.Fatal(err) + } + files = append(files, f) + if dir != "." { + continue + } + for _, d := range f.Decls { + g, ok := d.(*ast.GenDecl) + if !ok || g.Tok != token.CONST { + continue + } + for _, s := range g.Specs { + v := s.(*ast.ValueSpec) + for i, n := range v.Names { + if i < len(v.Values) { + if l, ok := v.Values[i].(*ast.BasicLit); ok && l.Kind == token.STRING { + consts[n.Name], _ = strconv.Unquote(l.Value) + } + } + } + } + } + } + } + declared := append(slices.Clone(FindingKinds), views.ViewKinds...) + raised := map[string]string{} // kind -> a place it is raised + kindOf := func(e ast.Expr) (string, bool) { + switch x := e.(type) { + case *ast.BasicLit: + s, err := strconv.Unquote(x.Value) + return s, err == nil + case *ast.Ident: + if x.Name == "kind" { + return "", true // a pass-through parameter: its callers give the kind + } + s, ok := consts[x.Name] + if !ok { + s, ok = imported["index."+x.Name] + } + return s, ok + case *ast.SliceExpr: + return "", true // the kind of a key a views reader names: its own kinds (views.ViewKinds) + case *ast.SelectorExpr: + if x.Sel.Name == "Kind" { + return "", true // a held finding's kind, given when it was raised + } + if p, ok := x.X.(*ast.Ident); ok { + if p.Name == "index" { + s, ok := consts[x.Sel.Name] + return s, ok + } + s, ok := imported[p.Name+"."+x.Sel.Name] + return s, ok + } + } + return "", false + } + note := func(e ast.Expr) { + k, ok := kindOf(e) + if !ok { + t.Errorf("%s: a finding kind the test cannot read; give it as a constant (or name it in imported)", fset.Position(e.Pos())) + return + } + if k != "" { + raised[k] = fset.Position(e.Pos()).String() + } + } + for _, f := range files { + ast.Inspect(f, func(n ast.Node) bool { + switch x := n.(type) { + case *ast.CallExpr: + var name string + switch fn := x.Fun.(type) { + case *ast.Ident: + name = fn.Name + case *ast.SelectorExpr: + name = fn.Sel.Name + } + if i, ok := kindArg[name]; ok && len(x.Args) > i { + if name == "Clear" && len(x.Args) != 5 { + return true // not a finding writer's Clear(ctx, scope, id, kind, why) + } + note(x.Args[i]) + } + case *ast.CompositeLit: + if s, ok := x.Type.(*ast.SelectorExpr); ok && s.Sel.Name == "Finding" { + for _, el := range x.Elts { + if kv, ok := el.(*ast.KeyValueExpr); ok { + if id, ok := kv.Key.(*ast.Ident); ok && id.Name == "Kind" { + note(kv.Value) + } + } + } + } + } + return true + }) + } + for _, k := range []string{PinMissingKind, OutOfStepKind, PackagesNotPublishedKind} { + if _, ok := raised[k]; !ok { + t.Errorf("the test no longer finds the kind %s the code raises: it reads the code wrongly", k) + } + } + for k, at := range raised { + if !slices.Contains(declared, k) { + t.Errorf("%s: the code raises the finding kind %q, which the writer's list FindingKinds does not declare", at, k) + } + } +} diff --git a/modules/mesh-delivery-indexer/internal/index/findings.go b/modules/mesh-delivery-indexer/internal/index/findings.go index 761480f7..25df6af3 100644 --- a/modules/mesh-delivery-indexer/internal/index/findings.go +++ b/modules/mesh-delivery-indexer/internal/index/findings.go @@ -12,6 +12,12 @@ const ( FindingsState = "findings" ) +// FindingKinds are the finding kinds the indexer's daemon raises, the kinds its writer owns (design 47 G §580, H H-A-240, +// H-A-242): the tool runner's writer over the same state `findings` owns its own, and a views reader's (views.ViewKinds) are +// always the writer's besides. TestFindingKindsHoldEveryKindTheCodeRaises holds the code to this list. +var FindingKinds = []string{PinMissingKind, OutOfStepKind, PackagesNotPublishedKind, HistoryFillingKind, SeedWaitsKind, + SeedLeftOutKind, SeatDefinitionUnparsedKind, SeatDefinedTwiceKind, SeatOutsideItsDomainKind, mcc.KindCallUnanswered} + // FindingWriter is the indexer's finding writer, mesh-sdk's held writer of the seat mesh-conditions' generated finding (design // 47 G A-29, A-38): Write raises a finding, Clear clears one, Held answers the findings it holds, so the indexer reads what // stands from the writer. From ad0052c6f573b0488b5742b167699d7da560b9df Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 11:41:13 +0100 Subject: [PATCH 2/4] Design 47 H1: the indexer owns the SDK parts' kinds, its own unanswered-call kind and a retired list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon's writer is handed to the process reader (event-unhandled) and the heard writer (family-not-heard), kinds its list lacked; and call-unanswered belongs to the tool runner's writer over the same state. The daemon's unanswered calls are now indexer-call-unanswered (same scope and id), its list holds the SDK parts' kinds, and merge-untaken is retired, so its live key and condition clear at the next start. The test reads the SDK parts handed the writer and refuses a retired kind still raised. Builds: design 47 H H-A-242, H-A-247 (1) (2) (3), H-A-82, G §580 --- .../cmd/mesh-delivery-indexer/main.go | 4 +- .../internal/index/finding_kinds_test.go | 41 +++++++++++++++++-- .../internal/index/findings.go | 18 ++++++-- .../internal/index/seed.go | 2 +- .../internal/index/seed_steps.go | 10 ++--- .../internal/index/seed_steps_test.go | 4 +- .../internal/index/tag_floor.go | 12 +++--- .../internal/index/versions_fill.go | 10 ++--- .../internal/index/versions_test.go | 6 +-- 9 files changed, 77 insertions(+), 30 deletions(-) diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go index 7045cdec..5b95d8e2 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go @@ -290,8 +290,8 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro // (design 47 G §689, A-29): it holds what is written before the state is bound, and starts once the state is. writer, err := views.NewHeldWriter(views.WriterConfig[mcseat.Finding, mcseat.FindingCleared, mcseat.FindingsStated, mcseat.FindingsAskedEvent]{ Module: cred.Module, State: calls.State(index.FindingsState), Node: cred.Node, Asked: mcseat.SubjectFindingsAsked, JS: js, Conn: conn, Logf: logger.Printf, - // its own kinds only (G §580, H-A-242): the tool runner's writer states its kinds over the same state - Kinds: index.FindingKinds}) + // its own kinds only (G §580, H-A-242, H-A-247): the tool runner's writer states its kinds over the same state + Kinds: index.FindingKinds, Retired: index.RetiredFindingKinds}) if err != nil { return fmt.Errorf("the indexer's finding writer cannot be made: %w", err) } diff --git a/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go index 31310d7f..1a6c9114 100644 --- a/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go +++ b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go @@ -12,13 +12,16 @@ import ( "testing" mcc "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient" + "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient/heard" "git.novox.be/novox/mesh-sdk/go/views" ) -// Design 47 H H-A-240, H-A-242, G §580: every finding kind the daemon's code raises or clears is one its writer owns +// Design 47 H H-A-240, H-A-242, H-A-247, G §580: every finding kind the daemon's code raises or clears is one its writer owns // (FindingKinds, and a views reader's views.ViewKinds), so the writer never refuses a kind of the indexer's own. The test // reads the daemon's code (this package and cmd/mesh-delivery-indexer) for every place a kind is given to the writer: the -// kind argument of observed, finding, clearFinding, clearHeld and a writer's Clear, and the Kind of a Finding literal. A +// kind argument of observed, finding, clearFinding, clearHeld and a writer's Clear, the Kind of a Finding literal, and the +// kinds of an SDK part handed the writer (partKinds). mcc.KindCallUnanswered stays readable, so a return to the tool runner's +// kind fails the test. A // kind there is a string, a constant of the package or a constant named in imported below; any other form fails the test, // naming its place, but for the pass-through parameter `kind`, a held finding's `.Kind` and the kind cut from a key a views // reader names, which carry a kind given elsewhere. @@ -26,6 +29,18 @@ func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { imported := map[string]string{"mcc.KindCallUnanswered": mcc.KindCallUnanswered, "views.ViewWaitsKind": views.ViewWaitsKind} // kindArg is the place of the kind among a raising call's arguments. kindArg := map[string]int{"observed": 2, "finding": 2, "clearFinding": 3, "clearHeld": 4, "Clear": 3} + // partKinds are the kinds each SDK part raises through the writer it is handed (H-A-247 (1)); handed says a literal's field + // gives it the writer. + partKinds := map[string][]string{"views.ProcessReader": {views.EventUnhandledKind}, "views.Emitter": {views.UnsaidKind, views.TooLargeKind}, + "heard.Writer": {heard.Kind}} + handed := func(e ast.Expr) bool { + kv, ok := e.(*ast.KeyValueExpr) + if !ok { + return false + } + id, ok := kv.Key.(*ast.Ident) + return ok && (id.Name == "Findings" || id.Name == "Put") + } fset := token.NewFileSet() var files []*ast.File consts := map[string]string{} @@ -125,6 +140,20 @@ func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { note(x.Args[i]) } case *ast.CompositeLit: + // an SDK part handed the writer raises its own kinds through it (H-A-247 (1)) + if s, ok := x.Type.(*ast.SelectorExpr); ok && slices.ContainsFunc(x.Elts, handed) { + if p, ok := s.X.(*ast.Ident); ok && p.Name != "index" { // the indexer's own code is read above + part := p.Name + "." + s.Sel.Name + if kinds, ok := partKinds[part]; ok { + for _, k := range kinds { + raised[k] = fset.Position(x.Pos()).String() + " (" + part + ")" + } + } else { + t.Errorf("%s: %s is handed the finding writer, and the test does not know its kinds: name them in partKinds", + fset.Position(x.Pos()), part) + } + } + } if s, ok := x.Type.(*ast.SelectorExpr); ok && s.Sel.Name == "Finding" { for _, el := range x.Elts { if kv, ok := el.(*ast.KeyValueExpr); ok { @@ -138,7 +167,7 @@ func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { return true }) } - for _, k := range []string{PinMissingKind, OutOfStepKind, PackagesNotPublishedKind} { + for _, k := range []string{PinMissingKind, OutOfStepKind, PackagesNotPublishedKind, CallUnansweredKind, views.EventUnhandledKind, heard.Kind} { if _, ok := raised[k]; !ok { t.Errorf("the test no longer finds the kind %s the code raises: it reads the code wrongly", k) } @@ -148,4 +177,10 @@ func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { t.Errorf("%s: the code raises the finding kind %q, which the writer's list FindingKinds does not declare", at, k) } } + // a retired kind is one no code raises and the writer does not own (H-A-247 (3)) + for _, k := range RetiredFindingKinds { + if at, ok := raised[k]; ok || slices.Contains(declared, k) { + t.Errorf("the retired kind %q is still declared or raised (%s)", k, at) + } + } } diff --git a/modules/mesh-delivery-indexer/internal/index/findings.go b/modules/mesh-delivery-indexer/internal/index/findings.go index 25df6af3..773a2966 100644 --- a/modules/mesh-delivery-indexer/internal/index/findings.go +++ b/modules/mesh-delivery-indexer/internal/index/findings.go @@ -4,7 +4,9 @@ import ( "context" mcc "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient" + "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient/heard" mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions" + "git.novox.be/novox/mesh-sdk/go/views" ) // FindingsState is the indexer's state of its findings (design 47 G §383, §687). @@ -12,11 +14,21 @@ const ( FindingsState = "findings" ) +// CallUnansweredKind is the indexer's finding of a call nobody answered within its bound (scope call, its id the call): a kind +// of its own, since the tool runner's writer over the same state owns call-unanswered (design 47 H H-A-247 (2)). +const CallUnansweredKind = "indexer-call-unanswered" + // FindingKinds are the finding kinds the indexer's daemon raises, the kinds its writer owns (design 47 G §580, H H-A-240, -// H-A-242): the tool runner's writer over the same state `findings` owns its own, and a views reader's (views.ViewKinds) are -// always the writer's besides. TestFindingKindsHoldEveryKindTheCodeRaises holds the code to this list. +// H-A-242, H-A-247): its own, the process reader's event-unhandled and the family-not-heard of the heard writer it is handed +// (H-A-247 (1)); a views reader's and the emitter's (views.ViewKinds) are always the writer's besides. The tool runner's +// writer over the same state `findings` owns its own. TestFindingKindsHoldEveryKindTheCodeRaises holds the code to this list. var FindingKinds = []string{PinMissingKind, OutOfStepKind, PackagesNotPublishedKind, HistoryFillingKind, SeedWaitsKind, - SeedLeftOutKind, SeatDefinitionUnparsedKind, SeatDefinedTwiceKind, SeatOutsideItsDomainKind, mcc.KindCallUnanswered} + SeedLeftOutKind, SeatDefinitionUnparsedKind, SeatDefinedTwiceKind, SeatOutsideItsDomainKind, CallUnansweredKind, + views.EventUnhandledKind, heard.Kind} + +// RetiredFindingKinds are kinds no code of the indexer raises any more, which its writer clears once at its start (H-A-247 +// (3)): merge-untaken went with H-A-82. +var RetiredFindingKinds = []string{"merge-untaken"} // FindingWriter is the indexer's finding writer, mesh-sdk's held writer of the seat mesh-conditions' generated finding (design // 47 G A-29, A-38): Write raises a finding, Clear clears one, Held answers the findings it holds, so the indexer reads what diff --git a/modules/mesh-delivery-indexer/internal/index/seed.go b/modules/mesh-delivery-indexer/internal/index/seed.go index c4f38aa7..317ebc48 100644 --- a/modules/mesh-delivery-indexer/internal/index/seed.go +++ b/modules/mesh-delivery-indexer/internal/index/seed.go @@ -124,7 +124,7 @@ func (r *Registry) ProposeSeed(ctx context.Context, modules []SeedModule, again return "", err } if len(seed.Unanswered) > 0 { - return "", fmt.Errorf("the build seats %v have not answered steps: the seed waits for them (call-unanswered after five minutes)", seed.Unanswered) + return "", fmt.Errorf("the build seats %v have not answered steps: the seed waits for them (indexer-call-unanswered after five minutes)", seed.Unanswered) } regs, left = seed.Registrations, seed.Left } diff --git a/modules/mesh-delivery-indexer/internal/index/seed_steps.go b/modules/mesh-delivery-indexer/internal/index/seed_steps.go index 9667902c..9a6391dd 100644 --- a/modules/mesh-delivery-indexer/internal/index/seed_steps.go +++ b/modules/mesh-delivery-indexer/internal/index/seed_steps.go @@ -57,7 +57,7 @@ func buildSeatOf(defs map[string]seatdef.Definition, a meshcatalog.Artifact) (st // SeedModulesFrom reads the modules the newest trunk revision holds for the seed (design 47 G §704, §8): for each artifact of // each module the seat list's build seat answers steps with {module, artifact, fingerprint, fetch} from the module's trunk // entry, the fetch its repository, commit, directory and the artifact's named paths. A seat that does not answer leaves -// its artifact unanswered, which holds the seed; its call-unanswered finding (scope call, id .steps) is written once +// its artifact unanswered, which holds the seed; its indexer-call-unanswered finding (scope call, id .steps) is written once // it is unanswered five minutes and cleared when it answers. func (ix *Indexer) SeedModulesFrom(ctx context.Context, defs map[string]seatdef.Definition, steps StepsCaller) ([]SeedModule, error) { if ix.Revisions == nil { @@ -202,7 +202,7 @@ func artifactName(ref string) string { return ref } -// stepsFindings writes call-unanswered for each seat unanswered for five minutes and clears it for each that answered. +// stepsFindings writes indexer-call-unanswered for each seat unanswered for five minutes and clears it for each that answered. func (ix *Indexer) stepsFindings(ctx context.Context, answered map[string]bool, unanswered map[string]error) { if ix.Findings == nil { return @@ -223,11 +223,11 @@ func (ix *Indexer) stepsFindings(ctx context.Context, answered map[string]bool, } for _, seat := range slices.Sorted(slices.Values(raise)) { id := seat + "." + StepsVerb - f := ix.observed(mcc.ScopeCall, id, mcc.KindCallUnanswered, + f := ix.observed(mcc.ScopeCall, id, CallUnansweredKind, fmt.Sprintf("the call %s is unanswered since %s", id, since[seat].UTC().Format(time.RFC3339)), "A call whose answer is kept is not answered", fmt.Sprintf("The seed asks %s of every artifact its build seat builds; it is not answered since %s (%v), so the first registrations wait for it.", id, since[seat].UTC().Format(time.RFC3339), unanswered[seat]), - "indexer."+mcc.KindCallUnanswered) + "indexer."+CallUnansweredKind) if err := ix.Findings.Write(ctx, f); err != nil { ix.logf("seed: the finding %s is not written: %v", id, err) } @@ -236,7 +236,7 @@ func (ix *Indexer) stepsFindings(ctx context.Context, answered map[string]bool, if _, bad := unanswered[seat]; bad { continue } - if err := ix.clearFinding(ctx, mcc.ScopeCall, seat+"."+StepsVerb, mcc.KindCallUnanswered, "the seat answers steps"); err != nil { + if err := ix.clearFinding(ctx, mcc.ScopeCall, seat+"."+StepsVerb, CallUnansweredKind, "the seat answers steps"); err != nil { ix.logf("seed: the finding %s.%s is not cleared: %v", seat, StepsVerb, err) } } diff --git a/modules/mesh-delivery-indexer/internal/index/seed_steps_test.go b/modules/mesh-delivery-indexer/internal/index/seed_steps_test.go index 6824bb67..a2107598 100644 --- a/modules/mesh-delivery-indexer/internal/index/seed_steps_test.go +++ b/modules/mesh-delivery-indexer/internal/index/seed_steps_test.go @@ -15,7 +15,7 @@ import ( // Design 47 G §704: the seed asks `steps` of the build seat whose `build` rule matches each artifact, with {module, // artifact, fingerprint, fetch} from the newest trunk entry; a seat that does not answer holds the seed and, after five -// minutes, is the finding call-unanswered (scope call, id .steps), cleared when it answers. +// minutes, is the finding indexer-call-unanswered (scope call, id .steps), cleared when it answers. func TestTheSeedAsksStepsOfTheBuildSeatsOfTheTrunkEntries(t *testing.T) { ctx := context.Background() now := time.Date(2026, 11, 1, 3, 0, 0, 0, time.UTC) @@ -85,7 +85,7 @@ func TestTheSeedAsksStepsOfTheBuildSeatsOfTheTrunkEntries(t *testing.T) { if _, err := ix.SeedModulesFrom(ctx, defs, call); err != nil { t.Fatal(err) } - if h := w.Held(); len(h) != 1 || h[0].Scope != mcc.ScopeCall || h[0].ID != "node-build-go.steps" || h[0].Kind != mcc.KindCallUnanswered { + if h := w.Held(); len(h) != 1 || h[0].Scope != mcc.ScopeCall || h[0].ID != "node-build-go.steps" || h[0].Kind != CallUnansweredKind { t.Fatalf("the findings after five minutes: %+v", h) } goUp = true diff --git a/modules/mesh-delivery-indexer/internal/index/tag_floor.go b/modules/mesh-delivery-indexer/internal/index/tag_floor.go index b7e69553..33f454d8 100644 --- a/modules/mesh-delivery-indexer/internal/index/tag_floor.go +++ b/modules/mesh-delivery-indexer/internal/index/tag_floor.go @@ -22,7 +22,7 @@ import ( // filled per module whenever the indexer starts and at each catalog revision kept, not once (A-490d, A-490f): the key // versions-filled closes only the builder's half of the fill. -// FloorCall is the id of the finding call-unanswered when a floor read (the forge's tags or a package holder's versions) is +// FloorCall is the id of the finding indexer-call-unanswered when a floor read (the forge's tags or a package holder's versions) is // unanswered five minutes after the first (A-490h). const FloorCall = "mesh-catalog.versions-floor" @@ -91,7 +91,7 @@ func (ix *Indexer) FloorModules(ctx context.Context) ([]string, error) { // FillFloor fills one module's floor, the highest version among its packages' tags and holders' versions (A-490g). Its reads are // kept calls made through mesh-sdk's form, which asks again through every transport fault; a read it gives up on (its own // pause spent) is asked again at once, never given up, so the read has no bound (A-490i). The first unanswered try starts the -// module's clock: five minutes later the finding call-unanswered is written, and cleared when a read answers. A read the +// module's clock: five minutes later the finding indexer-call-unanswered is written, and cleared when a read answers. A read the // callee answered with a failure ends the fill, left for the next start or revision. One fill of a module runs at a time. func (ix *Indexer) FillFloor(ctx context.Context, module string, src FloorSources) error { if _, running := ix.floors.LoadOrStore(module, true); running { @@ -198,7 +198,7 @@ func FloorSinceKey(module string) string { return floorSinceKey(module) } func floorSinceKey(module string) string { return "call-since." + keys.EscapeName(floorKey(module)) } -// floorUnanswered writes call-unanswered once the module's floor read is unanswered five minutes (the time kept in the own state). +// floorUnanswered writes indexer-call-unanswered once the module's floor read is unanswered five minutes (the time kept in the own state). func (ix *Indexer) floorUnanswered(ctx context.Context, module string, first time.Time, cause error) { now := ix.now() since := ix.unansweredSince(ctx, floorSinceKey(module), first) @@ -206,11 +206,11 @@ func (ix *Indexer) floorUnanswered(ctx context.Context, module string, first tim return } at := since.UTC().Format(time.RFC3339) - f := ix.observed(mcc.ScopeCall, floorKey(module), mcc.KindCallUnanswered, + f := ix.observed(mcc.ScopeCall, floorKey(module), CallUnansweredKind, fmt.Sprintf("the floor of %s's versions is unanswered since %s", module, at), "A call whose answer is kept is not answered", fmt.Sprintf("The floor of %s's versions reads the forge's tags and the package holders' versions; a read is not answered since %s (%v), so it has no version.", module, at, cause), - "indexer."+mcc.KindCallUnanswered) + "indexer."+CallUnansweredKind) if err := ix.Findings.Write(ctx, f); err != nil { ix.logf("floor: the finding %s is not written: %v", floorKey(module), err) } @@ -219,7 +219,7 @@ func (ix *Indexer) floorUnanswered(ctx context.Context, module string, first tim func (ix *Indexer) floorAnswered(ctx context.Context, module string) { ix.answered(ctx, floorSinceKey(module)) if ix.Findings != nil { - if err := ix.clearFinding(ctx, mcc.ScopeCall, floorKey(module), mcc.KindCallUnanswered, "the floor's reads answer"); err != nil { + if err := ix.clearFinding(ctx, mcc.ScopeCall, floorKey(module), CallUnansweredKind, "the floor's reads answer"); err != nil { ix.logf("floor: the finding %s is not cleared: %v", floorKey(module), err) } } diff --git a/modules/mesh-delivery-indexer/internal/index/versions_fill.go b/modules/mesh-delivery-indexer/internal/index/versions_fill.go index a19e1274..9b4cc2ad 100644 --- a/modules/mesh-delivery-indexer/internal/index/versions_fill.go +++ b/modules/mesh-delivery-indexer/internal/index/versions_fill.go @@ -63,7 +63,7 @@ func versionNameOf(module string, a meshcatalog.Artifact) string { // FillVersions fills the state versions once from builder_versions and says versions-filled (§372). A fill already made // is not made again; a builder_versions that does not answer holds the fill and, after five minutes, is the finding -// call-unanswered (scope call, id mesh-delivery-builder.builder_versions), cleared when it answers. +// indexer-call-unanswered (scope call, id mesh-delivery-builder.builder_versions), cleared when it answers. func (ix *Indexer) FillVersions(ctx context.Context, ask VersionsAsker) error { if ix.Versions == nil || ix.Heard == nil { return errors.New("the state versions is not kept here") @@ -127,7 +127,7 @@ func (ix *Indexer) FillVersions(ctx context.Context, ask VersionsAsker) error { } ix.answered(ctx, versionsFillSince) if ix.Findings != nil { - if err := ix.clearFinding(ctx, mcc.ScopeCall, BuilderVersionsCall, mcc.KindCallUnanswered, "builder_versions answers"); err != nil { + if err := ix.clearFinding(ctx, mcc.ScopeCall, BuilderVersionsCall, CallUnansweredKind, "builder_versions answers"); err != nil { ix.logf("versions fill: the finding %s is not cleared: %v", BuilderVersionsCall, err) } } @@ -184,18 +184,18 @@ func (ix *Indexer) FillVersions(ctx context.Context, ask VersionsAsker) error { return nil } -// fillUnanswered writes call-unanswered once builder_versions is unanswered five minutes (the time kept in the own state). +// fillUnanswered writes indexer-call-unanswered once builder_versions is unanswered five minutes (the time kept in the own state). func (ix *Indexer) fillUnanswered(ctx context.Context, cause error) { now := ix.now() since := ix.unansweredSince(ctx, versionsFillSince, now) if ix.Findings == nil || now.Sub(since) < mcc.CallUnansweredAfter { return } - f := ix.observed(mcc.ScopeCall, BuilderVersionsCall, mcc.KindCallUnanswered, + f := ix.observed(mcc.ScopeCall, BuilderVersionsCall, CallUnansweredKind, fmt.Sprintf("the call %s is unanswered since %s", BuilderVersionsCall, since.UTC().Format(time.RFC3339)), "A call whose answer is kept is not answered", fmt.Sprintf("The first fill of the catalog's versions asks %s of every artifact; it is not answered since %s (%v), so no version is released and the builder reserves nothing.", BuilderVersionsCall, since.UTC().Format(time.RFC3339), cause), - "indexer."+mcc.KindCallUnanswered) + "indexer."+CallUnansweredKind) if err := ix.Findings.Write(ctx, f); err != nil { ix.logf("versions fill: the finding %s is not written: %v", BuilderVersionsCall, err) } diff --git a/modules/mesh-delivery-indexer/internal/index/versions_test.go b/modules/mesh-delivery-indexer/internal/index/versions_test.go index 399d8791..b4c56076 100644 --- a/modules/mesh-delivery-indexer/internal/index/versions_test.go +++ b/modules/mesh-delivery-indexer/internal/index/versions_test.go @@ -87,7 +87,7 @@ func TestAVersionIsReleasedOnceEveryArtifactIsPublished(t *testing.T) { // Design 47 G §372, A-350: the first fill records, once, each module's highest version the builder gave a number, numbered or // published, over its artifacts as released and says versions-filled once; a builder_versions that does not answer holds it and, after five minutes, is the finding -// call-unanswered; a fill made is not made again. +// indexer-call-unanswered; a fill made is not made again. func TestTheFirstFillOfTheVersionsComesFromTheBuildersNumbers(t *testing.T) { ctx := context.Background() now := time.Date(2026, 11, 1, 3, 0, 0, 0, time.UTC) @@ -501,7 +501,7 @@ func TestAnInputIsDeletedAtTheStepEndedOfItsAsk(t *testing.T) { // Design 47 G §412 as A-490c, A-490d and A-490e amend it: a module the versions hold none of is filled from the highest tag of its // Go package in the repository it was taken in from, per module and not once; a forge that does not answer fills nothing and -// raises call-unanswered after five minutes. +// raises indexer-call-unanswered after five minutes. func TestTheTagFloorFillsAModuleWithNoVersionFromItsGoTags(t *testing.T) { ctx := context.Background() now := time.Date(2026, 11, 19, 17, 0, 0, 0, time.UTC) @@ -623,7 +623,7 @@ func TestAFloorEntryIsReplacedByThePublishHeardAtItsVersion(t *testing.T) { } } -// ADR 0668 §3, design 47 G A-490i: the finding call-unanswered of a module's floor clears, with its call-since key, on every way the +// ADR 0668 §3, design 47 G A-490i: the finding indexer-call-unanswered of a module's floor clears, with its call-since key, on every way the // fill ends but the end of its context: a release gave the module a version, the module left the trunk, or the callee answered with a // failure (FloorModules never picks the module again to clear it). func TestTheFloorFindingClearsOnEveryExitOfTheFill(t *testing.T) { From 31c2c5c7fe4075caad7fdb874f9fdac27d09f9da Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 11:43:57 +0100 Subject: [PATCH 3/4] Design 47 H1: the indexer retires call-unanswered by the ids it wrote under it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon's call-unanswered keys from before the rename would be seeded and stated by the tool runner's writer, which owns that kind, and never cleared. The retired list now names call-unanswered with the indexer's own id forms (the seed's node-build-.steps, the floor's mesh-catalog.versions-floor., the versions fill's mesh-delivery-builder.builder_versions), so those keys clear once and the tool runner's approval findings stay. Builds: design 47 H H-A-247 (3), H-A-249, G §580 --- .../internal/index/finding_kinds_test.go | 25 ++++++++++++++++--- .../internal/index/findings.go | 8 ++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go index 1a6c9114..fe735baf 100644 --- a/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go +++ b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go @@ -178,9 +178,28 @@ func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { } } // a retired kind is one no code raises and the writer does not own (H-A-247 (3)) - for _, k := range RetiredFindingKinds { - if at, ok := raised[k]; ok || slices.Contains(declared, k) { - t.Errorf("the retired kind %q is still declared or raised (%s)", k, at) + for _, r := range RetiredFindingKinds { + if at, ok := raised[r.Kind]; ok || slices.Contains(declared, r.Kind) { + t.Errorf("the retired kind %q is still declared or raised (%s)", r.Kind, at) } } + // H-A-249: the retired call-unanswered names the ids the indexer's unanswered calls are written under, as in a key + covers := func(id string) bool { + for _, r := range RetiredFindingKinds { + if r.Kind == mcc.KindCallUnanswered && (slices.Contains(r.IDs, id) || + slices.ContainsFunc(r.Prefixes, func(p string) bool { return strings.HasPrefix(id, p) })) { + return true + } + } + return false + } + for _, id := range []string{keyID("node-build-go." + StepsVerb), keyID("node-build-image." + StepsVerb), keyID(floorKey("mesh-tools")), + keyID(BuilderVersionsCall)} { + if !covers(id) { + t.Errorf("the retired call-unanswered does not cover the indexer's id %s", id) + } + } + if covers("mesh-hand-acts.warranted") || covers("ask-1") { + t.Error("the retired call-unanswered covers an id of the tool runner's") + } } diff --git a/modules/mesh-delivery-indexer/internal/index/findings.go b/modules/mesh-delivery-indexer/internal/index/findings.go index 773a2966..faa1fac9 100644 --- a/modules/mesh-delivery-indexer/internal/index/findings.go +++ b/modules/mesh-delivery-indexer/internal/index/findings.go @@ -27,8 +27,12 @@ var FindingKinds = []string{PinMissingKind, OutOfStepKind, PackagesNotPublishedK views.EventUnhandledKind, heard.Kind} // RetiredFindingKinds are kinds no code of the indexer raises any more, which its writer clears once at its start (H-A-247 -// (3)): merge-untaken went with H-A-82. -var RetiredFindingKinds = []string{"merge-untaken"} +// (3)): merge-untaken went with H-A-82; call-unanswered became indexer-call-unanswered (H-A-247 (2)), and since the tool +// runner's writer owns call-unanswered in the same state, only the ids the indexer wrote under it are cleared (H-A-249): +// the seed's .steps (every build seat is named node-build-), the floor's mesh-catalog.versions-floor. +// and the versions fill's mesh-delivery-builder.builder_versions. +var RetiredFindingKinds = []views.RetiredKind{{Kind: "merge-untaken"}, {Kind: mcc.KindCallUnanswered, + IDs: []string{keyID(BuilderVersionsCall)}, Prefixes: []string{"node-build-", keyID(FloorCall) + "."}}} // FindingWriter is the indexer's finding writer, mesh-sdk's held writer of the seat mesh-conditions' generated finding (design // 47 G A-29, A-38): Write raises a finding, Clear clears one, Held answers the findings it holds, so the indexer reads what From bdb4edd82096ce21f4881305ccf8adaa42615197 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 11:48:04 +0100 Subject: [PATCH 4/4] Design 47 H1: the indexer's retired call-unanswered names scope call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tool runner's approval findings of call-unanswered are of scope machine; the indexer's entry now names scope call, so no approval key is cleared even where an id form would match. The test's negative ids take the approval form. Builds: design 47 H H-A-249, G §580 --- .../internal/index/finding_kinds_test.go | 9 +++++---- modules/mesh-delivery-indexer/internal/index/findings.go | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go index fe735baf..070fc772 100644 --- a/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go +++ b/modules/mesh-delivery-indexer/internal/index/finding_kinds_test.go @@ -184,9 +184,9 @@ func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { } } // H-A-249: the retired call-unanswered names the ids the indexer's unanswered calls are written under, as in a key - covers := func(id string) bool { + covers := func(scope, id string) bool { for _, r := range RetiredFindingKinds { - if r.Kind == mcc.KindCallUnanswered && (slices.Contains(r.IDs, id) || + if r.Kind == mcc.KindCallUnanswered && (r.Scope == "" || r.Scope == scope) && (slices.Contains(r.IDs, id) || slices.ContainsFunc(r.Prefixes, func(p string) bool { return strings.HasPrefix(id, p) })) { return true } @@ -195,11 +195,12 @@ func TestFindingKindsHoldEveryKindTheCodeRaises(t *testing.T) { } for _, id := range []string{keyID("node-build-go." + StepsVerb), keyID("node-build-image." + StepsVerb), keyID(floorKey("mesh-tools")), keyID(BuilderVersionsCall)} { - if !covers(id) { + if !covers(mcc.ScopeCall, id) { t.Errorf("the retired call-unanswered does not cover the indexer's id %s", id) } } - if covers("mesh-hand-acts.warranted") || covers("ask-1") { + // the approval gate's findings: scope machine, id =2e + if covers("machine", "novox=2eask-1") || covers("machine", "node-build-go.steps") || covers(mcc.ScopeCall, "novox=2eask-1") { t.Error("the retired call-unanswered covers an id of the tool runner's") } } diff --git a/modules/mesh-delivery-indexer/internal/index/findings.go b/modules/mesh-delivery-indexer/internal/index/findings.go index faa1fac9..542c707b 100644 --- a/modules/mesh-delivery-indexer/internal/index/findings.go +++ b/modules/mesh-delivery-indexer/internal/index/findings.go @@ -28,10 +28,10 @@ var FindingKinds = []string{PinMissingKind, OutOfStepKind, PackagesNotPublishedK // RetiredFindingKinds are kinds no code of the indexer raises any more, which its writer clears once at its start (H-A-247 // (3)): merge-untaken went with H-A-82; call-unanswered became indexer-call-unanswered (H-A-247 (2)), and since the tool -// runner's writer owns call-unanswered in the same state, only the ids the indexer wrote under it are cleared (H-A-249): +// runner's writer owns call-unanswered in the same state, only the ids the indexer wrote under it, in scope call, are cleared (H-A-249): // the seed's .steps (every build seat is named node-build-), the floor's mesh-catalog.versions-floor. // and the versions fill's mesh-delivery-builder.builder_versions. -var RetiredFindingKinds = []views.RetiredKind{{Kind: "merge-untaken"}, {Kind: mcc.KindCallUnanswered, +var RetiredFindingKinds = []views.RetiredKind{{Kind: "merge-untaken"}, {Kind: mcc.KindCallUnanswered, Scope: mcc.ScopeCall, IDs: []string{keyID(BuilderVersionsCall)}, Prefixes: []string{"node-build-", keyID(FloorCall) + "."}}} // FindingWriter is the indexer's finding writer, mesh-sdk's held writer of the seat mesh-conditions' generated finding (design