B0's shape wins: the running checker asks and records facts, the checking program decides. The registry's types win: the rules and the program read the generated checker contract and the domain SDK, and no mesh-sdk delivery import is left. The registry's series, renames and unparsed seat definitions become facts with their refusals as rules; the tagged versions ride on the case. The program reads the heads' seat definitions through sdk/seatdefs and the running checker lays them over its reader's list by seat, reading no file of the heads: the reader's list is larger than a run input's bound. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
53 lines
1.7 KiB
Go
53 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"
|
|
|
|
"mesh-delivery-checker/rules"
|
|
|
|
"git.novox.be/novox/mesh-delivery/sdk/buildstep"
|
|
)
|
|
|
|
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(buildstep.RunHeadsEnv); dir != "" {
|
|
heads = os.DirFS(dir)
|
|
}
|
|
input := func() ([]byte, error) {
|
|
file := getenv(buildstep.RunInputEnv)
|
|
if file == "" {
|
|
return nil, fmt.Errorf("%s names no file", buildstep.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", buildstep.RunHeadsEnv)
|
|
}
|
|
fmt.Fprintf(stderr, "mesh-checking-program: %v\n", err)
|
|
return 2
|
|
}
|
|
fmt.Fprintf(stdout, "%s\n", line)
|
|
return 0
|
|
}
|