grouproll: floor refuses a declared fixed box with no edges file
Astra r1 F1.2: a fixed box whose first PUT fails can serve and forward with no edges file, so the listing alone cannot prove every forwarder was counted. No existing source of the fixed-box set is reachable by the verb (the operator role reads only control/edges/*, never SSM, and member status does not report CARLOS_HA_FIXED_BOX_IDENTITIES), so the config gains fixed_boxes: every fixed box of the deployment that may forward, by reference. A declared box with no file is DR-4 naming it (floor_fixed_missing); fixed_boxes missing or empty is a floor error (floor_fixed_boxes), never "none". Members are covered by admission: they take no traffic before their booting publication succeeds. Two new operator strings await copy review (text count 139 + 2).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 files changed,
+127
−23
internal/grouproll/config.go+35 −1internal/grouproll/config_test.go+29 −19internal/grouproll/depart_test.go+9 −0internal/grouproll/floor.go+14 −0internal/grouproll/floor_test.go+34 −1internal/grouproll/text.go+2 −0internal/grouproll/text_test.go+4 −2
diff --git a/internal/grouproll/config.go b/internal/grouproll/config.go| index e5453c771..7b76ed4db 100644 |
| --- a/internal/grouproll/config.go |
| +++ b/internal/grouproll/config.go |
| @@ -37,6 +37,14 @@ type Config struct { |
| ReleasePublicKey *string `json:"release_public_key,omitempty"` |
| ReleaseChannels []string `json:"release_channels,omitempty"` |
| ReleasePlatform *string `json:"release_platform,omitempty"` |
| + |
| + // FixedBoxes is every fixed box of the deployment that may forward a |
| + // request to a member, by reference, whatever its region (held floor |
| + // capability ruling, 2026-11-10). The floor refuses a drain unless each |
| + // has an edges file: a fixed box whose first publication failed can |
| + // still serve and forward. nil is absent; the floor refuses absent and |
| + // empty alike. The Go verb's own key: the superseded script refuses it. |
| + FixedBoxes []string `json:"fixed_boxes,omitempty"` |
| } |
| // The script's patterns (:242-266 and validate_config), anchored as |
| @@ -62,7 +70,10 @@ var requiredKeys = []string{"deployment", "account", "region", "group", "group_a |
| "target_groups", "bucket", "document", "state_dir", "profile", "min_release"} |
| var optionalKeys = []string{"ha_floor", "data_prefix", "data_bucket", |
| - "release_public_key", "release_channels", "release_platform"} |
| + "release_public_key", "release_channels", "release_platform", "fixed_boxes"} |
| + |
| +// boxRef is a box reference as an edges key names it (EdgesKey). |
| +var boxRef = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$`) |
| // LoadConfig reads and validates the config at path. A file that cannot be |
| // read or decoded is "record" (the script's decode and main); a decoded |
| @@ -134,6 +145,22 @@ func ValidateConfig(v any) (Config, error) { |
| out.ReleaseChannels = append(out.ReleaseChannels, s) |
| } |
| } |
| + if raw, present := c["fixed_boxes"]; present { |
| + list, ok := raw.([]any) |
| + if !ok || len(list) > 1024 { |
| + return Config{}, invalid |
| + } |
| + out.FixedBoxes = []string{} |
| + seen := map[string]bool{} |
| + for _, e := range list { |
| + s, ok := e.(string) |
| + if !ok || !boxRef.MatchString(s) || strings.HasSuffix(s, ".json") || seen[s] { |
| + return Config{}, invalid |
| + } |
| + seen[s] = true |
| + out.FixedBoxes = append(out.FixedBoxes, s) |
| + } |
| + } |
| if out.ReleasePlatform, ok = optional("release_platform", releasePlatform.MatchString); !ok { |
| return Config{}, invalid |
| } |
| @@ -251,6 +278,13 @@ func (c Config) Map() map[string]any { |
| } |
| m["release_channels"] = chs |
| } |
| + if c.FixedBoxes != nil { |
| + boxes := make([]any, len(c.FixedBoxes)) |
| + for i, s := range c.FixedBoxes { |
| + boxes[i] = s |
| + } |
| + m["fixed_boxes"] = boxes |
| + } |
| return m |
| } |
diff --git a/internal/grouproll/config_test.go b/internal/grouproll/config_test.go| index 5c7da7aef..a06349032 100644 |
| --- a/internal/grouproll/config_test.go |
| +++ b/internal/grouproll/config_test.go |
| @@ -84,6 +84,9 @@ func TestConfigMatchesScriptValidation(t *testing.T) { |
| "nested prefix": with(heldConfig(), "data_prefix", "a/b.c/d_e-f"), |
| "other document": with(baseConfig(), "document", "Carlos-Group-Operator"), |
| "state_dir other absolute": with(baseConfig(), "state_dir", "/var/lib/x/./y"), |
| + "fixed boxes": with(heldConfig(), "fixed_boxes", []any{"adi", "tito-1", "g.x_y"}), |
| + // An empty list is a valid config; the floor refuses it. |
| + "fixed boxes empty": with(heldConfig(), "fixed_boxes", []any{}), |
| } |
| for name, c := range accept { |
| t.Run("accept "+name, func(t *testing.T) { |
| @@ -136,25 +139,32 @@ func TestConfigMatchesScriptValidation(t *testing.T) { |
| "platform case": with(release, "release_platform", "Linux-arm64"), |
| "platform null": with(release, "release_platform", nil), |
| // validate_config's remaining rules |
| - "not an object": nil, |
| - "deployment empty": with(baseConfig(), "deployment", ""), |
| - "deployment long": with(baseConfig(), "deployment", longName(129)), |
| - "region": with(baseConfig(), "region", "eu-west"), |
| - "bucket": with(baseConfig(), "bucket", "Example"), |
| - "state_dir dotdot": with(baseConfig(), "state_dir", "/var/../etc"), |
| - "state_dir long": with(baseConfig(), "state_dir", "/"+longName(1024)), |
| - "AWS- document": with(baseConfig(), "document", "AWS-RunShellScript"), |
| - "group mismatch": with(baseConfig(), "group", "other-group"), |
| - "group_arn account": with(baseConfig(), "group_arn", "arn:aws:autoscaling:eu-west-1:111111111111:autoScalingGroup:example:autoScalingGroupName/example-group"), |
| - "one target group": with(baseConfig(), "target_groups", []any{"arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/example-8/8888888888888888"}), |
| - "same target groups": with(baseConfig(), "target_groups", []any{"arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/example-8/8888888888888888", "arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/example-8/8888888888888888"}), |
| - "target partition": with(baseConfig(), "target_groups", []any{"arn:aws-cn:elasticloadbalancing:eu-west-1:000000000000:targetgroup/a/0123456789abcdef", "arn:aws-cn:elasticloadbalancing:eu-west-1:000000000000:targetgroup/b/0123456789abcdef"}), |
| - "target short id": with(baseConfig(), "target_groups", []any{"arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/a/0123", "arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/b/0123456789abcdef"}), |
| - "profile number": with(baseConfig(), "profile", int64(7)), |
| - "trailing newline": with(baseConfig(), "account", "000000000000\n"), |
| - "no state_dir": without(baseConfig(), "state_dir"), |
| - "prefix long": with(heldConfig(), "data_prefix", longName(1025)), |
| - "ha_floor not string": with(heldConfig(), "ha_floor", int64(1)), |
| + "not an object": nil, |
| + "deployment empty": with(baseConfig(), "deployment", ""), |
| + "deployment long": with(baseConfig(), "deployment", longName(129)), |
| + "region": with(baseConfig(), "region", "eu-west"), |
| + "bucket": with(baseConfig(), "bucket", "Example"), |
| + "state_dir dotdot": with(baseConfig(), "state_dir", "/var/../etc"), |
| + "state_dir long": with(baseConfig(), "state_dir", "/"+longName(1024)), |
| + "AWS- document": with(baseConfig(), "document", "AWS-RunShellScript"), |
| + "group mismatch": with(baseConfig(), "group", "other-group"), |
| + "group_arn account": with(baseConfig(), "group_arn", "arn:aws:autoscaling:eu-west-1:111111111111:autoScalingGroup:example:autoScalingGroupName/example-group"), |
| + "one target group": with(baseConfig(), "target_groups", []any{"arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/example-8/8888888888888888"}), |
| + "same target groups": with(baseConfig(), "target_groups", []any{"arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/example-8/8888888888888888", "arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/example-8/8888888888888888"}), |
| + "target partition": with(baseConfig(), "target_groups", []any{"arn:aws-cn:elasticloadbalancing:eu-west-1:000000000000:targetgroup/a/0123456789abcdef", "arn:aws-cn:elasticloadbalancing:eu-west-1:000000000000:targetgroup/b/0123456789abcdef"}), |
| + "target short id": with(baseConfig(), "target_groups", []any{"arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/a/0123", "arn:aws:elasticloadbalancing:eu-west-1:000000000000:targetgroup/b/0123456789abcdef"}), |
| + "profile number": with(baseConfig(), "profile", int64(7)), |
| + "trailing newline": with(baseConfig(), "account", "000000000000\n"), |
| + "no state_dir": without(baseConfig(), "state_dir"), |
| + "prefix long": with(heldConfig(), "data_prefix", longName(1025)), |
| + "ha_floor not string": with(heldConfig(), "ha_floor", int64(1)), |
| + "fixed boxes string": with(heldConfig(), "fixed_boxes", "adi"), |
| + "fixed boxes number": with(heldConfig(), "fixed_boxes", []any{int64(1)}), |
| + "fixed boxes duplicate": with(heldConfig(), "fixed_boxes", []any{"adi", "adi"}), |
| + "fixed boxes blank": with(heldConfig(), "fixed_boxes", []any{""}), |
| + "fixed boxes slash": with(heldConfig(), "fixed_boxes", []any{"a/b"}), |
| + "fixed boxes json": with(heldConfig(), "fixed_boxes", []any{"adi.json"}), |
| + "fixed boxes null": with(heldConfig(), "fixed_boxes", nil), |
| } |
| for name, c := range refuse { |
| t.Run("refuse "+name, func(t *testing.T) { |
diff --git a/internal/grouproll/depart_test.go b/internal/grouproll/depart_test.go| index 4203fcc60..8158000fe 100644 |
| --- a/internal/grouproll/depart_test.go |
| +++ b/internal/grouproll/depart_test.go |
| @@ -36,6 +36,7 @@ func newHeldHarnessAt(t *testing.T, root string, members int, configure func(c * |
| h := newHarnessWith(t, root, members, func(c *Config) { |
| floor, prefix, bucket := "v0.35.0", "instances", "example-bucket" |
| c.HAFloor, c.DataPrefix, c.DataBucket = &floor, &prefix, &bucket |
| + c.FixedBoxes = []string{"adi"} |
| if configure != nil { |
| configure(c) |
| } |
| @@ -1170,6 +1171,14 @@ func TestDepartCountsOldEdgesFiles(t *testing.T) { |
| mustFloorRefused(t, h, Text("floor_box", "box", "old")) |
| } |
| +// A declared fixed box whose first PUT failed has no file: the depart is |
| +// floor-refused, naming it, before any write. |
| +func TestDepartDeclaredFixedBoxWithoutAFile(t *testing.T) { |
| + h := newHeldHarness(t, 2, nil) |
| + delete(h.f.fixed, "adi") |
| + mustFloorRefused(t, h, Text("floor_fixed_missing", "box", "adi")) |
| +} |
| + |
| // RemoveTests and RemoveMinimumTests. |
| func removeHarness(t *testing.T, pools map[string]any) *harness { |
diff --git a/internal/grouproll/floor.go b/internal/grouproll/floor.go| index 379d860d0..dffaee884 100644 |
| --- a/internal/grouproll/floor.go |
| +++ b/internal/grouproll/floor.go |
| @@ -56,15 +56,22 @@ func (e *Engine) Floor(ctx context.Context, kind, version string) (rule string, |
| } else { |
| floor := *e.c.HAFloor |
| err := func() error { |
| + if len(e.c.FixedBoxes) == 0 { |
| + // Never read as "no fixed boxes": an unlisted forwarder |
| + // with no file would be invisible. |
| + errs = append(errs, Text("floor_fixed_boxes")) |
| + } |
| keys, err := e.edgesList(ctx) |
| if err != nil { |
| return err |
| } |
| + filed := map[string]bool{} |
| for _, key := range keys { |
| m := EdgesKey.FindStringSubmatch(key) |
| if m == nil { |
| continue |
| } |
| + filed[m[1]] = true |
| v, err := e.edgesKey(ctx, key) |
| if err != nil { |
| if !refusalOrUncertain(err) { |
| @@ -82,6 +89,13 @@ func (e *Engine) Floor(ctx context.Context, kind, version string) (rule string, |
| reasons = append(reasons, Text("floor_box", "box", m[1])) |
| } |
| } |
| + // A declared fixed box with no file may still serve and |
| + // forward (its first PUT failed): DR-4, naming it. |
| + for _, box := range e.c.FixedBoxes { |
| + if !filed[box] { |
| + reasons = append(reasons, Text("floor_fixed_missing", "box", box)) |
| + } |
| + } |
| if kind == "replace" { |
| rel, err := e.templateRelease(ctx) |
| if err != nil { |
diff --git a/internal/grouproll/floor_test.go b/internal/grouproll/floor_test.go| index c4dfcc588..7804f8f16 100644 |
| --- a/internal/grouproll/floor_test.go |
| +++ b/internal/grouproll/floor_test.go |
| @@ -80,7 +80,7 @@ func floorPointer(current map[string]any, channel string, extra map[string]any) |
| } |
| // newFloorHarness is HeldBase.setUp: ha_floor v0.35.0 with a data bucket |
| -// and prefix, every box publishing ha_handover 1 (the members, which also |
| +// and prefix, the fixed box adi declared in fixed_boxes, every box publishing ha_handover 1 (the members, which also |
| // publish ha_take 1, and the fixed box adi, which is not HA and publishes |
| // no ha_take), the template pinned at v0.35.0, and the golden pointer in |
| // the stable channel. withKey adds the golden release_public_key |
| @@ -90,6 +90,7 @@ func newFloorHarness(t *testing.T, withKey bool) *harness { |
| h := newHarness(t, 2) |
| floor, prefix, bucket := "v0.35.0", "instances", "example-bucket" |
| h.c.HAFloor, h.c.DataPrefix, h.c.DataBucket = &floor, &prefix, &bucket |
| + h.c.FixedBoxes = []string{"adi"} |
| if withKey { |
| pub := strings.TrimSpace(string(floorFixture(t, "router-pointer-golden.pub"))) |
| h.c.ReleasePublicKey = &pub |
| @@ -367,6 +368,38 @@ func TestFloorCountsEveryEdgesFileWhateverItsAge(t *testing.T) { |
| } |
| } |
| +// A declared fixed box with no edges file is DR-4, naming it (Astra r1 |
| +// F1.2): a fixed box whose first PUT fails can serve and forward with no |
| +// file, so the listing alone cannot prove every forwarder was counted. |
| +func TestFloorDeclaredFixedBoxWithoutAFile(t *testing.T) { |
| + h := newFloorHarness(t, false) |
| + h.c.FixedBoxes = []string{"adi", "tito"} |
| + r := h.floor("replace", "") |
| + h.refused(t, r, Text("floor_fixed_missing", "box", "tito")) |
| + if containsValue(r.row(t, "floor")["live"], "tito") { |
| + t.Fatalf("tito counted: %v", r.row(t, "floor")["live"]) |
| + } |
| + // adi's first PUT failed: its file was never written. |
| + h = newFloorHarness(t, false) |
| + delete(h.f.fixed, "adi") |
| + h.refused(t, h.floor("replace", ""), Text("floor_fixed_missing", "box", "adi")) |
| + // A file present for a box not declared still counts by its capability. |
| + h = newFloorHarness(t, false) |
| + h.f.fixed["other"] = fixedEdges{age: time.Minute} |
| + h.refused(t, h.floor("replace", ""), Text("floor_box", "box", "other")) |
| +} |
| + |
| +// fixed_boxes missing or empty is a floor error, never "no fixed boxes". |
| +func TestFloorFixedBoxesRequired(t *testing.T) { |
| + for name, boxes := range map[string][]string{"missing": nil, "empty": {}} { |
| + t.Run(name, func(t *testing.T) { |
| + h := newFloorHarness(t, false) |
| + h.c.FixedBoxes = boxes |
| + h.floorError(t, h.floor("replace", ""), Text("floor_fixed_boxes")) |
| + }) |
| + } |
| +} |
| + |
| func TestFloorOldPinnedTemplate(t *testing.T) { |
| h := newFloorHarness(t, false) |
| h.f.templateRelease = "v0.34.9" |
diff --git a/internal/grouproll/text.go b/internal/grouproll/text.go| index 4ddd113a5..a93353050 100644 |
| --- a/internal/grouproll/text.go |
| +++ b/internal/grouproll/text.go |
| @@ -92,6 +92,8 @@ var text = map[string]string{ |
| "cancel_failed": "drain --cancel did not finish. The fence stays: {detail}", |
| "cancelled": "The drain was cancelled and the start fence removed.", |
| "floor_box": "Box {box} does not publish ha_handover: 1", |
| + "floor_fixed_missing": "Fixed box {box} is in fixed_boxes but has no edges file", |
| + "floor_fixed_boxes": "The config's fixed_boxes is missing or empty, so a fixed box with no edges file could be missed", |
| "floor_unreadable": "The edges file {key} cannot be read", |
| "floor_template": "The pinned launch template boots release {release}, below ha_floor", |
| "floor_version": "The roll's release {release} is below ha_floor", |
diff --git a/internal/grouproll/text_test.go b/internal/grouproll/text_test.go| index 91f722e39..9aefee514 100644 |
| --- a/internal/grouproll/text_test.go |
| +++ b/internal/grouproll/text_test.go |
| @@ -12,8 +12,10 @@ var placeholderPattern = regexp.MustCompile(`\{([a-z_]+)\}`) |
| // for every placeholder it names. A key whose text names a placeholder |
| // Text cannot fill, or leaves a brace behind, fails here. |
| func TestTextRendersEveryKey(t *testing.T) { |
| - if len(text) != 139 { |
| - t.Fatalf("text has %d keys, want the 139 approved", len(text)) |
| + // 139 approved, plus floor_fixed_missing and floor_fixed_boxes (held |
| + // floor capability, 2026-11-10), not yet copy-reviewed. |
| + if len(text) != 141 { |
| + t.Fatalf("text has %d keys, want the 139 approved plus 2", len(text)) |
| } |
| for key, raw := range text { |
| var args []string |