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
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package rules
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"flag"
|
|
"fmt"
|
|
"io"
|
|
"io/fs"
|
|
)
|
|
|
|
// Program is the checking program's work (cmd/mesh-checking-program; novox/hq ADR 0644, ADR 0656): over its arguments,
|
|
// its input (read only when asked for the verdict) and the heads laid for it (nil when none are), the one JSON line it
|
|
// answers, or why it refuses. `-seats` answers the seat list of the heads (SeatsOf), `-verdict` the verdict of the
|
|
// facts in the input (Judged), refusing facts of a version it does not read.
|
|
func Program(args []string, input func() ([]byte, error), heads fs.FS) ([]byte, error) {
|
|
set := flag.NewFlagSet("mesh-checking-program", flag.ContinueOnError)
|
|
set.SetOutput(io.Discard)
|
|
verdict := set.Bool("verdict", false, "answer the verdict of the facts in the input")
|
|
seats := set.Bool("seats", false, "answer the seat list of the heads laid for it")
|
|
if err := set.Parse(args); err != nil {
|
|
return nil, err
|
|
}
|
|
switch {
|
|
case *seats:
|
|
if heads == nil {
|
|
return nil, errors.New("no heads are laid for it")
|
|
}
|
|
answer, err := SeatsOf(heads)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return json.Marshal(answer)
|
|
case *verdict:
|
|
data, err := input()
|
|
if err != nil {
|
|
return nil, fmt.Errorf("the input cannot be read: %w", err)
|
|
}
|
|
facts, err := DecodeFacts(data)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return json.Marshal(Judged(facts))
|
|
}
|
|
return nil, errors.New("nothing asked: give -verdict or -seats")
|
|
}
|