indexer seed: an unanswering build seat is called once per seed
Later artifacts of a seat that did not answer stay unanswered without a call; one log line says so when the seat first goes unanswered. Per lead answer A-392. Builds: design 47 G §704, lead answer A-392 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -113,13 +113,20 @@ func (ix *Indexer) SeedModulesFrom(ctx context.Context, defs map[string]seatdef.
|
||||
sa := SeedArtifact{Name: name, Seat: seat}
|
||||
in := nodebuildgo.StepsInput{Module: e.Module, Artifact: nodebuildgo.DetectedStepsByModuleArtifactKey(e.Module, name), Fingerprint: e.Fp,
|
||||
Fetch: &nodebuildgo.Fetch{Repository: e.Repository, Commit: e.Commit, Dir: e.Path, Paths: namedPaths(e, name), Packages: maps.Clone(e.Packages)}}
|
||||
if _, gone := unanswered[seat]; gone {
|
||||
// the seat did not answer earlier in this seed: its later artifacts are not asked again (A-392)
|
||||
m.Artifacts = append(m.Artifacts, sa)
|
||||
continue
|
||||
}
|
||||
ans, err := steps(ctx, seat, in)
|
||||
switch {
|
||||
case errors.Is(err, ErrAskClosed): // the entry is no longer held: not said unanswered (A-190)
|
||||
case err != nil:
|
||||
unanswered[seat] = err
|
||||
ix.logf("seed: the seat %s did not answer steps: %v; its later artifacts are not asked in this seed", seat, err)
|
||||
case ans.Error != "":
|
||||
unanswered[seat] = fmt.Errorf("%s", ans.Error)
|
||||
ix.logf("seed: the seat %s did not answer steps: %s; its later artifacts are not asked in this seed", seat, ans.Error)
|
||||
default:
|
||||
sa.Answered = true
|
||||
answered[seat] = true
|
||||
|
||||
@@ -163,3 +163,51 @@ func TestTheSeedBypassesWhatTheBuilderPacksAndLeavesOutAModuleNoSeatBuilds(t *te
|
||||
t.Fatalf("the seed after odd left the catalogue: %v, the findings %+v", err, w.Held())
|
||||
}
|
||||
}
|
||||
|
||||
// Lead answer A-392: a seat that did not answer steps is called once in a seed; its later artifacts stay unanswered
|
||||
// without a call, and an answering seat is called per artifact.
|
||||
func TestTheSeedCallsAnUnansweringSeatOnce(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
up bool
|
||||
wantCalls int
|
||||
}{{"a seat that does not answer", false, 1}, {"a seat that answers", true, 3}} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ix := &Indexer{Module: testSelf, Findings: newFindings(), Heard: newMem(), Revisions: newMemObjects(1 << 20), Now: time.Now}
|
||||
entries := map[string]meshcatalog.CatalogEntry{}
|
||||
for _, m := range []string{"a", "b", "c"} {
|
||||
entries[m] = meshcatalog.CatalogEntry{Module: m, Repository: "novox/r", Commit: "c1", Path: "mods/" + m, Fp: "src2:" + strings.Repeat("a", 64),
|
||||
Manifest: map[string]any{}, Artifacts: []meshcatalog.Artifact{{Ref: m + ":program", Language: "go"}}}
|
||||
}
|
||||
rev, objects, err := CatalogRevisionOf(meshcatalog.CatalogRevision{Revision: 1, Kind: "trunk"}, entries)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := KeepRevision(ctx, ix.Revisions, rev, objects); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defs := map[string]seatdef.Definition{"node-build-go": {Acts: []seatdef.ActingRule{{Step: seatdef.StepBuild, On: "go"}}}}
|
||||
calls := 0
|
||||
call := func(context.Context, string, nodebuildgo.StepsInput) (nodebuildgo.StepsAnswer, error) {
|
||||
calls++
|
||||
if !tc.up {
|
||||
return nodebuildgo.StepsAnswer{}, errors.New("no responders")
|
||||
}
|
||||
return nodebuildgo.StepsAnswer{}, nil
|
||||
}
|
||||
mods, err := ix.SeedModulesFrom(ctx, defs, call)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if calls != tc.wantCalls {
|
||||
t.Errorf("calls = %d, want %d", calls, tc.wantCalls)
|
||||
}
|
||||
for _, m := range mods {
|
||||
if a := m.Artifacts[0]; a.Answered != tc.up || a.Seat != "node-build-go" {
|
||||
t.Errorf("%s: %+v", m.Module, a)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user