hub v0.155.0: the floor can never deliver a withdrawn controller build (R-1085); RomM/Ghost evidence
gates / gates (push) Successful in 6m44s
gates / gates (push) Successful in 6m44s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
920c1aaf84
commit
b17e9e993c
28 files changed
+955
-6
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// spoiledControllerTags are published felhom-controller tags whose image does NOT hold the code their number
|
||||
// says (R-1081). They are never re-pushed and never deleted — a version number is pushed once — so the only
|
||||
// safe thing left is that nothing ever SELECTS them (R-1085). The household's button and the daily auto-update
|
||||
// take the highest tag and cannot reach them; the floor targets a version EXACTLY, so the floor is the path this
|
||||
// list closes: both floor forms refuse a listed tag (web/configs.go), and ResolveManagedFloor HOLDS one that
|
||||
// arrives any other way (an old stored value, the config/env default).
|
||||
//
|
||||
// THE SAME LIST is the marked „never deploy" line in `skills/felhom-build-deploy/SKILL.md`, for the hand deploy
|
||||
// that names a tag. TestSpoiledControllerTags_MatchTheSkill fails when the two differ.
|
||||
var spoiledControllerTags = map[string]string{
|
||||
// 2026-10-15: running the build refusal against a real tag rebuilt and re-pushed 0.315.0 a fourth time, with
|
||||
// v0.316.0's code under it (digest 8887343011d6 → b809201841f7).
|
||||
"0.315.0": "re-pushed with v0.316.0's code under it",
|
||||
// 2026-10-15: built from the SHARED working copy, which held 31 uncommitted files of another session's work.
|
||||
"0.316.3": "built from a working copy holding another session's uncommitted files",
|
||||
}
|
||||
|
||||
// SpoiledControllerTag reports whether v (a leading "v" and spaces allowed) is a withdrawn controller build, and
|
||||
// why. A version that is not listed answers ("", false).
|
||||
func SpoiledControllerTag(v string) (reason string, spoiled bool) {
|
||||
v = strings.TrimPrefix(strings.TrimSpace(v), "v")
|
||||
reason, spoiled = spoiledControllerTags[v]
|
||||
return reason, spoiled
|
||||
}
|
||||
|
||||
// SpoiledControllerTags lists the withdrawn controller builds, sorted — for the parity test and the logs.
|
||||
func SpoiledControllerTags() []string {
|
||||
out := make([]string, 0, len(spoiledControllerTags))
|
||||
for v := range spoiledControllerTags {
|
||||
out = append(out, v)
|
||||
}
|
||||
sort.Strings(out)
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// R-1085, the serve-time half: a withdrawn build is HELD however it reached the floor — a stored global value (as
|
||||
// one written before the form refusal existed), a per-customer override, or the config/env default. Red-proof:
|
||||
// delete the SpoiledControllerTag block in ResolveManagedFloor → every case below serves the tag.
|
||||
func TestResolveManagedFloor_HoldsAWithdrawnBuildFromEverySource(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
setup func(t *testing.T, st *Store)
|
||||
tag string
|
||||
}{
|
||||
{"stored global value", func(t *testing.T, st *Store) {
|
||||
if err := st.SetGlobalMinControllerVersion("0.316.3"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}, "0.316.3"},
|
||||
{"per-customer override", func(t *testing.T, st *Store) {
|
||||
if err := st.SetMinControllerVersion("c", "0.315.0"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}, "0.315.0"},
|
||||
{"config/env default", func(t *testing.T, st *Store) { st.SetDefaultMinControllerVersion("0.316.3") }, "0.316.3"},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
st := newTestStore(t)
|
||||
if err := st.SaveCustomerConfig(&CustomerConfig{CustomerID: "c", RetrievalPassword: "pw", APIKey: "k"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tc.setup(t, st)
|
||||
d := st.ResolveManagedFloor("c")
|
||||
if d.Floor != "" || !d.Held || !d.HeldSpoiled {
|
||||
t.Fatalf("a withdrawn build must be HELD and served as no floor, got %+v", d)
|
||||
}
|
||||
if d.RequestedFloor != tc.tag {
|
||||
t.Errorf("RequestedFloor = %q, want %q (the message needs it)", d.RequestedFloor, tc.tag)
|
||||
}
|
||||
if r := d.HoldReason(); !strings.Contains(r, "WITHDRAWN") || !strings.Contains(r, tc.tag) {
|
||||
t.Errorf("the hold reason must say withdrawn and name the tag, got %q", r)
|
||||
}
|
||||
if got := st.EffectiveMinControllerVersion("c"); got != tc.tag {
|
||||
t.Errorf("the stored value must be left as it is (the page shows why), got %q", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// The control: a version that is not listed is served exactly as before (uncoupled, no manifest).
|
||||
func TestResolveManagedFloor_AnUnlistedFloorIsServed(t *testing.T) {
|
||||
st := newTestStore(t)
|
||||
if err := st.SetGlobalMinControllerVersion("0.317.0"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if d := st.ResolveManagedFloor("c"); d.Floor != "0.317.0" || d.Held || d.HeldSpoiled {
|
||||
t.Fatalf("an ordinary floor must be served, got %+v", d)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpoiledControllerTag_AcceptsTheFormsSpellings(t *testing.T) {
|
||||
for _, v := range []string{"0.316.3", "v0.316.3", " 0.315.0 ", "v0.315.0"} {
|
||||
if _, ok := SpoiledControllerTag(v); !ok {
|
||||
t.Errorf("%q must be recognised as withdrawn", v)
|
||||
}
|
||||
}
|
||||
for _, v := range []string{"", "0.317.0", "0.316.30", "0.316", "0.315.0-rc.1"} {
|
||||
if _, ok := SpoiledControllerTag(v); ok {
|
||||
t.Errorf("%q must NOT be withdrawn", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// THE PARITY PIN (R-1085 B3): the hub's list equals BOTH places the hand deploy reads it — the marked „never deploy"
|
||||
// line and the step-3 pre-check in skills/felhom-build-deploy/SKILL.md. A missing skill file is a failure, never a
|
||||
// skip. Red-proof: add "0.316.4" to spoiledControllerTags, or drop a tag from either skill line → this fails.
|
||||
func TestSpoiledControllerTags_MatchTheSkill(t *testing.T) {
|
||||
p := filepath.Join("..", "..", "..", "skills", "felhom-build-deploy", "SKILL.md")
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
t.Fatalf("the skill holds the hand deploy's copy of the list and must be readable: %v", err)
|
||||
}
|
||||
ver := regexp.MustCompile(`\d+\.\d+\.\d+`)
|
||||
var marked, precheck []string
|
||||
for _, line := range strings.Split(string(b), "\n") {
|
||||
switch {
|
||||
case strings.Contains(line, "<!-- spoiled-controller-tags -->"):
|
||||
for _, m := range regexp.MustCompile("`(\\d+\\.\\d+\\.\\d+)`").FindAllStringSubmatch(line, -1) {
|
||||
marked = append(marked, m[1])
|
||||
}
|
||||
case strings.HasPrefix(line, "VER=<VER>; case \""):
|
||||
q := line[len("VER=<VER>; case \""):]
|
||||
precheck = ver.FindAllString(q[:strings.Index(q, "\"")], -1)
|
||||
}
|
||||
}
|
||||
want := SpoiledControllerTags()
|
||||
if !reflect.DeepEqual(marked, want) {
|
||||
t.Errorf("the skill's marked never-deploy line lists %v, the hub %v", marked, want)
|
||||
}
|
||||
if !reflect.DeepEqual(precheck, want) {
|
||||
t.Errorf("the skill's step-3 pre-check refuses %v, the hub %v", precheck, want)
|
||||
}
|
||||
}
|
||||
@@ -2431,6 +2431,11 @@ type ManagedFloorDecision struct {
|
||||
// MinAgentSourceDeclared (the floor's own declaration, used ONLY above the golden). "" = no
|
||||
// requirement at all (an uncoupled release).
|
||||
MinAgentSource string
|
||||
// HeldSpoiled is the third hold reason (R-1085): the floor names a WITHDRAWN controller build
|
||||
// (SpoiledControllerTag). It wins over the other two — no agent check makes a faulty image safe.
|
||||
HeldSpoiled bool
|
||||
// SpoiledReason says why that build is withdrawn ("" unless HeldSpoiled).
|
||||
SpoiledReason string
|
||||
}
|
||||
|
||||
// Where a managed floor's agent requirement came from. See ManagedFloorDecision.MinAgentSource.
|
||||
@@ -2452,6 +2457,9 @@ func (d ManagedFloorDecision) HoldReason() string {
|
||||
switch {
|
||||
case !d.Held:
|
||||
return ""
|
||||
case d.HeldSpoiled:
|
||||
return fmt.Sprintf("held: floor %s is a WITHDRAWN controller build (%s) — set another version (R-1085)",
|
||||
d.EffectiveFloorForMessage(), d.SpoiledReason)
|
||||
case d.HeldBeyondGolden:
|
||||
return fmt.Sprintf("held: floor %s is ABOVE the vouched golden %s, so its agent requirement is unknown — vouch a golden carrying the floor's controller (publish-train rule 1)",
|
||||
d.EffectiveFloorForMessage(), goldenOrUnknown(d.GoldenVersion))
|
||||
@@ -2511,6 +2519,7 @@ func agentOrUnknownVersion(v string) string {
|
||||
//
|
||||
// Logic:
|
||||
// - effective floor "" → nothing to serve (no floor configured);
|
||||
// - effective floor is a WITHDRAWN build (spoiled_tags.go) → HOLD + HeldSpoiled (R-1085);
|
||||
// - manifest MinAgent "" → UNCOUPLED release: serve the floor as-is (no agent gating);
|
||||
// - floor ABOVE the vouched golden's controller → HOLD (requirement unknown) + flag;
|
||||
// - agent_version known AND ≥ MinAgent → serve the floor;
|
||||
@@ -2523,6 +2532,14 @@ func (s *Store) ResolveManagedFloor(customerID string) ManagedFloorDecision {
|
||||
if d.Floor == "" {
|
||||
return d
|
||||
}
|
||||
// R-1085: a withdrawn build is never served, whatever put it here — the forms refuse it, but a value stored
|
||||
// before that refusal existed, or the config/env default, reaches this line unchecked. Checked FIRST: no agent
|
||||
// comparison makes a faulty image safe. The stored value is left as it is; the pages say why it is held.
|
||||
if reason, spoiled := SpoiledControllerTag(d.Floor); spoiled {
|
||||
d.Held, d.HeldSpoiled, d.SpoiledReason = true, true, reason
|
||||
d.Floor = ""
|
||||
return d
|
||||
}
|
||||
man := s.GetArtifactManifest()
|
||||
d.MinAgent, d.GoldenVersion = man.MinAgent, man.GoldenVersion
|
||||
if d.MinAgent != "" {
|
||||
|
||||
Reference in new issue
Block a user