From 247d89e152ccde9273653a75b192b9bc4fdc10a1 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 19 Nov 2026 23:19:59 +0100 Subject: [PATCH] =?UTF-8?q?mesh-config:=20a=20rename=20window=20written=20?= =?UTF-8?q?after=20start=20rearms=20the=20deadline=20timer=20(issue=201982?= =?UTF-8?q?;=20ADR=200681=20=C2=A71;=20A-490l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The timer was rearmed on a write of proposals or retiring only, so a rename window opened after start, with nothing else waiting on a time, left it blocked and its seven-day held finding never came; a window opened under a later armed deadline came late. The condition is now armsDeadline (proposals, retiring, renames), and a test shows a written window rearms it. The comment on Proposal.Pull cites ADR 0681 §5. Builds: ADR 0681 §1; lead answer A-490l (hq main, 03-DESIGN/01-to-be/47-milestones/G-22-lead-answers-2.md: the held finding comes in a quiet mesh too). Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- modules/mesh-config/cmd/mesh-config/main.go | 7 ++++- .../mesh-config/cmd/mesh-config/proposals.go | 4 +-- .../mesh-config/cmd/mesh-config/quiet_test.go | 31 +++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/modules/mesh-config/cmd/mesh-config/main.go b/modules/mesh-config/cmd/mesh-config/main.go index 15d4d8df5..aadd6c207 100644 --- a/modules/mesh-config/cmd/mesh-config/main.go +++ b/modules/mesh-config/cmd/mesh-config/main.go @@ -134,10 +134,15 @@ func (runtimeAsks) Warranted(ask string) error { return err } +// armsDeadline says a write to this state can move the deadline timer: a proposal, a retirement or a rename window (A-490l). +func armsDeadline(state string) bool { + return state == ProposalsState || state == RetiringState || state == RenamesState +} + func main() { own, rearm := newOwnCopy(), make(chan struct{}, 1) own.changed = func(state string) { - if state == ProposalsState || state == RetiringState { + if armsDeadline(state) { select { case rearm <- struct{}{}: default: diff --git a/modules/mesh-config/cmd/mesh-config/proposals.go b/modules/mesh-config/cmd/mesh-config/proposals.go index f821555bb..59d31ac8f 100644 --- a/modules/mesh-config/cmd/mesh-config/proposals.go +++ b/modules/mesh-config/cmd/mesh-config/proposals.go @@ -98,8 +98,8 @@ type Proposal struct { HadValue bool `json:"had-value"` WasDigest string `json:"was-digest"` Trusted bool `json:"trusted,omitempty"` - // Pull is read only: a proposal an earlier mesh-config kept for a pull request (ADR 0502, ended by the operator's word, - // record pending). It is never set on an Approve now, and judged not to be one this module makes (problem). + // Pull is read only: a proposal an earlier mesh-config kept for a pull request (ADR 0502, superseded by ADR 0681 §5). + // It is never set on an Approve now, and judged not to be one this module makes (problem). Pull string `json:"pull,omitempty"` // Reaches is each module on each node whose value it moves, as it was judged when proposed. Reaches []string `json:"reaches"` diff --git a/modules/mesh-config/cmd/mesh-config/quiet_test.go b/modules/mesh-config/cmd/mesh-config/quiet_test.go index 1995523e3..0abf7b72e 100644 --- a/modules/mesh-config/cmd/mesh-config/quiet_test.go +++ b/modules/mesh-config/cmd/mesh-config/quiet_test.go @@ -320,3 +320,34 @@ func TestAHeldWindowIsAFindingAtItsDeadlineWithNoPass(t *testing.T) { t.Error("a deadline is still set once the finding is written") } } + +// A write of a proposal, a retirement or a rename window sets the deadline timer again, and no other state does: a window opened +// after start, with nothing else waiting on a time, must not leave the timer blocked (A-490l). +func TestAWriteOfARenameWindowRearmsTheDeadlineTimer(t *testing.T) { + for state, want := range map[string]bool{ProposalsState: true, RetiringState: true, RenamesState: true, + ValuesState: false, ResolvedState: false, DeclaredState: false} { + if got := armsDeadline(state); got != want { + t.Errorf("a write of %s arms the timer: %v, want %v", state, got, want) + } + } + // Wired as main wires it: the copy's write of a window tells the channel the timer waits on. + b := &busOf{held: map[string]map[string][]byte{}, handles: map[string]func(stdio.StateChange) error{}} + own := b.ownCopy() + rearm := make(chan struct{}, 1) + own.changed = func(state string) { + if armsDeadline(state) { + select { + case rearm <- struct{}{}: + default: + } + } + } + if err := own.write(RenamesState, "player.level", Rename{Module: "player"}); err != nil { + t.Fatal(err) + } + select { + case <-rearm: + default: + t.Error("a rename window written after start did not rearm the timer") + } +}