H-A-48: the own build and the pull-request candidates' leftovers go

Nothing of the one model reads which build the indexer runs: the take-in holds nothing for the
indexer a revision names and indexer_pending answers the state held alone, so FixOwnBuild, the
state own-build, the ask of the node-engine's composition and its invoke go. No pull request's
candidate is written any more, so what only it read goes: the member heads' packages
(candidatePublished), SameCandidate, headOf and CandidatesKey; and consumerSink with the state
consumers (H-A-80). The state taken stays: the view reads it. The run on request's candidate
stays (H-A-105 b). The manifest test holds the state and the invoke absent.

Builds: design 47 H §743 (holds nothing for the indexer), §764 (the indexer); H-A-48, H-A-80, H-A-102, H-A-105

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 04:56:28 +01:00
parent 1a3664ad77
commit dad31f49c5
12 changed files with 15 additions and 344 deletions
@@ -283,7 +283,6 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
// The state heard (A-80): the forge messages handled (key forge) and what the indexer heard and compares later (the time a call is
// unanswered since, the newest toolchain-agreed, the artifacts published so far of a version).
heardStore := awaitedStore{b: process.AwaitBucket(ctx, js, conn, index.Bucket(cred.Module, index.HeardState), "what the indexer heard is not kept", logger.Printf)}
ownBuildState := process.AwaitBucket(ctx, js, conn, index.Bucket(cred.Module, index.OwnBuildStateName), "which build this indexer runs is not kept", logger.Printf)
// The runs on request the indexer holds a candidate for (A-174): a state this delivery brings, bound when it appears.
runs := process.AwaitBucket(ctx, js, conn, index.Bucket(cred.Module, index.RunsState), "no run on request's candidate is written or dropped", logger.Printf)
findings := process.AwaitBucket(ctx, js, conn, index.Bucket(cred.Module, index.FindingsState), "no finding of the indexer is written", logger.Printf)
@@ -333,7 +332,7 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
Predefined: awaitedStore{b: predefined}, Logf: logger.Printf,
Named: namedVia(calls.Call), Trunk: trunkVia(calls.Call), BranchHead: branchHeadVia(calls.Call), Contains: containsVia(calls.Call), Read: readVia(calls.Call),
Packages: awaitedStore{b: packages, js: js, name: index.Bucket(cred.Module, index.PackagesState)}, Files: filesVia(calls.Call), GoSum: goSumVia(calls.Call), GoMod: goModVia(calls.Call),
OwnBuild: ownBuildVia(calls.Call, cred.Module, cred.Node), OwnBuildState: awaitedStore{b: ownBuildState}, Heard: heardStore, Runs: awaitedStore{b: runs}, Graph: graph,
Heard: heardStore, Runs: awaitedStore{b: runs}, Graph: graph,
SeatDefinitions: awaitedStore{b: seatDefs}, ReadFile: readFileVia(calls.Call), SaySeatDefinition: saySeats,
Revisions: revisions, EntryIndex: awaitedStore{b: process.AwaitBucket(ctx, js, conn, index.Bucket(cred.Module, index.EntryIndexState), "no entry is found by its fingerprint", logger.Printf)}, // Message a kept call: a read, called again through a transport fault (ADR 0668 §1)
// Each catalog revision may bring another holder of a build seat: the build modules are found again (buildmodules.go).
@@ -372,10 +371,6 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
}
return ix.SeedModulesFrom(ctx, r.Definitions(), stepsVia(calls.CallKeptWhileOpen, ix.SeedEntryHeld, logger.Printf))
}
// Which build this program is, fixed here once, before it hears any merge and never asked again (index.FixOwnBuild): the
// node-engine names the successor while it replaces this process, and an old process that learnt it later would take
// revisions in with its old judge.
ix.FixOwnBuild(ctx)
// Each step of the start says when it begins and how long it took, so a start that does not end is read in the journal
// and not guessed (lead-47 2026-11-16: two starts on novox ran 25 minutes at one CPU with no line).
step := func(name string) func() {
@@ -7,7 +7,6 @@ import (
"fmt"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/git"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
"git.novox.be/novox/mesh-sdk/go/process"
"mesh-delivery-indexer/internal/index"
"slices"
"strings"
@@ -80,57 +79,6 @@ func TestTheTrunkIsTheDirectoriesTheForgeListsTrees(t *testing.T) { // 1900/AC3
if _, err := filesVia(down)(context.Background(), "novox/mesh-sdk", strings.Repeat("a", 40), []string{"go"}); err == nil || errors.Is(err, index.ErrNotInTree) {
t.Errorf("a failed call: %v, want an error that is not ErrNotInTree", err)
}
// The build the indexer runs is the engine's word (Runs.FP of its composition verb), asked of its own machine.
var asked, askedFor string
own := func(key string, body any) (json.RawMessage, error) {
asked, askedFor = key, body.(map[string]any)["module"].(string)
return json.RawMessage(`{"runs":{"fp":"src2:abc"}}`), nil
}
if fp, err := ownBuildVia(own, "acme-indexer", "n1")(context.Background()); err != nil || fp != "src2:abc" || asked != "seat:node-engine.composition@n1" || askedFor != "acme-indexer" {
t.Errorf("own build = %q %v asked %q for %q", fp, err, asked, askedFor)
}
// Issue 1921: the start during a replacement. What runs still names the old build, the want (composed by the node itself)
// the successor, which this process is: it fixes the successor. A want that is not self, or is removed, leaves what runs.
for _, row := range []struct{ name, answer, want string }{
{"replacing: runs old, want new and self", `{"runs":{"fp":"src2:old"},"want":{"fp":"src2:new","self":true}}`, "src2:new"},
{"a want the node does not compose", `{"runs":{"fp":"src2:old"},"want":{"fp":"src2:new"}}`, "src2:old"},
{"replacing: the apply of the want failed or is held", `{"runs":{"fp":"src2:old"},"want":{"fp":"src2:new","self":true},"attempt":{"fp":"src2:new","held":true}}`, "src2:old"},
{"replacing: an attempt of another build", `{"runs":{"fp":"src2:old"},"want":{"fp":"src2:new","self":true},"attempt":{"fp":"src2:older"}}`, "src2:new"},
{"the want already runs", `{"runs":{"fp":"src2:new"},"want":{"fp":"src2:new","self":true}}`, "src2:new"},
{"a removed want", `{"runs":{"fp":"src2:old"},"want":{"fp":"src2:new","self":true,"removed":true}}`, "src2:old"},
{"no build runs yet, want self", `{"want":{"fp":"src2:new","self":true}}`, "src2:new"},
} {
ask := func(string, any) (json.RawMessage, error) { return json.RawMessage(row.answer), nil }
if fp, err := ownBuildVia(ask, "acme-indexer", "n1")(context.Background()); err != nil || fp != row.want {
t.Errorf("%s: own build = %q %v, want %q", row.name, fp, err, row.want)
}
}
// Design 47 G A-366: a process started with a fingerprint takes it and asks no engine; one started without asks the engine.
for _, row := range []struct {
name string
started process.Build
want string
wantAsked bool
}{
{"started with a fingerprint", process.Build{Fingerprint: "src2:env"}, "src2:env", false},
{"started without one", process.Build{Unknown: process.OwnBuildUnknown}, "src2:abc", true},
} {
started := startedBuild
startedBuild = func() process.Build { return row.started }
defer func() { startedBuild = started }()
called := false
ask := func(string, any) (json.RawMessage, error) {
called = true
return json.RawMessage(`{"runs":{"fp":"src2:abc"}}`), nil
}
if fp, err := ownBuildVia(ask, "acme-indexer", "n1")(context.Background()); err != nil || fp != row.want || called != row.wantAsked {
t.Errorf("%s: own build = %q %v, engine asked %v, want %q asked %v", row.name, fp, err, called, row.want, row.wantAsked)
}
}
none := func(string, any) (json.RawMessage, error) { return json.RawMessage(`{}`), nil }
if _, err := ownBuildVia(none, "acme-indexer", "n1")(context.Background()); err == nil {
t.Error("an engine that says nothing runs gave a build")
}
// Design 47 G §64, A-160, A-174: the runner's run-started and pipeline-ended reach the indexer; one that is no such body,
// or a run that can never be taken in, is terminated, any other failure is left for redelivery, and a taken one is acked.
for _, row := range []struct {
@@ -1,67 +0,0 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"git.novox.be/novox/mesh-sdk/go/process"
)
// compositionVerb is the node-engine seat's read verb that says what runs of a module on a machine (its Runs.FP), asked of
// that machine's own engine as `seat:node-engine.composition@<machine>`. The indexer learns the build it runs from it, never
// from the trunk's value of itself or the haves bucket.
const compositionVerb = "seat:node-engine.composition"
// startedBuild is the build the process was started with (mesh-sdk process.OwnBuild: MESH_FINGERPRINT, set by the node-engine and
// by a unit started by hand); a variable so a test starts the process with another.
var startedBuild = process.OwnBuild
// ownBuildVia is the build of the indexer: the one it was started with, else what the engine of node says which fingerprint of the indexer runs there.
func ownBuildVia(call toolCaller, module, node string) func(ctx context.Context) (string, error) {
return func(context.Context) (string, error) {
// The build the process was started with is the build; the engine is asked only when there is none (design 47 G A-366).
if fp := startedBuild().Fingerprint; fp != "" {
return fp, nil
}
raw, err := call(compositionVerb+"@"+node, map[string]any{"module": module})
if err != nil {
return "", fmt.Errorf("%s: %w", compositionVerb, err)
}
var a struct {
Runs *struct {
FP string `json:"fp"`
} `json:"runs"`
Want *struct {
FP string `json:"fp"`
Self bool `json:"self"`
Removed bool `json:"removed"`
} `json:"want"`
// Attempt is the engine's last apply that did not end running (failed, or held), with the build it was of.
Attempt *struct {
FP string `json:"fp"`
} `json:"attempt"`
}
if err := json.Unmarshal(raw, &a); err != nil {
return "", fmt.Errorf("the answer of %s is not a composition: %w", compositionVerb, err)
}
// While the engine's apply of the want is in progress (what runs still names the old build, the want names another, and no
// attempt names that want as failed or held), this process is the successor and fixes the want's build. self is the node's
// standing way of composing the module, not a mark of this process, so it is not enough alone: an old process started again
// while the want names a successor that does not run (its apply failed or is held) takes what runs. The start fixes the
// build once (quick fix, ADR 0639 §7: nothing is learnt later, nothing waits on a timer); the thorough form is the
// engine passing each process the fingerprint it starts it with.
running := ""
if a.Runs != nil {
running = a.Runs.FP
}
if w := a.Want; w != nil && w.Self && !w.Removed && w.FP != "" && w.FP != running && (a.Attempt == nil || a.Attempt.FP != w.FP) {
return w.FP, nil
}
if a.Runs == nil || a.Runs.FP == "" {
return "", errors.New("the engine says no fingerprint of the indexer runs")
}
return a.Runs.FP, nil
}
}
@@ -34,15 +34,3 @@ func pendingOf(js jetstream.JetStream, cred process.Account) func(context.Contex
return n, nil
}
}
// consumerSink writes one key of the state consumers once its bucket is bound.
func consumerSink(b *process.AwaitedBucket) process.ConsumerSink {
return func(ctx context.Context, key string, value []byte) error {
kv := b.KV()
if kv == nil {
return process.ErrNotYet
}
_, err := kv.Put(ctx, key, value)
return err
}
}
@@ -24,15 +24,6 @@ import (
// change removes the module. The indexer writes it and the assigner reads it as a removal (issue 1297).
const CandidateNoneNoModule = "the merge preview names no manifest for the module's directory"
// CandidatesKey is the key, in the candidates state, of a group: `<group>`, the branch name the group's pull requests share
// (a slash is allowed), escaped so a branch such as `fix/1.2` keys; a lone pull request is a group of one under its branch.
func CandidatesKey(group string) (string, error) {
if group == "" {
return "", fmt.Errorf("index: the group name is empty")
}
return meshcatalog.CandidatesByGroupKey(keys.EscapeName(group)), nil
}
func checkCandidateModule(m meshcatalog.CandidatesByGroupValuePullsItemFpsValue) error {
switch {
case m.Fp2 != "" && m.None2 != "":
@@ -124,11 +115,3 @@ func DecodeCandidate(data []byte) (meshcatalog.CandidatesByGroupValue, error) {
}
return c, nil
}
// SameCandidate says whether two candidates are the same value.
func SameCandidate(a, b meshcatalog.CandidatesByGroupValue) bool { return reflect.DeepEqual(a, b) }
// headOf is a candidate's pull request as the head the heads hash is over.
func headOf(p meshcatalog.CandidatesByGroupValuePullsItem) meshdeliveryclient.Head {
return meshdeliveryclient.Head{Repository: p.Repository, Number: int(p.Number), Head: p.Head}
}
@@ -151,19 +151,13 @@ type Indexer struct {
moving map[string]whole // by modules key: a merge naming a module another repository holds, waiting for that trunk to drop it (moves.go)
fresh map[string]bool // modules whose import form is computed again by hand (FingerprintsAgain), "*" for every one; under freshMu
freshMu sync.Mutex
recompute sync.Mutex // one Recompute at a time
untaken map[string]string // repository to the latest merge applied while the taken state was missing (taken.go)
filling atomic.Bool // a FillTaken runs in the background (KickFill)
fillAgain atomic.Bool // a kick arrived while it ran
atHeads map[string]map[string]meshcatalog.PackagesByModuleValue // a member head's published Go modules, by repository@head (candidatePublished)
saidAt map[string]string // the head of a repository whose failed read was said, by repository: said once per head
failedAt map[string]string // the head of a repository whose tree lacks a directory asked, by repository: not asked again until the head changes
// OwnBuild answers the fingerprint of the build this program runs, from the node-engine's seat; nil knows none.
OwnBuild func(ctx context.Context) (string, error)
underSeats bool // a dry run inside judge.WithSeats: its judge passes do not hold the seat list (verdicts.go)
judgeMu sync.Mutex // one judge pass at a time (verdicts.go)
ownMu sync.Mutex // guards ownFP
keepMu sync.Mutex // one catalog graph revision kept at a time (keepEntries)
recompute sync.Mutex // one Recompute at a time
untaken map[string]string // repository to the latest merge applied while the taken state was missing (taken.go)
filling atomic.Bool // a FillTaken runs in the background (KickFill)
fillAgain atomic.Bool // a kick arrived while it ran
underSeats bool // a dry run inside judge.WithSeats: its judge passes do not hold the seat list (verdicts.go)
judgeMu sync.Mutex // one judge pass at a time (verdicts.go)
keepMu sync.Mutex // one catalog graph revision kept at a time (keepEntries)
// Pins is the state pins (pins.go); nil keeps none. PinsPending says how many messages the indexer's durable consumer of the
// events stream has not been given: a revision is removed only while none is pending (§579).
Pins Store
@@ -174,12 +168,6 @@ type Indexer struct {
behindWaiting atomic.Bool // a source revision came while a catch-up ran (A-463a)
behindAgain atomic.Bool // a source revision came while it ran
catchUpWG sync.WaitGroup // the first start's catch-up in the background (kickCatchUp), for tests to wait on
ownFP string // the fingerprint of the build this program runs, fixed once at the start (FixOwnBuild)
ownFixed bool // FixOwnBuild asked already: it asks once
ownSince time.Time // when the build was asked and not known, with ownWhy
ownWhy string
// OwnBuildState keeps which build this process knows it runs, or since when and why not (FixOwnBuild); nil keeps none.
OwnBuildState Store
// Heard keeps what the indexer heard and compares later (A-80): the time a call is unanswered since (steps-since, call-since),
// toolchain.<language>, pending.<module>.<version>, acted.<acting part>.<dependent>, each key part escaped as a name
// (§73), and the mark versions-filled; nil keeps none. It is the state heard, whose key forge keeps the forge messages handled.
@@ -30,12 +30,12 @@ func (ix *Indexer) dry() *dryRun {
d := &dryRun{}
x := &Indexer{Module: ix.Module, Manifests: ix.Manifests, Packages: ix.Packages, JudgeID: ix.JudgeID, Files: ix.Files, GoSum: ix.GoSum,
GoMod: ix.GoMod, Now: ix.Now, Builds: ix.Builds, Named: ix.Named, Trunk: ix.Trunk, BranchHead: ix.BranchHead, Read: ix.Read, Contains: ix.Contains,
OwnBuild: nil, SayTakeIn: nil,
SayTakeIn: nil,
// The registry milestone's fields: what a take-in would write on the bus stays out of a dry run, so the states of the
// requirements, findings, seat definitions, holds and their bounds are not overlaid, nothing is said, and no hold is
// weighed (Holds and Counted nil hold nothing); ReadFile only reads.
Requirements: nil, Findings: nil, SeatDefinitions: nil, ReadFile: ix.ReadFile, SaySeatDefinition: nil,
OwnBuildState: nil, Heard: nil, underSeats: true,
Heard: nil, underSeats: true,
// A dry run keeps no catalog graph revision (catalog_revisions.go): its revision is the take-in's to keep.
Revisions: nil, SayCatalogRevision: nil, SayFill: nil, EntryIndex: nil, NamedSets: nil, Versions: nil, SayVersionReleased: nil, SayVersionsFilled: nil, Inputs: nil, InputObjects: nil, Pins: nil, PinsPending: nil,
// A dry run writes no registration and asks no one.
@@ -57,9 +57,6 @@ func (ix *Indexer) dry() *dryRun {
x.moving = maps.Clone(ix.moving)
x.untaken = maps.Clone(ix.untaken)
ix.mu.Unlock()
ix.ownMu.Lock()
x.ownFP = ix.ownFP
ix.ownMu.Unlock()
d.ix = x
return d
}
@@ -1,84 +0,0 @@
package index
import (
"context"
"encoding/json"
"errors"
"time"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
)
// OwnBuildState is the indexer's state of the build it runs (the bucket mesh-delivery-indexer_own-build, one key, OwnBuildKey):
// written once, at the process's start by FixOwnBuild, so indexer_pending says which build this process knows it runs, and since
// when. The build only names the writer of what is written (A-476 b).
const (
OwnBuildStateName = "own-build"
OwnBuildKey = "state"
)
// OwnBuild is the value of the own-build state.
type OwnBuild struct {
V int `json:"v"`
Known bool `json:"known"`
FP string `json:"fp,omitempty"`
Since time.Time `json:"since"`
Why string `json:"why,omitempty"`
}
// FixOwnBuild fixes, once and at the process's start, which build of the indexer this program is: asked of the node-engine's
// seat (OwnBuild; never the trunk's value of the indexer, which names a build that may be merged and not delivered), before
// this process hears a merge. It is never asked again: while the node-engine replaces the indexer the seat already names the
// successor, and an old process that learnt it later would take revisions in with its old judge. Where the start's ask is not
// answered the build stays unknown for the life of this process, said in the own-build state and the journal; nothing waits for it.
func (ix *Indexer) FixOwnBuild(ctx context.Context) {
ix.ownMu.Lock()
if ix.ownFixed || ix.OwnBuild == nil {
ix.ownMu.Unlock()
return
}
ix.ownFixed = true
ix.ownMu.Unlock()
fp, err := ix.OwnBuild(ctx)
if err == nil && fp == "" {
err = errors.New("the node-engine names no build of the indexer")
}
st := OwnBuild{V: 1, Since: ix.now().UTC()}
if err != nil {
st.Why = err.Error()
ix.logf("judge: the build this program runs is not known (%v); merges are taken in all the same, and it is learnt only at the start", err)
} else {
st.Known, st.FP = true, fp
ix.logf("judge: this program runs the indexer build %s, fixed here at its start", fp)
}
ix.ownMu.Lock()
ix.ownFP, ix.ownSince, ix.ownWhy = fp, st.Since, st.Why
ix.ownMu.Unlock()
if ix.OwnBuildState == nil {
return
}
data, _ := json.Marshal(st)
if _, rev, found, gerr := ix.OwnBuildState.Get(ctx, OwnBuildKey); gerr == nil && found {
err = ix.OwnBuildState.Update(ctx, OwnBuildKey, data, rev)
} else if gerr == nil {
err = ix.OwnBuildState.Create(ctx, OwnBuildKey, data)
} else {
err = gerr
}
if err != nil {
ix.logf("the own-build state cannot be written: %v", err)
}
}
// ownBuildIsNewest says whether the build of the indexer this program runs (ownFP, from the node-engine) is the newest the
// trunk holds: the indexer's own modules value names it. A newer build merged and not yet delivered ends it at the trunk's
// merge, as one that pins a changed mesh-sdk always is; false when either is unknown.
func (ix *Indexer) ownBuildIsNewest(held map[string]meshcatalog.ModulesByModuleValue) bool {
fp := held[ix.Module].Fp2
if fp == "" {
return false
}
ix.ownMu.Lock()
defer ix.ownMu.Unlock()
return ix.ownFP != "" && ix.ownFP == fp
}
@@ -215,7 +215,7 @@ func (ix *Indexer) packagesAt(ctx context.Context, repository, commit string, mo
}
}
if len(absent) == len(dirs) {
return nil, whole // the tree itself fails: the caller asks once per head (candidatePublished)
return nil, whole // the tree itself fails
}
}
out := map[string]meshcatalog.PackagesByModuleValue{}
@@ -357,78 +357,6 @@ func (ix *Indexer) FillPackages(ctx context.Context) error {
return nil
}
// candidatePublished is the packages state as a candidate builds against it (novox/hq ADR 0573 §4): each Go module a
// member's repository publishes at the member's head (members, by repository), every other at its latest published
// version. A head's modules are read from the forge once and kept while the head is a member somewhere; one the forge
// cannot list is said and left at its published version.
func (ix *Indexer) candidatePublished(ctx context.Context, members map[string]string, held map[string]meshcatalog.ModulesByModuleValue) map[string]meshcatalog.PackagesByModuleValue {
out := ix.publishedAll(ctx)
if len(members) == 0 {
return out
}
modules, imports := reached(held)
for _, repo := range slices.Sorted(maps.Keys(members)) {
head := members[repo]
if len(modules[repo]) == 0 && len(imports[repo]) == 0 {
continue
}
at := repo + "@" + head
ix.mu.Lock()
got, ok := ix.atHeads[at]
ix.mu.Unlock()
ix.mu.Lock()
failed := ix.failedAt[repo] == head
ix.mu.Unlock()
if failed {
continue // said once for this head; the candidate takes the published version until the head changes
}
if !ok {
var ms []string
ms = append(ms, modules[repo]...)
for m, p := range out {
if trunk.SameRepository(p.Repository, repo) && !slices.Contains(ms, m) {
ms = append(ms, m)
}
}
var err error
if got, err = ix.packagesAt(ctx, repo, head, ms, imports[repo]); err != nil {
// A failure of the tree itself (the directory is not in the tree at that head) no retry changes: it is asked once per
// head. Any other failure may be transient: it is asked again at the next pass, and said once per head.
ix.mu.Lock()
said := ix.saidAt[repo] == head
if ix.saidAt == nil {
ix.saidAt = map[string]string{}
}
ix.saidAt[repo] = head
if errors.Is(err, ErrNotInTree) {
if ix.failedAt == nil {
ix.failedAt = map[string]string{}
}
ix.failedAt[repo] = head
}
ix.mu.Unlock()
if !said {
ix.logf("%s at the head %s: its packages are not read, so the candidate takes their published version: %v", repo, head, err)
}
continue
}
ix.mu.Lock()
delete(ix.failedAt, repo)
delete(ix.saidAt, repo)
if ix.atHeads == nil || len(ix.atHeads) >= maxHeadsKept {
ix.atHeads = map[string]map[string]meshcatalog.PackagesByModuleValue{}
}
ix.atHeads[at] = got
ix.mu.Unlock()
}
maps.Copy(out, got)
}
return out
}
// ErrNotInTree is a failure of the tree itself: a directory asked of the forge is not in the tree at that commit. No retry
// changes it, so a head that fails so is asked once (candidatePublished).
var ErrNotInTree = errors.New("the directory is not in the tree at that commit")
// maxHeadsKept bounds the member heads' packages kept between recomputes; past it they are read again.
const maxHeadsKept = 64
@@ -287,10 +287,10 @@ func TestAnInputIsKeptByItsDigestAndSweptAfterADay(t *testing.T) {
}
// Design 47 G A-80, §73: what the indexer heard lives in the state heard, each key part escaped as a name, so a dotted module
// name parses and nothing of it is written to the own-build state.
// name parses.
func TestWhatIsHeardIsKeptEscapedInTheStateHeard(t *testing.T) {
ctx := context.Background()
ix := &Indexer{Module: testSelf, Versions: newMem(), OwnBuildState: newMem(), Heard: newMem(), Revisions: newMemObjects(1 << 20)}
ix := &Indexer{Module: testSelf, Versions: newMem(), Heard: newMem(), Revisions: newMemObjects(1 << 20)}
if err := ix.HearToolchainAgreed(ctx, meshbuilds.ToolchainAgreed{Language: "go", Version: "1.26"}); err != nil {
t.Fatal(err)
}
@@ -299,9 +299,6 @@ func TestWhatIsHeardIsKeptEscapedInTheStateHeard(t *testing.T) {
if want := []string{"toolchain.go"}; !slices.Equal(got, want) {
t.Errorf("the keys of heard are %v, want %v", got, want)
}
if own, _ := ix.OwnBuildState.Keys(ctx); len(own) != 0 {
t.Errorf("the own-build state holds %v", own)
}
}
// Design 47 G §375, A-78, A-80: outdated says a kind-3 edge behind when the agreed toolchain of its artifact's language names another
@@ -131,7 +131,7 @@ func TestManifestDeclarations(t *testing.T) { // 1238/AC1, 1444 (reads the build
t.Errorf("uses = %v, invokes = %v, want the seat operator-channel used and seat:mesh-module-assigner.assignments invoked", m.Uses, m.Invokes)
}
// 1126 note 76: heard keeps the last 64 FORGE messages the indexer handled, for indexer_heard.
if want := []state{{Name: "candidates", History: 10}, {Name: "heard", History: 64}, {Name: "manifests", History: 1}, {Name: "predefined", History: 5}, {Name: "taken", History: 1}, {Name: "takeins", History: 1}, {Name: "oldsections", History: 1}, {Name: index.RunsState, History: 1}, {Name: "own-build", History: 1}, {Name: index.PackagesState, History: index.PackagesHistory},
if want := []state{{Name: "candidates", History: 10}, {Name: "heard", History: 64}, {Name: "manifests", History: 1}, {Name: "predefined", History: 5}, {Name: "taken", History: 1}, {Name: "takeins", History: 1}, {Name: "oldsections", History: 1}, {Name: index.RunsState, History: 1}, {Name: index.PackagesState, History: index.PackagesHistory},
{Name: views.MarksState, History: 1}, {Name: index.FindingsState, History: 5}, {Name: views.StatusState, History: 1},
{Name: index.RequirementsState, History: 5}, {Name: index.SeatDefinitionsState, History: 5},
{Name: index.EntryIndexState, History: 1, MaxMiB: 8}, {Name: index.NamedState, History: 1, MaxMiB: 4}, // design 47 G §695
@@ -182,7 +182,7 @@ func TestManifestDeclarations(t *testing.T) { // 1238/AC1, 1444 (reads the build
// Three invokes: the file of a registered module's manifest and lock files (registered.go), the forge's trees (the named paths' objects, since the indexer is the one reader of a manifest's paths:
// ADR 0499 clauses 2 and 3, ADR 0495 clause 1; and the module directories of the trunk, issue 1900) and whether a
// commit is in another (issue 1900).
if want := []string{"seat:git.trees", "seat:git.tags", "seat:go-package-registry.versions", "seat:npm-package-registry.versions", "seat:git.file", "seat:git.contains", "seat:git.branch", "seat:node-engine.composition", "seat:mesh-module-assigner.assignments", "seat:mesh-module-assigner.placement", "seat:mesh-hand-acts.hand-act", "seat:mesh-watchdogs.presence", "seat:node-build-go.steps",
if want := []string{"seat:git.trees", "seat:git.tags", "seat:go-package-registry.versions", "seat:npm-package-registry.versions", "seat:git.file", "seat:git.contains", "seat:git.branch", "seat:mesh-module-assigner.assignments", "seat:mesh-module-assigner.placement", "seat:mesh-hand-acts.hand-act", "seat:mesh-watchdogs.presence", "seat:node-build-go.steps",
"seat:node-build-node.steps", "seat:node-build-image.steps", "mesh-delivery-builder.builder_versions"}; !reflect.DeepEqual(m.Invokes, want) {
t.Errorf("invokes = %v, want %v", m.Invokes, want)
}
@@ -102,7 +102,6 @@
{ "name": "takeins", "history": 1 },
{ "name": "oldsections", "history": 1 },
{ "name": "runs", "history": 1 },
{ "name": "own-build", "history": 1 },
{ "name": "packages", "history": 5 },
{ "name": "view-marks", "history": 1 },
{ "name": "findings", "history": 5 },
@@ -153,7 +152,6 @@
"seat:git.file",
"seat:git.contains",
"seat:git.branch",
"seat:node-engine.composition",
"seat:mesh-module-assigner.assignments",
"seat:mesh-module-assigner.placement",
"seat:mesh-hand-acts.hand-act",