Design 26 has the indexer learn out-of-step generated files from the check's verdict event, so it runs no generator; the test step's answer carries them. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
38 lines
1.8 KiB
Go
38 lines
1.8 KiB
Go
package check
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.novox.be/novox/mesh-contracts/go/seats/meshdeliverychecker"
|
|
"git.novox.be/novox/mesh-sdk/go/delivery"
|
|
)
|
|
|
|
// EventVerdict is the checker's event that says a pull request's check ended, with the generated files its steps found out
|
|
// of step with their seat definitions (design 26 *Out of step*; ADR 0620): on the checker's own family asks (its stream
|
|
// asks), so the indexer learns them from the event and runs no generator, and a waiter on the stream checks does not wake.
|
|
const EventVerdict = meshdeliverychecker.HolderEventVerdict
|
|
|
|
// VerdictEvent is the body of verdict, as the seat definition of mesh-delivery-checker says it.
|
|
type VerdictEvent = meshdeliverychecker.VerdictHolderEvent
|
|
|
|
// VerdictSayer publishes a verdict event.
|
|
type VerdictSayer interface {
|
|
Say(ctx context.Context, v VerdictEvent) error
|
|
}
|
|
|
|
// sayVerdict says, for each pull request of a check that ended in pass or fail, one verdict event naming its head and its
|
|
// out-of-step files. A try owes no pull request anything and says none (ADR 0501 §5). A publish that fails is said in the
|
|
// log: the verdict and the status are written already, and the next check of the heads says it again.
|
|
func (ch *Checker) sayVerdict(ctx context.Context, cs *Case, v delivery.Verdict, out Outcome) {
|
|
if ch.Says == nil || cs.Try != nil || (v.State != delivery.VerdictPass && v.State != delivery.VerdictFail) {
|
|
return
|
|
}
|
|
for _, p := range cs.Pulls {
|
|
e := VerdictEvent{Repository: p.Repository, Pull: int64(p.Number), Head: p.Head, Verdict: v.State,
|
|
OutOfStep: out.OutOfStep[pullKey(Pull{Repository: p.Repository, Number: p.Number})]}
|
|
if err := ch.Says.Say(ctx, e); err != nil {
|
|
ch.logf("%s: the verdict of %s#%d was written, and its event could not be said: %v", cs.Key, p.Repository, p.Number, err)
|
|
}
|
|
}
|
|
}
|