Files
mesh-delivery/modules/mesh-delivery-checker/internal/check/verdictevent.go
T
jschoubben 71a35a6376 MV1: move contracts and sdk under modules/, importers follow
The delivery repository's contracts and SDK live under modules/ as
mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths
renamed to match the folders (the TypeScript names already did), and
every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools
and mesh-sdk follows in the same group: a design as it should be, one
path per module, checked by the group's check building every importer.

Builds: design 47 G §427, §88

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:09:56 +01:00

45 lines
2.3 KiB
Go

package check
import (
"context"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliverycheckerclient"
"git.novox.be/novox/mesh-delivery/modules/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"