close: read the became links the effort already carries, check the record size, drop empty table cases (issue 784, ADR 0630)
mesh/delivery merged: source.main moved to novox/mesh-catalog@d2f326dff40e
mesh/check being carried to e9ba05bd9a3c on d2f326dff40e | from 79c2fc7fe1d5

Claude-Session: https://claude.ai/code/session_01JG73KG7AfSdh6FP8VrBqCn
This commit is contained in:
2026-11-04 15:15:34 +01:00
parent 8f5667cca5
commit e9ba05bd9a
3 changed files with 57 additions and 12 deletions
@@ -2,6 +2,7 @@ package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"sort"
@@ -131,7 +132,12 @@ func (k *KB) Close(caller string, a CloseAsk) (*Closed, error) {
look := k.lookup(ctx)
probe := &Record{Kind: KindResearch, Number: a.Number, Title: "the closing", Date: day, Effort: a.To, Status: StatusProposed,
Links: added, Sections: []Section{{Name: "00-overview.md", Text: note}, {Name: name, Text: note}}}
closing := JudgeRecordOn(probe, e, look, ref, day)
var closing []Refusal
for _, x := range JudgeRecordOn(probe, e, look, ref, day) {
if x.Rule != "became" { // the probe holds only the added links; the whole record's became is checked below
closing = append(closing, x)
}
}
if a.To == StatusGraduated {
became := false
for _, l := range r.Links {
@@ -141,7 +147,10 @@ func (k *KB) Close(caller string, a CloseAsk) (*Closed, error) {
refusals = append(refusals, Refusal{Rule: "became", Says: "a graduated research effort names what it became, as a became link"})
}
}
for _, l := range added {
for _, l := range r.Links {
if l.Kind != LinkBecame {
continue
}
if target, ok := l.To.Record(); ok && a.To == StatusGraduated && target.Kind == KindDecision {
if t := look(target); t != nil && t.Status != StatusAccepted {
refusals = append(refusals, Refusal{Rule: "link-target", Says: fmt.Sprintf("a graduated effort's became names accepted records: %s is %s", target, t.Status)})
@@ -149,6 +158,9 @@ func (k *KB) Close(caller string, a CloseAsk) (*Closed, error) {
}
}
refusals = append(refusals, closing...)
if raw, _ := json.Marshal(r); len(raw) > MostRecordBytes {
refusals = append(refusals, Refusal{Rule: "size", Says: fmt.Sprintf("the record is %d bytes; a record holds at most %d", len(raw), MostRecordBytes)})
}
if len(refusals) > 0 {
lines := make([]string, len(refusals))
for i, x := range refusals {