The operator's answer: mesh-build-go reading the checker's state inputs broke ADR 0596 §2. The run ask's input now names the verb seat:mesh-delivery-checker.input; the checker's tools serve it from the state inputs (Reader.Input, checked against its digest), and the state is the checker's own again, read by no other module. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
58 lines
1.8 KiB
Go
58 lines
1.8 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"sort"
|
|
"testing"
|
|
)
|
|
|
|
// The checker says on the bus which states it keeps and which others may read (novox/hq ADR 0495 clauses 2 and 3): a
|
|
// reader is granted from that announcement. owed is read by the forge module, which writes mesh/check from it (ADR 0521,
|
|
// R4e round 2 finding R2-1), and by the forge bridge; previews by the indexer; verdicts by the gate. The list names every
|
|
// state of the manifest, so no state is refused at the call for want of being announced (clause 5).
|
|
func TestTheCheckerAnnouncesEveryStateItKeepsAndOwedReadable(t *testing.T) { // R2-1, ADR 0495 §2-§3, ADR 0521
|
|
raw, err := os.ReadFile("../../module.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var m struct {
|
|
State []struct{ Name string } `json:"state"`
|
|
}
|
|
if err := json.Unmarshal(raw, &m); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var manifest, announced, readable []string
|
|
for _, s := range m.State {
|
|
manifest = append(manifest, s.Name)
|
|
}
|
|
for _, s := range keptStates {
|
|
announced = append(announced, s.Name)
|
|
if s.Readable {
|
|
readable = append(readable, s.Name)
|
|
}
|
|
}
|
|
sort.Strings(manifest)
|
|
sort.Strings(announced)
|
|
if !equal(manifest, announced) {
|
|
t.Errorf("announced %v, the manifest keeps %v", announced, manifest)
|
|
}
|
|
// kept is read by the Go build module for a check ask (issue 1887 design limit 1); tries by the delivery view (build_usage).
|
|
// inputs are the checker's own: the Go build module asks the seat's verb input for one (ADR 0596 §2, issue 1921).
|
|
if want := []string{"kept", "owed", "previews", "tries", "verdicts"}; !equal(readable, want) {
|
|
t.Errorf("readable %v, want %v", readable, want)
|
|
}
|
|
}
|
|
|
|
func equal(a, b []string) bool {
|
|
if len(a) != len(b) {
|
|
return false
|
|
}
|
|
for i := range a {
|
|
if a[i] != b[i] {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|