The checker built from G's heads makes no tag-wanted and waits on no published of a tagged version: tagwanted.go and tags.go go (the verdict sayer stays, in verdictsay.go), with st.tagged, groupVersions, Case.Tagged, TagAsks, the PublishedHeard wiring, the group path's tagged Node package and Go packages, the manifest's two published consumes and the tag-wanted event of asks. Builds: design 47 G §528, §373, §321 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
45 lines
2.2 KiB
Go
45 lines
2.2 KiB
Go
package check
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshdeliverycheckerclient"
|
|
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshdeliverychecker"
|
|
)
|
|
|
|
// 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 meshdeliverychecker.VerdictsByGroupHeadsValue, out Outcome) {
|
|
if ch.Says == nil || cs.Try != nil || (v.State != meshdeliverycheckerclient.VerdictPass && v.State != meshdeliverycheckerclient.VerdictFail) {
|
|
return
|
|
}
|
|
for _, p := range cs.Pulls {
|
|
key := pullKey(Pull{Repository: p.Repository, Number: p.Number})
|
|
e := VerdictEvent{Repository: p.Repository, Pull: int64(p.Number), Head: p.Head, Verdict: v.State, OutOfStep: out.OutOfStep[key]}
|
|
for _, s := range cs.SeriesChanges(key) {
|
|
e.Series = append(e.Series, meshdeliverychecker.VerdictHolderEventSeriesItem{Module: s.Module, Artifact: s.Artifact, From: s.From, To: s.To})
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
|
|
// AsksStream is the checker's stream that carries verdict, one that keeps its history (ADR 0592 §6): the bus names it
|
|
// ASKS.
|
|
const AsksStream = "asks"
|