carlos / platform Public

egress ranges: fuller apps set help, true warning, fleet floor witnesses

Review round 1 on Task 3 (#1357). The apps set detailed help names the
8-entry limit, host bits refused, the v0.43.0 floor and the box's own
address rule. The not-checked warning no longer calls every listed box
a fleet box. New witness: the floor counts fleet boxes, skips detached
ones and refuses 503 on an unreadable fleet heartbeat. Copy record and
the root envelope's census overlay follow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 8e5b29c27424eedf0a5edce165defe536dab1018 parent 04ee387
6 files changed, +58 −7
  • apps_policy.go +5 −2
  • apps_policy_test.go +1 −1
  • docs/site/cli.md +1 −1
  • docs/superpowers/plans/2026-10-21-instance-policy-copy.json +2 −2
  • internal/console/egressfleet_test.go +48 −0
  • internal/provision/testdata/plan14-root-reads-egress-allow-cidr-console.tsv +1 −1

Intent

Attributed to this commit: 22.6 g CO₂e (2,609,370 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on egress-allow-cidr, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/apps_policy.go b/apps_policy.go
index 46b9d50ae..170995bcf 100644
--- a/apps_policy.go
+++ b/apps_policy.go
@@ -37,7 +37,10 @@ const (
appsSetFlagSize = "the size the app's instances run at: small, standard, large or xlarge. default uses the build's size. system operators only"
instancesSetFlagSize = "this instance's size: small, standard, large or xlarge. default follows the app's size. system operators only"
appsSetPolicyUsage = `Only system operators may pass --egress-allow or --size. A change reaches
-the app's boxes within seconds on a box following the deployment's change index, or within about 33 minutes on another box.`
+the app's boxes within seconds on a box following the deployment's change index, or within about 33 minutes on another box.
+--egress-allow takes at most 8 entries. A range starts at its first address, so
+10.0.64.5/20 is refused; write 10.0.64.0/20. Ranges need v0.43.0 or later on
+every box, and a box refuses a range that holds one of its own addresses.`
appsSetBadEgress = "apps set: --egress-allow: %v"
appsSetBadSize = "apps set: --size is small, standard, large, xlarge or default, not %q"
instancesSetBadSize = "instances set: --size is small, standard, large, xlarge or default, not %q"
@@ -45,7 +48,7 @@ the app's boxes within seconds on a box following the deployment's change index,
appsPolicyChanged = "the policy changed while this ran. run it again"
appsSetEgressDone = "egress allow for %s set to %s"
appsSetEgressCleared = "egress allow for %s cleared"
- appsSetEgressNotChecked = "not checked against fleet boxes %s, which do not publish their addresses. each one still refuses an entry that holds its own address"
+ appsSetEgressNotChecked = "not checked against these boxes, which publish no address list (fleet boxes never do): %s. each one still refuses an entry that holds its own address"
appsSetSizeDone = "default size for %s set to %s. instances with their own size are unchanged"
appsSetSizeCleared = "default size for %s set to the build's size. instances with their own size are unchanged"
instancesSetSizeDone = "%s size set to %s"
diff --git a/apps_policy_test.go b/apps_policy_test.go
index cb258815a..3974a8bb5 100644
--- a/apps_policy_test.go
+++ b/apps_policy_test.go
@@ -324,7 +324,7 @@ func TestAppsSetPrintsNotChecked(t *testing.T) {
if out.String() != want {
t.Fatalf("stdout = %q, want %q", out.String(), want)
}
- if want := "not checked against fleet boxes box-c, which do not publish their addresses. each one still refuses an entry that holds its own address\n"; !strings.HasSuffix(out.String(), want) {
+ if want := "not checked against these boxes, which publish no address list (fleet boxes never do): box-c. each one still refuses an entry that holds its own address\n"; !strings.HasSuffix(out.String(), want) {
t.Fatalf("stdout = %q, want it to end %q", out.String(), want)
}
diff --git a/docs/site/cli.md b/docs/site/cli.md
index bbfdeeddd..deded7b41 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -261,7 +261,7 @@ carlos apps show shop
An instance cannot reach a private address unless its app allows it. `--egress-allow` takes the app's whole list, comma-separated, and replaces the list before it. To drop one entry, pass the list without it; `--egress-allow ""` removes them all. Each entry is a single IP address or a private range such as `10.0.64.0/20` or `fd00:5::/64`, with no port or zone. A range is at least a /16 for IPv4 or a /48 for IPv6, and starts at its first address, so `10.0.64.5/20` is refused. Public addresses are refused because instances can reach them already, and so are loopback, link-local, multicast and reserved addresses, the cloud metadata service and the NAT64 prefix, and any range that holds one of them. An app may allow at most 8 entries, and a range counts as one.
-A change that adds an entry is checked against the deployment's boxes. An entry that holds an address of one of them is refused, and so is any new entry while a box does not publish its address list yet. Fleet boxes that publish no address list are named after the change, and each of them still refuses an entry that holds its own address. A range can be added only while every box runs v0.43.0 or later. Single addresses work on any release. An allow takes effect only on a box where every instance runs nested (see `carlos status --layout`). It does not take effect while host claims are on. If a box later takes an allowed address, or an address in an allowed range, the console sends an alert.
+A change that adds an entry is checked against the deployment's boxes. An entry that holds an address of one of them is refused, and so is any new entry while a box does not publish its address list yet. Boxes that publish no address list are named after the change (fleet boxes never publish one), and each of them still refuses an entry that holds its own address. A range can be added only while every box runs v0.43.0 or later. Single addresses work on any release. An allow takes effect only on a box where every instance runs nested (see `carlos status --layout`). It does not take effect while host claims are on. If a box later takes an allowed address, or an address in an allowed range, the console sends an alert.
The sizes are `small` (256 MiB of memory), `standard` (512 MiB), `large` (1 GiB) and `xlarge` (2 GiB), with CPU and IO to match. `carlos apps set --size` sets the app's size, and `--size default` goes back to the build's size. `carlos instances set --size` gives one instance a size of its own, and `--size default` makes it follow the app's size again. A size above `standard` is refused when it is more than a quarter of the memory on the smallest box the app can run on, or when one of those boxes reports no memory total.
diff --git a/docs/superpowers/plans/2026-10-21-instance-policy-copy.json b/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
index 460ea14aa..5f7cf86dd 100644
--- a/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
+++ b/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
@@ -57,7 +57,7 @@
{"id": "IP1-35", "file": "apps_policy.go", "text": "the policy changed while this ran. run it again"},
{"id": "IP1-36", "file": "apps_policy.go", "text": "egress allow for %s set to %s"},
{"id": "IP1-37", "file": "apps_policy.go", "text": "egress allow for %s cleared"},
- {"id": "IP2-30", "file": "apps_policy.go", "text": "not checked against fleet boxes %s, which do not publish their addresses. each one still refuses an entry that holds its own address"},
+ {"id": "IP2-30", "file": "apps_policy.go", "text": "not checked against these boxes, which publish no address list (fleet boxes never do): %s. each one still refuses an entry that holds its own address"},
{"id": "IP1-38", "file": "apps_policy.go", "text": "default size for %s set to %s. instances with their own size are unchanged"},
{"id": "IP1-39", "file": "apps_policy.go", "text": "default size for %s set to the build's size. instances with their own size are unchanged"},
{"id": "IP1-42", "file": "apps_policy.go", "text": "%s size set to %s"},
@@ -68,7 +68,7 @@
{"id": "IP1-50", "file": "apps_policy.go", "text": "private addresses or ranges every instance of the app may reach, comma-separated, never a port. a range is at least /16 (IPv4) or /48 (IPv6). pass the whole list; \"\" clears it. system operators only"},
{"id": "IP1-51", "file": "apps_policy.go", "text": "the size the app's instances run at: small, standard, large or xlarge. default uses the build's size. system operators only"},
{"id": "IP1-52", "file": "apps_policy.go", "text": "this instance's size: small, standard, large or xlarge. default follows the app's size. system operators only"},
- {"id": "IP1-53", "file": "apps_policy.go", "text": "Only system operators may pass --egress-allow or --size. A change reaches\nthe app's boxes within seconds on a box following the deployment's change index, or within about 33 minutes on another box."},
+ {"id": "IP1-53", "file": "apps_policy.go", "text": "Only system operators may pass --egress-allow or --size. A change reaches\nthe app's boxes within seconds on a box following the deployment's change index, or within about 33 minutes on another box.\n--egress-allow takes at most 8 entries. A range starts at its first address, so\n10.0.64.5/20 is refused; write 10.0.64.0/20. Ranges need v0.43.0 or later on\nevery box, and a box refuses a range that holds one of its own addresses."},
{"id": "IP1-54", "file": "apps_policy.go", "text": "usage: carlos apps show <app> [--account <sqid|name>] [--account-id <sqid>] [--console <origin>]"},
{"id": "IP1-60", "file": "apps_policy.go", "text": "egress allow %s"},
{"id": "IP1-61", "file": "apps_policy.go", "text": "default size %s"},
diff --git a/internal/console/egressfleet_test.go b/internal/console/egressfleet_test.go
index 4e44fa723..106212b24 100644
--- a/internal/console/egressfleet_test.go
+++ b/internal/console/egressfleet_test.go
@@ -1133,3 +1133,51 @@ func TestEgressViewMarksARange(t *testing.T) {
t.Fatalf("conflicts = %v, want [10.0.64.0/20]", e.Conflicts)
}
}
+
+// The floor reads every fleet's heartbeats as well as the platform's: an
+// old box under fleets/<name>/ refuses a range, a detached one does not
+// count, and a fleet heartbeat that cannot be read refuses with 503.
+func TestEgressGrantRangeFloorCountsFleetBoxes(t *testing.T) {
+ t.Parallel()
+ fx := newConsoleFixture(t)
+ now := time.Now()
+ putEdgesAddrs(t, fx.rel, "annie", []string{"10.0.1.5"})
+ setBoxRelease(t, fx.rel, "annie", "v0.43.0", now)
+ reg := openTestReg(t, fx)
+ t.Cleanup(func() { reg.Close() })
+ if _, err := reg.CreateFleet(registry.Fleet{Name: "fx", Account: fx.sqid, Bucket: "fx-data"}); err != nil {
+ t.Fatal(err)
+ }
+ for _, label := range []string{"bx-1", "bx-2"} {
+ if err := reg.AddFleetBox(registry.FleetBox{Fleet: "fx", Label: label, TokenHash: strings.Repeat("a", 64)}); err != nil {
+ t.Fatal(err)
+ }
+ }
+ fleet := release.NewPrefixStore(fx.rel, "fleets/fx/")
+ setBoxRelease(t, fleet, "bx-1", "v0.43.0", now)
+ setBoxRelease(t, fleet, "bx-2", "v0.42.1", now)
+ ctx := context.Background()
+
+ _, ref := fx.srv.egressGrantCheck(ctx, prefixes(t, "10.0.64.0/20"))
+ if want := "box bx-2 runs v0.42.1. allowing a range needs v0.43.0 or later on every box. single addresses are unaffected"; ref == nil ||
+ ref.Status != http.StatusConflict || ref.Msg != want {
+ t.Fatalf("a range with fleet box bx-2 on v0.42.1 = %+v, want 409 %q", ref, want)
+ }
+
+ if err := reg.SetFleetBoxStatus("fx", "bx-2", "detached"); err != nil {
+ t.Fatal(err)
+ }
+ if _, ref := fx.srv.egressGrantCheck(ctx, prefixes(t, "10.0.64.0/20")); ref != nil {
+ t.Fatalf("a range with old bx-2 detached = %+v, want no refusal", ref)
+ }
+
+ putFixtureObject(t, fleet, "status/boxes/bx-3.json", []byte(`{"label":"bx-3",`))
+ _, ref = fx.srv.egressGrantCheck(ctx, prefixes(t, "10.0.64.0/20"))
+ if want := "the fleet's list of boxes could not be read. try again in a minute"; ref == nil ||
+ ref.Status != http.StatusServiceUnavailable || ref.Msg != want {
+ t.Fatalf("a range with a fleet heartbeat unreadable = %+v, want 503 %q", ref, want)
+ }
+ if _, ref := fx.srv.egressGrantCheck(ctx, prefixes(t, "10.0.64.5")); ref != nil {
+ t.Fatalf("a single address with a fleet heartbeat unreadable = %+v, want no refusal", ref)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-egress-allow-cidr-console.tsv b/internal/provision/testdata/plan14-root-reads-egress-allow-cidr-console.tsv
index 53b026976..fd67a0f33 100644
--- a/internal/provision/testdata/plan14-root-reads-egress-allow-cidr-console.tsv
+++ b/internal/provision/testdata/plan14-root-reads-egress-allow-cidr-console.tsv
@@ -1,4 +1,4 @@
# Census overlay egress-allow-cidr-console, written by census-propose (#369). census-ruling-egress-allow-cidr-console, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-egress-allow-cidr-console.md.
# 0 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-@coverage . 45601ab03aeafb26666d00000451b3a286cd406fc3ee80d7ca3962326bc73d70
+@coverage . cdbb327b7c294a63068fb058a6056135dde0a871379b5043203ab9371546c6aa
@coverage internal/release d5ad27f00e653c322b60826f5174354b6f2deae4f27f41bdd148aad959a35fd1