console: a placement with a box below the rootfs floor names the box and its release (whole-branch r2 P2)
RFS-4-C139 (fleet) and RFS-4-C140 (region), approved by copy review 2026-10-27 unchanged. C05 and C06 stay for no ready box, and for a box below the floor whose heartbeat names no release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+117
−18
approved_rootfs_copy_test.go+6 −1docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md+7 −0internal/console/rootfs.go+35 −12internal/console/rootfs_test.go+69 −5
diff --git a/approved_rootfs_copy_test.go b/approved_rootfs_copy_test.go| index ee05b43bf..f59bb678c 100644 |
| --- a/approved_rootfs_copy_test.go |
| +++ b/approved_rootfs_copy_test.go |
| @@ -21,7 +21,7 @@ import ( |
| const rootfsCopyRecordPath = "docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md" |
| // Canonical ids only: two digits from C01 to C99, three digits from C100 |
| -// (Plan 4 runs to RFS-4-C138). No leading zero on a three-digit id, no C00. |
| +// (Plan 4 runs to RFS-4-C140). No leading zero on a three-digit id, no C00. |
| var rootfsCopyIDPattern = regexp.MustCompile(`^RFS-[1-6]-C(0[1-9]|[1-9][0-9]{1,2})$`) |
| // rootfsCopyIDs is the deck's inventory, pinned as a literal list in the |
| @@ -104,6 +104,8 @@ var rootfsCopyIDs = []string{ |
| "RFS-4-C129", "RFS-4-C130", "RFS-4-C131", "RFS-4-C132", |
| "RFS-4-C133", "RFS-4-C134", "RFS-4-C135", "RFS-4-C136", |
| "RFS-4-C137", "RFS-4-C138", |
| + // Whole-branch review round 2: the mixed-version refusals |
| + "RFS-4-C139", "RFS-4-C140", |
| // Plan 5 |
| "RFS-5-C01", "RFS-5-C02", "RFS-5-C03", "RFS-5-C04", |
| "RFS-5-C05", "RFS-5-C06", "RFS-5-C07", "RFS-5-C08", |
| @@ -205,6 +207,9 @@ var rootfsCopyBuilt = []string{ |
| // Plan 4 Task 5: the first rootfs release of an app with binary |
| // instances (internal/console/rootfs.go) |
| "RFS-4-C11", |
| + // Whole-branch review round 2: a placement with a box below the |
| + // rootfs floor (internal/console/rootfs.go) |
| + "RFS-4-C139", "RFS-4-C140", |
| } |
| func mustParseRootfsRecord(t *testing.T) []copyRow { |
diff --git a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md| index 8467c89b0..362b66064 100644 |
| --- a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md |
| +++ b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md |
| @@ -389,6 +389,13 @@ From the plan: Placeholders: `<app>` an app; `<fleet>` a fleet name; `<region>` |
| | RFS-4-C137 | docs/site/rootfs.md (fact, R11) | Node stops at start without --jit. node --jitless does run, but only as an interpreter and without WebAssembly, which makes most apps much slower. Ship a Node app with --jit instead. | approved | |
| | RFS-4-C138 | docs/site/rootfs.md (fact, R11) | carlos ship --check warns when a process runs Node, Bun or Deno and the release is not shipped with --jit, because the check passes on your machine and the box then stops the process at start. | approved | |
| +### Instance create, mixed versions (whole-branch review round 2) |
| + |
| +| id | file | text | status | |
| +|---|---|---|---| |
| +| RFS-4-C139 | internal/console/rootfs.go | fleet <fleet> has a box on a platform release older than v0.29.0 (<box> runs <release>). every box of the fleet needs v0.29.0 or later before it can run a rootfs app | approved | |
| +| RFS-4-C140 | internal/console/rootfs.go | <region> has a box on a platform release older than v0.29.0 (<box> runs <release>). every box in <region> needs v0.29.0 or later before it can run a rootfs app | approved | |
| + |
| From the plan: (The WORKERS count `<running>/<total>` alone is a number, not copy, so it has no row. RFS-4-C20, unused in the first draft, is the sample page's database line.) |
| ## Plan 5: egress allow (`2026-10-24-rootfs-apps-5-egress-allow.md`) |
diff --git a/internal/console/rootfs.go b/internal/console/rootfs.go| index d49190554..5b8be5ab3 100644 |
| --- a/internal/console/rootfs.go |
| +++ b/internal/console/rootfs.go |
| @@ -24,7 +24,8 @@ import ( |
| // asks for a clear message; the box's own refusal (Plan 2) is the one that |
| // counts, and nothing here replaces it. |
| -// The refusals, one row of the copy deck each (RFS-4-C01, C02, C05 to C08). |
| +// The refusals, one row of the copy deck each (RFS-4-C01, C02, C05 to C08, |
| +// C139, C140). |
| const ( |
| // rootfsNotOwnBoxesMsg is RFS-4-C01, filled with the app. <name> and |
| // <fleet> stay as written: the user fills them in. |
| @@ -35,6 +36,12 @@ const ( |
| rootfsFleetNotReadyMsg = "none of fleet %s's boxes can run a rootfs app yet. a box can once it runs a platform release with rootfs support, on the nested layout, with overlap deploys on, and has passed its rootfs check" |
| // rootfsRegionNotReadyMsg is RFS-4-C06, filled with the region's name. |
| rootfsRegionNotReadyMsg = "no box in %s can run a rootfs app yet. a box can once it runs a platform release with rootfs support, on the nested layout, with overlap deploys on, and has passed its rootfs check" |
| + // rootfsFleetBelowFloorMsg is RFS-4-C139, filled with the fleet's name, |
| + // the first fresh box below the floor and the release it runs. |
| + rootfsFleetBelowFloorMsg = "fleet %s has a box on a platform release older than v0.29.0 (%s runs %s). every box of the fleet needs v0.29.0 or later before it can run a rootfs app" |
| + // rootfsRegionBelowFloorMsg is RFS-4-C140, filled with the region's |
| + // name, the box, its release, and the region's name again. |
| + rootfsRegionBelowFloorMsg = "%s has a box on a platform release older than v0.29.0 (%s runs %s). every box in %s needs v0.29.0 or later before it can run a rootfs app" |
| // rootfsReadyUnreadableMsg is RFS-4-C07. |
| rootfsReadyUnreadableMsg = "could not check which boxes can run a rootfs app. try again" |
| // rootfsReleasesUnreadableMsg is RFS-4-C08. |
| @@ -171,10 +178,12 @@ func (s *Server) rootfsPlacementRefusal(reg consoleRegistry, acct *Account, app, |
| // "dev") counts as below. Stale boxes are not candidates, as for |
| // readiness. |
| // |
| -// None ready, or a fresh candidate below the floor: 409 C05 naming the |
| -// fleet, or C06 naming the region (their second sentence names the |
| -// platform release). A read that fails, or any heartbeat that could not |
| -// be read (LoadBoxesComplete: incomplete evidence is neither ready nor not |
| +// A fresh candidate below the floor that names its release: 409 C139 |
| +// naming the fleet, or C140 naming the region, with the first such box |
| +// (by label) and its release. None ready, or a fresh candidate below the |
| +// floor that names no release (a heartbeat with no metrics): 409 C05 or |
| +// C06. A read that fails, or any heartbeat that could not be read |
| +// (LoadBoxesComplete: incomplete evidence is neither ready nor not |
| // ready): 503 C07. |
| func (s *Server) rootfsReadyRefusal(ctx context.Context, reg consoleRegistry, placed, region string) *doorRefusal { |
| unreadable := &doorRefusal{http.StatusServiceUnavailable, rootfsReadyUnreadableMsg} |
| @@ -184,18 +193,23 @@ func (s *Server) rootfsReadyRefusal(ctx context.Context, reg consoleRegistry, pl |
| now := time.Now() |
| fresh := func(b status.Box) bool { return !status.BoxStale(b, now, status.SnapshotPeriod) } |
| // admits: some fresh candidate is ready, and none is below the floor. |
| - admits := func(candidates []status.Box) bool { |
| - anyReady := false |
| + // When one is below it, old is the first by label that names a release. |
| + admits := func(candidates []status.Box) (ok bool, old *status.Box) { |
| + anyReady, below := false, false |
| for _, b := range candidates { |
| if !fresh(b) { |
| continue |
| } |
| if !boxAtRootfsFloor(b) { |
| - return false |
| + below = true |
| + if b.Metrics != nil && b.Metrics.Release != "" && (old == nil || b.Label < old.Label) { |
| + old = &b |
| + } |
| + continue |
| } |
| anyReady = anyReady || boxRootfsReady(b) |
| } |
| - return anyReady |
| + return anyReady && !below, old |
| } |
| if fleet, ok := registry.FleetPlacement(placed); ok { |
| regBoxes, err := reg.ListFleetBoxes(fleet) |
| @@ -220,9 +234,13 @@ func (s *Server) rootfsReadyRefusal(ctx context.Context, reg consoleRegistry, pl |
| candidates = append(candidates, b) |
| } |
| } |
| - if admits(candidates) { |
| + ok, old := admits(candidates) |
| + if ok { |
| return nil |
| } |
| + if old != nil { |
| + return &doorRefusal{http.StatusConflict, fmt.Sprintf(rootfsFleetBelowFloorMsg, fleet, old.Label, old.Metrics.Release)} |
| + } |
| return &doorRefusal{http.StatusConflict, fmt.Sprintf(rootfsFleetNotReadyMsg, fleet)} |
| } |
| hbs, complete, err := status.LoadBoxesComplete(ctx, s.cfg.Releases) |
| @@ -236,10 +254,15 @@ func (s *Server) rootfsReadyRefusal(ctx context.Context, reg consoleRegistry, pl |
| candidates = append(candidates, b) |
| } |
| } |
| - if admits(candidates) { |
| + ok, old := admits(candidates) |
| + if ok { |
| return nil |
| } |
| - return &doorRefusal{http.StatusConflict, fmt.Sprintf(rootfsRegionNotReadyMsg, s.rootfsRegionName(ctx, region))} |
| + name := s.rootfsRegionName(ctx, region) |
| + if old != nil { |
| + return &doorRefusal{http.StatusConflict, fmt.Sprintf(rootfsRegionBelowFloorMsg, name, old.Label, old.Metrics.Release, name)} |
| + } |
| + return &doorRefusal{http.StatusConflict, fmt.Sprintf(rootfsRegionNotReadyMsg, name)} |
| } |
| // rootfsRegionName is a region as C06 names it: its place, the name the |
diff --git a/internal/console/rootfs_test.go b/internal/console/rootfs_test.go| index dfc771837..cfe2877d1 100644 |
| --- a/internal/console/rootfs_test.go |
| +++ b/internal/console/rootfs_test.go |
| @@ -328,9 +328,18 @@ func TestRootfsReadyRefusesAPlacementWithABoxBelowTheFloor(t *testing.T) { |
| writeFleetBoxOn(t, fx, "home", label, "", ready, at, rel) |
| writeFleetBoxOn(t, fx, "", label, "", ready, at, rel) |
| } |
| - check := func(what string, refused bool) { |
| + // below is the release the old box names: C139 and C140 name it and |
| + // the box; a box naming none gets C05 and C06 (round 2 P2). |
| + check := func(what string, refused bool, below string) { |
| t.Helper() |
| - for placed, want := range map[string]string{"fleet/home": fleetWant, "": regionWant} { |
| + wants := map[string]string{"fleet/home": fleetWant, "": regionWant} |
| + if below != "" { |
| + wants = map[string]string{ |
| + "fleet/home": fmt.Sprintf(rootfsFleetBelowFloorMsg, "home", "pi-3", below), |
| + "": fmt.Sprintf(rootfsRegionBelowFloorMsg, "home", "pi-3", below, "home"), |
| + } |
| + } |
| + for placed, want := range wants { |
| ref := fx.srv.rootfsReadyRefusal(context.Background(), reg, placed, "") |
| if refused && (refStatus(ref) != http.StatusConflict || ref.Msg != want) { |
| t.Errorf("%s, %q: %v; want 409 %q", what, placed, ref, want) |
| @@ -342,13 +351,21 @@ func TestRootfsReadyRefusesAPlacementWithABoxBelowTheFloor(t *testing.T) { |
| } |
| write("pi-1", "v0.29.0", true, now) |
| write("pi-2", "v0.30.1", false, now) |
| - check("all new", false) |
| + check("all new", false, "") |
| for _, rel := range []string{"v0.28.17", "v0.28.99", "", "4f3c2a1", "dev"} { |
| write("pi-3", rel, rel == "v0.28.17", now) |
| - check("an old or unplaceable box ("+rel+") beside new ones", true) |
| + check("an old or unplaceable box ("+rel+") beside new ones", true, rel) |
| + } |
| + // Two old boxes: the first by label is named. |
| + write("pi-2", "v0.28.20", false, now) |
| + write("pi-3", "v0.28.17", true, now) |
| + if ref := fx.srv.rootfsReadyRefusal(context.Background(), reg, "fleet/home", ""); ref == nil || |
| + ref.Msg != fmt.Sprintf(rootfsFleetBelowFloorMsg, "home", "pi-2", "v0.28.20") { |
| + t.Errorf("two old boxes: %v; want pi-2 named", ref) |
| } |
| + write("pi-2", "v0.30.1", false, now) |
| write("pi-3", "v0.28.17", true, now.Add(-2*time.Hour)) |
| - check("a stale old box", false) |
| + check("a stale old box", false, "") |
| // A fresh heartbeat with no metrics names no release. |
| if boxAtRootfsFloor(status.Box{Label: "pi-1"}) { |
| t.Error("a box with no metrics read as at the floor") |
| @@ -636,6 +653,53 @@ func TestRootfsCreateStaticRecordStaysPlain(t *testing.T) { |
| } |
| } |
| +// [Whole-branch review round 2, P1] Through create and reconcile: a static |
| +// and an upstream-backed record of a rootfs app carry no runtime by |
| +// design, and the box's stripped-runtime backstop still mints their rows. |
| +// A socket-backed record with no runtime (what an older console writes) |
| +// beside them is left unmaterialized. |
| +func TestRootfsAppPlainRecordsReachTheBox(t *testing.T) { |
| + fx, token := unplacedRootfsApp(t) |
| + letStateUpstreams(t, fx, "paul@keymail.dev") // an upstream-backed record is an operator's |
| + const static, upstream, stripped = "shop.example.com", "shop-api.example.com", "shop-old.example.com" |
| + for _, body := range []string{ |
| + `{"host":"` + static + `","kind":"static"}`, |
| + `{"host":"` + upstream + `","addrs":["127.0.0.1:9000"]}`, |
| + } { |
| + if code, out := createShop(t, fx, token, body); code != http.StatusCreated { |
| + t.Fatalf("create %s = %d %s", body, code, out) |
| + } |
| + } |
| + rec, _ := storedShop(t, fx, upstream) |
| + if rec.Runtime != "" || rec.DerivesPaths() { |
| + t.Fatalf("upstream record %+v; want plain and upstream-backed", rec) |
| + } |
| + if err := provision.CreateRecord(context.Background(), fx.rel, provision.Record{Schema: 1, Host: stripped, Slug: "old", |
| + App: "shop", Account: fx.sqid, Region: rec.Region, Channel: rec.Channel, CreatedAt: time.Now().UTC()}); err != nil { |
| + t.Fatal(err) |
| + } |
| + if mk, err := release.ReadAppKindMarker(context.Background(), fx.rel, fx.sqid, "shop"); err != nil || mk == nil || mk.Kind != release.KindRootfs { |
| + t.Fatalf("shop's kind marker = %+v, %v; want rootfs", mk, err) |
| + } |
| + reg, err := registry.Open(filepath.Join(t.TempDir(), "registry.db")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { reg.Close() }) |
| + cfg := provision.ReconcileConfig{Region: rec.Region, DataDir: t.TempDir()} |
| + if err := provision.Reconcile(context.Background(), fx.rel, reg, cfg); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, host := range []string{static, upstream} { |
| + if got, err := reg.Get(host); err != nil || got == nil || got.Runtime != "" { |
| + t.Fatalf("%s's row = %+v, %v; want a plain row", host, got, err) |
| + } |
| + } |
| + if got, err := reg.Get(stripped); err != nil || got != nil { |
| + t.Fatalf("the stripped record minted %+v, %v; want no row", got, err) |
| + } |
| +} |
| + |
| // Plans-caps 3b and 4c leave always-on rootfs instances alone (row 2.5): |
| // with a plan catalog on, the create still mints hibernate false. |
| func TestRootfsCreateUnderPlansMintsAlwaysOn(t *testing.T) { |