carlos / platform Public

docs: restoring a deleted instance (#658)

Adds the approved "Bringing back a deleted instance" section to the CLI
docs, weights the restore provenance simulation for the CI shards, and
drafts the CLI's --restore request. make census-card reports a clean
census.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev e99738ce7c2ba0cd11db7c16c894b7f4815b2ce0 parent 85f425e
3 files changed, +63 −0
  • .amadan/test-weights.tsv +1 −0
  • docs/site/cli.md +29 −0
  • docs/superpowers/notes/instance-restore-658-cli-request.md +33 −0

CI passed — run details

diff --git a/.amadan/test-weights.tsv b/.amadan/test-weights.tsv
index 7f2166c35..5c04bdf7a 100644
--- a/.amadan/test-weights.tsv
+++ b/.amadan/test-weights.tsv
@@ -76,6 +76,7 @@ github.com/carlosframework/platform TestSeededWiredCopyIsApplied 0.25
github.com/carlosframework/platform TestRegionLabelsCreateLinesThroughTheConsole 0.25
github.com/carlosframework/platform/internal/console TestALapsedWriterCannotOverwriteTheNextWritersRevoke 60.5
github.com/carlosframework/platform/internal/console TestClaimConsoleMutationInvariant 60.1
+github.com/carlosframework/platform/internal/console TestRestoreProvenanceSimulation 36.00
github.com/carlosframework/platform/internal/console TestPolicyWriterLeaseIsOneConsolePerBucket 30.4
github.com/carlosframework/platform/internal/console TestClaimConsoleMutationInvariantWitnesses 12.3
github.com/carlosframework/platform/internal/console TestConsoleScreensMeetTheBudget 4.2
diff --git a/docs/site/cli.md b/docs/site/cli.md
index 9804272bd..df6c2eca7 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -1242,6 +1242,35 @@ would reach that quota between them.
`--private-storage=false` turns the policy off. Instances created before it
keep the bindings and buckets they already have.
+#### Bringing back a deleted instance
+
+Deleting an instance keeps its database. To bring the instance back with
+that data, create it again on the same host with `--restore`:
+
+```sh
+carlos instances delete --app jam --host acme.jam.bab.oncarlos.com
+carlos instances create --app jam --host acme.jam.bab.oncarlos.com --restore
+```
+
+A service credential with the `instance` role does the same through the
+create door, with `"restore": true` in the body. The instance wakes with the
+data it had when it was deleted.
+
+Without `--restore`, a create on a host that has held data is refused, as it
+always has been. If a restore would work, the refusal says so.
+
+A restore works only when all of these are true:
+
+- The same app in the same account deleted the instance. An app deleted and
+ created again under the same name counts as a different app.
+- The instance was created after restore became available, and deleted after
+ that too.
+- It is a plain instance: no seed, import, pool, fleet placement or high
+ availability.
+- You restore it from the console in the region it lived in.
+
+Anything else is refused with the reason, and nothing is written.
+
**The edge-local door.** Some apps run their own processes on a box beside their instances: a router that serves many customers under one domain, a relay, a sync loop. Dialling each instance's socket directly stops working when an instance sleeps, moves to another box, or changes where its socket lives. The edge-local door is one socket those processes dial instead, wherever the instance is.
```sh
diff --git a/docs/superpowers/notes/instance-restore-658-cli-request.md b/docs/superpowers/notes/instance-restore-658-cli-request.md
new file mode 100644
index 000000000..8298d139c
--- /dev/null
+++ b/docs/superpowers/notes/instance-restore-658-cli-request.md
@@ -0,0 +1,33 @@
+# CLI request (draft, not posted)
+
+Post as an amadan discussion on the carlos CLI repo.
+
+## Title
+
+`carlos instances create --restore`
+
+## Body
+
+The platform can now bring back a deleted instance with the data it had
+(carlos/platform #658, branch `design-instance-restore-658`). The CLI needs a
+flag to ask for it.
+
+Add `--restore` (boolean, default false) to `carlos instances create`. When
+set, send `"restore": true` in the body of
+`POST /api/cli/apps/{account}/{app}/instances`. The response gains
+`"restore": true` when the instance was restored; print that the instance was
+restored rather than newly created.
+
+Without the flag, a create on a host that has held data is refused, and the
+refusal text already tells the user to use `--restore`.
+
+Help text for the flag:
+
+> Deleting an instance keeps its database. To bring the instance back with
+> that data, create it again on the same host with `--restore`.
+
+Example:
+
+```sh
+carlos instances create --app jam --host acme.jam.bab.oncarlos.com --restore
+```