docs: carlos instances label, copy deck for review
Task 7 of fleet record labels (#1008 option B), steps 1-5. UX pass on the label output: the command to run sits on its own line after the warning (C14, new C48) and repeats the operator's --console, --destination, --account and --account-id; the no-evidence refusal says what to do instead of repeating the evidence (new C47); C38 covers every unknown outcome; C29 names the console and the boxes. "the console" (C49) and the --account-id help (C50) get keys; the console's copy of C31's reasons is C46, held to C31's words by a test. C40 and C41 replace the guard's refusals with the spec drafts that point at carlos instances label; SR-4-C95/C96 are marked superseded and leave the stateless replicas built list. TestInstancesLabelCopyKeysPresent holds C01-C50 to their markers. The deck (66 strings) and README with the UX notes are in docs/drafts/fleet-record-labels; docs/site/cli.md gains the command.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
approved_stateless_replicas_copy_test.go+6 −1docs/drafts/fleet-record-labels/README.md+105 −0docs/site/cli.md+35 −0docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md+2 −2instances_cli.go+111 −53instances_cli_label_test.go+48 −10instances_label_copy_keys_test.go+115 −0internal/console/appcopies.go+6 −4internal/console/fleetcreate.go+9 −7internal/console/instancelabel.go+4 −2internal/console/instancelabel_test.go+1 −1
CI failed — run details
Intent
<task-notification> <task-id>a318744e3eec06800</task-id> <tool-use-id>toolu_01TXa6NPURQLnzs6W8Ent31X</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/a318744e3eec06800.output</output-file> <status>completed</status> <summary>Agent "Implement Task 6 Part A: D1 creates" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>- **Status:** DONE. I fixed both items from fix round 1. The rootfs 409 and `labelActive` are unchanged, as you ruled. - **Commits:** - `ae17b62c` "console: no unlabelled process creates on multi-box fleets (D1)" - `94bd01d9` "console: D1 verifies the head manifest and refuses units first" - **Tests:** Both new witnesses failed against the old code and pass now: the tampered manifest (503, C39, Retry-After 30, zero writes) and the unit with no manifest (409 C42). Step 5 (22 tests) and Step 7 pass. The neighbour runs, every test in the fleet-fixture files and the host two-box e2e also pass. Darwin build and vet are clean. - **Concerns:** 1. **Extra reads.** A multi-box create that follows a release now makes 2 more reads, for the promotion record and the manifest. 2. **Old releases refused.** A release promoted before promotion records existed now gets C39 on multi-box fleets until it is promoted again. 3. **Still open from round 0:** - C42 can't be reached through the door today. - Creates on multi-box fleets get 503 until every active box and the console run v0.35.4. - Fixtures moved to the record floor, and test runs went beyond the listed commands. - C39, C42 and the C31 reasons still need copy review. - **Report:** /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-record-labels/.superpowers/sdd/2026-11-14-fleet-record-labels/task-6a-report.md (fix round 1 section added at the end)</result> <usage><subagent_tokens>255045</subagent_tokens><tool_uses>11</tool_uses><duration_ms>502615</duration_ms></usage> </task-notification>
diff --git a/approved_stateless_replicas_copy_test.go b/approved_stateless_replicas_copy_test.go| index 4d2606408..893cf75d5 100644 |
| --- a/approved_stateless_replicas_copy_test.go |
| +++ b/approved_stateless_replicas_copy_test.go |
| @@ -9,7 +9,12 @@ import ( |
| const statelessReplicaCopyDeck = "docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md" |
| -var statelessReplicaBuiltCopy = []string{"SR-2-C11", "SR-2-C01", "SR-2-C02", "SR-2-C03", "SR-2-C04", "SR-2-C05", "SR-2-C06", "SR-2-C07", "SR-2-C08", "SR-2-C09", "SR-2-C12", "SR-2-C13", "SR-2-C14", "SR-2-C15", "SR-2-C16", "SR-2-C17", "SR-1-C08", "SR-1-C06", "SR-1-C07", "SR-1-C01", "SR-1-C02", "SR-1-C03", "SR-1-C04", "SR-1-C05", "SR-1-C12", "SR-1-C09", "SR-1-C10", "SR-1-C13", "SR-1-C14", "SR-4-C95", "SR-4-C96"} |
| +var statelessReplicaBuiltCopy = []string{"SR-2-C11", "SR-2-C01", "SR-2-C02", "SR-2-C03", "SR-2-C04", "SR-2-C05", "SR-2-C06", "SR-2-C07", "SR-2-C08", "SR-2-C09", "SR-2-C12", "SR-2-C13", "SR-2-C14", "SR-2-C15", "SR-2-C16", "SR-2-C17", "SR-1-C08", "SR-1-C06", "SR-1-C07", "SR-1-C01", "SR-1-C02", "SR-1-C03", "SR-1-C04", "SR-1-C05", "SR-1-C12", "SR-1-C09", "SR-1-C10", "SR-1-C13", "SR-1-C14"} |
| + |
| +// SR-4-C95 and SR-4-C96 left the built list when fleet record labels |
| +// replaced their text with C41 and C40, which point at carlos instances |
| +// label; those drafts are held by TestInstancesLabelCopyKeysPresent until |
| +// Paul's copy review. |
| func statelessReplicaCopyRows(t *testing.T) []copyRow { |
| t.Helper() |
diff --git a/docs/drafts/fleet-record-labels/README.md b/docs/drafts/fleet-record-labels/README.md| new file mode 100644 |
| index 000000000..75135ba82 |
| --- /dev/null |
| +++ b/docs/drafts/fleet-record-labels/README.md |
| @@ -0,0 +1,105 @@ |
| +# Fleet record labels: copy deck |
| + |
| +The strings for `carlos instances label` and the refusals around it (#1008 |
| +option B), drafted from spec §9 of |
| +`docs/superpowers/specs/2026-11-14-fleet-record-labels-design.md`, after a UX |
| +pass on the real CLI output. The deck for Paul's copy review is |
| +`copy-review/strings.json` (66 strings). Each string is marked in the code |
| +with `// draft for copy review (Cnn)`, and `TestInstancesLabelCopyKeysPresent` |
| +fails if any key from C01 to C50 loses its marker. |
| + |
| +Approved text is applied verbatim before release B. |
| + |
| +## UX pass |
| + |
| +Captured by running the built CLI against a stub console: a dry run with |
| +agreeing evidence, a dry run with disagreeing evidence, an applied label, and |
| +refusals (no evidence, not the serving box, an outside address, the release |
| +floor, an unknown outcome). |
| + |
| +Dry run, before: |
| + |
| +```text |
| +shop.example.com is not tied to a box of fleet pi |
| + last binding reported: box-1 (3m05s ago) |
| + the hub sends its requests to box-1 |
| + these agree: box-1 looks like the box serving it |
| + this is what the boxes reported, not proof of which box runs it now |
| +box-1 can take it. tie it with carlos instances label --app shop shop.example.com --box box-1 |
| +if the report is wrong, tying it moves it: it stops on the box that runs it and starts on box-1 from its last saved copy |
| +dry run. nothing changed |
| +``` |
| + |
| +Dry run, after: |
| + |
| +```text |
| +shop.example.com is not tied to a box of fleet pi |
| + last binding reported: box-1 (3m05s ago) |
| + the hub sends its requests to box-1 |
| + these agree: box-1 looks like the box serving it |
| + this is what the boxes reported, not proof of which box runs it now |
| +box-1 can take it |
| +if the report is wrong, tying it moves it: it stops on the box that runs it and starts on box-1 from its last saved copy |
| +to tie it, run: |
| + carlos instances label --account bab --app shop shop.example.com --box box-1 |
| +dry run. nothing changed |
| +``` |
| + |
| +### Changes |
| + |
| +1. **C14, the command to run, and new C48.** |
| + - Before: `%s can take it. tie it with carlos instances label --app %s %s --box %s` |
| + - After: `%s can take it`, then C15, then `to tie it, run:` (C48), then the command on its own indented line. |
| + - Why: the command sat inside a sentence, and came before the warning about what it does. Now the reader sees the consequence (C15) before the action, and the command is a line they can copy whole. |
| + |
| +2. **The command keeps the operator's console and account** (C14 and C38). |
| + - Before: the command always read `carlos instances label --app <a> <host> ...`, so an operator on a second console, or with more than one account, got a command that went somewhere else or failed. |
| + - After: any `--console`, `--destination`, `--account` or `--account-id` the operator typed is repeated in the command, shell-quoted when needed. A flag left to its default stays out. |
| + - Why: the command must do what it says when pasted. |
| + |
| +3. **The no-evidence refusal says what to do: new C47.** |
| + - Before: the refusal repeated the evidence line just above it (C09, or C10's second form), so the output said the same thing twice and gave no next step. |
| + - After: `nothing shows which box serves it yet. open it once, then try again in about 10 minutes` |
| + - Why: no repeated lines; a refusal says what to do. The wait matches C12. |
| + |
| +4. **C38, the unknown result.** |
| + - Before: `the result is unknown: the console did not answer in time. run carlos instances label --app %s %s to see whether it is tied` |
| + - After (CLI): `the result is unknown: it may or may not be tied. to see which, run:` and the command on its own line. |
| + - After (console, C38.door): `the result is unknown: it may or may not be tied. to see which, run carlos instances label --app %s %s` |
| + - Why: C38 is also shown when the save fails at once with an unknown outcome, or the connection drops, or a gateway fails, so "did not answer in time" was wrong. The new words state the one thing that is true in every case, and what to do. |
| + |
| +5. **C29, the release floor.** |
| + - Before: `%s runs %s. every box of fleet %s needs %s or later before instances can be tied to boxes` |
| + - After: `%s runs %s. tying instances to boxes needs %s or later on the console and on every box of fleet %s` |
| + - Why: when the console is the one behind, the old line said "the console runs v0.34.0. every box of fleet pi needs ...", which points the reader at the boxes. The new line names both. The placeholders now run: who, their release, the floor, the fleet. |
| + |
| +6. **"the console" in C29 gets its own key, C49.** It was added with the floor answer under C29's marker. A separate key lets it be reviewed as a word choice of its own. |
| + |
| +7. **The `--account-id` help gets a key, C50.** An earlier review round rewrote it for this command (no capitals, no dash), but it had no key. |
| + |
| +### Looked at and left |
| + |
| +- **The timestamp on refusal lines.** Refusals go to stderr through the CLI's standard `log.Fatal`, which prints the date and time first. Every other `carlos instances` verb does the same (retry, set-pages, create, delete), so this command keeps it. Dropping it for one verb would make this command the odd one out; dropping it for all is a CLI-wide decision. |
| +- **The `using <console> as <address>` line** is printed by every console command. Unchanged. |
| +- **The order of the evidence block.** State first (C06), then the two reports, then whether they agree, then the dimmed caveat (C13). It already reads top-down; unchanged. |
| +- **The applied answer (C17)** is one line and states the result. Unchanged. |
| + |
| +## Keys |
| + |
| +- C01 to C45: spec §9 and the plan (C43 to C45 are box log lines). |
| +- C40 and C41 replace the guard's refusals, approved by Paul as SR-5-C02 and SR-5-C01 (`7e86fb1`), so they point at the new command. The stateless replicas deck marks SR-4-C95 and SR-4-C96 as superseded, and they left that deck's built list. |
| +- C46: the console's copy of C31's reasons, used by C42. Same words; a test holds them to C31's. Not in the deck: edit C31's reasons and C46 follows. |
| +- C47: the no-evidence refusal (UX pass). |
| +- C48: `to tie it, run:` (UX pass). |
| +- C49: `the console`, C29's subject when the console is below the floor. |
| +- C50: the `--account-id` help. |
| + |
| +## Left out of the deck |
| + |
| +- `C46`, the console's reasons: identical to C31's reasons, which are in the deck. |
| +- `carlos instances label` as a command prefix (`labelCommandLine`): command syntax from C01, not prose. |
| +- `instances label: unreadable response: %w`: an internal error a person sees only if the console sends broken JSON on a dry run. |
| +- `<host>: <code>`: the fallback for a refusal code this CLI does not know; it only shows across a version skew. |
| +- The shared flag help for `--app`, `--console`, `--account` and `--destination`: used unchanged by many commands. |
| +- The shared refusals the door reuses: `too many requests. wait a minute and try again`, the missing bucket answer, the start of the owner refusal, and the standard not-found answer. |
| +- The console's own log lines for the door and for creates (`console: api instance label ...`, `... manifest ... cannot be verified ...; refused`): diagnostics for platform operators reading console logs, not text an owner acts on. |
diff --git a/docs/site/cli.md b/docs/site/cli.md| index c6d966605..450e14d58 100644 |
| --- a/docs/site/cli.md |
| +++ b/docs/site/cli.md |
| @@ -1381,6 +1381,41 @@ Turns page caching on or off for one instance. `off` throws away the pages it ke |
| carlos instances set-pages --app shop a.shop.example.com off |
| ``` |
| +### carlos instances label |
| + |
| +Ties an instance on a fleet to the box serving it now. An instance that is not tied to a box is carried by every box of its fleet. That is fine while the fleet has one box. With more than one, the platform will not add a box, run more than one copy, or switch it to a release without a local database until the instance is tied to one box. |
| + |
| +Use it when a refusal tells you to tie an instance first, or before you add a second box to a fleet that already runs instances. Instances created on a fleet with more than one box are tied when they are created, so older instances are the ones that need it. |
| + |
| +Run it without `--box` first. This is a dry run and changes nothing. It shows two reports: the box that last reported running the instance, and the box the hub sends its requests to. When they agree, it names that box and gives you the command that ties it. |
| + |
| +```sh |
| +carlos instances label --app shop shop.example.com |
| +``` |
| + |
| +```text |
| +shop.example.com is not tied to a box of fleet main |
| + last binding reported: box-1 (3m05s ago) |
| + the hub sends its requests to box-1 |
| + these agree: box-1 looks like the box serving it |
| + this is what the boxes reported, not proof of which box runs it now |
| +box-1 can take it |
| +if the report is wrong, tying it moves it: it stops on the box that runs it and starts on box-1 from its last saved copy |
| +to tie it, run: |
| + carlos instances label --app shop shop.example.com --box box-1 |
| +dry run. nothing changed |
| +``` |
| + |
| +The reports are not proof. If they are wrong, tying the instance moves it: it stops on the box that runs it and starts on the box you named from its last saved copy. |
| + |
| +You can only tie an instance to the box serving it now. Naming any other box is refused. To move an instance off a box, drain that box with `carlos fleets drain`. If the two reports disagree, or one is missing, wait for the instance to settle, or open it once, then try again in about 10 minutes. |
| + |
| +To tie it, run the command the dry run gave you. Only an account owner can tie an instance to a box. The other boxes stop carrying it once they update, usually within seconds. If the command cannot tell whether the change landed, run it again without `--box` to see. |
| + |
| +```sh |
| +carlos instances label --app shop shop.example.com --box box-1 |
| +``` |
| + |
| ### carlos instances backups |
| ```sh |
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md| index d7fae29cf..fd1d26836 100644 |
| --- a/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md |
| +++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md |
| @@ -166,5 +166,5 @@ copy too. Internal wire enums are not an excuse to expose unreviewed text. |
| | SR-4-C92 | internal/activator/replicadeploy.go | the new copy's configuration was not written on its box in time, so it did not start. existing copies keep serving | approved (controller; Luna house rules) (drill 1 round 2) | |
| | SR-4-C93 | docs/site/stateless-replicas.md | An app that creates its own instance.key or report.token file must take those values from a shared source, its configuration or its environment, or run one copy. The platform gives every copy the same CARLOS_INSTANCE_KEY, but it cannot stop each copy of an app from writing a different file of its own. | approved (controller; Luna house rules) (drill 1 round 2, A3 restriction) | |
| | SR-4-C94 | docs/site/stateless-replicas.md | When a copy switches, its old build stops once the new one serves. A response still streaming from the old build when it stops is cut, as when a box stops. Websockets on the old build disconnect and their clients reconnect to a healthy copy. | approved (controller; Luna house rules) (drill 3, H4) | |
| -| SR-4-C95 | internal/console/appcopies.go | <host> is not tied to one box of fleet <fleet>, and that fleet has more than one box. a release without a local database needs that first, so keep this app on a release with a local database for now | approved (Paul, copy review u4k4cyxedlsfh72a7vpq3sn2uu as SR-5-C01, 2026-11-14; #1008: refused at ship, at any publication of a stateless build, and at copies above 1) | |
| -| SR-4-C96 | internal/console/appcopies.go | <host> runs a release without a local database and is not tied to a box of fleet <fleet>, so a second active box would stop it. move it to a release with a local database before adding a box | approved (Paul, copy review u4k4cyxedlsfh72a7vpq3sn2uu as SR-5-C02, 2026-11-14; #1008: refused at fleet add-box, box reactivation and a managed fleet add) | |
| +| SR-4-C95 | internal/console/appcopies.go | <host> is not tied to one box of fleet <fleet>, and that fleet has more than one box. a release without a local database needs that first, so keep this app on a release with a local database for now | pending (superseded 2026-11-14 by fleet record labels C41, which points at carlos instances label; this text was approved by Paul as SR-5-C01 in copy review u4k4cyxedlsfh72a7vpq3sn2uu; the new text goes to Paul's copy review in docs/drafts/fleet-record-labels/copy-review) | |
| +| SR-4-C96 | internal/console/appcopies.go | <host> runs a release without a local database and is not tied to a box of fleet <fleet>, so a second active box would stop it. move it to a release with a local database before adding a box | pending (superseded 2026-11-14 by fleet record labels C40, which points at carlos instances label; this text was approved by Paul as SR-5-C02 in copy review u4k4cyxedlsfh72a7vpq3sn2uu; the new text goes to Paul's copy review in docs/drafts/fleet-record-labels/copy-review) | |
diff --git a/instances_cli.go b/instances_cli.go| index 15df87cca..08a5b834b 100644 |
| --- a/instances_cli.go |
| +++ b/instances_cli.go |
| @@ -1257,46 +1257,53 @@ func runInstancesRetry(args []string) { |
| // option B): the client of the console's label door. Its strings are the |
| // spec's drafts, each marked with its key until Paul's copy review. |
| const ( |
| - instancesLabelUsageLine = "carlos instances label --app <a> <host> [--box <b>] [--dry-run]" // draft for copy review (C01) |
| - instancesLabelHelp = "label ties an instance on a fleet to the box serving it now. without --box, or with --dry-run, it only shows what it found and changes nothing" // draft for copy review (C02) |
| - instancesLabelFlagBox = "the box to tie it to. it must be the box serving it now" // draft for copy review (C03) |
| - instancesLabelFlagDry = "show what would happen and change nothing" // draft for copy review (C04) |
| - instancesLabelOneHost = "name one instance host" // draft for copy review (C05) |
| - |
| - labelNotTied = "%s is not tied to a box of fleet %s" // draft for copy review (C06) |
| - labelNothingToDo = "%s is already tied to %s. nothing to do" // draft for copy review (C07) |
| - labelBindingSeen = "last binding reported: %s (%s ago)" // draft for copy review (C08) |
| - labelNoBinding = "no box has reported a binding for it since it was created" // draft for copy review (C09) |
| - labelHubBox = "the hub sends its requests to %s" // draft for copy review (C10) |
| - labelNoHubBox = "the hub has no box for it yet" // draft for copy review (C10) |
| - labelAgree = "these agree: %s looks like the box serving it" // draft for copy review (C11) |
| - labelDisagree = "these disagree. wait for it to settle, or open it once, then try again in about 10 minutes" // draft for copy review (C12) |
| - labelNotProof = "this is what the boxes reported, not proof of which box runs it now" // draft for copy review (C13) |
| - labelCanTake = "%s can take it. tie it with carlos instances label --app %s %s --box %s" // draft for copy review (C14) |
| - labelIfWrong = "if the report is wrong, tying it moves it: it stops on the box that runs it and starts on %s from its last saved copy" // draft for copy review (C15) |
| - labelDryRun = "dry run. nothing changed" // draft for copy review (C16) |
| - labelTied = "tied %s to %s. the other boxes stop carrying it once they update, usually within seconds" // draft for copy review (C17) |
| - labelNotOnFleet = "%s is not on a fleet" // draft for copy review (C19) |
| - labelAlreadyTied = "%s is already tied to %s. to move it, drain that box with carlos fleets drain" // draft for copy review (C20) |
| - labelCopies = "%s runs as copies, so placement chooses its boxes" // draft for copy review (C21) |
| - labelMoving = "%s has a move in progress. finish it before tying it to a box" // draft for copy review (C22) |
| - labelImporting = "%s has an import in progress. finish it before tying it to a box" // draft for copy review (C23) |
| - labelCoordinated = "%s is coordinated by %s right now. try again in a few minutes" // draft for copy review (C24) |
| - labelNotActive = "%s is not an active box of fleet %s" // draft for copy review (C25) |
| - labelDraining = "%s is draining. it cannot take an instance" // draft for copy review (C26) |
| - labelStale = "%s has not reported in recently" // draft for copy review (C27) |
| - labelRuntime = "%s cannot run this app's runtime yet" // draft for copy review (C28) |
| - labelFloor = "%s runs %s. every box of fleet %s needs %s or later before instances can be tied to boxes" // draft for copy review (C29) |
| - labelNotServing = "%s is not the box serving it now. only that box can be named for now" // draft for copy review (C30) |
| - labelUnmovable = "%s cannot be tied to one box: %s" // draft for copy review (C31) |
| - labelSidecars = "fleet %s has sidecars, so its instances cannot be tied to boxes yet" // draft for copy review (C32) |
| - labelCompetingWrite = "another change tied %s to %s first. nothing more changed" // draft for copy review (C34) |
| - labelChanged = "%s changed while it was being tied, so it was not tied. try again" // draft for copy review (C35) |
| - labelMarkFailed = "could not mark %s for this instance, so it was not tied. try again" // draft for copy review (C36) |
| - labelReadFailed = "could not read the instance and its fleet, so it was not tied. try again" // draft for copy review (C37) |
| - labelUnknown = "the result is unknown: the console did not answer in time. run carlos instances label --app %s %s to see whether it is tied" // draft for copy review (C38) |
| + instancesLabelUsageLine = "carlos instances label --app <a> <host> [--box <b>] [--dry-run]" // draft for copy review (C01) |
| + instancesLabelHelp = "label ties an instance on a fleet to the box serving it now. without --box, or with --dry-run, it only shows what it found and changes nothing" // draft for copy review (C02) |
| + instancesLabelFlagBox = "the box to tie it to. it must be the box serving it now" // draft for copy review (C03) |
| + instancesLabelFlagDry = "show what would happen and change nothing" // draft for copy review (C04) |
| + instancesLabelOneHost = "name one instance host" // draft for copy review (C05) |
| + instancesLabelFlagAcctID = "account sqid, matched as a sqid only. it supersedes --account" // draft for copy review (C50) |
| + |
| + labelNotTied = "%s is not tied to a box of fleet %s" // draft for copy review (C06) |
| + labelNothingToDo = "%s is already tied to %s. nothing to do" // draft for copy review (C07) |
| + labelBindingSeen = "last binding reported: %s (%s ago)" // draft for copy review (C08) |
| + labelNoBinding = "no box has reported a binding for it since it was created" // draft for copy review (C09) |
| + labelHubBox = "the hub sends its requests to %s" // draft for copy review (C10) |
| + labelNoHubBox = "the hub has no box for it yet" // draft for copy review (C10) |
| + labelAgree = "these agree: %s looks like the box serving it" // draft for copy review (C11) |
| + labelDisagree = "these disagree. wait for it to settle, or open it once, then try again in about 10 minutes" // draft for copy review (C12) |
| + labelNotProof = "this is what the boxes reported, not proof of which box runs it now" // draft for copy review (C13) |
| + labelCanTake = "%s can take it" // draft for copy review (C14) |
| + labelRunToTie = "to tie it, run:" // draft for copy review (C48) |
| + labelIfWrong = "if the report is wrong, tying it moves it: it stops on the box that runs it and starts on %s from its last saved copy" // draft for copy review (C15) |
| + labelDryRun = "dry run. nothing changed" // draft for copy review (C16) |
| + labelTied = "tied %s to %s. the other boxes stop carrying it once they update, usually within seconds" // draft for copy review (C17) |
| + labelNotOnFleet = "%s is not on a fleet" // draft for copy review (C19) |
| + labelAlreadyTied = "%s is already tied to %s. to move it, drain that box with carlos fleets drain" // draft for copy review (C20) |
| + labelCopies = "%s runs as copies, so placement chooses its boxes" // draft for copy review (C21) |
| + labelMoving = "%s has a move in progress. finish it before tying it to a box" // draft for copy review (C22) |
| + labelImporting = "%s has an import in progress. finish it before tying it to a box" // draft for copy review (C23) |
| + labelCoordinated = "%s is coordinated by %s right now. try again in a few minutes" // draft for copy review (C24) |
| + labelNotActive = "%s is not an active box of fleet %s" // draft for copy review (C25) |
| + labelDraining = "%s is draining. it cannot take an instance" // draft for copy review (C26) |
| + labelStale = "%s has not reported in recently" // draft for copy review (C27) |
| + labelRuntime = "%s cannot run this app's runtime yet" // draft for copy review (C28) |
| + labelFloor = "%s runs %s. tying instances to boxes needs %s or later on the console and on every box of fleet %s" // draft for copy review (C29) |
| + labelNotServing = "%s is not the box serving it now. only that box can be named for now" // draft for copy review (C30) |
| + labelUnmovable = "%s cannot be tied to one box: %s" // draft for copy review (C31) |
| + labelSidecars = "fleet %s has sidecars, so its instances cannot be tied to boxes yet" // draft for copy review (C32) |
| + labelCompetingWrite = "another change tied %s to %s first. nothing more changed" // draft for copy review (C34) |
| + labelChanged = "%s changed while it was being tied, so it was not tied. try again" // draft for copy review (C35) |
| + labelMarkFailed = "could not mark %s for this instance, so it was not tied. try again" // draft for copy review (C36) |
| + labelReadFailed = "could not read the instance and its fleet, so it was not tied. try again" // draft for copy review (C37) |
| + labelUnknown = "the result is unknown: it may or may not be tied. to see which, run:" // draft for copy review (C38) |
| + labelNoEvidence = "nothing shows which box serves it yet. open it once, then try again in about 10 minutes" // draft for copy review (C47) |
| ) |
| +// labelCommandLine is the command C14 and C38 hand back to run, indented on |
| +// a line of its own so it can be copied: C01's syntax, not copy. |
| +const labelCommandLine = "carlos instances label" |
| + |
| // labelUnmovableReasons are C31's reasons, by the door's unmovable:<reason>. |
| var labelUnmovableReasons = map[string]string{ |
| "static": "every box serves a static site", // draft for copy review (C31) |
| @@ -1309,7 +1316,7 @@ var labelUnmovableReasons = map[string]string{ |
| // labelFloorConsole is C29's first blank when the door's floor_box is |
| // "console": it is this console that is below the floor. |
| -const labelFloorConsole = "the console" // draft for copy review (C29) |
| +const labelFloorConsole = "the console" // draft for copy review (C49) |
| // instanceLabelBinding mirrors the door's labelBinding. |
| type instanceLabelBinding struct { |
| @@ -1398,23 +1405,71 @@ func labelNotSent(err error) bool { |
| // instancesLabel asks the door and prints its answer to w. The error is the |
| // line the verb exits non-zero on: a refusal's copy, C38 for an unknown |
| -// outcome, or the console's own refusal (owner only, not found). |
| -func instancesLabel(ctx context.Context, w io.Writer, s *apiSession, acct apiAcct, app, host, box string, dryRun bool, now time.Time) error { |
| +// outcome, or the console's own refusal (owner only, not found). via is |
| +// the --console, --destination, --account and --account-id the operator |
| +// typed, as words, so the command C14 and C38 hand back reaches the same |
| +// console and account. |
| +func instancesLabel(ctx context.Context, w io.Writer, s *apiSession, acct apiAcct, app, host, box string, dryRun bool, via []string, now time.Time) error { |
| ans, err := s.instanceLabel(ctx, acct, app, host, box, dryRun) |
| if errors.Is(err, errLabelOutcomeUnknown) { |
| - return fmt.Errorf(labelUnknown, app, host) |
| + return labelUnknownError(app, host, via) |
| } |
| if err != nil { |
| return err |
| } |
| - return renderInstanceLabel(w, app, host, box != "" && !dryRun, ans, now) |
| + return renderInstanceLabel(w, app, host, box != "" && !dryRun, via, ans, now) |
| +} |
| + |
| +// labelUnknownError is C38 with the command that shows the outcome. |
| +func labelUnknownError(app, host string, via []string) error { |
| + return errors.New(labelUnknown + "\n " + labelCommand(app, host, "", via)) |
| +} |
| + |
| +// labelCommand is `carlos instances label` for host, with the operator's |
| +// own console and account flags, and --box when box is set. |
| +func labelCommand(app, host, box string, via []string) string { |
| + words := append([]string{labelCommandLine}, via...) |
| + words = append(words, "--app", labelShellWord(app), labelShellWord(host)) |
| + if box != "" { |
| + words = append(words, "--box", labelShellWord(box)) |
| + } |
| + return strings.Join(words, " ") |
| +} |
| + |
| +// labelShellWord quotes s for a POSIX shell when it holds anything but the |
| +// characters hosts, labels, URLs and account names usually carry. |
| +func labelShellWord(s string) string { |
| + if s != "" && strings.Trim(s, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._:/@=+-") == "" { |
| + return s |
| + } |
| + return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'" |
| +} |
| + |
| +// labelVia is the console and account flags the operator set on fs, in a |
| +// fixed order, as words to repeat in a command. |
| +func labelVia(fs *flag.FlagSet) []string { |
| + set := map[string]string{} |
| + fs.Visit(func(f *flag.Flag) { |
| + name := f.Name |
| + if name == cliAliases["destination"] { |
| + name = "destination" |
| + } |
| + set[name] = f.Value.String() |
| + }) |
| + var via []string |
| + for _, name := range []string{"console", "destination", "account", "account-id"} { |
| + if v, ok := set[name]; ok && strings.TrimSpace(v) != "" { |
| + via = append(via, "--"+name, labelShellWord(strings.TrimSpace(v))) |
| + } |
| + } |
| + return via |
| } |
| // renderInstanceLabel prints one answer. Tied (C17) is printed only when |
| // applied is true. The evidence (C06, C08-C11, C13) is printed for every |
| // answer the door judged; the record refusals it answers before reading |
| // the fleet carry none. |
| -func renderInstanceLabel(w io.Writer, app, host string, write bool, a *instanceLabelAnswer, now time.Time) error { |
| +func renderInstanceLabel(w io.Writer, app, host string, write bool, via []string, a *instanceLabelAnswer, now time.Time) error { |
| if a.Host != "" { |
| host = a.Host |
| } |
| @@ -1462,10 +1517,14 @@ func renderInstanceLabel(w io.Writer, app, host string, write bool, a *instanceL |
| if write { |
| // Eligible and asked to write, yet not applied: the door's |
| // contract never answers this, so the outcome is not known. |
| - return fmt.Errorf(labelUnknown, app, host) |
| + return labelUnknownError(app, host, via) |
| } |
| - fmt.Fprintf(w, labelCanTake+"\n", a.Box, app, host, a.Box) |
| + // What it would do (C14, C15), then the command, on its own line to |
| + // copy (C48), then that nothing changed (C16). |
| + fmt.Fprintf(w, labelCanTake+"\n", a.Box) |
| fmt.Fprintf(w, labelIfWrong+"\n", a.Box) |
| + fmt.Fprintln(w, labelRunToTie) |
| + fmt.Fprintln(w, " "+labelCommand(app, host, a.Box, via)) |
| fmt.Fprintln(w, labelDryRun) |
| return nil |
| } |
| @@ -1514,16 +1573,15 @@ func labelRefusal(host string, a *instanceLabelAnswer) string { |
| if who == "console" { |
| who = labelFloorConsole |
| } |
| - return fmt.Sprintf(labelFloor, who, a.FloorRelease, a.Fleet, a.Floor) |
| + return fmt.Sprintf(labelFloor, who, a.FloorRelease, a.Floor, a.Fleet) |
| case "not_serving": |
| return fmt.Sprintf(labelNotServing, a.Box) |
| case "disagree": |
| return labelDisagree |
| case "no_evidence": |
| - if b := a.Binding; b == nil || !b.AfterCreate { |
| - return labelNoBinding |
| - } |
| - return labelNoHubBox |
| + // The evidence block above already says which report is missing |
| + // (C09 or C10's second form), so the refusal says what to do. |
| + return labelNoEvidence |
| case "sidecars": |
| return fmt.Sprintf(labelSidecars, a.Fleet) |
| case "incomplete": |
| @@ -1552,7 +1610,7 @@ func runInstancesLabel(args []string) { |
| dryRun := fs.Bool("dry-run", false, instancesLabelFlagDry) |
| consoleFlag := consoleOption(fs, "console to act through (default: the only logged-in one)") |
| acctRaw := fs.String("account", "", "account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)") |
| - acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid only. it supersedes --account") |
| + acctIDRaw := fs.String("account-id", "", instancesLabelFlagAcctID) |
| fs.Usage = flagUsage(fs, instancesRecordsUsage) |
| words := interleavedArgs(fs, args) |
| host := "" |
| @@ -1567,7 +1625,7 @@ func runInstancesLabel(args []string) { |
| printUsing(stdout, sess) |
| acct := resolvedAccount(sess, acctRaw, acctIDRaw) |
| app2 := resolvedApp(sess, acct, *app, instancesRecordsUsage) |
| - if err := instancesLabel(context.Background(), stdout, sess, acct, app2, host, strings.TrimSpace(*box), *dryRun, time.Now()); err != nil { |
| + if err := instancesLabel(context.Background(), stdout, sess, acct, app2, host, strings.TrimSpace(*box), *dryRun, labelVia(fs), time.Now()); err != nil { |
| log.Fatal(err) |
| } |
| } |
diff --git a/instances_cli_label_test.go b/instances_cli_label_test.go| index 85d5ddfba..204d6631b 100644 |
| --- a/instances_cli_label_test.go |
| +++ b/instances_cli_label_test.go |
| @@ -107,7 +107,7 @@ const ( |
| labelC13 = "this is what the boxes reported, not proof of which box runs it now" |
| labelC16 = "dry run. nothing changed" |
| labelC17 = "tied shop.example.com to box-1. the other boxes stop carrying it once they update, usually within seconds" |
| - labelC38 = "the result is unknown: the console did not answer in time. run carlos instances label --app shop shop.example.com to see whether it is tied" |
| + labelC38 = "the result is unknown: it may or may not be tied. to see which, run:\n carlos instances label --account bab --app shop shop.example.com" |
| ) |
| // With no --box the request is a dry run, and the answer's evidence is |
| @@ -131,9 +131,11 @@ func TestInstancesLabelDryRunByDefault(t *testing.T) { |
| "the hub sends its requests to box-1", |
| "these agree: box-1 looks like the box serving it", |
| labelC13, |
| - "box-1 can take it. tie it with carlos instances label --app shop shop.example.com --box box-1", |
| - "if the report is wrong, tying it moves it: it stops on the box that runs it and starts on box-1 from its last saved copy", |
| - labelC16, |
| + "box-1 can take it\n" + |
| + "if the report is wrong, tying it moves it: it stops on the box that runs it and starts on box-1 from its last saved copy\n" + |
| + "to tie it, run:\n" + |
| + " carlos instances label --account bab --app shop shop.example.com --box box-1\n" + |
| + labelC16 + "\n", |
| } { |
| if !strings.Contains(out, want) { |
| t.Errorf("output missing %q:\n%s", want, out) |
| @@ -244,17 +246,17 @@ func TestInstancesLabelRefusalExitsNonZero(t *testing.T) { |
| {"stale", refused("stale", nil), nil, "box-1 has not reported in recently"}, |
| {"runtime", refused("runtime", nil), nil, "box-1 cannot run this app's runtime yet"}, |
| {"floor: a box", refused("floor", map[string]any{"floor_box": "box-2", "floor_release": "v0.34.0", "floor": "v9.9.9"}), nil, |
| - "box-2 runs v0.34.0. every box of fleet pi needs v9.9.9 or later before instances can be tied to boxes"}, |
| + "box-2 runs v0.34.0. tying instances to boxes needs v9.9.9 or later on the console and on every box of fleet pi"}, |
| {"floor: the console", refused("floor", map[string]any{"floor_box": "console", "floor_release": "v0.34.0", "floor": "v9.9.9"}), nil, |
| - "the console runs v0.34.0. every box of fleet pi needs v9.9.9 or later before instances can be tied to boxes"}, |
| + "the console runs v0.34.0. tying instances to boxes needs v9.9.9 or later on the console and on every box of fleet pi"}, |
| {"not_serving", refused("not_serving", map[string]any{"box": "box-2"}), []string{"--box", "box-2"}, |
| "box-2 is not the box serving it now. only that box can be named for now"}, |
| {"disagree", refused("disagree", map[string]any{"hub_box": "box-2", "agree": false, "serving_box": "", "box": ""}), nil, |
| "these disagree. wait for it to settle, or open it once, then try again in about 10 minutes"}, |
| {"no_evidence: no binding", refused("no_evidence", map[string]any{"binding": nil, "agree": false, "serving_box": "", "box": ""}), nil, |
| - "no box has reported a binding for it since it was created"}, |
| + "nothing shows which box serves it yet. open it once, then try again in about 10 minutes"}, |
| {"no_evidence: no hub row", refused("no_evidence", map[string]any{"hub_box": "", "agree": false, "serving_box": "", "box": ""}), nil, |
| - "the hub has no box for it yet"}, |
| + "nothing shows which box serves it yet. open it once, then try again in about 10 minutes"}, |
| {"unmovable:static", withEarly("unmovable:static", nil), nil, "shop.example.com cannot be tied to one box: every box serves a static site"}, |
| {"unmovable:addr", refused("unmovable:addr", nil), nil, "shop.example.com cannot be tied to one box: it is served from an address the platform does not manage"}, |
| {"unmovable:always_on", refused("unmovable:always_on", nil), nil, "shop.example.com cannot be tied to one box: it never sleeps and keeps a local database"}, |
| @@ -326,7 +328,7 @@ func TestInstancesLabelUnknownOutcome(t *testing.T) { |
| cancel() // the deadline passes while the console holds the write |
| }() |
| var out bytes.Buffer |
| - err := instancesLabel(ctx, &out, newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", "shop.example.com", "box-1", false, time.Now()) |
| + err := instancesLabel(ctx, &out, newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", "shop.example.com", "box-1", false, []string{"--account", "bab"}, time.Now()) |
| if err == nil || err.Error() != labelC38 { |
| t.Fatalf("err = %v, want C38", err) |
| } |
| @@ -344,7 +346,7 @@ func TestInstancesLabelUnknownOutcome(t *testing.T) { |
| cancel() |
| }() |
| var out bytes.Buffer |
| - err := instancesLabel(ctx, &out, newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", "shop.example.com", "", true, time.Now()) |
| + err := instancesLabel(ctx, &out, newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", "shop.example.com", "", true, []string{"--account", "bab"}, time.Now()) |
| if err == nil || err.Error() == labelC38 { |
| t.Fatalf("err = %v, want a plain error (nothing was written)", err) |
| } |
| @@ -473,3 +475,39 @@ func TestInstancesLabelArgErrors(t *testing.T) { |
| t.Fatalf("the console saw %d requests, want 0", calls) |
| } |
| } |
| + |
| +// The command C14 hands back carries the console and account the operator |
| +// named, so it reaches the same place; a flag left to its default stays out. |
| +func TestInstancesLabelCommandKeepsConsoleAndAccount(t *testing.T) { |
| + stub := newLabelStub(t, http.StatusOK, labelAnswerJSON(t, nil)) |
| + out, ok := runLabelCLI(t, stub.ts.URL, "--console", stub.ts.URL, "--app", "shop", "--account", "bab", "shop.example.com") |
| + want := " carlos instances label --console " + stub.ts.URL + " --account bab --app shop shop.example.com --box box-1\n" |
| + if !ok || !strings.Contains(out, want) { |
| + t.Fatalf("want %q and exit 0, got ok=%v:\n%s", want, ok, out) |
| + } |
| + if got := labelCommand("shop", "shop.example.com", "", []string{"--account", labelShellWord("my team")}); got != "carlos instances label --account 'my team' --app shop shop.example.com" { |
| + t.Fatalf("labelCommand = %q", got) |
| + } |
| +} |
| + |
| +// A no_evidence refusal says what to do, and does not repeat the missing |
| +// report the evidence block already names. |
| +func TestInstancesLabelNoEvidenceSaysItOnce(t *testing.T) { |
| + for _, tc := range []struct { |
| + over map[string]any |
| + line string |
| + }{ |
| + {map[string]any{"binding": nil}, "no box has reported a binding for it since it was created"}, |
| + {map[string]any{"hub_box": ""}, "the hub has no box for it yet"}, |
| + } { |
| + over := map[string]any{"why_not": "no_evidence", "eligible": false, "agree": false, "serving_box": "", "box": ""} |
| + for k, v := range tc.over { |
| + over[k] = v |
| + } |
| + stub := newLabelStub(t, http.StatusOK, labelAnswerJSON(t, over)) |
| + out, ok := runLabelCLI(t, stub.ts.URL, "--app", "shop", "--account", "bab", "shop.example.com") |
| + if ok || strings.Count(out, tc.line) != 1 || !strings.Contains(out, "nothing shows which box serves it yet") { |
| + t.Fatalf("want %q once, C47, and a non-zero exit, got ok=%v:\n%s", tc.line, ok, out) |
| + } |
| + } |
| +} |
diff --git a/instances_label_copy_keys_test.go b/instances_label_copy_keys_test.go| new file mode 100644 |
| index 000000000..3f83586ca |
| --- /dev/null |
| +++ b/instances_label_copy_keys_test.go |
| @@ -0,0 +1,115 @@ |
| +// The fleet record labels copy keys (spec §9, and the keys the T7 UX pass |
| +// added) are held in the code by their markers until Paul's copy review: |
| +// every key must have at least one `// draft for copy review (Cnn)` in a Go |
| +// source file, so a string cannot lose its place in the deck unnoticed. |
| +package main |
| + |
| +import ( |
| + "fmt" |
| + "io/fs" |
| + "os" |
| + "path/filepath" |
| + "regexp" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +// instancesLabelCopyKeys is C01-C45 from the spec and plan, then C46-C50 |
| +// from the UX pass (docs/drafts/fleet-record-labels/README.md). |
| +var instancesLabelCopyKeys = func() []string { |
| + var keys []string |
| + for i := 1; i <= 50; i++ { |
| + keys = append(keys, fmt.Sprintf("C%02d", i)) |
| + } |
| + return keys |
| +}() |
| + |
| +var instancesLabelCopyMarker = regexp.MustCompile(`draft for copy review \((C[0-9]{2})\)`) |
| + |
| +// instancesLabelCopyMarks maps each key to the marked lines under root's Go |
| +// sources, test files excluded. |
| +func instancesLabelCopyMarks(t *testing.T, root string) map[string][]string { |
| + t.Helper() |
| + marks := map[string][]string{} |
| + err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { |
| + if err != nil { |
| + return err |
| + } |
| + if d.IsDir() { |
| + name := d.Name() |
| + if path != root && (strings.HasPrefix(name, ".") || name == "node_modules" || name == "testdata" || name == "docs") { |
| + return filepath.SkipDir |
| + } |
| + return nil |
| + } |
| + if !strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "_test.go") { |
| + return nil |
| + } |
| + raw, err := os.ReadFile(path) |
| + if err != nil { |
| + return err |
| + } |
| + lines := strings.Split(string(raw), "\n") |
| + for i, line := range lines { |
| + for _, m := range instancesLabelCopyMarker.FindAllStringSubmatch(line, -1) { |
| + // A marker on a line of its own names the line below. |
| + text := line |
| + if strings.HasPrefix(strings.TrimSpace(line), "//") && i+1 < len(lines) { |
| + text = lines[i+1] |
| + } |
| + marks[m[1]] = append(marks[m[1]], fmt.Sprintf("%s:%d: %s", path, i+1, strings.TrimSpace(text))) |
| + } |
| + } |
| + return nil |
| + }) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return marks |
| +} |
| + |
| +func TestInstancesLabelCopyKeysPresent(t *testing.T) { |
| + marks := instancesLabelCopyMarks(t, ".") |
| + var missing []string |
| + for _, key := range instancesLabelCopyKeys { |
| + if len(marks[key]) == 0 { |
| + missing = append(missing, key) |
| + } |
| + } |
| + if len(missing) > 0 { |
| + t.Fatalf("copy keys with no `draft for copy review (Cnn)` marker in the tree: %s", strings.Join(missing, ", ")) |
| + } |
| + for key, lines := range marks { |
| + for _, line := range lines { |
| + if strings.Contains(line, "—") { |
| + t.Errorf("%s has an em dash: %s", key, line) |
| + } |
| + } |
| + } |
| +} |
| + |
| +// The console's copy of C31's reasons (C46, named by C42) says what the |
| +// CLI's C31 says, word for word: one review covers both. |
| +func TestInstancesLabelConsoleReasonsMatchTheCLI(t *testing.T) { |
| + reason := regexp.MustCompile(`^"([a-z_]+)":\s*"([^"]*)",`) |
| + byKey := func(lines []string) map[string]string { |
| + out := map[string]string{} |
| + for _, line := range lines { |
| + _, text, _ := strings.Cut(line, ": ") |
| + if m := reason.FindStringSubmatch(strings.TrimSpace(text)); m != nil { |
| + out[m[1]] = m[2] |
| + } |
| + } |
| + return out |
| + } |
| + marks := instancesLabelCopyMarks(t, ".") |
| + cli, console := byKey(marks["C31"]), byKey(marks["C46"]) |
| + if len(console) == 0 { |
| + t.Fatal("no C46 reasons found") |
| + } |
| + for k, text := range console { |
| + if cli[k] != text { |
| + t.Errorf("reason %s: console (C46) %q, CLI (C31) %q", k, text, cli[k]) |
| + } |
| + } |
| +} |
diff --git a/internal/console/appcopies.go b/internal/console/appcopies.go| index 1c0499f4c..e88453a30 100644 |
| --- a/internal/console/appcopies.go |
| +++ b/internal/console/appcopies.go |
| @@ -21,10 +21,12 @@ import ( |
| const ( |
| copiesStopping = "copies are still stopping on other boxes. wait for that to finish before selecting a release with a local database" |
| - // copiesUnlabelledGrowth (#1008, draft for copy review): host, fleet. |
| - copiesUnlabelledGrowth = "%s runs a release without a local database and is not tied to a box of fleet %s, so a second active box would stop it. move it to a release with a local database before adding a box" |
| - // copiesUnlabelled (#1008, draft for copy review): host, fleet. |
| - copiesUnlabelled = "%s is not tied to one box of fleet %s, and that fleet has more than one box. a release without a local database needs that first, so keep this app on a release with a local database for now" |
| + // copiesUnlabelledGrowth (#1008): host, fleet. It points at carlos |
| + // instances label (fleet record labels C40), replacing SR-4-C96. |
| + copiesUnlabelledGrowth = "%s is not tied to a box of fleet %s, so a second box would stop it. tie it first with carlos instances label, then add the box" // draft for copy review (C40) |
| + // copiesUnlabelled (#1008): host, fleet. It points at carlos instances |
| + // label (fleet record labels C41), replacing SR-4-C95. |
| + copiesUnlabelled = "%s is not tied to one box of fleet %s, and that fleet has more than one box. tie it first with carlos instances label, then try again" // draft for copy review (C41) |
| copiesBounds = "copies must be a whole number of at least 1" |
| copiesCapacity = "%d copies need %d eligible boxes. this fleet has %d" |
| copiesRelease = "more than one copy requires a stateless, always-on release. set --copies 1 before selecting this release" |
diff --git a/internal/console/fleetcreate.go b/internal/console/fleetcreate.go| index 8b8df7a73..6e3fe35f3 100644 |
| --- a/internal/console/fleetcreate.go |
| +++ b/internal/console/fleetcreate.go |
| @@ -37,14 +37,16 @@ func msgFleetCreateUnplaceable(host, reason string) string { |
| return fmt.Sprintf("%s cannot run on a fleet with more than one box: %s", host, reason) // draft for copy review (C42) |
| } |
| -// unmovableReasonText is C31's reasons, by unmovableReason's key. C42 |
| -// names one of them. |
| +// unmovableReasonText is the console's copy of C31's reasons (C46), by |
| +// unmovableReason's key. C42 names one of them. The CLI keeps its own |
| +// (labelUnmovableReasons, package main); TestInstancesLabelCopyKeysPresent |
| +// holds the two to the same words. |
| var unmovableReasonText = map[string]string{ |
| - "addr": "it is served from an address the platform does not manage", // draft for copy review (C31) |
| - "always_on": "it never sleeps and keeps a local database", // draft for copy review (C31) |
| - "unit": "it runs as a system unit", // draft for copy review (C31) |
| - "ha": "it is a high availability instance", // draft for copy review (C31) |
| - "demo": "it is a demo", // draft for copy review (C31) |
| + "addr": "it is served from an address the platform does not manage", // draft for copy review (C46) |
| + "always_on": "it never sleeps and keeps a local database", // draft for copy review (C46) |
| + "unit": "it runs as a system unit", // draft for copy review (C46) |
| + "ha": "it is a high availability instance", // draft for copy review (C46) |
| + "demo": "it is a demo", // draft for copy review (C46) |
| } |
| // fleetCreateApplies reports whether D1 decides a create of rec on a fleet |
diff --git a/internal/console/instancelabel.go b/internal/console/instancelabel.go| index d3fce08d7..1e680bd3c 100644 |
| --- a/internal/console/instancelabel.go |
| +++ b/internal/console/instancelabel.go |
| @@ -113,9 +113,11 @@ const claimInstanceLabelUnsupportedMsg = "tying instances to boxes is not availa |
| const msgLabelReadFailed = "could not read the instance and its fleet, so it was not tied. try again" // draft for copy review (C37) |
| // msgLabelUnknown is the door's answer when the record write failed in a |
| -// way that does not say whether it landed. |
| +// way that does not say whether it landed: a deadline, or a store error |
| +// with no outcome. It is C38 on one line; the CLI prints its own C38 with |
| +// the command on a line of its own. |
| func msgLabelUnknown(app, host string) string { |
| - return fmt.Sprintf("the result is unknown: the console did not answer in time. run carlos instances label --app %s %s to see whether it is tied", app, host) // draft for copy review (C38) |
| + return fmt.Sprintf("the result is unknown: it may or may not be tied. to see which, run carlos instances label --app %s %s", app, host) // draft for copy review (C38) |
| } |
| // labelDoorTimeout bounds one request: the fleet view reads each heartbeat |
diff --git a/internal/console/instancelabel_test.go b/internal/console/instancelabel_test.go| index c515efb80..2b33f19c0 100644 |
| --- a/internal/console/instancelabel_test.go |
| +++ b/internal/console/instancelabel_test.go |
| @@ -584,7 +584,7 @@ func TestLabelDoorMarkSurvivesFailedWrite(t *testing.T) { |
| servingEvidence(t, fx, reg, created, "pi-1") |
| fx.srv.cfg.Releases = putFailStore{Store: fx.srv.cfg.Releases, key: provision.RecordKey(fx.sqid, "shop", labelHost)} |
| code, _, raw := rawReq(t, http.MethodPost, labelURL(fx, labelHost), token, labelBody("pi-1", false)) |
| - want := fmt.Sprintf("the result is unknown: the console did not answer in time. run carlos instances label --app shop %s to see whether it is tied", labelHost) |
| + want := fmt.Sprintf("the result is unknown: it may or may not be tied. to see which, run carlos instances label --app shop %s", labelHost) |
| if code != http.StatusBadGateway || errorOf(t, raw) != want { |
| t.Fatalf("a failed write = %d %s; want 502 with C38", code, raw) |
| } |