The running checker asks the checking program twice on the build seat's job run: first the heads' seat list, which the manifest validator's requests (change and trunk) and the node-engine composer's carry; then the verdict of the facts it gathered. The program is built at the group's mesh-delivery head, else at mesh-delivery's trunk, and its input is kept in the checker's new state inputs as the exact bytes of its digest, read with checker_inputs. A run ask no build node begins within 5 minutes is put once more, then fails the check naming the job; a program that does not build or answer fails the check naming it, and the verdict records who judged it (JudgedBy). A second step-seen hook on a context is added to the first, so a try still sees its steps. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
// Command mesh-checking-program is the checker's checking program (novox/hq ADR 0644, ADR 0656; design 47's bootstrap
|
|
// delivery): built from a check's heads and run in the build seat's sandbox through the seat node-build-go's ask run,
|
|
// with no network and no bus account, it reads the check's facts from the file MESH_RUN_INPUT names and answers the
|
|
// verdict the judging rules give them, as one JSON line on its standard output (rules.Answer).
|
|
//
|
|
// mesh-checking-program -verdict
|
|
// mesh-checking-program -seats
|
|
//
|
|
// Asked -seats, it answers the seat list of the heads laid in the directory MESH_RUN_HEADS names (rules.SeatsAnswer).
|
|
// It refuses facts of a version it does not read, naming it, with exit 2.
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"io/fs"
|
|
"os"
|
|
"slices"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/delivery"
|
|
"mesh-delivery-checker/rules"
|
|
)
|
|
|
|
func main() {
|
|
os.Exit(run(os.Args[1:], os.Getenv, os.Stdout, os.Stderr))
|
|
}
|
|
|
|
// run is the command over its arguments, environment and outputs, answering its exit.
|
|
func run(args []string, getenv func(string) string, stdout, stderr io.Writer) int {
|
|
var heads fs.FS
|
|
if dir := getenv(delivery.RunHeadsEnv); dir != "" {
|
|
heads = os.DirFS(dir)
|
|
}
|
|
input := func() ([]byte, error) {
|
|
file := getenv(delivery.RunInputEnv)
|
|
if file == "" {
|
|
return nil, fmt.Errorf("%s names no file", delivery.RunInputEnv)
|
|
}
|
|
return os.ReadFile(file)
|
|
}
|
|
line, err := rules.Program(args, input, heads)
|
|
if err != nil {
|
|
if heads == nil && slices.Contains(args, "-seats") {
|
|
err = fmt.Errorf("no heads: %s names no directory", delivery.RunHeadsEnv)
|
|
}
|
|
fmt.Fprintf(stderr, "mesh-checking-program: %v\n", err)
|
|
return 2
|
|
}
|
|
fmt.Fprintf(stdout, "%s\n", line)
|
|
return 0
|
|
}
|