R3-3: the node's own composer has no path without an entry call; its tests compose from the catalog half

Builds: design 47 G §628, §421, A-312, A-317

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 23:33:31 +01:00
parent 321a0744d8
commit 650910dc9e
6 changed files with 117 additions and 171 deletions
+1 -29
View File
@@ -66,10 +66,6 @@ type WantRow struct {
KeptSince time.Time `json:"kept-since"`
}
// byEntries says the composer reads the catalog half by fingerprint (the node's own composer), as the shadow, which keeps
// its reads of the indexer until it goes with the checker (§628), does not.
func (c *Composer) byEntries() bool { return c.entries != nil }
// newEntries makes the composer's cache of entries over env's call of `entry`.
func (c *Composer) newEntries() {
if c.env.Entry == nil {
@@ -96,7 +92,7 @@ func wantStateKey(module string) string { return keptWantPrefix + module }
// half (§683). A want read stands only until the live read of the wants answers (endKeptWants). A state that cannot be read
// is said, and what it would have kept is asked of `entry` and read from the wants as they come.
func (c *Composer) loadKept(ctx context.Context) {
if !c.byEntries() || c.env.ComposedState == nil {
if c.env.ComposedState == nil {
return
}
kept, err := c.env.ComposedState.Entries(ctx)
@@ -136,9 +132,6 @@ func (c *Composer) loadKept(ctx context.Context) {
// says are the ones the node composes from, never a want older than its stream's (§683). A kept want the read did not
// announce is gone.
func (c *Composer) endKeptWants() {
if !c.byEntries() {
return
}
c.mu.Lock()
defer c.mu.Unlock()
for module := range c.keptWants {
@@ -252,9 +245,6 @@ func (c *Composer) wantedBuilds() map[string]bool {
// composes from, and lays the picture frombus reads (c.modules, c.manifests) from the entries it holds. It runs at the start of
// each pass.
func (c *Composer) syncEntries(ctx context.Context) {
if !c.byEntries() {
return
}
need := c.wantedBuilds()
for fp := range need {
c.entryOf(fp)
@@ -393,9 +383,6 @@ func entryManifest(e meshcatalog.CatalogEntry) (digest string, raw []byte, err e
// entryHolds is, of each module this node's want names, why its entry is not held: asked and not answered, or answered not
// found. It is the phase held with a detail opening entry-asked: or entry-missing: and naming the fingerprint (§421, §614).
func (c *Composer) entryHolds() map[string]string {
if !c.byEntries() {
return nil
}
c.mu.Lock()
wants := map[string]meshwants.WantsByWantNodeModuleValue{}
for module, w := range c.wants {
@@ -476,9 +463,6 @@ func (c *Composer) buildOf(module, fp string) *builds.BuilderBuild {
// follows no branch), the entries it keeps and the wants it composes from.
func (c *Composer) FirstViews() (views []map[string]any, entries []EntryRow, wants []WantRow) {
views, entries, wants = []map[string]any{}, []EntryRow{}, []WantRow{}
if !c.byEntries() {
return
}
seen := map[string]bool{}
for _, r := range c.entries.Rows() {
seen[r.Fingerprint] = true
@@ -508,9 +492,6 @@ func (c *Composer) EntryAgain(ctx context.Context, fp string) error {
if c.AlsoEntryAgain != nil {
c.AlsoEntryAgain(ctx, fp)
}
if !c.byEntries() {
return fmt.Errorf("this engine reads no entry by fingerprint")
}
c.mu.Lock()
_, kept := c.keptEnt[fp]
delete(c.keptEnt, fp)
@@ -554,9 +535,6 @@ const noEntryWords = "no entry of fingerprint"
// to, each read from the entry the composer holds of its fingerprint (design 47 G §296, §297). An entry not held is an error: the
// node agent then says it is not known and the move goes on.
func (c *Composer) FormChanges(_ context.Context, module, runningFp, appliedFp string) ([]catalogue.FormChange, error) {
if !c.byEntries() {
return nil, fmt.Errorf("this engine reads no entry by fingerprint")
}
read := func(fp string) (catalogue.Manifest, error) {
e, state := c.entryOf(fp)
if state != meshcatalogclient.EntryAnswered {
@@ -583,9 +561,6 @@ func (c *Composer) FormChanges(_ context.Context, module, runningFp, appliedFp s
// c.manifests from the entries held, and says whether an entry asked is not yet answered: the shadow's picture of the catalog,
// where it once watched the indexer's modules (design 47 G §421, A-308).
func (c *Composer) syncShadowEntries(ctx context.Context) (pending bool) {
if !c.byEntries() {
return false
}
c.syncEntries(ctx)
c.mu.Lock()
defer c.mu.Unlock()
@@ -651,9 +626,6 @@ func (c *Composer) addedModule(ctx context.Context, module string) (fp string, e
// and says the first not yet answered: the shadow composes a candidate from entries alone (§421, §628), and an answer wakes it. The
// fingerprints are kept beside the candidates' added ones while a proposal stands (addedFps).
func (c *Composer) askBuildsEntries(fps map[string]string) (pending string) {
if !c.byEntries() {
return ""
}
for _, module := range slices.Sorted(maps.Keys(fps)) {
fp := fps[module]
if !strings.HasPrefix(fp, meshcatalogclient.SourcePrefix2) {