The take-in says each manifest word it set aside, once per fingerprint (H-A-809)

The take-in's read names a set-aside word in the manifest's SetAside, but
no reader of the indexer said it, so a fingerprint taken from part of a
manifest was silent. The recompute now says, when a pass gives a module a
fingerprint other than the one the bucket held, one journal line naming the
module, its fingerprint and each word set aside with its path. It is a
journal line, not a finding: a word set aside is the normal state while a
newer manifest form reaches an older indexer.

Issue 1984.

Builds: design 47 H2 H-A-809
This commit is contained in:
2026-11-27 00:22:06 +01:00
parent 982a059e42
commit ad56d96bc4
2 changed files with 49 additions and 0 deletions
@@ -369,6 +369,7 @@ func (ix *Indexer) recomputeLocked(ctx context.Context, overlay map[string]meshc
}
}
finals[key] = final
ix.saySetAside(k.manifest, r.fp, k.held.Fp2)
continue
}
if !stale[key] && k.cur.Fp2 == r.fp && k.cur.None2 == r.none && sameUsed(k.cur, r.tcs, r.pkgs) {
@@ -398,6 +399,7 @@ func (ix *Indexer) recomputeLocked(ctx context.Context, overlay map[string]meshc
}
if wrote {
w.wrote(key)
ix.saySetAside(k.manifest, r.fp, k.held.Fp2)
}
}
if err := ix.writeOverlay(ctx, overlay, finals, w); err != nil {
@@ -409,6 +411,17 @@ func (ix *Indexer) recomputeLocked(ctx context.Context, overlay map[string]meshc
return nil // only a take-in keeps a catalog revision (design 47 H §743, H-A-49)
}
// saySetAside says, in one journal line, each word the take-in's read set aside of a module's manifest, with its path
// (SetAside), once per module and fingerprint: when a pass gives the module a fingerprint other than the one the bucket
// held (design 47 H2 H-A-809). It is not a finding: a word set aside is the normal state while a newer manifest form
// reaches an older indexer, and it ends when the indexer that reads the word runs.
func (ix *Indexer) saySetAside(m catalogue.Manifest, fp, held string) {
if fp == "" || fp == held || m.SetAside() == "" {
return
}
ix.logf("%s: its fingerprint %s is taken from the words of its manifest this indexer knows; set aside: %s", m.Module, fp, m.SetAside())
}
// writeOverlay writes the records of a merge, each once and only if it differs from what the bucket holds; finals has
// the ones that were computed, the others are written as the merge gave them.
//
@@ -903,3 +903,39 @@ func TestATakeInMovesTheImportersOfThePackagesItsRepositoryPublishes(t *testing.
}
}
}
// H-A-809: a take-in of a manifest with a word set aside inside a known one says, once per module and fingerprint, one
// journal line naming the module, its fingerprint and the word with its path; a pass that gives it no other fingerprint
// says nothing more.
func TestATakeInSaysEachWordItSetAsideOncePerFingerprint(t *testing.T) {
raw := strings.Replace(catalogueManifest(t, "avahi"), `"name": "tools",`, `"name": "tools", "zzz-unknown-word": true,`, 1)
ix, mods, f := newFormIndexerUnmerged(t, mod{"avahi", raw})
var said []string
ix.Logf = func(format string, args ...any) { said = append(said, fmt.Sprintf(format, args...)) }
reportToolchain(t, ix, "mesh-build-go", "novox", "go", "go1.27.1")
reportToolchain(t, ix, "mesh-build-go", "ace", "go", "go1.27.1")
naming := func() []string {
var lines []string
for _, line := range said {
if strings.Contains(line, "zzz-unknown-word") {
lines = append(lines, line)
}
}
return lines
}
if err := ix.Apply(context.Background(), f); err != nil {
t.Fatal(err)
}
m, _ := moduleOf(t, mods, "avahi")
lines := naming()
if m.Fp2 == "" || len(lines) != 1 || !strings.HasPrefix(lines[0], "avahi: ") || !strings.Contains(lines[0], m.Fp2) ||
!strings.Contains(lines[0], "build.artifacts[0].zzz-unknown-word") {
t.Errorf("fingerprint %q (none %q), lines naming the word %q, want one naming avahi, its fingerprint and the path", m.Fp2, m.None2, lines)
}
if err := ix.Recompute(context.Background()); err != nil {
t.Fatal(err)
}
if again := naming(); len(again) != len(lines) {
t.Errorf("a pass giving the same fingerprint said it again: %q", again)
}
}