I3: a branch's first source revision is taken in with no movers
A source-moved with start true, the seed of a branch's first revision, keeps its revision with every module's entry at the heads it names and says take-in.taken with no entries and no pin; a later take-in's movers are judged against those entries. Builds: design 47 H §768 (the indexer's half), §743 (no mover); H-A-19 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -26,7 +26,8 @@ func TakenID(branch string, source int64) string {
|
||||
// repository it moves, the trees at the named commit through the seat git (wholeAt) and the fingerprints of the modules
|
||||
// registered for it; its movers (moversOf) against the branch's newest catalog revision; one catalog revision of the branch,
|
||||
// <branch>.<source>, carrying the movers and pinned for the take-in's pipeline when it has one (KeepBranchEntries); and
|
||||
// take-in.taken once, with branch, source, revision, call and one entry per mover. A revision already kept under that name (a
|
||||
// take-in.taken once, with branch, source, revision, call and one entry per mover; a branch's first revision (start) has no
|
||||
// mover (§768). A revision already kept under that name (a
|
||||
// restart before the acknowledgement) is said again from its kept movers, recomputing nothing (H-A-92). The first watched
|
||||
// branch is taken in on the indexer's own view; another on its newest revision's, computed and kept only as that revision.
|
||||
// An error leaves the source-moved held: ErrOldForm never takes it in, ErrObjectsFull waits for room (§744), any other is the
|
||||
@@ -87,6 +88,9 @@ func (ix *Indexer) TakeInSource(ctx context.Context, e meshdelivery.SourceMovedE
|
||||
return taken, err
|
||||
}
|
||||
movers := moversOf(before, entries, moved)
|
||||
if e.Start {
|
||||
movers = nil // a branch's first revision moves nothing: its entries are the base later take-ins are held against (§768, H-A-19)
|
||||
}
|
||||
if err := ix.KeepBranchEntries(ctx, e.Branch, e.Source, entries, movers); err != nil {
|
||||
return taken, err
|
||||
}
|
||||
|
||||
@@ -92,3 +92,27 @@ func TestASourceRevisionIsTakenInAsOneRevision(t *testing.T) {
|
||||
t.Errorf("a source-moved with no call answered %v, want ErrOldForm", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Design 47 H §768, §743, H-A-19: a branch's first source revision (start true) is taken in with no mover, says take-in.taken
|
||||
// with no entries and pins nothing; its entries are the base a later take-in's movers are judged against.
|
||||
func TestAFirstSourceRevisionIsTakenInWithNoMover(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ix, objects, _, f := takeInIndexer(t)
|
||||
start := meshdelivery.SourceMovedEvent{V: 1, Branch: "main", Source: 1, Call: "seed.operator.20261120", Start: true,
|
||||
Heads: []meshdelivery.SourceMovedEventHeadsItem{{Repository: f.Repository, Commit: f.Merge}}}
|
||||
taken, err := ix.TakeInSource(ctx, start)
|
||||
if err != nil || len(taken.Entries) != 0 || taken.Revision != 1 {
|
||||
t.Fatalf("the first revision said %+v (%v), want revision 1 with no entries", taken, err)
|
||||
}
|
||||
if keys, _ := ix.Pins.Keys(ctx); len(keys) != 0 {
|
||||
t.Errorf("the first revision pinned %v", keys)
|
||||
}
|
||||
if _, entries, err := ReadRevision(ctx, objects, "main.1"); err != nil || len(entries) != 1 || entries[0].Commit != f.Merge {
|
||||
t.Fatalf("main.1 holds %+v (%v), want avahi at the head", entries, err)
|
||||
}
|
||||
next := start
|
||||
next.Source, next.Call, next.Start = 2, "0123456789abcdef", false
|
||||
if again, err := ix.TakeInSource(ctx, next); err != nil || len(again.Entries) != 0 {
|
||||
t.Errorf("a later take-in of the same head said %+v (%v), want no mover against the first revision", again, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user