56 lines
1.9 KiB
Go
56 lines
1.9 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
mdc "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshdeliveryclient"
|
|
)
|
|
|
|
var t0 = time.Date(2026, 10, 6, 12, 0, 0, 0, time.UTC)
|
|
|
|
// mergedAt is the forge's `pull.merged` at a moment.
|
|
func mergedAt(p PullEvent, merge string, at time.Time) PullEvent {
|
|
p.MergeCommit = merge
|
|
p.MergedAt = at.UTC().Format(time.RFC3339)
|
|
return p
|
|
}
|
|
|
|
// verdictMoving is a passing verdict. The gate plans no delivery any more (ADR 0539 §17), so it names no module.
|
|
func verdictMoving(repo string, number int, sha string, _ ...string) CheckedEvent {
|
|
return verdict(repo, number, sha, "pass")
|
|
}
|
|
|
|
// ungated is the setting check-gates-merge false: mesh/check gates no merge (the operator, 2026-10-25 22:56).
|
|
func ungated(w *world) {
|
|
off := false
|
|
w.h.Settings = func() Settings { return Settings{CheckGatesMerge: &off} }
|
|
}
|
|
|
|
func statusOn(w *world, repo, commit string) string {
|
|
w.forge.mu.Lock()
|
|
defer w.forge.mu.Unlock()
|
|
return w.forge.statuses[repo+"@"+commit+" mesh/delivery"]
|
|
}
|
|
|
|
// checkerSays puts the checker's verdict at these heads together into its verdicts bucket, as captured on the bus
|
|
// (mesh-delivery-checker, key `<group>.<heads hash>`).
|
|
func checkerSays(w *world, group, state, failed string, heads ...mdc.Head) {
|
|
checkerSaysWith(w, group, state, failed, nil, heads...)
|
|
}
|
|
|
|
// checkerSaysWith is checkerSays with more of the verdict's fields (its composition); the state "gone" deletes the key.
|
|
func checkerSaysWith(w *world, group, state, failed string, more map[string]any, heads ...mdc.Head) {
|
|
hash, _ := mdc.HeadsHash(heads)
|
|
if state == "gone" {
|
|
w.h.CheckerVerdictChanged(group+"."+hash, nil)
|
|
return
|
|
}
|
|
v := map[string]any{"v": 1, "group": group, "heads": hash, "state": state, "failed": map[string]string{"words": failed}}
|
|
for k, x := range more {
|
|
v[k] = x
|
|
}
|
|
value, _ := json.Marshal(v)
|
|
w.h.CheckerVerdictChanged(group+"."+hash, value)
|
|
}
|