The node's words for a want it composes nothing of are said once per reason, and proved on the live paths (issue 1966)
The said-once keys no longer hold where the indexer's picture stands; a module composed from the manifest for want of a done build is named in Pass.Unmade; the agent's wait is told once per want and again after the composition was there; the two tests are folded into existing ones. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
+17
-5
@@ -246,6 +246,8 @@ type Agent struct {
|
||||
// prior is a module the node ran before this agent started, so it has something to back up.
|
||||
prior map[string]bool
|
||||
said map[string]string
|
||||
// waited is, by module, the want (fingerprint and revision) the agent said it waits for the composer for.
|
||||
waited map[string]string
|
||||
// notComposed is the modules whose have says the node could not compose them: why, and the have before (NotComposed).
|
||||
notComposed map[string]notComposedMark
|
||||
// heldAlone is the modules the composer holds alone (NotComposedEach): what runs of each in the node's own
|
||||
@@ -311,7 +313,7 @@ func New(env Env) *Agent {
|
||||
env.Say = func(string) {}
|
||||
}
|
||||
return &Agent{env: env, wants: map[string]wantNow{}, comps: map[string]compNow{}, running: map[string]nodeengine.HaveByNodeModuleValue{}, applied: map[string]compNow{}, had: map[string]compNow{}, keptData: map[string]bool{},
|
||||
attempt: map[string]attempt{}, checked: map[string]bool{}, prior: map[string]bool{}, said: map[string]string{}, notComposed: map[string]notComposedMark{},
|
||||
attempt: map[string]attempt{}, checked: map[string]bool{}, prior: map[string]bool{}, said: map[string]string{}, waited: map[string]string{}, notComposed: map[string]notComposedMark{},
|
||||
pulls: map[string]*pullWait{}, settledAt: map[string]time.Time{}, settledSeq: map[string]int{},
|
||||
retry: make(chan []string, 8), reconcile: make(chan []string, 64), failedAgain: make(chan string, 8), tries: map[string]int{}, again: make(chan againAsk, 64),
|
||||
transient: make(chan struct{}, 1), stopped: make(chan struct{}), quiet: make(chan chan struct{})}
|
||||
@@ -1327,7 +1329,7 @@ func (a *Agent) HoldsNode() bool {
|
||||
// waitsForComposer says once per want and reason that the agent waits for the node's own composition of module at fp, and
|
||||
// why the composer made none (Env.WhyUnmade), and tells the composer (Env.Waiting) so it hands again what it believes it
|
||||
// handed. Called without a.mu held.
|
||||
func (a *Agent) waitsForComposer(module, fp string) {
|
||||
func (a *Agent) waitsForComposer(module, fp string, rev uint64) {
|
||||
why := "the composer has made none yet"
|
||||
if a.env.WhyUnmade != nil {
|
||||
if w := a.env.WhyUnmade(module); w != "" {
|
||||
@@ -1335,9 +1337,14 @@ func (a *Agent) waitsForComposer(module, fp string) {
|
||||
}
|
||||
}
|
||||
line := fmt.Sprintf("%s waits for the composer: no composition of it at %s: %s", module, fp, why)
|
||||
// Said and told once per want (its fingerprint and revision), whatever the reason says; forgotten once composed.
|
||||
at := fmt.Sprintf("%s@%d", fp, rev)
|
||||
a.mu.Lock()
|
||||
first := a.said["composer:"+module] != line
|
||||
a.sayOnce("composer:"+module, line)
|
||||
first := a.waited[module] != at
|
||||
if first {
|
||||
a.waited[module] = at
|
||||
a.env.Say(line)
|
||||
}
|
||||
a.mu.Unlock()
|
||||
if first && a.env.Waiting != nil {
|
||||
a.env.Waiting(module, fp)
|
||||
@@ -1359,9 +1366,14 @@ func (a *Agent) settleOne(ctx context.Context, module string) {
|
||||
comp, have := a.compositionFor(module, w.Want.Fp)
|
||||
a.mu.Unlock()
|
||||
if a.env.SelfComposed {
|
||||
if have {
|
||||
a.mu.Lock()
|
||||
delete(a.waited, module)
|
||||
a.mu.Unlock()
|
||||
}
|
||||
if !have || comp.Err != nil {
|
||||
if !have {
|
||||
a.waitsForComposer(module, w.Want.Fp)
|
||||
a.waitsForComposer(module, w.Want.Fp, w.Rev)
|
||||
}
|
||||
return // waits for the node's own composition of the want's build
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user