carlos / platform Public

Managed fleets 1b: second Luna copy pass applied verbatim

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev a47bd5a1ea504b65e63fd54acd1b59b5b6ad42b8 parent 78f3d59
3 files changed, +10 −8
  • docs/site/cli.md +2 −2
  • fleets.go +7 −5
  • internal/provision/testdata/plan14-root-reads-managed-fleets-1b.tsv +1 −1

CI passed — run details

diff --git a/docs/site/cli.md b/docs/site/cli.md
index 3043e3594..7a4491290 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -2151,8 +2151,8 @@ will only refuse the label. Put it straight into the box's credential store.
Rotation is not revocation. A fresh token refuses the box's next dial-in with
the old one, but it does not evict a channel the box is already holding. If a
credential may be compromised, `detach-box` is the command that actually
-stops it. A box that has run instances is detached only once its machine is
-terminated, as the next section says.
+stops it. A box that has ever run an instance is detached only after its
+instances have moved and its machine is terminated, as the next section says.
On a fleet with two or more boxes, the console picks the box each instance
runs on. To take a box out, drain it, terminate its machine, then detach it:
diff --git a/fleets.go b/fleets.go
index e0bd7da48..76d74a733 100644
--- a/fleets.go
+++ b/fleets.go
@@ -81,10 +81,12 @@ const fleetsUsage = `usage: carlos fleets <create|add-box|rotate-token|tag-box|d
detach-box [--terminated] [--account <sqid|name>] <fleet> <label>
the hard revocation rotate-token is not: flips the box to
"detached", which refuses its next dial-in AND closes any
- channel it already holds. a box that ever ran instances the
- console placed on it is detached only with --terminated,
- which confirms its machine is gone. drain it before you
- terminate the machine. writes it never uploaded are lost.
+ channel it already holds. a box that has ever run an
+ instance placed on it by the console is detached only with
+ --terminated, which confirms its machine is gone. drain it
+ before you terminate the machine. writes the box never
+ uploaded are lost if its machine is terminated before its
+ instances have moved.
secrets-key [--account <sqid|name>] [--file <path>] <fleet> [<pubkey>]
register the public half of the fleet's secrets key. every secret
@@ -389,7 +391,7 @@ func runFleetsDetachBox(args []string) {
acctRaw := fs.String("account", "", "account (sqid or name) the fleet belongs to (default: your only account, or the configured/chosen one)")
acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes --account")
consoleFlag := consoleOption(fs, "console to detach through (default: the only logged-in one)")
- terminated := fs.Bool("terminated", false, "confirm that the box's machine is terminated. a box that has run instances is detached only with this")
+ terminated := fs.Bool("terminated", false, "confirm that the box's machine is terminated. a box that has ever run an instance is detached only with this flag")
fs.Usage = flagUsage(fs, "")
fs.Parse(args)
if fs.NArg() != 2 {
diff --git a/internal/provision/testdata/plan14-root-reads-managed-fleets-1b.tsv b/internal/provision/testdata/plan14-root-reads-managed-fleets-1b.tsv
index 6f6c19503..5260d266e 100644
--- a/internal/provision/testdata/plan14-root-reads-managed-fleets-1b.tsv
+++ b/internal/provision/testdata/plan14-root-reads-managed-fleets-1b.tsv
@@ -73,7 +73,7 @@ internal/activator/activator.go Service.doWake legacy accepted-legacy accepted-l
internal/activator/backend_exec.go ExecBackend.restorePlain legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): body of the frozen ExecBackend.Restore, which is now its dispatcher, with the seed marker reconciled before the warm-cache check; same staging fallback and replica restore;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: first asks haRestore(ctx, rt) (+whole:Route x2: rt to haRestore and to restoreHA); an HA host restores through restoreHA (hawake.go, a new unit) and never through the warm cache or the staging fallback; an error there fails the restore; a non-HA host takes the unchanged path;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 3, rule 6 start rule): the +whole:Route sites are calls taking rt: reconcileAssignment before the seed-marker check (a labelled row's copy not kept under rt.Assigned is moved into <DataDir>/.superseded/<host>/, never deleted), startAllowed on the warm-cache, restored and fresh paths (a labelled row may refuse with ErrNothingToRestore), and establishAssignment after a restore and before a fresh boot (writes the <db>.assigned marker). Task 6a's record clear after a restore is removed. An unlabelled row (Assigned "") takes none of these. Agent, not root; it refuses more, never less. file:Stat@1179,registry:Host@370,whole:Route@1036,whole:Route@1116,whole:Route@1392,whole:Route@243,whole:Route@323,whole:Route@390,whole:Route@5629,whole:Route@5719,whole:Route@6296,whole:Route@6527,whole:Route@659 35c21389c435c3f11579e2e9e38f2b0e7a00203f77ef539024b84539134b7385
internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test (generation proxy, hib, no-activator 404) is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance goes through the activator; binary rows unchanged;rev3=census-ruling-edge-roll-blip;basis=the tcpProxy and multiProxy calls pass e.hold (the per-Edge localHold set once in newEdge): a loopback TCP upstream that refuses is redialled for up to 13 s and a probed route with a local upstream waits for prober readmission instead of answering 502/503 (#434 part B); edge-side dial policy only, no read added, same 52 sites;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: after the alias fold, reads the regional_domains rows (e.reg.ListRegional; an error aborts the reload as every registry read here does) and applies them with foldRegional against the routes slice the same reload read; the added reads are that one registry list and the routes already read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 4 and 6: the forward case (fleetProxy toward the binding's FleetBox, throttled refusal); one refusal check before the switch from FleetArmVerdict (sidecar not judged; a non-ready forward row refused; a forward row always judged by FleetServeEligible, any other row only where tunnels are on; an alias of a refused source refused with it); the accountless note; path rows of a forward host not folded; no alias folded onto a refused row; refusedHosts held through every fold. ListFleets and FleetChannelAuth read before the loop (+registry:FleetBox, +registry:Host x7, +whole:Route x3). Serving only; the hub's agent, not root. Review R1 finding 2: the switch reads verdict.Served (FleetArmVerdict) by host; the forward case and the fleet-placed case take their fleet from it (served.Fleet) instead of FleetPlacement(t.Region), and an admitted forward row not Served continues rather than falling through (+registry:Host, -registry:Region); the same rows take the same arms; no read added. Review R2: the switch is on DispatchArm(t, viaFleet, tunnels) (the order moved there unchanged: forward only when in Arm, own Tunnel, fleet, socket, addrs, static, status, else continue), the fleet cases read verdict.Arm (renamed from Served), and the platform-alias fold is foldPlatformAliases with the same take (source entry, own paths, alias marks) and the same refusal log (-registry:Kind x2, -registry:Socket, -registry:Tunnel, +whole:Route: those reads moved into DispatchArm); same rows, same arms, same entries; no read added.;rev3=census-ruling-fleet-routes-followups;basis=the owners map is now e.reg.FleetOwners() instead of ListFleets folded inline: the same fresh-connection ListFleets read and the same name->account map (-registry:Account, -registry:Name, -whole:Fleet x2 move into Registry.FleetOwners); no read added; same error path (abort the reload);rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3): the two fleet proxy builds pass the row to fleetBoxOf(t) instead of reading t.FleetBox (-registry:FleetBox x2, +whole:Route x2); fleetBoxOf answers FleetLabel as authoritative when set, else FleetBox; an authoritative box has no fallback to another of the fleet's channels (503 errFleetDark instead). The edge in the agent, not root; it routes to fewer channels, never more. registry:Alias@23639,registry:Alias@23726,registry:Alias@24306,registry:Health@12592,registry:Health@12718,registry:Host@10273,registry:Host@10330,registry:Host@10366,registry:Host@11014,registry:Host@13201,registry:Host@13296,registry:Host@13584,registry:Host@13610,registry:Host@13662,registry:Host@18115,registry:Host@20022,registry:Host@20330,registry:Host@20357,registry:Host@21158,registry:Host@21730,registry:Host@24060,registry:Host@24109,registry:Host@4537,registry:Host@4591,registry:Host@4641,registry:Host@5508,registry:Kind@16451,registry:Kind@16473,registry:Prefix@21705,registry:Socket@11078,registry:Socket@20338,registry:Status@4462,registry:Target@21717,registry:Tunnel@8889,registry:Version@16432,registry:Version@16534,whole:RegionalDomain@24776,whole:Route@10421,whole:Route@10529,whole:Route@11134,whole:Route@130,whole:Route@13735,whole:Route@13799,whole:Route@13850,whole:Route@20390,whole:Route@20397,whole:Route@20493,whole:Route@21593,whole:Route@22761,whole:Route@24768,whole:Route@3217,whole:Route@3275,whole:Route@5537,whole:Route@6413,whole:Route@6521,whole:Route@8951,whole:RouteAlias@23610,whole:RoutePath@21136 9725995383ae7c27bb9643adfe93de08e486b3442870e32d116ecbce830a87d5
internal/registry/fleets.go Registry.migrateFleets legacy accepted-legacy accepted-legacy;rev3=J1,J4;basis=route-and-input;rev3=census-ruling-fleet-secrets-key;basis=fleet secrets key (#366): four more idempotent migration statements: ALTER TABLE fleets ADD COLUMN for secrets_pubkey, secrets_key_fp, secrets_key_set_at, secrets_key_set_by (duplicate column ignored) and CREATE UNIQUE INDEX IF NOT EXISTS fleets_secrets_key_fp ON fleets (secrets_key_fp) WHERE secrets_key_fp != ''; CREATE TABLE IF NOT EXISTS fleet_secrets_key_fps (fp primary key, fleet, account, at), the permanent reservation of every registered fingerprint to its fleet, and an idempotent backfill INSERT ... SELECT of the fleets rows' current non-empty fingerprints ON CONFLICT(fp) DO NOTHING; fixed SQL, no new read of any input;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 6b): two more idempotent statements, ALTER TABLE fleet_boxes ADD COLUMN draining_since INTEGER and labelled_at INTEGER (duplicate column ignored), the +file:Exec and +registry:sql sites. Fixed SQL, no input. Registry side, not root. file:Exec@1207,file:Exec@1699,file:Exec@1933,file:Exec@2471,file:Exec@2686,file:Exec@313,file:Exec@57,file:Exec@735,registry:sql@1207,registry:sql@1699,registry:sql@1933,registry:sql@2471,registry:sql@2686,registry:sql@313,registry:sql@57,registry:sql@735 7d2d5e945297abc2a6c97c2b75895e5c6602200a2bea505c4858f7d5a2d0da86
-@coverage . a910a697efcda9d488b70cff1d8579bfdc9b09b6752075146bc2512a224e94ac
+@coverage . 72c07efa951bb35eac60f704e1afeb7da4224608ced01e395f9fd433c4ee5374
@coverage internal/activator 5da685ac59810f875045024ef5a06c1e44070e666c978c0919eb5f6cd845c78e
@coverage internal/edge 095d70162367b564b90e8b1361d42fad0fd01c5779062098cf2a0446b72c575d
@coverage internal/host 7bc18dca53c5776d97abd9c7c7208c90b040f95c810f7d8734351bd3df3afa04