copy: plan 2's egress strings collected for the pre-merge review (#328)
Deck only (controller ruling C13): every person-facing string plan 2 added or changed, with file:line, current text, where it is seen and its base count at 4317d894; the approved strings it changed; the docs to update before merge. No code and no approved-copy record changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+309
−0
docs/superpowers/notes/copy-instance-policy-plan2.md+309 −0
CI failed — run details
diff --git a/docs/superpowers/notes/copy-instance-policy-plan2.md b/docs/superpowers/notes/copy-instance-policy-plan2.md| new file mode 100644 |
| index 000000000..561fa76e4 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/copy-instance-policy-plan2.md |
| @@ -0,0 +1,309 @@ |
| +# Instance sizes and egress allows, plan 2: copy deck (pending review) |
| + |
| +Every user-facing string plan 2 (`2026-10-21-instance-policy-2-egress`) |
| +added or changed, for the one copy review that covers plans 1 to 3 before |
| +the branch merges (controller ruling C13, Task 17). Nothing here is |
| +approved yet. After the review, the approved text goes into the code |
| +verbatim and `approved_instance_policy_copy_test.go` pins it, beside plan |
| +1's deck (`copy-instance-policy-plan1.md`). |
| + |
| +Collected from the Task 1 to 15 reports and from `git diff 4317d894..HEAD` |
| +(non-test files; plan 2 starts after plan 1's last commit, 4317d894). The |
| +commits in `540690f4..4317d894` are plan 1's tail; their strings (IP1-45 to |
| +IP1-49, IP1-58, IP1-59, IP1-L8) are already in plan 1's deck. 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 Task 17 commit. |
| +- **text**: the current text, exactly. `%s`, `%d` and `%v` are filled at |
| + run time; `%q` adds double quotes. |
| +- **seen**: where a person reads it. |
| +- **base**: how many non-test Go files held this exact text at the base |
| + commit `4317d894` (a shared string needs its own review, and a rewrite |
| + must not hit its other uses). `0` means new in plan 2. |
| + |
| +Who sees what: |
| + |
| +- `carlos status --layout` and `carlos apps show` are operator views. They |
| + show root's full report: the state, root's `Detail`, every refused entry, |
| + and the `!` mark on an address a fleet box holds. |
| +- `carlos instances list` is visible to app members. The console sends it a |
| + fixed projection only (Task 12 ruling): the held addresses, a member state |
| + word and a fixed reason. No `Detail`, no refusals, no conflict marks, no |
| + box or host names. |
| +- A door message reaches a person as the CLI prints the console's JSON |
| + `error`: `apps set` puts `apps set: ` in front. It is also what an API |
| + caller reads in the response body. |
| + |
| +## 1. The EGRESS column and its words (Task 12) |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-01 | status_instances.go:256 | `BOX HOST LAYOUT EGRESS REASON` | `carlos status --layout` heading. Changed from the approved `BOX HOST LAYOUT REASON` (isolated-exec layout copy; pinned by `status_instances_test.go:68`). Plan 3 makes it `BOX HOST LAYOUT SIZE EGRESS REASON` | 0 (old heading: 1) | |
| +| IP2-02 | instances_cli.go:543 `instancesListHeader` | `HOST\tREGION\tCHANNEL\tPOOL\tINSTALLED\tSERVING\tHEALTH\tUPSTREAMS\tDB\tEGRESS\tCREATED\tBY\tREASON` | `carlos instances list` heading. Changed from the approved `zdd.list.header` (no `EGRESS`) | 0 | |
| +| IP2-03 | instances_cli.go:497, :499 | `-` | the EGRESS cell when nothing is held, or no box reported (an older console) | common literal | |
| +| IP2-04 | instances_cli.go:505 | `!` before an address | `status --layout` EGRESS cell: a fleet box now holds this allowed address (the console's report). Never in `instances list` | 0 | |
| +| IP2-05 | instances_cli.go:508 | `,` (no space) between addresses | EGRESS cell | n/a | |
| +| IP2-06 | instances_cli.go:516, :518 | ` !<word>` after the addresses | EGRESS cell, when the allow is not simply in force | 0 | |
| +| IP2-07 | instances_cli.go:486 `egressRefusedWord` | refused | EGRESS cell (` !refused`), when the box dropped an entry and no state is set | 21 (common literal) | |
| +| IP2-08 | instances_cli.go:487 `egressReasonLabel` | `egress: ` | REASON cell prefix, in both tables; its entries are joined with `; ` (instances_cli.go:539), and it follows any other reason after `; ` (status_instances.go:238, instances_cli.go:658) | 0 | |
| + |
| +### State words (`egressStateWords`, instances_cli.go:473) |
| + |
| +The word after ` !` in the EGRESS cell. A code the CLI does not know is |
| +shown as sent. |
| + |
| +| id | where | code | text | seen | base | |
| +|---|---|---|---|---|---| |
| +| IP2-10 | instances_cli.go:474 | `failing` | failing | both tables: root could not write the allow, or it did not hold | 2 (unrelated JSON keys) | |
| +| IP2-11 | instances_cli.go:475 | `unreadable` | policy unreadable | `status --layout` | 1 (a comment); see "Plan 1's status words" below | |
| +| IP2-12 | instances_cli.go:476 | `unverifiable` | policy unverifiable | `status --layout` | 2 (an error in apppolicy, a comment) | |
| +| IP2-13 | instances_cli.go:477 | `expired` | policy expired | `status --layout` | 2 | |
| +| IP2-14 | instances_cli.go:478 | `not_nested` | box not wholly nested | `status --layout` | 0 | |
| +| IP2-15 | instances_cli.go:479 | `under_claims` | not yet supported under claims | `status --layout`. The same words are root's Detail (IP2-46), so the row reads `- !not yet supported under claims` and REASON `egress: not yet supported under claims` | 0 | |
| +| IP2-16 | instances_cli.go:481 | `pending` | pending | `instances list` (member). Root does not emit it today; kept so the word exists if it lands | 34 (common literal) | |
| +| IP2-17 | instances_cli.go:482 | `not_available` | not available | `instances list` (member): every state other than failing and pending | 10 (common phrase) | |
| + |
| +Examples, built from the formats above (`TestEgressCellTable` and |
| +`TestStatusLayoutShowsEgress` pin the cell and row shapes): |
| + |
| + BOX HOST LAYOUT EGRESS REASON |
| + ie-1 shop-a.example.com nested !10.0.5.20,fd00:5::20 - |
| + ie-1 shop-b.example.com foreign 10.0.5.20 !refused db and socket are neither default; egress: 10.0.5.1: an address of this box (10.0.5.0/24) |
| + ie-1 shop-c.example.com nested - !box not wholly nested egress: shop-d.example.com is flat |
| + ie-1 shop-e.example.com nested - !not yet supported under claims egress: not yet supported under claims |
| + |
| +## 2. The member projection (Task 12 fix round 1, `internal/console/apiinstances.go`) |
| + |
| +The fixed reasons a member reads in `instances list`'s REASON cell, as |
| +`egress: <reason>`. |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-20 | internal/console/apiinstances.go:241 `memberEgressPendingReason` | the allow takes effect when the instance next starts | `instances list`, with `!pending` | 0 | |
| +| IP2-21 | internal/console/apiinstances.go:242 `memberEgressFailingReason` | the box could not apply the allow, and tries again | `instances list`, with `!failing` | 0 | |
| +| IP2-22 | internal/console/apiinstances.go:243 `memberEgressNotAvailableReason` | the allow is not in force on this box | `instances list`, with `!not available` | 0 | |
| + |
| +Example row cells: `10.0.5.20 !failing` and REASON |
| +`egress: the box could not apply the allow, and tries again`. |
| + |
| +## 3. `apps set` and `apps show` (Task 12) |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-30 | apps_policy.go:47 `appsSetEgressNotChecked` | Not checked against these boxes, which publish no address list: %s. | `apps set --egress-allow`, after IP1-36, only when the reply's `not_checked` is non-empty; the box names joined with `, ` | 0 | |
| +| IP2-31 | apps_policy.go:327 | `!` before a configured address | `apps show`'s `egress allow` line (IP1-60): a fleet box now holds this address, per the console's last report pass | 0 | |
| + |
| +Example: |
| + |
| + shop instances may reach 10.0.5.20, 10.0.5.21 |
| + Not checked against these boxes, which publish no address list: kass-3, kass-4. |
| + |
| + egress allow 10.0.5.20, !10.0.5.21 |
| + |
| +## 4. The grant-time fleet check (Task 9, `internal/console/egressfleet.go`) |
| + |
| +Only a grant that adds an address is checked. Seen as `apps set: <text>` |
| +and as the API's error body. |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-40 | internal/console/egressfleet.go:43 `egressFleetHeldMsg` | %s is an address of box %s. An egress allow cannot open a box of this fleet. | 409; the address, then the box | 0 | |
| +| IP2-41 | internal/console/egressfleet.go:44 `egressFleetUnreadableMsg` | Box %s's address list could not be read. Try again in a minute. | 503; the box is its edges file's name, `control/edges/` and `.json` removed | 0 | |
| +| IP2-42 | internal/console/egressfleet.go:45 `egressFleetOlderBoxMsg` | Box %s does not publish its addresses yet. Upgrade it before granting an egress allow. | 409, a box on a release from before plan 2 | 0 | |
| +| IP2-43 | internal/console/egressfleet.go:46 `egressFleetListMsg` | The fleet's address lists could not be read. Try again in a minute. | 503, the edges listing failed (Task 9's own draft; the brief gave none) | 0 | |
| +| IP2-44 | internal/console/egressfleet.go:47 `egressFleetBoxesMsg` | The fleet's list of boxes could not be read. Try again in a minute. | 503, the box list is incomplete (Task 9's own decision and draft) | 0 | |
| + |
| +## 5. The fleet-address alert (Task 10, `internal/console/egressfleet.go:165`) |
| + |
| +Paged through the console's armed sinks (webhook or SNS), at most once a day |
| +per app and address, per console process. |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-50 | internal/console/egressfleet.go:166 | Egress allow %s is now a fleet box's address | alert subject; the address | 0 | |
| +| IP2-51 | internal/console/egressfleet.go:167 | 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. | alert body; app, account, address, box, app. The account is the sqid, not the account's name | 0 | |
| + |
| +## 6. Root's report Detail and refusals (`status --layout` REASON) |
| + |
| +What root says about one host's allow. `status --layout` shows it after |
| +`egress: `; `instances list` never does. |
| + |
| +### Refused entries (Task 2, `internal/instancectl/egress.go`) |
| + |
| +Each refusal is `<entry>: <reason>`, or egressaddr's own text (IP1-01 to |
| +IP1-14, which already name the address). |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-60 | internal/instancectl/egress.go:620 | %s: an address of this box (%s) | the entry, then the box prefix that holds it | 2 (the resolver allow's separate literal `%s is an address of this box (%s)`, hardening.go:209, and a comment) | |
| +| IP2-61 | internal/instancectl/egress.go:616 | %s: this box's addresses could not be read | every entry, when root cannot read the box's addresses | 0 | |
| + |
| +### Closed and unreadable details |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-45 | internal/instancectl/egress.go:626 | the policy has more than %d addresses (%d); every one is closed | with `!policy unreadable`; the limit (8), then the count | 0 | |
| +| IP2-46 | internal/host/egress_source.go:367 `claimsEgressDetail` | not yet supported under claims | with `!not yet supported under claims`, on every host with an allow while host claims are on (ruling 9 fixes its sense) | 0 | |
| +| IP2-47 | internal/host/egress_source.go:241 | no expiry recorded | with `!policy expired` (Task 5) | 0 | |
| +| IP2-48 | internal/host/egress_source.go:251 `expiredDetail` | the policy expired at %s | with `!policy expired`; the time in UTC, RFC 3339 | 0 | |
| +| IP2-49 | internal/instancectl/egress.go:147 `egressRestarted` | revoked (restarted) | after a revoke that closed its address by restarting the instance's running units; appended after `; ` to another detail (`not yet supported under claims; revoked (restarted)`) | 0 | |
| + |
| +### Why a box is not wholly nested (Task 5, `boxWhollyNested`) |
| + |
| +With `!box not wholly nested`. Each names the first row that fails, which |
| +may be another tenant's host and unit (operator views only). |
| + |
| +| id | where | text | base | |
| +|---|---|---|---| |
| +| IP2-70 | internal/host/egress_source.go:59 | %s is a sidecar member, which runs flat | 0 | |
| +| IP2-71 | internal/host/egress_source.go:64 | %s runs as %s, whose user could not be read: %v (host, unit, an internal error) | 0 | |
| +| IP2-72 | internal/host/egress_source.go:67 | %s runs as %s, which runs as the agent's user (host, unit) | 0 | |
| +| IP2-73 | internal/host/egress_source.go:72 | %s has backing %q, which this check does not know | 0 | |
| +| IP2-74 | internal/host/egress_source.go:76 | %s is a %q row, which this check does not know (host, kind) | 0 | |
| +| IP2-75 | internal/host/egress_source.go:83, :85 | %s is %s: %s / %s is %s (host, the layout word, then `activator.Classify`'s reason) | 0. The layout words (`flat`, `fenced`, `foreign`, `conflict`) and Classify's reasons are the isolated-exec layout's approved copy, reused | |
| + |
| +### Failing details (operator diagnostics, Tasks 2, 13, 14, 15) |
| + |
| +With `!failing`. They mix fixed words with systemctl's output and Go |
| +errors. Listed so the review can decide whether to word them; the fixed |
| +parts are below, the `%v` and systemctl tails are diagnostics. |
| + |
| +| id | where | text | |
| +|---|---|---| |
| +| IP2-80 | internal/instancectl/egress.go:265 | read back: %v; nothing written | |
| +| IP2-81 | internal/instancectl/egress.go:273 | ...; refusing the start: %s (why: IP2-90 to IP2-92) | |
| +| IP2-82 | internal/instancectl/egress.go:300, :307 | set-property: %s: %v; the slice now holds %s | |
| +| IP2-83 | internal/instancectl/egress.go:304, :311 | ...; read back: %v; %s / read back after the write: %v; %s (then IP2-93 or IP2-94) | |
| +| IP2-84 | internal/instancectl/egress.go:315 | after the write the slice holds %s, not %s (`nothing` when empty, :725, :730) | |
| +| IP2-85 | internal/instancectl/egress.go:358, :411 | granted, but applying it to the slice's running units failed: %s | |
| +| IP2-86 | internal/instancectl/egress.go:377, :381, :387 | with no cgroup root the slice's running units cannot be found to apply it to them / the slice's running units could not be read to apply it to them: %v / the slice runs something that is not a service, so it cannot be applied to it (each after `granted, but `) | |
| +| IP2-87 | internal/instancectl/egress.go:401 | %s holds an allow of its own (%s) (unit, its allow) | |
| +| IP2-88 | internal/instancectl/egress.go:443, :447, :454 | revoked, but with no cgroup root the slice's running units cannot be found to restart them / revoked, but the slice's running units could not be read to restart them: %v / revoked, but the slice runs something that is not a service, so it cannot be restarted | |
| +| IP2-89 | internal/instancectl/egress.go:484 | revoked, but restarting the slice's units failed: %s | |
| +| IP2-90 | internal/instancectl/egress.go:535 | this control service saw the slice hold an allow, or owes it a change | |
| +| IP2-91 | internal/instancectl/egress.go:540, :542 | its runtime allow drop-in could not be read: %v / its runtime allow drop-in sets an allow | |
| +| IP2-92 | internal/instancectl/egress.go:544 | nothing is wanted and no allow is known or on disk (logged only, on a start that goes ahead) | |
| +| IP2-93 | internal/instancectl/egress.go:564 | what the slice holds is as read before the write and may have changed | |
| +| IP2-94 | internal/instancectl/egress.go:566 | what the slice holds is not known | |
| + |
| +All new in plan 2 (base 0), except `nothing written` as a fragment (22 |
| +other literals). |
| + |
| +## 7. Log lines an operator acts on |
| + |
| +As in plan 1's deck: the lines that tell an operator something to do or |
| +check. The other new lines are diagnostics and are left out. |
| + |
| +| id | where | text | seen | base | |
| +|---|---|---|---|---| |
| +| IP2-L1 | internal/instancectl/egress.go:988 | egress: %s: no host for this slice; its allow is closed | root's instance-control log (the brief places it in `carlos logs`); the slice name | 0 | |
| +| IP2-L2 | internal/instancectl/egress.go:1012 | egress: %s: failing for %d sweeps in a row: %v | the same log, from the third failing sweep | 0 | |
| +| IP2-L3 | internal/instancectl/egress.go:481 | egress: %s: restarted %s to close its revoke | the same log; slice, unit. Says why an instance restarted | 0 | |
| +| IP2-L4 | internal/console/egressfleet.go:352 | console: egress report: not checked, the recorded policy does not open: %s | console log; `<sqid>/<app>` list | 0 | |
| +| IP2-L5 | internal/console/egressfleet.go:362 | console: egress report: unreadable edges files, their addresses not checked: %s | console log; edges keys | 0 | |
| + |
| +## 8. Left out, and why |
| + |
| +- JSON keys (`egress`, `allowed`, `refused`, `state`, `detail`, `reason`, |
| + `conflicts`, `egress_conflicts`, `not_checked`, `addrs`) and the root |
| + state codes (`unreadable`, `not_nested`, `under_claims`, ...). |
| +- `egress: <err>` from root's start paths and `POST /egress` |
| + (instancectl/server.go, claimunit.go): internal error fragments (Task 3). |
| +- Root's other `egress: ...` log lines, the agent's nudge lines |
| + (`agent: egress nudge ...`), the status tick's read-back line, and the |
| + grant check's own log lines: diagnostics. |
| +- The `unreadable` Detail when root's registry read fails: the Go error as |
| + it is. |
| +- `unitRunsAsAgent`'s errors (`not a unit name`, `User %s is not an account |
| + on this box`, ...): they reach a person only inside IP2-71's `%v`. |
| + |
| +## 9. Approved strings this plan changed (records not edited) |
| + |
| +Per C13 no approved-copy record is edited before the review. |
| + |
| +- `zdd.list.header` (`docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json`): |
| + IP2-02 added `EGRESS`. `go test . -run TestZeroDowntimeCopyIsApplied` |
| + now fails on it, beside plan 1's `zdd.apps.usage-line` (IP1-56) and |
| + `zdd.apps-set.nothing` (IP1-57). |
| +- The `status --layout` heading (IP2-01). No JSON record holds it; the |
| + comment at status_instances.go:209 calls it approved copy, and |
| + `status_instances_test.go:68` and `:178` already pin the new text. |
| +- Plan 3 changes both headings again (SIZE). Review the final forms |
| + together: `BOX HOST LAYOUT SIZE EGRESS REASON`, and `instances |
| + list` with or without SIZE (plan 3 leaves it out). |
| + |
| +## 10. Docs to update before merge |
| + |
| +`docs/site/cli.md`: |
| + |
| +- `carlos instances list` (after the `DB` paragraph, near line 858): the |
| + `EGRESS` column. The held addresses, `-` for none, ` !pending`, |
| + ` !failing` or ` !not available`, and the reason in REASON as |
| + `egress: ...`. Say that members see no box diagnostics here. |
| +- `carlos status --layout` (near line 2225): the new heading, the EGRESS |
| + cell, `!` before an address (a fleet box holds it), the state words |
| + IP2-10 to IP2-15, and `egress: <refusals or detail>` in REASON. |
| +- `carlos apps` (the section at line 112): plan 1's `apps set |
| + --egress-allow` and `--size`, `instances set --size` and `apps show` are |
| + not documented yet. Plan 2 adds: `apps show` marks `!` on a configured |
| + address a fleet box holds; `apps set --egress-allow` prints the |
| + not-checked line (IP2-30); a grant is refused while any box does not |
| + publish its addresses, or names one of them (IP2-40 to IP2-44). |
| + |
| +`README.md`, the "App policies: egress allows and sizes (2026-10-25)" entry |
| +(line 515, plan 1's IP1 section 7), gains plan 2's lines: |
| + |
| +- **Boxes before egress grants.** Every box must run this release before |
| + the first grant: a box that does not publish its addresses in its edges |
| + file refuses every adding grant (IP2-42). Boxes with no edges file are |
| + named as not checked (IP2-30). |
| +- **The parent resolver allow.** A revoke goes live 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 `status --layout` says |
| + `revoked (restarted)`. |
| +- **The nudge drop-ins.** 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. |
| +- **Claims deferred.** Under host claims root writes no allow (ruling 9) and |
| + `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. |
| +- **Wholly nested boxes only.** Before claims, an allow is honoured only on |
| + a box whose every row is nested; otherwise `box not wholly nested` names |
| + the first row that is not. |
| +- **The fleet-address report and alert.** The console re-checks live allows |
| + on a `control/edges` change when `CARLOS_CHANGE_INDEX=read` (not under |
| + host claims), otherwise every 30 to 33 minutes, and pages through |
| + `CARLOS_ALERT_WEBHOOK` or `CARLOS_ALERT_SNS_TOPIC_ARN`. With neither set it |
| + only logs. |
| + |
| +## 11. For the reviewer |
| + |
| +- **`!` means two things.** Before an address it says a fleet box holds |
| + it; before a word it says the allow is not in force. Neither table prints |
| + a legend. |
| +- **Door casing.** IP2-40 to IP2-44 are sentences with a capital and a full |
| + stop. Plan 1's door messages (IP1-15 to IP1-30) are lower case with no |
| + full stop, so `apps set: Box kass-1's address list could not be read.` |
| + sits beside `apps set: could not read the policy. Try again`. |
| +- **One phrase, two places.** `not yet supported under claims` is the state |
| + word (IP2-15, instances_cli.go) and root's Detail (IP2-46, |
| + egress_source.go), so the row says it twice. Change both, or make the |
| + Detail say something the word does not. |
| +- **Plan 1's status words.** `policy unreadable`, `policy unverifiable`, |
| + `policy expired` in `internal/provision/apppolicy_reconcile.go` are now |
| + matched as keys by `agentPolicyState` (internal/host/egress_status.go:89 |
| + to :93). The words people see come from IP2-11 to IP2-13. A rewrite of |
| + plan 1's words must change that switch too. |
| +- **IP2-60 and the resolver.** The resolver allow already says |
| + `%s is an address of this box (%s)` (hardening.go:209, a separate |
| + literal). The two could match. |
| +- **The alert names the account by sqid** (IP2-51). The report holds the |
| + sqid only; a name would need a lookup. |
| +- **IP2-51 and IP1-37.** The alert tells the operator to remove the |
| + address with `carlos apps set <app> --egress-allow`, which takes the full |
| + list, not one address to drop. |