carlos / platform Public

test: the web launch-file invariant includes CARLOS_MEMORY_MIB (#892 S1)

TestRootfsLaunchFilesCarryOnlyComposedEnv recomposes web's variables
by hand; it now adds the memory figure root was asked for, as
spawnRootfs does. Also adds the Astra brief for the branch review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 4dd2825acc10373f5adf8cc48a65be623271369b parent 1649f85
2 files changed, +72 −2
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md +69 −0
  • internal/activator/rootfs_invariants_test.go +3 −2

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md
new file mode 100644
index 000000000..5353adb63
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md
@@ -0,0 +1,69 @@
+# Review brief: #892 S1, CARLOS_MEMORY_MIB (branch and census), round 1 of 3
+
+Repo carlos/platform, branch `stateless-scale-1-memory-env`, commit 1649f85c.
+Under review: the diff `origin/main..1649f85c` (main is 01d6ca78), and the census
+card `docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md`.
+Authorities (merged on main): `docs/superpowers/specs/2026-11-11-stateless-replicas-production-scale-design.md`
+§4 S1 (rev 2, merged from `design-stateless-replicas-scale`), `docs/site/rootfs.md`,
+AGENTS.md "The census: the reviewer decides".
+
+You are an independent reviewer (the author is a Claude model). You give two
+verdicts: one for the branch, and one census verdict for every unit and re-pinned
+envelope on the card.
+
+## Fixed: do not re-argue
+
+- The spec's S1 rules: web gets the tier `spawnRootfs` passes root; a worker gets
+ `g.Tier`, the figure `LaunchRootfsWorker` passes root; release, runs and sessions
+ get none, and the name is removed from theirs.
+- Copy row PS-1-C01 is approved by delegation (Luna) and goes to Paul separately.
+ Do not edit the wording.
+
+## What to check
+
+1. For each of web, worker, release, run and session: is the variable exactly what
+ the spec says (the same number passed to root on that start, in MiB rounded
+ down, or absent), and can no tenant file, config bundle or earlier launch
+ environment put a different value in front of the process? Check every path
+ that writes a rootfs launch file (`writeRootfsLaunchFor`, `writeRootfsWorkerLaunch`).
+2. Does anything compare or hash a launch environment such that a new variable
+ changes behaviour: restarts on config change, edge page cache inputs
+ (`launchInputs`), escrow of the launch env, moves' box-owned variables, the
+ worker-equals-web check?
+3. Census: for each unit on the card (`spawnRootfs`, `rootfsCmdVars`,
+ `rootfsTTYVars`, `rootfsWorkerVars`) and the re-pinned `internal/activator`
+ envelope, apply AGENTS.md's rule: reject if root now opens, runs, queries or
+ follows anything new from a path or input a tenant, app or box agent controls,
+ or if a check, refusal or environment root relies on is weakened. Cite lines.
+4. Are the tests (`internal/activator/rootfs_memoryvar_test.go`, the updated
+ `TestRootfsWebLaunchCarriesTheContract`, `approved_stateless_scale_copy_test.go`)
+ able to fail for the behaviour they name?
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3, each with the evidence (file:line, verified), the
+failure scenario, a concrete fix and its fault family. Then the census table:
+`unit | approve or reject | lines read | reason`, one row per unit and one for the
+envelope. End with exactly one branch verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites; targeted `go test -run` is fine.
diff --git a/internal/activator/rootfs_invariants_test.go b/internal/activator/rootfs_invariants_test.go
index 4ead8e42a..6daf29b9f 100644
--- a/internal/activator/rootfs_invariants_test.go
+++ b/internal/activator/rootfs_invariants_test.go
@@ -1220,8 +1220,9 @@ var rootfsLaunchRows = map[string]func(t *testing.T) (instancectl.Launch, map[st
l := readLaunchNamed(t, b, rt, instancectl.GenLaunchFileName(7))
// What startRootfs composed: the file environment the generation
// launched with (its handle keeps it), the agent-owned variables,
- // then the socket and the database.
- vars := rootfsVars(b.agentOwnedVars(rt, sock+".control", p.(*unitProc).LaunchEnv(), true), sock, b.pathsFor(rt).dbPath)
+ // then the socket and the database, and the memory limit root was
+ // asked for (#892 S1).
+ vars := withMemoryVar(rootfsVars(b.agentOwnedVars(rt, sock+".control", p.(*unitProc).LaunchEnv(), true), sock, b.pathsFor(rt).dbPath), webMemoryMaxAsked(t, ctl))
if vars["SHOP_MODE"] != "live" {
t.Fatalf("the instance's file did not reach the composed variables: %v", vars)
}