A module's floor counts every running have, healthy or not; health stays in its words (ADR 0556 clause 2, insight)

This commit is contained in:
2026-10-26 21:12:31 +01:00
parent 54a8afac73
commit aa8e9afc7c
2 changed files with 6 additions and 13 deletions
+5 -6
View File
@@ -80,9 +80,11 @@ type Reach struct {
// ModuleReach is how far one module reached. FP is its fingerprint at the indexer now; Nodes how many nodes want it
// (a want not removed); Changes its fingerprints the view knows of, each with the merge commit it first appeared at,
// newest first. Floor is the oldest first-appearance commit among the fingerprints its nodes run, set only when every
// node's want is settled (its have equal to the want, running and healthy) and every fingerprint they run is among
// Changes; otherwise Waiting says why there is none. A module no node wants has neither.
// newest first. Floor is the oldest first-appearance commit among the fingerprints its nodes' haves run, a running have
// counting whether its health check passes or not; it is empty when a node that wants the module has no running have, or
// runs a fingerprint not among Changes. Waiting names, in words, every node where the module is not settled (its have
// different from its want, not running, or not healthy), with or without a floor: health is said here and never moves the
// floor (ADR 0556 clause 2). A module no node wants has neither.
type ModuleReach struct {
FP string `json:"fp,omitempty"`
Nodes int `json:"nodes"`
@@ -116,9 +118,6 @@ func (r Reach) check() error {
if m.Nodes < 0 {
return fmt.Errorf("delivery: the reach of %s counts %d nodes", name, m.Nodes)
}
if m.Floor != "" && m.Waiting != "" {
return fmt.Errorf("delivery: the reach of %s has a floor and waits", name)
}
if len(m.Changes) > MostChanges {
return fmt.Errorf("delivery: the reach of %s keeps %d changes, more than %d", name, len(m.Changes), MostChanges)
}
+1 -7
View File
@@ -309,12 +309,6 @@ func TestSourceValuesRefused(t *testing.T) { // 1200/AC4
wantErr("reach without repository", err, "repository")
r = sampleReach()
m := r.Modules["gitea"]
m.Waiting = "gitea on ace does not yet run src2:b"
r.Modules["gitea"] = m
_, err = EncodeReach(r)
wantErr("reach with a floor that waits", err, "gitea", "floor")
r = sampleReach()
m = r.Modules["gitea"]
m.Changes = append(m.Changes, Change{Commit: "dddd"})
r.Modules["gitea"] = m
_, err = EncodeReach(r)
@@ -334,7 +328,7 @@ func TestSourceValuesRefused(t *testing.T) { // 1200/AC4
// sampleReach is a reach value of one repository with a module at its floor and a library-like empty one.
func sampleReach() Reach {
return Reach{V: Version, Repository: "novox/mesh-catalog", Indexed: "cccc", Reached: "cccc", ReachedSrc: 9, Modules: map[string]ModuleReach{
"gitea": {FP: "src2:a", Nodes: 1, Floor: "cccc", Changes: []Change{{Commit: "cccc", FP: "src2:a", Src: 9}, {Commit: "bbbb", FP: "src2:b", Src: 7}}},
"gitea": {FP: "src2:a", Nodes: 1, Floor: "cccc", Waiting: "gitea on ace runs src2:a and its health check failed", Changes: []Change{{Commit: "cccc", FP: "src2:a", Src: 9}, {Commit: "bbbb", FP: "src2:b", Src: 7}}},
"zsh": {FP: "src2:z", Changes: []Change{{Commit: "aaaa", FP: "src2:z"}}},
}}
}