History (A2j finding 1, J4): the indexer's and the assigner's read tools are views.ReadTool over views.KeptSource, which
answers `{key, history: true}` now; modules (20), heard (64) and wants (20) keep more than one revision. Rows in the
view's "each tool answers through the owners' read tools as before": indexer_module_history and indexer_heard answer
the owner's kept history, and a want's history (view_tiers' Since) is read through assigner_read_wants (the row it
replaces held that the owner answered no history).
Series (A2j finding 2, J4): the checker keeps each series change as a delivery.SeriesChange {module, artifact, from,
to} and renders the status line from it; delivery.Verdict.Series holds the case's changes (each module's artifact once),
and the verdict event's series the pull request's (meshdeliverychecker.VerdictHolderEventSeriesItem). An artifact new
on the head is no series change (the lead's ruling). Rows: TestTheIndexersJudgeJudgesTheChangesManifests (the verdict's
series; failed first, empty) and TestTheStatusIsPendingWhileTheCheckRunsAndEndsSuccessOrFailure (the event's; failed
with the fill cut).
Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
41 lines
2.0 KiB
Go
41 lines
2.0 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 {
|
|
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)
|
|
}
|
|
}
|
|
}
|