A checker that hands no seat digests gets the heads' definitions with only each seat's own description (issue 1921, milestone 47/G, review round 2)
mesh/delivery-group group feat/registry-milestone checking: 7 of 7 member(s) ready
mesh/delivery closed: a newer head of the same pull request
mesh/check failed (3): ace: the check of novox/mesh-catalog#612 failed: the unit level: the candidate's mes…; and 2 more | 932e7ccf0255 on bab05c66b3cb
mesh/delivery-group group feat/registry-milestone checking: 7 of 7 member(s) ready
mesh/delivery closed: a newer head of the same pull request
mesh/check failed (3): ace: the check of novox/mesh-catalog#612 failed: the unit level: the candidate's mes…; and 2 more | 932e7ccf0255 on bab05c66b3cb
G's own check is made by the running B0 checker, which hands no digests, so the program answers every head definition: 342 KB, over the 256 KiB a run's answer may be. Without digests the descriptions of verbs, events and their schemas are left out (171 KB for the group's heads); neither the manifest validator nor the composer reads one, and the validator's verdicts over the group are the same either way. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshdeliverycheckerclient"
|
||||
"git.novox.be/novox/mesh-delivery/sdk/buildstep"
|
||||
"git.novox.be/novox/mesh-sdk/go/seatdef"
|
||||
)
|
||||
|
||||
// 1921 (B0, D2): the checking program answers, on its last line, the verdict the rules give the facts in its input, and
|
||||
@@ -146,7 +147,8 @@ func TestTheCheckingProgramAnswersTheVerdictOfItsFacts(t *testing.T) {
|
||||
t.Run("heads carrying every definition the reader holds unchanged answer none of them, within the bound", func(t *testing.T) {
|
||||
real := under{prefix: "novox/mesh-delivery", fs: os.DirFS("../../../..")}
|
||||
group := rules.Facts{V: rules.FactsVersion, Members: []rules.Member{{Repository: "novox/mesh-delivery", Head: "h"}}}
|
||||
whole, err := rules.SeatsOf(real, group)
|
||||
// An empty list of digests answers every definition whole (a checker that hands its list's digests, holding none).
|
||||
whole, err := rules.SeatsOf(real, rules.Facts{V: rules.FactsVersion, Members: group.Members, SeatDigests: map[string]string{}})
|
||||
if err != nil || len(whole.Seats) < 10 {
|
||||
t.Fatalf("the repository's own definitions: %d, %v", len(whole.Seats), err)
|
||||
}
|
||||
@@ -162,6 +164,34 @@ func TestTheCheckingProgramAnswersTheVerdictOfItsFacts(t *testing.T) {
|
||||
t.Errorf("unchanged heads answer %d definitions (%d the same), %d bytes; want none, all %d the same, within %d: %v",
|
||||
len(same.Seats), same.Same, len(answer), len(whole.Seats), buildstep.RunInputBound, err)
|
||||
}
|
||||
// Review round 2 of G: a checker from before G (B0's, which makes G's own check) hands no digests, and the answer
|
||||
// then keeps each seat's own description only, so a group's whole list stays within the bound; each still parses.
|
||||
b0, err := rules.SeatsOf(real, rules.Facts{V: rules.FactsVersion, Members: group.Members})
|
||||
if err != nil || len(b0.Seats) != len(whole.Seats) {
|
||||
t.Fatalf("B0-shaped facts: %d definitions, %v", len(b0.Seats), err)
|
||||
}
|
||||
for i, raw := range b0.Seats {
|
||||
var own struct {
|
||||
Description string `json:"description"`
|
||||
}
|
||||
_ = json.Unmarshal(whole.Seats[i], &own)
|
||||
var d struct {
|
||||
Description string `json:"description"`
|
||||
Verbs []json.RawMessage `json:"verbs"`
|
||||
Events []json.RawMessage `json:"events"`
|
||||
}
|
||||
_ = json.Unmarshal(raw, &d)
|
||||
inner := 0
|
||||
for _, m := range append(d.Verbs, d.Events...) {
|
||||
inner += strings.Count(string(m), `"description":"`)
|
||||
}
|
||||
if _, perr := seatdef.Parse(raw); inner > 0 || d.Description != own.Description || perr != nil {
|
||||
t.Errorf("B0-shaped facts answer %s with %d inner descriptions, its own %q: %v; want only its own", raw[:min(len(raw), 80)], inner, d.Description, perr)
|
||||
}
|
||||
}
|
||||
if answer, _ := json.Marshal(b0); len(answer) > buildstep.RunInputBound || len(answer) >= len(mustJSON(t, whole))*3/4 {
|
||||
t.Errorf("B0-shaped facts answer %d bytes (whole %d), want within %d and far below the whole", len(answer), len(mustJSON(t, whole)), buildstep.RunInputBound)
|
||||
}
|
||||
// One definition the heads change is answered alone.
|
||||
for seat := range group.SeatDigests {
|
||||
group.SeatDigests[seat] = "changed"
|
||||
@@ -214,3 +244,12 @@ func (u under) Open(name string) (fs.File, error) {
|
||||
}
|
||||
return nil, &fs.PathError{Op: "open", Path: name, Err: fs.ErrNotExist}
|
||||
}
|
||||
|
||||
func mustJSON(t *testing.T, v any) []byte {
|
||||
t.Helper()
|
||||
out, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user