IX22: a test that a merged revision naming a newer indexer is the previous catalog graph revision with only the indexer's entry replaced

Builds: design 47 G §273, §237

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 14:05:04 +01:00
parent ae8a6f1a6d
commit 83b5275fe2
@@ -292,6 +292,27 @@ func TestTakeIn(t *testing.T) { // 1585/T3-T13 (ADR 0633)
t.Errorf("said %v, want %v", b.events(), want)
}
})
t.Run("IX22 a merged revision naming a newer indexer is the previous catalog graph revision with only the indexer's entry replaced", func(t *testing.T) { // design 47 G §273, §237
b := newTakeInBed(t)
store := newMemObjects(0)
b.ix.Revisions = store
if err := b.ix.KeepView(ctx); err != nil {
t.Fatal(err)
}
before, _, err := newestTrunk(ctx, store)
if err != nil || before.Revision != 1 {
t.Fatalf("the view's revision %+v (%v), want revision 1", before, err)
}
// The merge changes avahi and the indexer: only the indexer is written, the revision is made at once.
b.arrive(t, 2, b.merge(21, sha('c'), "tree-avahi-3", "tree-indexer-2"))
after, _, err := newestTrunk(ctx, store)
if err != nil || after.Revision != 2 {
t.Fatalf("after the merge naming a newer indexer the newest revision is %+v (%v), want revision 2", after, err)
}
if changed := changedEntries(before.Entries, after.Entries); !slices.Equal(changed, []string{Module}) {
t.Errorf("the revision differs from the previous in %v, want the indexer's entry alone", changed)
}
})
t.Run("P1 a revision that adds a Go module its own indexer uses is computed against that module's packages at its merge", func(t *testing.T) {
// The Go module exists only at the revision's own merge: nothing publishes it before the take-in, so the fingerprint
// the revision names must come from the packages its merge holds (issue 1585, ADR 0593 §2), not wait for a version only