Tighten who writes and reviews a record, date the rules, bound history (review of #206)
mesh/merge-gate pass: builds new: modules/mesh-knowledge, sent nowhere; no bus step; every machine composes with the change as it did without (4 of 4 compo…
mesh/repo-check pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
mesh/delivery superseded: a newer head of the same pull request

A revision came from anyone and a review was refused only to the first author,
so a co-writer could approve, and a record proposed before callers are proven
would later be reviewable by its own unproven author. Now a revision is taken
only from the proven author, a reserved number only from whoever reserved it,
and a review is refused from any writer of any version or for any record with
an unproven writer. The rules held records from no date, so a correction to an
older record was refused by rules hq never held it to; each dated rule now holds
from hq's own start date, and a new record cannot be dated before its
reservation. history and the question to ask are bounded like the other answers.
This commit is contained in:
2026-10-11 05:10:02 +02:00
parent ba7b455719
commit 10ab959d0f
10 changed files with 382 additions and 33 deletions
@@ -293,12 +293,20 @@ func (k *KB) Propose(caller string, a ProposeAsk) (*Proposed, error) {
switch w := held.Working(); {
case held.Current.Status == StatusReserved:
r.ReservedBy, r.ReservedAt, r.ReservedFor = held.Current.ReservedBy, held.Current.ReservedAt, held.Current.ReservedFor
if proven(r.ReservedBy) && caller != r.ReservedBy {
return nil, fmt.Errorf("%s was reserved by %s: only who reserved a number proposes under it. Nothing was proposed", key, r.ReservedBy)
}
if why == "" {
why = "proposed"
}
case w.Status == StatusProposed && held.Pending == nil:
// A revision of a proposal: a new version, its earlier reviews kept with the versions they reviewed.
if !proven(caller) || caller != w.Author {
return nil, fmt.Errorf("%s is proposed by %s: only its author, proven by the runtime, revises it (this call is by %s). "+
"Nothing was proposed", key, w.Author, caller)
}
r.Author, r.Reviews, r.ReservedBy, r.ReservedAt, r.ReservedFor = w.Author, w.Reviews, w.ReservedBy, w.ReservedAt, w.ReservedFor
r.Writers = w.Writers
if a.Insight != "" {
refusals = append(refusals, Refusal{Rule: "reserved", Says: "a proposal not yet accepted is revised, not corrected by an insight"})
}
@@ -312,6 +320,10 @@ func (k *KB) Propose(caller string, a ProposeAsk) (*Proposed, error) {
}
current = false
r.Author = caller
r.Writers = append([]string{}, held.Current.Writers...)
if held.Current.Author != "" && !contains(r.Writers, held.Current.Author) {
r.Writers = append(r.Writers, held.Current.Author)
}
r.AcceptedAt = held.Current.AcceptedAt
r.Pending = &PendingState{Insight: Insight{Date: k.now().Format("2006-01-02"), Before: strings.TrimSpace(a.Insight), By: caller}}
r.Date = held.Current.Date
@@ -323,6 +335,14 @@ func (k *KB) Propose(caller string, a ProposeAsk) (*Proposed, error) {
return nil, fmt.Errorf("%s is %s and takes no proposal; nothing was proposed", key, held.Working().Status)
}
}
if current && held != nil && !held.Current.ReservedAt.IsZero() && r.Date < held.Current.ReservedAt.Format("2006-01-02") {
// A new record is of its own day: a date before its reservation would put it under rules older records keep.
refusals = append(refusals, Refusal{Rule: "date", Says: fmt.Sprintf("a new record is dated from the day its number was reserved, %s, not %s",
held.Current.ReservedAt.Format("2006-01-02"), r.Date)})
}
if !contains(r.Writers, caller) {
r.Writers = append(r.Writers, caller)
}
if !current && a.Kind == KindResearch && r.Effort == "" {
r.Effort = held.Current.Status
}
@@ -401,9 +421,22 @@ func (k *KB) Review(caller string, a ReviewAsk) (*Reviewed, error) {
"author, and none is taken until it does. Nothing was reviewed", key)
}
w := held.Working().Clone()
if caller == w.Author {
return nil, fmt.Errorf("%s was written by %s, who called this review: a record is reviewed by someone who did not write it. "+
"Nothing was reviewed", key, caller)
// The record's writers; an imported record's are hq's, reviewed there, and none of them is named here.
var writers []string
for _, by := range append([]string{w.Author}, w.Writers...) {
if by != "" {
writers = append(writers, by)
}
}
for _, by := range writers {
if !proven(by) {
return nil, fmt.Errorf("%s has a version written while the runtime proved no caller, so who wrote it cannot be told from "+
"who reviews it: its author is to propose it again under a new number. Nothing was reviewed", key)
}
}
if contains(writers, caller) {
return nil, fmt.Errorf("%s has a version %s wrote, who called this review: a record is reviewed by someone who wrote none "+
"of it. Nothing was reviewed", key, caller)
}
reviewed := held.CurrentVersion
if held.Pending != nil {