carlos / platform Public

docs: operator section for the site-host demo API

Luna copy pass applied verbatim. Startup errors kept: diagnostics, not copy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 1f531cad0eab4800167229bd1d6593518ad597e3 parent f1edc6c
3 files changed, +85 −0
  • README.md +19 −0
  • docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-API-SITE-ROUTE.md +44 −0
  • docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-API-SITE-ROUTE.md +22 −0

Intent

Human

<task-notification> <task-id>bemtl26m7</task-id> <tool-use-id>toolu_01HVyqSWMrFLFTSJALcUpwbg</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ada77e36-2f79-4efb-88a5-c350ac2ffa6a/tasks/bemtl26m7.output</output-file> <status>completed</status> <summary>Background command "Wait for Task 3 implementer to finish" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bzyi7yhxp</task-id> <tool-use-id>toolu_01PQRU9spxty8M49oj8C87VD</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ada77e36-2f79-4efb-88a5-c350ac2ffa6a/tasks/bzyi7yhxp.output</output-file> <status>completed</status> <summary>Background command "Wait for the Luna copy pass" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 12.2 g CO₂e (1,306,336 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on demo-api-site-route, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/README.md b/README.md
index 0c001bb43..258b6f080 100644
--- a/README.md
+++ b/README.md
@@ -655,6 +655,25 @@ Set `CARLOS_DEMO_CONSOLE_URL` on every demo edge to the exact HTTPS origin in th
Take down every existing Plan 1 demo through `carlos system demos takedown --host <host>`. Check `takedown-status` until cleanup is complete. Their earlier traffic was never counted, so they cannot be grandfathered or given fresh counters. Once every serving path runs the protected version, run `carlos system demos serving on` and restore admission. The intended first activation is the approved dev rollout when this slice lands. Wider activation waits for the later /start plans.
+<!-- DEMO-API-SITE-ROUTE: approved by delegation, Luna copy pass, 2026-11-05. -->
+#### Serve the demo API on the site origin
+
+The site can serve anonymous demo requests for create, update and status operations on its own hostname. The alias is off by default. Confirm that the site host is already claimed by the intended account before enabling it. Once the console setting is enabled, only operators can change that host's claim.
+
+Set `CARLOS_DEMO_API_ORIGIN` to the site's HTTPS origin and `CARLOS_DEMO_API_CONSOLE_ORIGIN` to the canonical `CONSOLE_ORIGIN`. Set both on every public ingress that can receive the site, including regions without a local console, and on the console's home edge. Both must be canonical HTTPS DNS origins without ports, paths, credentials, queries or fragments. They must differ. With valid, different values, setting both enables the alias. Setting only one, using an invalid value, or setting equal values prevents edge startup.
+
+Deliver both settings through root-owned `/etc/carlos/host.env`. For group boxes, update the operator parameters in every participating region and use the existing `system host-env write --group` workflow without `--install`. Confirm replacement bootstrap releases recognize both names first. Fixed boxes keep their existing host.env workflow. Do not rewrite a fixed box with the group writer.
+
+Roll the edges before the console. Place settings immediately before each roll's restart. Stop at the first box until its startup, ordinary app traffic and alias checks pass. Every ingress needs current signing keys and a usable console route or exact console home. A remote ingress forwards over the existing authenticated backhaul. Missing keys, an unusable console target or a stale home refuse with an empty 503 and `Retry-After: 2`.
+
+After all participating edges pass, set `CONSOLE_DEMO_API_ORIGIN` to the same site origin in root-owned `/etc/systemd/system/console.service.d/40-demo-api.conf`, using a `[Service]` section and `Environment=`. Reload systemd and restart the console as part of its roll. New `statusUrl` values use the site origin. Browser `claimUrl` values keep the console origin and private fragment. Give that link to the human without fetching it. Live app URLs keep their own origin. Claim API paths are not available through this alias yet.
+
+On every public ingress, verify the static `/start` page, an empty uncached 404 for `/api/demo/not-a-route`, and a JSON uncached 404 for a well-formed unknown job ID. Then use an authorized dev demo to check actual create, status and update, source limit and rate limit refusals, client-IP attribution, and absence of cookies or cacheable responses. Keep agent API requests restricted to the site host. Local integration tests do not prove a deployed worker journey.
+
+To roll back, finish or stop active journeys and restore any website consumer that requires the alias. Clear `CONSOLE_DEMO_API_ORIGIN` and restart the console so new links use its original origin. Remove both edge parameters and host.env values, including replacement-box delivery, then restart participating edges with announced downtime. Check one before continuing. Existing returned URLs are not rewritten. The site regains its ordinary `/api/demo/*` behavior. Keep ordinary console and demo services running. No registry migration or worker cleanup is needed for this alias rollback.
+
+#### Smoke check
+
For the smoke check, gzip a tar archive of the locked starter's files without a wrapper directory. Submit it without logging in to `POST /api/demo/apps` as `application/gzip`; the compressed limit is 5,000,000 bytes. Keep the returned claim token private. Both create and update return `202` with `jobId`, `name`, `statusUrl`, and `expiresAt` (Unix seconds). Create also returns `claimToken`, `claimUrl`, and `claimAvailable:false`. Send your harness name in `X-Carlos-Client`; the stored value is trimmed to 100 bytes. Poll `statusUrl` (`GET /api/demo/jobs/<jobId>`) until its `state` is `live`. The other states are `building`, `starting`, `failed`, and `superseded`. An earlier job becomes `superseded` when a newer update is accepted, even if the earlier job was live. Use the new update's `statusUrl` to follow its progress. Then GET its exact HTTPS URL and check `X-Carlos-Version`. Write a SQLite value, submit changed source to the same POST endpoint with `Authorization: Bearer <claimToken>`, and verify that a new version serves the saved value. An update must not extend the 24-hour lifetime. An unavailable worker or failed policy check must refuse admission. If a worker has not reconnected after a console restart, create and update return `503` with `Retry-After: 15`. Retry after that many seconds. This refusal does not spend a create or update attempt.
Run `CARLOS_DEMO_DEV_WITNESS=1 go test ./internal/host -run '^TestDemoDevKernelAndPurge$' -count=1 -v` only on an explicitly designated disposable, idle linux-arm64 systemd sandbox. Install the built binary and this checkout's unit templates first. The application witness needs no pre-existing demo drop-ins. The builder witness needs root control active with its worker switch off, concurrency one, and `CARLOS_DEMO_TOOLCHAIN_DIR` pointing at the verified bundle. The root release/adoption gate must be available for the purge witness. The test exercises application and builder isolation, root stop-before-delete, and local protocol and durability checks. A skipped test is outstanding evidence, not a rollout pass. Real DNS, TLS, and fleet activation still need a separately recorded deployment check.
diff --git a/docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-API-SITE-ROUTE.md b/docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-API-SITE-ROUTE.md
new file mode 100644
index 000000000..9576854fb
--- /dev/null
+++ b/docs/superpowers/specs/LUNA-COPY-BRIEF-DEMO-API-SITE-ROUTE.md
@@ -0,0 +1,44 @@
+# Copy pass brief: serve the demo API on the site host (branch demo-api-site-route)
+
+You are the copy-review gate itself for this set. Paul delegated copy review to you on 2026-10-25; your verdicts ARE the review. Do NOT run the copy-review skill or start any server. Do not edit any file. Answer in your final message only.
+
+The feature: a platform operator can have one site host serve the anonymous demo API, so a cloud coding agent that blocks hosts by default needs one allowed host for the whole journey. These strings are a section of the operator README and three startup errors. The audience is an operator running their own deployment who already knows the words box, edge, ingress, console, region, roll and host.env.
+
+## House rules
+
+- Plain words, short sentences, 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 new sentence.
+- Sentence case, full stops on sentences. Headings have no full stop.
+- Leave setting names, paths, commands, HTTP codes and backticked text exactly as they are.
+- Do not name the product beyond what the draft does. Neutral examples only (`shop`, `example.com`).
+- Keep the order of steps. Do not drop a step or a condition: an operator follows this literally.
+
+## Facts that must stay true
+
+- The alias is off by default. Both edge settings set means on. One set, equal values or a bad value stops the edge from starting.
+- Edges go before the console. The console setting is the last step, because it changes the links agents receive.
+- Edge settings go in place immediately before the roll, so the roll's own restart picks them up. A bare edge restart causes tenant downtime, so a rollback restart is announced.
+- Only the anonymous create, update and status paths are forwarded today. Claim paths arrive later.
+- `statusUrl` follows the site origin. `claimUrl` stays on the console origin and is for a person's own browser; an agent hands it over without fetching it. Live app URLs keep their own origin.
+- An unknown path under `/api/demo` on the site gets an empty, uncached 404. A well-formed unknown job ID gets the console's JSON 404, uncached. A missing signing key, an unusable console target or a stale home gets an empty 503 with `Retry-After: 2`.
+- Once the console setting is on, only operators can change that host's claim.
+
+## Output
+
+Answer with one markdown table, `| key | new | why |`, one row per deck row in deck order, every row included, `unchanged` in why when you keep a string. Then a short **Flags** list for anything you think is wrong or unclear in fact. Do not put pipes in the table cells other than the column separators.
+
+## Deck
+
+| key | Surface | Draft text |
+|---|---|---|
+| readmeHeading | README heading | Serve the demo API on the site origin |
+| readmeIntro | README | The site can serve anonymous demo create, update and status requests on its own hostname. The alias is off by default. Confirm that the site host is already claimed by the intended account before enabling it. Once the console setting is enabled, only operators can change that host's claim. |
+| readmeSettings | README | Set `CARLOS_DEMO_API_ORIGIN` to the site's HTTPS origin and `CARLOS_DEMO_API_CONSOLE_ORIGIN` to the canonical `CONSOLE_ORIGIN`. Set both on every public ingress that can receive the site, including regions without a local console, and on the console's home edge. Both must be canonical HTTPS DNS origins without ports, paths, credentials, queries or fragments. They must differ. Setting only one prevents edge startup. |
+| readmeDelivery | README | Deliver both settings through root-owned `/etc/carlos/host.env`. For group boxes, update the operator parameters in every participating region and use the existing `system host-env write --group` workflow without `--install`. Confirm replacement bootstrap releases recognize both names first. Fixed boxes keep their existing host.env workflow. Do not rewrite a fixed box with the group writer. |
+| readmeRoll | README | Roll the edges before the console. Place settings immediately before each roll's restart. Stop at the first box until its startup, ordinary app traffic and alias checks pass. Every ingress needs current signing keys and a usable console route or exact console home. A remote ingress forwards over the existing authenticated backhaul. Missing keys, an unusable console target or a stale home refuse with an empty 503 and `Retry-After: 2`. |
+| readmeConsole | README | After all participating edges pass, set `CONSOLE_DEMO_API_ORIGIN` to the same site origin in root-owned `/etc/systemd/system/console.service.d/40-demo-api.conf`, using a `[Service]` section and `Environment=`. Reload systemd and restart the console as part of its roll. New `statusUrl` values use the site origin. Browser `claimUrl` values keep the console origin and private fragment; give that link to the human without fetching it. Live app URLs keep their own origin. Claim API paths are not available through this alias yet. |
+| readmeVerify | README | On every public ingress, verify the static `/start` page, an empty uncached 404 for `/api/demo/not-a-route`, and a JSON uncached 404 for a well-formed unknown job ID. Then use an authorized dev demo to check actual create, status and update, source-limit and rate-limit refusals, client-IP attribution, and absence of cookies or cacheable responses. Keep agent API requests restricted to the site host. Local integration tests do not prove a deployed worker journey. |
+| readmeRollback | README | To roll back, finish or stop active journeys and restore any website consumer that requires the alias. Clear `CONSOLE_DEMO_API_ORIGIN` and restart the console so new links use its original origin. Remove both edge parameters and host.env values, including replacement-box delivery, then restart participating edges with announced downtime. Check one before continuing. Existing returned URLs are not rewritten. The site regains its ordinary `/api/demo/*` behavior. Keep ordinary console and demo services running; no registry migration or worker cleanup is needed for this alias rollback. |
+| errConsoleOrigin | Console startup error | CONSOLE_DEMO_API_ORIGIN must be a canonical HTTPS DNS origin without a port, credentials, path, query or fragment |
+| errEdgeOrigins | Edge startup error | CARLOS_DEMO_API_ORIGIN and CARLOS_DEMO_API_CONSOLE_ORIGIN must both be canonical HTTPS DNS origins without ports, credentials, paths, queries or fragments |
+| errEdgeDiffer | Edge startup error | CARLOS_DEMO_API_ORIGIN and CARLOS_DEMO_API_CONSOLE_ORIGIN must differ |
diff --git a/docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-API-SITE-ROUTE.md b/docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-API-SITE-ROUTE.md
new file mode 100644
index 000000000..cd8a31fc7
--- /dev/null
+++ b/docs/superpowers/specs/LUNA-COPY-RESULT-DEMO-API-SITE-ROUTE.md
@@ -0,0 +1,22 @@
+# Luna copy result: serve the demo API on the site host
+
+Brief: LUNA-COPY-BRIEF-DEMO-API-SITE-ROUTE.md. Applied verbatim to README.md. The three startup errors keep their draft text: Luna only added backticks, and they are diagnostics, not human copy.
+
+| key | new | why |
+|---|---|---|
+| readmeHeading | Serve the demo API on the site origin | unchanged |
+| readmeIntro | The site can serve anonymous demo requests for create, update and status operations on its own hostname. The alias is off by default. Confirm that the site host is already claimed by the intended account before enabling it. Once the console setting is enabled, only operators can change that host's claim. | Clearer wording |
+| readmeSettings | Set `CARLOS_DEMO_API_ORIGIN` to the site's HTTPS origin and `CARLOS_DEMO_API_CONSOLE_ORIGIN` to the canonical `CONSOLE_ORIGIN`. Set both on every public ingress that can receive the site, including regions without a local console, and on the console's home edge. Both must be canonical HTTPS DNS origins without ports, paths, credentials, queries or fragments. They must differ. With valid, different values, setting both enables the alias. Setting only one, using an invalid value, or setting equal values prevents edge startup. | States all startup conditions |
+| readmeDelivery | Deliver both settings through root-owned `/etc/carlos/host.env`. For group boxes, update the operator parameters in every participating region and use the existing `system host-env write --group` workflow without `--install`. Confirm replacement bootstrap releases recognize both names first. Fixed boxes keep their existing host.env workflow. Do not rewrite a fixed box with the group writer. | unchanged |
+| readmeRoll | Roll the edges before the console. Place settings immediately before each roll's restart. Stop at the first box until its startup, ordinary app traffic and alias checks pass. Every ingress needs current signing keys and a usable console route or exact console home. A remote ingress forwards over the existing authenticated backhaul. Missing keys, an unusable console target or a stale home refuse with an empty 503 and `Retry-After: 2`. | unchanged |
+| readmeConsole | After all participating edges pass, set `CONSOLE_DEMO_API_ORIGIN` to the same site origin in root-owned `/etc/systemd/system/console.service.d/40-demo-api.conf`, using a `[Service]` section and `Environment=`. Reload systemd and restart the console as part of its roll. New `statusUrl` values use the site origin. Browser `claimUrl` values keep the console origin and private fragment. Give that link to the human without fetching it. Live app URLs keep their own origin. Claim API paths are not available through this alias yet. | Splits a long sentence |
+| readmeVerify | On every public ingress, verify the static `/start` page, an empty uncached 404 for `/api/demo/not-a-route`, and a JSON uncached 404 for a well-formed unknown job ID. Then use an authorized dev demo to check actual create, status and update, source limit and rate limit refusals, client-IP attribution, and absence of cookies or cacheable responses. Keep agent API requests restricted to the site host. Local integration tests do not prove a deployed worker journey. | Uses plain wording |
+| readmeRollback | To roll back, finish or stop active journeys and restore any website consumer that requires the alias. Clear `CONSOLE_DEMO_API_ORIGIN` and restart the console so new links use its original origin. Remove both edge parameters and host.env values, including replacement-box delivery, then restart participating edges with announced downtime. Check one before continuing. Existing returned URLs are not rewritten. The site regains its ordinary `/api/demo/*` behavior. Keep ordinary console and demo services running. No registry migration or worker cleanup is needed for this alias rollback. | Splits a long sentence |
+| errConsoleOrigin | `CONSOLE_DEMO_API_ORIGIN` must be a canonical HTTPS DNS origin without a port, credentials, path, query or fragment | Adds code formatting |
+| errEdgeOrigins | `CARLOS_DEMO_API_ORIGIN` and `CARLOS_DEMO_API_CONSOLE_ORIGIN` must both be canonical HTTPS DNS origins without ports, credentials, paths, queries or fragments | Adds code formatting |
+| errEdgeDiffer | `CARLOS_DEMO_API_ORIGIN` and `CARLOS_DEMO_API_CONSOLE_ORIGIN` must differ | Adds code formatting |
+
+**Flags**
+
+- “Exact console home” is not defined in this copy. Confirm that it is an established operator term.
+- “Replacement bootstrap releases recognize both names” tells operators what to confirm but not how. Add the verification method if one exists.
\ No newline at end of file