indexer: revision answers none-yet with no trunk revision (G holder)
Builds: design 47 G §530 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -34,8 +34,8 @@ func RevisionCallers(entries []meshcatalog.CatalogEntry, holder string) stdio.Ca
|
||||
// graph revision, the trunk's newest when the input names none, a kept trunk revision by its number, or a candidate's by
|
||||
// its group and heads, with one page of its entries whole, by module name. The caller is the runtime's proof: it is
|
||||
// answered only when the newest trunk revision's entry of its module declares the verb in invokes, and the holder is
|
||||
// refused too. With no trunk revision kept yet nobody is answered and the reader waits (ErrNoRevision), never an empty
|
||||
// catalog.
|
||||
// refused too. With no trunk revision kept yet the answer is `none-yet` alone (design 47 G §530), never an empty
|
||||
// catalog and never an error.
|
||||
func Revision(ctx context.Context, o Objects, holder, caller string, in meshcatalog.RevisionInput) (meshcatalog.RevisionAnswer, error) {
|
||||
var out meshcatalog.RevisionAnswer
|
||||
newest, ok, err := newestTrunk(ctx, o)
|
||||
@@ -43,7 +43,8 @@ func Revision(ctx context.Context, o Objects, holder, caller string, in meshcata
|
||||
return out, fmt.Errorf("the catalog graph revisions cannot be read: %w", err)
|
||||
}
|
||||
if !ok {
|
||||
return out, ErrNoRevision
|
||||
// An answer is told by its fields (design 47 G §530): no trunk revision kept yet is `none-yet`, no error.
|
||||
return meshcatalog.RevisionAnswer{NoneYet: true}, nil
|
||||
}
|
||||
_, trunkEntries, err := ReadRevision(ctx, o, RevisionObject(newest))
|
||||
if err != nil {
|
||||
|
||||
@@ -620,8 +620,8 @@ func TestBasesAreComputedFirstAndNoFingerprintTakesTheBuilder(t *testing.T) { //
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if _, err := Revision(context.Background(), verbObjects, Module, "n1.node-tools", meshcatalog.RevisionInput{}); !errors.Is(err, ErrNoRevision) {
|
||||
t.Errorf("revision with none kept answered %v, want it to wait", err)
|
||||
if got, err := Revision(context.Background(), verbObjects, Module, "n1.node-tools", meshcatalog.RevisionInput{}); err != nil || !got.NoneYet || got.Revision != nil || len(got.Entries) != 0 {
|
||||
t.Errorf("revision with none kept answered %+v, %v, want none-yet alone with no error (design 47 G §530)", got, err)
|
||||
}
|
||||
keep(meshcatalog.CatalogRevision{Revision: 3, Kind: "trunk"}, map[string]bool{"node-tools": true, Module: true})
|
||||
keep(meshcatalog.CatalogRevision{Revision: 4, Kind: "candidate", Group: "feat/x", Heads: "0123456789ab"}, map[string]bool{"node-tools": true, "mesh-grants": true})
|
||||
|
||||
Reference in New Issue
Block a user