The node whole publishes its compositions and answers a candidate (H6)
ADR 0593 §6, §7, §9: the integration test runs the node agent against the real bus under the grant the grants part composes for a node: it publishes web's composition in composed-<node> with the digest its have names, and answers compose-candidate for the indexer's candidate, changing nothing. A node that cannot compose now answers unready, so the checker counts it as no answer by the verdict and never by words. The golden grant reads the indexer's candidates and verdicts as it reads the builder's builds. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
@@ -40,18 +40,25 @@ func (s *Shadow) ComposeCandidate(ctx context.Context, ask delivery.ComposeCandi
|
||||
a.Took = time.Since(began).Milliseconds()
|
||||
return a
|
||||
}
|
||||
// A node that cannot compose now (its shadow not ready, a read the bus did not answer, the bound passed) answers
|
||||
// unready: the checker takes it as no answer (ADR 0593 §9) by the verdict, the words only saying why.
|
||||
unready := func(why string) delivery.ComposeCandidateAnswer {
|
||||
a = refuse(why)
|
||||
a.Verdict = delivery.ComposeCandidateUnready
|
||||
return a
|
||||
}
|
||||
if _, _, err := delivery.ParseCompositionKey(ask.Candidate); err != nil {
|
||||
return refuse(err.Error())
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(ctx, delivery.ComposeAnswerBound)
|
||||
defer cancel()
|
||||
if !s.ready.Load() {
|
||||
return refuse(errNotReady.Error())
|
||||
return unready(errNotReady.Error())
|
||||
}
|
||||
base := c.scratch()
|
||||
raw, err := base.get(ctx, delivery.CandidatesBucket, ask.Candidate)
|
||||
if err != nil {
|
||||
return refuse(fmt.Sprintf("the indexer's candidate %s cannot be read: %v", ask.Candidate, err))
|
||||
return unready(fmt.Sprintf("the indexer's candidate %s cannot be read: %v", ask.Candidate, err))
|
||||
}
|
||||
if raw == nil {
|
||||
return refuse("the indexer holds no candidate " + ask.Candidate)
|
||||
@@ -63,7 +70,7 @@ func (s *Shadow) ComposeCandidate(ctx context.Context, ask delivery.ComposeCandi
|
||||
laid := c.scratch()
|
||||
touched, err := laid.layCandidate(ctx, cand)
|
||||
if err != nil {
|
||||
return refuse(err.Error())
|
||||
return unready(err.Error())
|
||||
}
|
||||
|
||||
var running []delivery.Composed
|
||||
@@ -89,11 +96,11 @@ func (s *Shadow) ComposeCandidate(ctx context.Context, ask delivery.ComposeCandi
|
||||
}
|
||||
})
|
||||
if ctx.Err() != nil {
|
||||
return refuse(fmt.Sprintf("the bound of %s passed before the node composed the candidate", delivery.ComposeAnswerBound))
|
||||
return unready(fmt.Sprintf("the bound of %s passed before the node composed the candidate", delivery.ComposeAnswerBound))
|
||||
}
|
||||
switch {
|
||||
case laidErr != nil && BusFailed(laidErr):
|
||||
return refuse("a read on the bus did not answer: " + laidErr.Error())
|
||||
return unready("a read on the bus did not answer: " + laidErr.Error())
|
||||
case laidErr != nil && baseErr != nil:
|
||||
// The node composes none of its own without the candidate either: the candidate changes nothing of that.
|
||||
a.Verdict, a.Modules = delivery.ComposeCandidateComposed, []delivery.ModuleComposed{}
|
||||
|
||||
Reference in New Issue
Block a user