carlos / platform Public

instance policy: plan 3 copy deck and the Luna copy brief for plans 1 to 3 (PM-1, #328, #329)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 21c28038d29106e77b2b8dade43790e9025ede61 parent 879a9c4
2 files changed, +573 −0
  • docs/superpowers/notes/copy-instance-policy-plan3.md +116 −0
  • docs/superpowers/specs/LUNA-COPY-BRIEF-INSTANCE-POLICY.md +457 −0
diff --git a/docs/superpowers/notes/copy-instance-policy-plan3.md b/docs/superpowers/notes/copy-instance-policy-plan3.md
new file mode 100644
index 000000000..c65d563d2
--- /dev/null
+++ b/docs/superpowers/notes/copy-instance-policy-plan3.md
@@ -0,0 +1,116 @@
+# Instance sizes and egress allows, plan 3: copy deck (pending review)
+
+Every user-facing string plan 3 (`2026-10-21-instance-policy-3-sizes`)
+added or changed and that still exists, for the one copy review that covers
+plans 1 to 3 before the branch merges (rulings C10/C11: plan 3's Task 14
+folds into PM-1). After the review, the approved text goes into the code
+verbatim and `approved_instance_policy_copy_test.go` pins it, beside plan
+1's and plan 2's decks (`copy-instance-policy-plan1.md`,
+`copy-instance-policy-plan2.md`).
+
+Collected from the plan's Task 14 table, the Task 5, 6, 9, 10 and 12a
+reports, and from the current code (`git diff e5ab0e8a..HEAD`, non-test
+files, plan 3's own first-parent commits; plan 3 starts at e5ab0e8a). Ruling
+12 (spec rev 10: no live memory change) removed Task 5's door string 6 and
+its in-flight variant (`memory never shrinks while the slice is
+populated...`) and Task 6's log strings 2, 3 and 7, and added string 7
+(task-12a-report.md). They are not listed. Columns:
+
+- **id**: this deck's id, for the review and the approved-copy test.
+- **where**: the Go constant or call site, `file:line` at the PM-1 base
+ commit 879a9c4a.
+- **text**: the current text, exactly. `%s` and `%d` are filled at run time.
+- **seen**: where a person reads it.
+- **base**: how many non-test Go files held this exact text at plan 3's base
+ commit `e5ab0e8a` (a shared string needs its own review, and a rewrite
+ must not hit its other uses). `0` means new in plan 3.
+
+Who sees what: `carlos status --layout` is an operator view (ops account
+owners and `CARLOS_SYSTEM_OPERATORS`). The size door and the lines printed
+after a size change are seen by system operators, the only people who may
+set a size. A door message reaches a person as the CLI prints the console's
+JSON `error` after `apps set: ` or `instances set: `; it is also what an API
+caller reads in the response body.
+
+## 1. The size door (Task 9, `internal/console/policysize.go`)
+
+A size above `standard` is checked against every box the app can run on.
+
+| id | where | text | seen | base |
+|---|---|---|---|---|
+| IP3-01 | internal/console/policysize.go:39 `sizeQuarterMsg` | %s is more than a quarter of the memory on %s (%d MiB). Choose a smaller size. | 409 on `apps set --size` / `instances set --size`; the size, the smallest box, its memory total | 0 |
+| IP3-02 | internal/console/policysize.go:40 `sizeNoTotalMsg` | %s does not publish its memory total, so only small and standard can be set. Upgrade the box, then try again. | 409; the box. A platform box on a release from before plan 3, or a box with no total from its edges file, headroom or its own fresh status report (Task 9 fix round: a fleet box takes its total from its status report, so it is refused only when all three are missing) | 0 |
+| IP3-03 | internal/console/policysize.go:41 `sizeUnreadMsg` | Could not read every box's memory total, so only small and standard can be set. Try again in a minute. | 503 (C7b): the box listing or a fleet roster could not be read | 0 |
+
+## 2. `carlos status --layout` (Task 10, `status_instances.go`; Task 7, `internal/host/sizestatus.go`)
+
+| id | where | text | seen | base |
+|---|---|---|---|---|
+| IP3-04 | status_instances.go:159 `statusLayoutHeading` | `BOX HOST LAYOUT SIZE EGRESS REASON` | the heading. Replaces plan 2's `BOX HOST LAYOUT EGRESS REASON` (IP2-01), itself a change to the isolated-exec layout's approved `BOX HOST LAYOUT REASON` | 0 (plan 2's heading: 1) |
+| IP3-05 | internal/host/sizestatus.go:95 | swap | SIZE cell: a swap holds the instance's parent slice at the overlap size | 8 (common literal) |
+| IP3-06 | internal/host/sizestatus.go:97 | ? | SIZE cell: the size in force could not be read | 23 (common literal) |
+| IP3-07 | internal/host/sizestatus.go:101 | `<in force>><wanted>`, e.g. `standard>large` | SIZE cell: the instance runs at one size and its policy wants another; the wanted one takes effect later (IP3-09) | 0 |
+| IP3-08 | internal/host/sizestatus.go:114, :118; status_instances.go:256 | - | SIZE cell: a row that is not nested, or not awake, or a box that reports no sizes | 102 (common literal) |
+| IP3-09 | status_instances.go:160 `statusLayoutSizePending` | A size after > takes effect when the instance next starts cold. Restart the instance to apply it now. | printed once after the table when any SIZE cell holds `>`, before the box warnings | 0 |
+
+### Reviewer items for this section
+
+- **`-` beside `—`.** An empty SIZE or EGRESS cell is `-` (hyphen), but an
+ empty REASON cell is `—` (an em dash glyph, from `dashIfEmpty`,
+ routes_cli.go:128, shared with `carlos routes` and `carlos restart` in 5
+ files at base). A row with nothing to say reads `nested - - —`. Choose
+ one glyph for this table; a change can be local to `status --layout`
+ (status_instances.go:276) without touching the shared helper.
+- **The `>` footnote.** It prints after the table and before the `WARNING:`
+ paragraphs about mixed boxes and box modes, separated by a blank line. The
+ cell order is in force first, wanted second (`standard>large`); the
+ footnote says "a size after >", that is the wanted one. Choose whether the
+ footnote stays there, and whether it explains the order.
+- **The footnote's facts after ruling 12.** Memory never changes live. A
+ growth lands at the next start (a wake or a cold start) or at the next
+ deploy (a swap starts its successor at the larger of the new size and the
+ running one). A shrink waits for a cold start: a deploy keeps the larger
+ memory. CPU and IO weights change at once, so the cell shows only the
+ memory size. "Restart the instance to apply it now" is true for both.
+
+## 3. Lines after a size change (Tasks 10 and 12a, `apps_policy.go`)
+
+After a successful `apps set --size` (set or `default`) or `instances set
+--size` (set or `default`), the CLI prints IP1-38/IP1-39 or IP1-42/IP1-43,
+then one IP3-10 line per box the console checked, then IP3-11.
+
+| id | where | text | seen | base |
+|---|---|---|---|---|
+| IP3-10 | apps_policy.go:110 `sizeCommittedLine` | %s: %d MiB committed to awake instances, of %d MiB. %d MiB free. | stdout, one per box; box, committed, total, free | 0 |
+| IP3-11 | apps_policy.go:115 `sizeTakesEffectLine` | The new memory size applies when an instance next starts or is deployed. CPU and IO apply now. | stdout, after the committed lines (ruling 12, string 7) | 0 |
+
+Example:
+
+ shop instances run at large unless an instance has its own size
+ kass-1: 2304 MiB committed to awake instances, of 3884 MiB. 1200 MiB free.
+ The new memory size applies when an instance next starts or is deployed. CPU and IO apply now.
+
+## 4. Left out, and why
+
+- Root's `/size` refusals and errors (`size %q is not a platform size`,
+ `memory_max %q is not a platform size's memory`, `gen %q is not a
+ generation`, `host %q is not a host`, `<unit> is not active (...)`,
+ `show <name>: MemoryMax %q is not a number`, `control drop-in: ...`,
+ `memory_max is not a size parameter: memory changes only at a start`):
+ internal error fragments between root and the agent, logged only.
+- `activator: no live size change for this host` and the activator's and
+ instance-control's size log lines (`... cpu and io applied live`,
+ `... retried next sweep`, `... no swap until a write settles it`,
+ `size %q is not one this box knows; using the build's tier`): log lines.
+- `console: size check ...` log lines: diagnostics.
+- The JSON keys `size`, `committed`, `committed_mib`, `total_mib`,
+ `free_mib`, `box_mem_total_mib`, `size_committed_mib`.
+- Task 2's notes on `memory_max %d is not a platform tier` and `memory_max
+ %q is not one tier or two` (instancectl): internal fragments.
+
+## 5. Approved strings this plan changed
+
+- The `status --layout` heading (IP3-04). No JSON record holds it;
+ `status_instances_test.go` pins it.
+- None of `zdd.*` beyond plan 2's `zdd.list.header`: plan 3 leaves `SIZE`
+ out of `instances list`.
diff --git a/docs/superpowers/specs/LUNA-COPY-BRIEF-INSTANCE-POLICY.md b/docs/superpowers/specs/LUNA-COPY-BRIEF-INSTANCE-POLICY.md
new file mode 100644
index 000000000..3f0bbdd01
--- /dev/null
+++ b/docs/superpowers/specs/LUNA-COPY-BRIEF-INSTANCE-POLICY.md
@@ -0,0 +1,457 @@
+# Copy pass brief: instance policies, egress allows and sizes (#328, #329)
+
+You are reviewing user-facing strings for a hosting platform's CLI, console
+and docs. Paul, the owner, delegated this review to you. Apply his house
+rules and return improved strings.
+
+The feature: a system operator sets an app's instance policy. The policy
+has two parts. An **egress allow** is a list of private IP addresses the
+app's instances may reach (they can reach nothing private otherwise). A
+**size** (`small`, `standard`, `large`, `xlarge`) sets the memory, CPU and IO
+an instance runs with: an app has a default size, and one instance may have
+its own. The decks with every string's context are
+`docs/superpowers/notes/copy-instance-policy-plan1.md`, `-plan2.md` and
+`-plan3.md`; read them for anything this brief leaves unclear.
+
+## House rules
+
+- Plain words, short sentences, no jargon, no marketing tone, no
+ exclamation marks.
+- No em dashes or en dashes used as dashes. Where you would use one, end the
+ sentence with a full stop and start a separate sentence that **continues
+ in lower case**, the way Go error strings and this CLI write. Paul's own
+ example: "could not provision the store — re-run `carlos store create` to
+ resume" becomes "could not provision the store. re-run `carlos store
+ create` to resume". If the second half is a bare command with no verb,
+ give it a verb: "not approved for object storage. run `carlos store
+ apply` to ask for it". Semicolons are fine; the rule is about em dashes.
+- Casing by kind:
+ - **CLI and door strings** (everything in sections 1 to 7 below except
+ the rows marked *flash*, *alert*, *help paragraph* or *table*): lower
+ case at the start and after every full stop, no full stop at the very
+ end. Flag names, command names, variable names, `IP`, `CPU`, `IO`,
+ `MiB`, `NAT64` and size names keep their own spelling.
+ - **Browser flashes** (marked *flash*), the **alert** (marked *alert*),
+ **help paragraphs** (marked *help paragraph*) and **docs** (section 8):
+ ordinary sentence case with full stops, as the surrounding text has.
+ They still use no em dashes.
+ - **Table headings and cell words** (marked *table*): keep their form
+ (upper-case headings, lower-case words).
+- Keep every placeholder (`%s`, `%d`, `%q`, `%v`) and their order. Go cannot
+ reorder them. If a placeholder must move, say so in Flags instead.
+- Leave flag names (`--egress-allow`, `--size`, `--account`, ...), command
+ names (`carlos apps set`, `carlos apps show`, `carlos instances set`,
+ `carlos status --layout`, `carlos auth login --console <url>`), JSON field
+ names (`egress_allow`, `default_size`, `size`, `If-Match`,
+ `If-None-Match: *`), variable names and the size names exactly as they
+ are.
+- Do not name the product. Use neutral examples only (`shop`,
+ `shop-a.example.com`, `10.0.5.20`, `kass-1`); never a real customer.
+- Human text only. Internal error fragments, log lines, diagnostics and
+ JSON keys are out of scope and not listed.
+- A `<br>` in a cell is a line break. Keep the breaks of a multi-line
+ string where they are unless you have a reason.
+
+## Facts that must stay true
+
+- Only system operators may set or read a policy. App members see only the
+ `EGRESS` column of `carlos instances list` with its fixed words.
+- The CLI records the policy at the console; it does not watch a box apply
+ it. A box that follows the deployment's change index sees a change within
+ seconds; any other box within about 33 minutes. So a success line must say
+ what was **set**, not claim it is already in force.
+- `--egress-allow` takes the app's **whole** list, comma-separated, and
+ replaces the list before it. `--egress-allow ""` removes every address.
+ There is no way to add or drop one address on its own: to drop one, pass
+ the list without it.
+- An allow names single IP addresses: no range, port or zone. Public
+ addresses are refused because instances can already reach them; loopback,
+ unspecified, link-local, multicast, reserved, the cloud metadata service
+ and the NAT64 prefix are refused. At most 8 per app.
+- A grant that adds an address is refused when the address belongs to one
+ of the deployment's own boxes, and while any box does not yet publish its
+ address list (an older release). Boxes that publish no list at all are
+ named as "not checked".
+- An allow is honoured only on a box where every instance runs nested, and
+ not yet under host claims. A box that later takes an allowed address
+ makes the console alert; the allow stays in force until an operator
+ changes the list.
+- `apps set --size <size>` sets the app's default size; `apps set --size
+ default` goes back to the size each build asks for ("the build's size").
+ `instances set --size <size>` gives one instance its own size; `instances
+ set --size default` makes it follow the app's size again. An empty
+ `--size` is refused (unlike the update settings of `instances set`, where
+ an empty value clears).
+- 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 such a box reports
+ no memory total. A box reports a total from this release on, or from its
+ own status report; a fleet box can be refused only when neither exists.
+- Memory never changes on a running instance. A larger size takes effect
+ at the instance's next start (a wake or a cold start) or its next deploy.
+ A smaller size takes effect only at a cold start; a deploy keeps the
+ larger memory. CPU and IO weights change at once. Restarting the instance
+ applies the new memory now, in both directions.
+- Only one console per deployment may write policies at a time (the
+ "policy writer"). It holds a lease while it writes; another console
+ refuses policy changes, and refuses app creates that would have to clear
+ an earlier app's leftover policy, until the lease lapses (up to 15
+ minutes).
+- The alert's account is the account's sqid (a short id such as `bab`); the
+ console has no name for it at that point.
+
+## How the strings appear
+
+- A door string is the console's JSON `error`. The CLI prints it after
+ `apps set: ` or `instances set: `, bare for `apps show`, and an API caller
+ reads it in the response body. Example: `apps set: could not read the
+ policy. try again`.
+- IP1-01 to IP1-14 also appear after `apps set: --egress-allow: ` (IP1-31)
+ and in `carlos status --layout`'s REASON cell after `egress: `.
+- `carlos status --layout` prints:
+
+ BOX HOST LAYOUT SIZE EGRESS REASON
+ kass-1 shop-a.example.com nested standard>large !10.0.5.20,fd00:5::20 —
+ kass-1 shop-b.example.com foreign - 10.0.5.20 !refused egress: 10.0.5.1: an address of this box (10.0.5.0/24)
+ kass-1 shop-c.example.com nested large - !box not wholly nested egress: shop-d.example.com is flat
+ kass-1 shop-e.example.com nested - - !not yet supported under claims egress: not yet supported under claims
+
+ A size after > takes effect when the instance next starts cold. Restart the instance to apply it now.
+
+- `carlos instances list` (app members) adds an `EGRESS` column with
+ `10.0.5.20 !failing` and REASON `egress: the box could not apply the
+ allow, and tries again`.
+- `carlos apps show shop` prints:
+
+ egress allow 10.0.5.20, !10.0.5.21
+ default size large
+ size shop-a.example.com xlarge
+ size shop-b.example.com small (not in force. The instance was deleted or recreated)
+
+- After `carlos apps set shop --size large`:
+
+ shop instances run at large unless an instance has its own size
+ kass-1: 2304 MiB committed to awake instances, of 3884 MiB. 1200 MiB free.
+ The new memory size applies when an instance next starts or is deployed. CPU and IO apply now.
+
+## Reviewer items to settle
+
+Answer each in Flags if you cannot settle it in the table.
+
+1. **`!` means two things.** Before an address it says a fleet box holds
+ that address; after a space, before a word, it says the allow is not in
+ force. Neither table prints a legend. You may propose another mark for
+ one of them (give the exact cell form), or keep both.
+2. **Door casing.** IP2-40 to IP2-44 and IP3-01 to IP3-03 are capitalised
+ sentences with a full stop; plan 1's door strings are lower case. Make
+ them one style (the casing rule above).
+3. **One phrase twice.** `not yet supported under claims` is both the state
+ word (IP2-15) and root's detail (IP2-46), so a row says it twice. Change
+ one so the detail says something the word does not, or confirm.
+4. **The alert names the account by sqid** (IP2-51). Word it so a reader
+ knows it is an account id.
+5. **The alert's fix** (IP2-51) tells the operator to "Remove it with
+ carlos apps set %s --egress-allow", but that flag takes the whole list.
+ Say to set the list again without the address.
+6. **Success lines claim the policy is in force** (IP1-36 to IP1-39,
+ IP1-42, IP1-43, IP3-11): reword so they say what was set, and when
+ boxes apply it where that helps. IP1-53's "within seconds" is also too
+ strong (some boxes take up to about 33 minutes).
+7. **Stale `instances set` usage** (GAP-1): it does not list `--size`, and
+ "(an empty value clears)" is false for `--size`.
+8. **`-` beside `—`** in `status --layout` (IP3-12): SIZE and EGRESS print
+ `-` for empty, REASON prints the em dash glyph `—`. Choose one glyph for
+ this table (the change stays local to this table).
+9. **The `>` footnote** (IP3-09): it prints after the table, before any
+ `WARNING:` paragraphs. Its facts must match the memory rule above (a
+ deploy also applies a larger size). Say whether it stays there.
+10. **"the build's size"** is in IP1-21, IP1-39, IP1-51, IP1-64 and IP1-A5.
+ Change it in all five or none. IP1-A6 "the app default" and IP1-43
+ "follows the app's size" describe the same state.
+11. **Lease refusals on a create** (IP1-15, IP1-16): "Make the change
+ there" also answers an app create.
+12. **"settings"** in IP1-40 and IP1-41 means the old app's policy object
+ (its egress allow and sizes). Apps also have config and update
+ settings.
+
+## Strings
+
+### 1. Egress address refusals (door, CLI, status REASON)
+
+| key | current |
+|---|---|
+| `IP1-01` | an address is empty |
+| `IP1-02` | %q is a range. Allow single addresses only |
+| `IP1-03` | %q has a port. An allow opens an address, never a port |
+| `IP1-04` | %q has a zone. Name the address without it |
+| `IP1-05` | %q is not an IP address |
+| `IP1-06` | %s is a loopback address |
+| `IP1-07` | %s is the unspecified address |
+| `IP1-08` | %s is the cloud metadata service |
+| `IP1-09` | %s is link-local |
+| `IP1-10` | %s is a multicast address |
+| `IP1-11` | %s is in %s, a reserved range |
+| `IP1-12` | %s is in the NAT64 prefix 64:ff9b::/96, which reaches any IPv4 address |
+| `IP1-13` | %s is a public address and is already reachable. No allow is needed |
+| `IP1-14` | at most %d addresses per app (%d given) |
+
+### 2. The policy writer lease (door; also answers an app create)
+
+The first `%s` of IP1-15 is the other console, `<hostname>:<pid>`; the last
+`%s` is a time in UTC.
+
+| key | current |
+|---|---|
+| `IP1-15` | another console (%s) is the policy writer for this deployment until %s. Make the change there, or try again after that |
+| `IP1-16` | another console is the policy writer for this deployment until %s. Make the change there, or try again after that |
+| `IP1-17` | could not take the policy writer lease. Try again |
+| `IP1-18` | this console is not set up to write app policies (no writer lease). Deploy a console built from current main |
+| `IP1-19` | this console stopped being the policy writer during the change, so it may not have been published. Read the policy again before you retry |
+
+### 3. The policy door (`PUT`/`GET .../policy`)
+
+IP1-20 to IP1-22, IP1-24 and IP1-25 are read only by direct API callers.
+
+| key | current |
+|---|---|
+| `IP1-20` | nothing to set: send egress_allow, default_size or size |
+| `IP1-21` | default_size must be small, standard, large or xlarge, or empty for the build's size |
+| `IP1-22` | size must be small, standard, large, xlarge or default |
+| `IP1-23` | no instance %s in this app |
+| `IP1-24` | send If-Match with the policy's etag, or If-None-Match: * when there is none |
+| `IP1-25` | the policy changed since it was read. Read it again and retry |
+| `IP1-26` | the change could not be recorded, so it was not made. Try again |
+| `IP1-27` | the change could not be audited, so it was not made. Try again |
+| `IP1-28` | the change is recorded but not yet published. Run the command again to publish it now |
+| `IP1-29` | could not read the policy. Try again |
+| `IP1-30` | invalid host |
+| `IP1-45` | the app was deleted, renamed or moved while the change was being made, so it was not made |
+| `IP3-01` | %s is more than a quarter of the memory on %s (%d MiB). Choose a smaller size. |
+| `IP3-02` | %s does not publish its memory total, so only small and standard can be set. Upgrade the box, then try again. |
+| `IP3-03` | Could not read every box's memory total, so only small and standard can be set. Try again in a minute. |
+
+IP3-01: the size, the smallest box, its memory total. IP3-02: the box.
+
+### 4. Activity tab (console, operator audit)
+
+One part per changed field, joined with `; `, then ` (cli)`. Example:
+`egress allow: none -> 10.0.5.20; default size: the build's size -> large (cli)`.
+
+| key | current |
+|---|---|
+| `IP1-A1` | egress allow: %s -> %s |
+| `IP1-A2` | default size: %s -> %s |
+| `IP1-A3` | size of %s: %s -> %s |
+| `IP1-A5` | the build's size |
+| `IP1-A6` | the app default |
+
+### 5. App create, rename and move
+
+`%s` in IP1-40 is a bucket key, `control/app-policy/<sqid>/<app>.json`. IP1-47's
+`%s` is the new name; IP1-58's are the app's name, then the destination
+account's name.
+
+| key | current |
+|---|---|
+| `IP1-40` | an earlier app's settings under this name could not be cleared, so nothing was created. Try again, or ask an operator to delete %s from the deployment bucket |
+| `IP1-41` (*flash*) | Could not clear an earlier app's settings under this name, so nothing was created. Please try again. |
+| `IP1-46` (*flash*) | This app has had an instance policy set by an operator, so it cannot be renamed. Create a new app instead. |
+| `IP1-47` (*flash*) | The name %s has had an instance policy set by an operator, so no app can be renamed to it. Choose another name. |
+| `IP1-48` (*flash*) | Could not check the instance policies, so nothing was renamed. Try again. |
+| `IP1-49` (*flash*) | This app has had an instance policy set by an operator, so its record cannot be moved to another account. Ask an operator to move it. |
+| `IP1-58` (*flash*) | An earlier app named %s in %s had an instance policy set by an operator, so this app cannot be moved there. Ask an operator to move it. |
+| `IP1-59` (*flash*) | Could not check the instance policies, so nothing was moved. Try again. |
+
+### 6. The CLI
+
+IP1-36 to IP1-39: the app, then the addresses joined with `, ` or the size.
+IP1-42, IP1-43: the host, then the size. IP3-10: box, committed, total, free.
+IP2-30: box names joined with `, `.
+
+| key | current |
+|---|---|
+| `IP1-31` | apps set: --egress-allow: %v |
+| `IP1-32` | apps set: --size is small, standard, large, xlarge or default, not %q |
+| `IP1-33` | instances set: --size is small, standard, large, xlarge or default, not %q |
+| `IP1-34` | not found: either %s is not an app in this account, you are not a system operator, or this console predates app policies (deploy a console built from current main) |
+| `IP1-35` | the policy changed while this ran. Run it again |
+| `IP1-36` | %s instances may reach %s |
+| `IP1-37` | %s instances have no egress allow |
+| `IP2-30` | Not checked against these boxes, which publish no address list: %s. |
+| `IP1-38` | %s instances run at %s unless an instance has its own size |
+| `IP1-39` | %s instances run at the build's size unless an instance has its own size |
+| `IP1-42` | %s runs at %s |
+| `IP1-43` | %s follows the app's size |
+| `IP3-10` | %s: %d MiB committed to awake instances, of %d MiB. %d MiB free. |
+| `IP3-11` | The new memory size applies when an instance next starts or is deployed. CPU and IO apply now. |
+| `IP1-44` | apps show works through a console, and this shell is in direct bucket mode (CARLOS_DEPLOYMENT_BUCKET or CARLOS_DEPLOYMENT_DIR is set). Log in instead: carlos auth login --console \<url\> |
+| `IP1-50` | private addresses every instance of the app may reach, comma-separated, never a port. "" clears them. System operators only |
+| `IP1-51` | the size the app's instances run at: small, standard, large or xlarge. default goes back to the build's size. System operators only |
+| `IP1-52` | this instance's size: small, standard, large or xlarge. default follows the app's size. System operators only |
+| `IP1-53` (*help paragraph*) | Only system operators may pass --egress-allow or --size. A change reaches<br>the app's boxes within seconds once they run a release that applies it. |
+| `IP1-54` | usage: carlos apps show \<app\> [--account \<sqid\|name\>] [--account-id \<sqid\>] [--console \<origin\>] |
+| `IP1-55` | ` show <app> the app's egress allow and sizes. System operators only.` (one line of `carlos apps -h`, after a 16-character command column; keep the column) |
+| `IP1-56` | usage: carlos apps \<create\|place\|build-probe\|set\|show\|delete\|restore\|ttl\|keep\|list\> [flags] \<app\> |
+| `IP1-57` | apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow or --size |
+| `IP1-60` (*table*) | `egress allow %s` (label padded to 15 columns) |
+| `IP1-61` (*table*) | `default size %s` |
+| `IP1-62` (*table*) | `size %s %s` (host, then size) |
+| `IP1-63` (*table*) | none |
+| `IP1-64` (*table*) | the build's size |
+| `IP1-65` | ` (not in force. The instance was deleted or recreated)` (appended to an IP1-62 line) |
+| `GAP-1` | usage: carlos instances set \<host\> [--app \<a\>] [--updates auto\|manual] [--channel \<c\>] [--major \<n\>] [--pin \<build\>] (an empty value clears) |
+| `GAP-2` | usage: carlos apps set \<app\> [--swap overlap\|hold] [--swap-concurrency \<n\>] [--account \<sqid\|name\>] [--account-id \<sqid\>] [--console \<origin\>] (the first line of `carlos apps set -h`; it lists no policy flags) |
+| `GAP-3` | app whose swap policy to set (help for `apps set --app`, which now sets more than the swap policy) |
+
+### 7. Tables: `status --layout`, `instances list`, `apps show`
+
+`!` marks: IP2-04 / IP2-31 put `!` before an address a fleet box holds;
+IP2-06 puts ` !<word>` after the addresses. IP2-10 to IP2-17 are those
+words. IP2-17 and IP2-16 are the member view's words; IP2-11 to IP2-15 are
+operators' only.
+
+| key | current |
+|---|---|
+| `IP3-04` (*table*) | `BOX HOST LAYOUT SIZE EGRESS REASON` |
+| `IP2-02` (*table*) | `HOST REGION CHANNEL POOL INSTALLED SERVING HEALTH UPSTREAMS DB EGRESS CREATED BY REASON` (tab-separated in the code) |
+| `IP3-05` (*table*) | swap |
+| `IP3-06` (*table*) | ? |
+| `IP3-07` (*table*) | `<in force>><wanted>`, as `standard>large` |
+| `IP3-08` (*table*) | - (empty SIZE cell; IP2-03 is the same for EGRESS) |
+| `IP3-12` (*table*) | — (empty REASON cell in `status --layout` only) |
+| `IP3-09` | A size after > takes effect when the instance next starts cold. Restart the instance to apply it now. (printed once under the table; a sentence, so ordinary sentence case is fine) |
+| `IP2-04` (*table*) | `!` before an address |
+| `IP2-07` (*table*) | refused |
+| `IP2-08` (*table*) | `egress: ` (REASON prefix) |
+| `IP2-10` (*table*) | failing |
+| `IP2-11` (*table*) | policy unreadable |
+| `IP2-12` (*table*) | policy unverifiable |
+| `IP2-13` (*table*) | policy expired |
+| `IP2-14` (*table*) | box not wholly nested |
+| `IP2-15` (*table*) | not yet supported under claims |
+| `IP2-16` (*table*) | pending |
+| `IP2-17` (*table*) | not available |
+| `IP2-20` | the allow takes effect when the instance next starts |
+| `IP2-21` | the box could not apply the allow, and tries again |
+| `IP2-22` | the allow is not in force on this box |
+
+Root's detail in `status --layout`'s REASON, after `egress: ` (operators):
+
+| key | current |
+|---|---|
+| `IP2-60` | %s: an address of this box (%s) (the entry, then the box's prefix that holds it) |
+| `IP2-61` | %s: this box's addresses could not be read |
+| `IP2-45` | the policy has more than %d addresses (%d); every one is closed |
+| `IP2-46` | not yet supported under claims |
+| `IP2-47` | no expiry recorded |
+| `IP2-48` | the policy expired at %s |
+| `IP2-49` | revoked (restarted) (appended after `; ` to another detail) |
+| `IP2-70` | %s is a sidecar member, which runs flat |
+| `IP2-71` | %s runs as %s, whose user could not be read: %v |
+| `IP2-72` | %s runs as %s, which runs as the agent's user |
+| `IP2-73` | %s has backing %q, which this check does not know |
+| `IP2-74` | %s is a %q row, which this check does not know |
+
+### 7a. Grant check and alert (door, alert)
+
+| key | current |
+|---|---|
+| `IP2-40` | %s is an address of box %s. An egress allow cannot open a box of this fleet. |
+| `IP2-41` | Box %s's address list could not be read. Try again in a minute. |
+| `IP2-42` | Box %s does not publish its addresses yet. Upgrade it before granting an egress allow. |
+| `IP2-43` | The fleet's address lists could not be read. Try again in a minute. |
+| `IP2-44` | The fleet's list of boxes could not be read. Try again in a minute. |
+| `IP2-50` (*alert*, subject) | Egress allow %s is now a fleet box's address |
+| `IP2-51` (*alert*, body) | App %s in account %s may reach %s, and box %s now holds that address. The allow is still in force. Remove it with carlos apps set %s --egress-allow, or move the address off the box. |
+
+IP2-51's placeholders: app, account sqid, address, box, app.
+
+## 8. Docs (new prose; ordinary sentence case)
+
+Review these as prose. Command examples in code blocks sit beside them and
+are not under review. Where a doc quotes a string from the tables above,
+quote your new text.
+
+`DOC-1` (docs/site/cli.md, `carlos apps`, after the update settings
+paragraph):
+
+> System operators can also set an app's instance policy: which private addresses its instances may reach, and the size they run at. `carlos apps show` reads it back.
+
+`DOC-2`:
+
+> 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 address, pass the list without it; `--egress-allow ""` removes them all. Each entry is a single IP address, with no range, port or zone. 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. An app may allow at most 8.
+
+`DOC-3`:
+
+> A change that adds an address is checked against the deployment's boxes. An address that belongs to one of them is refused, and so is any new address while a box does not publish its address list yet. Boxes that publish none at all are named after the change. An allow only takes effect on a box where every instance runs nested (see `carlos status --layout`), and not yet while host claims are on. If a box later takes an allowed address, the console sends an alert.
+
+`DOC-4`:
+
+> 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 size each build asks for. `carlos instances set --size` gives one instance a size of its own, and `--size default` makes it follow the app's 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.
+
+`DOC-5`:
+
+> After a size change, the command prints each box's memory committed to awake instances, out of its total. CPU and IO change at once. Memory changes when an instance next starts or is deployed, except that a smaller size waits for the instance to start cold. Restart it to apply the new memory now. `carlos status --layout` shows the size each instance runs at.
+
+`DOC-6`:
+
+> The console records a change, and the app's boxes apply it. A box that follows the deployment's change index does so within seconds; any other box within about 33 minutes. `carlos apps show` prints the egress allow, the app's size, and every instance with a size of its own. A `!` before an address means one of the deployment's boxes now holds it.
+
+`DOC-7` (docs/site/cli.md, `carlos instances set`; replaces "An empty value clears a setting, so the app's default applies again."):
+
+> An empty value clears an update setting, so the app's default applies again. System operators can also give the instance its own size with `--size`; `--size default` clears it. See [carlos apps](/docs/cli#carlos-apps).
+
+`DOC-8` (docs/site/cli.md, `carlos instances`, after the `DB` paragraph):
+
+> The `EGRESS` column lists the private addresses the instance may reach, or `-` for none. A word after `!` means the allow is not in force yet: `pending` until the instance next starts, `failing` while its box retries, or `not available` on a box that cannot apply it. The `REASON` column says why, after `egress:`.
+
+`DOC-9` (docs/site/cli.md, `carlos status --layout`, after the paragraph on layouts):
+
+> The `SIZE` column is the size an awake nested instance runs at: `swap` while a deploy is swapping it, `?` when its box could not read it, and `-` for anything else. `standard>large` means it runs at standard and its policy asks for large; a note under the table says when that takes effect. The `EGRESS` column is the instance's egress allow as its box applies it. A `!` before an address means one of the deployment's boxes now holds it. A word after `!` means the allow is not in force: `failing`, `policy unreadable`, `policy unverifiable`, `policy expired`, `box not wholly nested`, `not yet supported under claims`, or `refused` when the box dropped an entry. `REASON` gives the detail after `egress:`.
+
+`DOC-10` to `DOC-17` are README rollout notes for operators (README.md,
+"App policies: egress allows and sizes"). That entry is written in Paul's
+lower-case bullet style: keep it (lower case at the start of every
+sentence).
+
+`DOC-10` (replaces the current lease bullet, which says an app create always takes the lease; since then a create takes it only when it must clear an earlier policy):
+
+> - one console per bucket writes policies. it holds a lease at `control/app-policy-lease/lock.json`, taken the first time it changes a policy and renewed every five minutes after that. an app create takes it too, but only when an earlier app's policy is still stored under the new name and has to be cleared first. a second console on the same bucket refuses those changes and creates, and names the console that holds the lease and when it expires.
+
+`DOC-11` (replaces the next bullet):
+
+> - a console that stops cleanly gives the lease back. if it crashes, or its role may not delete objects in the bucket, the lease stays held for up to 15 minutes. until it lapses, the console that replaced it refuses policy changes, and app creates that would have to clear an earlier policy.
+
+`DOC-12`:
+
+> - every box must run this release before the first egress grant. a box that does not publish its addresses refuses every grant that adds one, and a box with no address list at all is named as not checked.
+
+`DOC-13`:
+
+> - a revoke takes effect at once when `carlos-instances.slice` holds the resolver allow, the normal case. on a box where it holds none, or cannot be read, a revoke that empties a host's allow restarts that host's running units, and `carlos status --layout` says `revoked (restarted)`.
+
+`DOC-14`:
+
+> - after every change to a host's allow, root writes an empty `IPAddressAllow=` on each running unit in the slice so the change reaches it. that leaves `/run/systemd/system.control/<unit>.d/50-IPAddressAllow.conf` until reboot. it is expected: the claim checks accept exactly that drop-in, so nothing needs clearing before claims are switched on.
+
+`DOC-15`:
+
+> - under host claims root writes no allow, and `carlos status --layout` says `not yet supported under claims`. switching claims on resets every allow granted before, and restarts the running units of each host that held one. an allow is honoured only on a box where every row is nested; otherwise `box not wholly nested` names the first row that is not.
+
+`DOC-16`:
+
+> - the console re-checks live allows against the boxes' addresses when a box's address list changes (with `CARLOS_CHANGE_INDEX=read`, and not under host claims), and otherwise every 30 to 33 minutes. it alerts through `CARLOS_ALERT_WEBHOOK` or `CARLOS_ALERT_SNS_TOPIC_ARN`, at most once a day per app and address. with neither set it only logs.
+
+`DOC-17`:
+
+> - memory never changes on a running instance. a new size's memory applies at the instance's next start or deploy, and a smaller size waits for a cold start. cpu and io change at once. a size above standard is refused when a box the app can run on reports no memory total, or when it is more than a quarter of the smallest such box's memory.
+
+## Answer
+
+Return a Markdown table with columns `key`, `new`, `why` for every key in
+sections 1 to 8, `new` equal to `current` where no change is needed (for
+`DOC-*`, the full paragraph or bullet). Write `<br>` for a line break and
+`\|` for a pipe inside a cell. For a *table* key whose mark or glyph you
+change, give the exact new form. Then a section `Reviewer items` with one
+line per item 1 to 12 saying what you decided. Then a section `Flags` for
+anything Paul must decide: fact conflicts, a placeholder you could not keep
+in order, or a meaning you could not tell. Do not edit any files.