oficina / base Public

Spec: apps go live, revision 2 after Astra's first review

Eight P1s: a proxy and scan for app previews, a Linux-only confinement
of their own, the real CARLOS contract (--socket, --db), vet after ship,
an app_place merge criterion, authorizeAppDeploy with publish's rules
and the card's snapshot, one deploy per app never older over newer, a
table of where a failed deploy stopped, and a build probe set before
the first deploy. Six P2s applied once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev ad6ec119297212cbf70686f8eedd5ba7c8298bc5 parent 69ac8bb
1 file changed, +189 −107
  • docs/superpowers/specs/2026-11-28-apps-go-live-design.md +189 −107

CI passed — run details

CI log
=== build ===
CGO_ENABLED=0 go build ./...
=== vet ===
go vet ./...
=== fmt-check ===
=== staticcheck ===
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./...
=== govulncheck ===
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
No vulnerabilities found.
=== gitleaks ===
11:05PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
11:05PM INF 1 commits scanned.
11:05PM INF scanned ~2899806 bytes (2.90 MB) in 283ms
11:05PM INF no leaks found
=== budget ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 22 directories within budget
=== script-test ===
scripts/prepare-apps_test.sh
ok   releases lookup failure stops before ship
ok   app owned elsewhere stops the script
ok   apps listing failure stops before create
ok   ambiguous release dir is refused
ok   explicit version resolves the ambiguity
ok   releases match is exact, not substring
ok   shipped version is only promoted, existing app not created
ok   fresh account creates, ships, promotes to edge, enables
ok   failing promote stops the script
ok   ship is retried while uploads are rate limited
all passed
hack/fonts_test.sh
fonts_test: ok
=== test ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 ./...

receipt: test step 9.669s against a 60s target (the gate's other steps are not in this figure)
receipt: 16 packages ran, 0 cached, 6 without tests, 0 failed
receipt: slow package 8.837s amadan.net/oficina/base/internal/webtest
receipt: slow package 631ms amadan.net/oficina/base/internal/equipo
receipt: slow package 587ms amadan.net/oficina/base/internal/operations
receipt: slow package 391ms amadan.net/oficina/base/internal/issuer
receipt: slow package 184ms amadan.net/oficina/base/internal/consumer
receipt: slow test 1.52s amadan.net/oficina/base/internal/webtest TestHomeDoesNotWaitOnAStalledSnapshot
receipt: slow test 1.08s amadan.net/oficina/base/internal/webtest TestAskZoneIsToldOnce
receipt: slow test 610ms amadan.net/oficina/base/internal/webtest TestAskUploadStalledBodyFreesItsSlot
receipt: slow test 520ms amadan.net/oficina/base/internal/operations TestOperationsRefusals
receipt: slow test 510ms amadan.net/oficina/base/internal/equipo TestUploadRefusals
=== native ===
strings: copy review's strings.json is not here (git-ignored); its comparison skipped
strings: 120 in the catalog, 117 used
worktree-lib_test: ok
diff --git a/docs/superpowers/specs/2026-11-28-apps-go-live-design.md b/docs/superpowers/specs/2026-11-28-apps-go-live-design.md
index 839979a..d732058 100644
--- a/docs/superpowers/specs/2026-11-28-apps-go-live-design.md
+++ b/docs/superpowers/specs/2026-11-28-apps-go-live-design.md
@@ -1,6 +1,6 @@
# Apps Equipo builds get tested, previewed and put live with an address
-Date: 2026-11-28. Paul approved the direction on 2026-11-28. Design only: nothing here is built, merged or deployed.
+Date: 2026-11-28. Paul approved the direction on 2026-11-28. Design only: nothing here is built, merged or deployed. Revision 2, after Astra's first review (see Review, at the end).
An addendum to the jobs design (`2026-11-20-jobs-that-keep-moving-design.md`, "jobs spec", K1 to K16) and its plan (`2026-11-25-jobs-that-keep-moving.md`, "jobs plan"), both on Base branch `jobs-rulings` 19e1897. It reads the abilities design (`2026-11-26-assistant-abilities-design.md` revision 8, branch `assistant-abilities` 291b252, "abilities spec") for the `build` and `go_live` gates, and Equipo's places design (`equipo:docs/superpowers/specs/2026-11-26-places-config.md` revision 3 and Paul's rulings of 2026-11-26, "places spec") for where sites go and who holds which CARLOS credential. Code references are to Equipo `origin/main` 57f370c5 (`equipo:`), the CARLOS CLI on docs-t1 (`carlos <verb> -h`), the platform docs (`carlos/platform/docs/site/cli.md`, "cli.md") and the CARLOS app spec (`carlos/spec/spec.md`, "app spec"). Every person-facing string is **DRAFT** and listed in the copy register at the end; none goes into code before copy review.
@@ -14,20 +14,20 @@ Four causes:
1. **Not tested: the repository has no checks.** `amadan ci status paulca/recipes` answers "No CI script". `create_project` (`equipo:internal/runner/thin/bridge.go`, `Forge.Create`, then `Clones.StartDefault` in `forge.go`) starts `main` at an empty first commit. The Checks step looks for `.amadan/ci.d`, `.amadan/ci` or `make ci` (`judge.go`, `findGate`), finds none, and reports `none`. The merge gate then fails `environment_reason` (`mergegate/gate.go`) and the card says "it could not be fully tested".
2. **Not tried: previews are static only.** `preview.go` exports `release/preview.json`'s output folder and runs `carlos deploy --temporary ... --kind static`. The devbox host shares a folder. A Go program has no preview path, so nobody could try the app before it went in.
-3. **No address: going live for an app is only the merge.** Going live for a site is a separate Publish card and step (`site.go`: `carlos deploy --kind static` to a confirmed place, then a per-app `deploy` credential). For anything else, nothing creates a CARLOS app or deploys it. So the work is merged and nothing serves it.
-4. **The go-ahead kept asking.** The Assistant's outcome card keeps the merge card's words once it is answered or withdrawn (`chat/outcome.go`, `fillMirror`), and `touchOutcomes` only cleared its links when the task ended. So after the merge the card still read "…Go ahead?". The fix is on Equipo branch `stale-goahead-card` (section 9). It is separate from this design.
+3. **No address: going live for an app is only the merge.** Going live for a site is a separate Publish card and step (`site.go`: `carlos deploy --kind static` to a confirmed place, then a per-app `deploy` credential). For anything else, nothing creates a CARLOS app or deploys it. The work is merged and nothing serves it.
+4. **The go-ahead kept asking.** The Assistant's outcome card keeps the merge card's words once it is answered or withdrawn (`chat/outcome.go`, `fillMirror`), and `touchOutcomes` only cleared its links when the task ended. After the merge the card still read "…Go ahead?". The fix is on Equipo branch `stale-goahead-card` (section 9), separate from this design.
## 2. What changes, in one paragraph
-Every repository Equipo creates starts with checks that fit what it holds: build, vet, test and a start-up check for a Go app; link and page checks for a static site. They sit in `.amadan/ci.d` on `main`'s first commit, so the hub runs them on every push and Equipo's Checks step certifies each change against them. An approved Go app gets a preview the person can try: it is built and run on the person's own machine in the same sandbox checks use, with an empty database of its own and no secrets, and shared as a private link. It ends after 24 hours or when the job ends. Going live for an app is one tap, "Put it live", which merges the work and deploys it as a CARLOS app in the confirmed place. The first deploy creates the app and its address and mints a deploy credential for that app alone; each later change redeploys with that credential. The address goes on the job and into the Assistant's reply. When something couldn't be tested or tried, Base says what and why in one plain line.
+Every repository Equipo creates starts with checks that fit what it holds: build, vet, test and a start-up check for a Go app; link and page checks for a static site. They sit in `.amadan/ci.d` on `main`'s first commit, so the hub runs them on every push and Equipo's Checks step judges each change by them. An approved Go app gets a preview the person can try. It is built and run on the person's own Linux machine in a confined sandbox of its own, with an empty database, no secrets and no network, behind a proxy that sets the same browser protections static previews get, and is shared as a private link. It ends after 24 hours or when the job ends. Going live for an app is one tap, "Put it live", by the task's creator, who must be an owner. It merges the work and then deploys it as a CARLOS app in the confirmed place, one deploy per app at a time, never older over newer. The first deploy creates the app and its address and mints a deploy credential for that app alone; each later change redeploys with that credential. The job stays "Going live" until the deploy is confirmed, then shows the address, and the Assistant's reply says it. When something couldn't be tested or tried, Base says what and why in one plain line.
## 3. Rules this design keeps
- **Outcomes, not machinery.** Base never names Equipo, runners, tasks, checks, repositories, branches, merges or CARLOS. "Tests", "try it", "live" and "address" are the person's words.
-- **The person's decisions stay the person's** (jobs spec K12). Putting an app live, for the first time and for every later change, is a tap, gated by `go_live`. Nothing here lets the Assistant, housekeeping or merge authority deploy on its own.
-- **Previews stay behind Review** (jobs spec O5, ruled). An app preview runs only for a candidate that Review approved, under the same `authorizePreview` checks as a static preview.
+- **The person's decisions stay the person's** (jobs spec K12). Putting an app live, the first time and for every later change, is a tap. Nothing here lets the Assistant, housekeeping or merge authority deploy, and merge authority never merges an app task on its own (C1).
+- **Previews stay behind Review** (jobs spec O5, ruled). An app preview runs only for a candidate Review approved, under the same `authorizePreview` checks as a static preview.
- **Don't work around CARLOS.** Where CARLOS lacks something, this design waits for it or uses what exists. Section 8 lists the requests.
-- **Places are the only destinations** (places spec §1). An app lives in a confirmed place on one console and account. Model text never names a console, account or app.
+- **Places are the only destinations** (places spec §1). An app lives in a confirmed place on one console and account. Model text never names a console, account, region or app.
## 4. Starter checks
@@ -35,105 +35,127 @@ Every repository Equipo creates starts with checks that fit what it holds: build
`create_project` gains `kind`: `go_app`, `site` or `other` (runner protocol bump; an older runner drops it and gets `other`). The Coordinator sets it from what it is about to build. The instance stores it on the project and checks it against the fixed list. `StartDefault` then writes `main`'s first commit from a fixed, versioned template for that kind instead of the empty tree. The commit stays deterministic per template (fixed dates, as today), so a retried start still recognises its own `main`.
-| kind | files on `main`'s first commit | what the steps do |
+| kind | files on `main`'s first commit | what the steps check |
|---|---|---|
-| `go_app` | `.equipo/gates.json` (`{"version":1,"files":[]}`), `.amadan/ci.d/10-go`, `.amadan/ci.d/20-starts` | `10-go`: refuses without `go.mod`; `gofmt -l` is empty; `CGO_ENABLED=0 go build ./...`; `go vet ./...`; `go test -count=1 ./...`. `20-starts`: builds the binary, starts it with `PORT` on a free loopback port and `CARLOS_DB` in a fresh temporary directory, waits up to 10 s for `GET /healthz` to answer 200 and `GET /` to answer below 500, then stops it. |
-| `site` | `.equipo/gates.json`, `.amadan/ci.d/10-site`, `release/preview.json` (`{"output":"site"}`) | `10-site` (POSIX `sh` and `awk`, no downloads): every `.html` file under the output folder starts with a doctype and has a `lang` and a `<title>`; every local `href` and `src` resolves to a file in the folder; nothing loads over `http:`; the folder is within the preview caps (`previewMaxFiles`, `previewMaxBytes`). |
-| `other` | nothing (today's empty tree) | none: the card says so honestly (section 7). |
+| `go_app` | `.equipo/gates.json` (`{"version":1,"files":["release/app.json"]}`), `.amadan/ci.d/10-go`, `.amadan/ci.d/20-starts`, `release/app.json` (`{"build":"go","package":".","health":"/healthz"}`) | `10-go`: refuses without `go.mod`; `gofmt -l` is empty; `CGO_ENABLED=0 go build` of `release/app.json`'s package for `linux/amd64` and `linux/arm64`; `go vet ./...`; `go test -count=1 ./...`, and at least one test exists (`go test -list` is not empty). `20-starts`: builds that package for the host, starts it as CARLOS does (A3) with a socket and a database in a fresh temporary directory, waits up to 10 s for `GET /healthz` to answer 200, checks `GET /version` names the commit under test, stops it, starts it again on the same database, and checks `/healthz` again and that the database file is SQLite. |
+| `site` | `.equipo/gates.json` (`{"version":1,"files":["release/preview.json"]}`), `.amadan/ci.d/10-site`, `release/preview.json` (`{"output":"site"}`) | `10-site` (POSIX `sh` and `awk`, no downloads): every `.html` file under the output folder starts with a doctype and has a `lang` and a `<title>`; every local `href` and `src` resolves to a file in the folder; nothing loads over `http:`; the folder is within the preview caps (`previewMaxFiles`, `previewMaxBytes`). |
+| `other` | nothing (today's empty tree) | none: the card says so honestly (D2). |
-The `go_app` template also writes a short `README.md` with the app's CARLOS declaration headings (app spec §0.5) left for Engineering to fill, and an `AGENTS.md` line with the app contract below. These are files on the first commit, not checks.
+The `go_app` template also writes a short `README.md` with the app spec's declaration headings (§0.5) left for Engineering to fill, and an `AGENTS.md` that states the app contract (A3). These are files, not checks. Naming `release/app.json` in `gates.json` pins it: a candidate can't move the package the checks and the preview build.
-### A2. The same checks in both places
+### A2. The same checks in both places, and where they differ
-- **The hub.** Right after creating the repository, the runner turns hosted CI on with one fixed call (`amadan ci hosted <ns>/<repo> on`, the smallest size; the agent account is a writer on the repository it created). The hub then runs `.amadan/ci.d` on every push, as for any Amadan repository.
-- **Equipo's Checks step.** `.equipo/gates.json` on `main` makes the base gates trusted (`base_gates.go`, `readBaseGates`): every candidate is checked against `main`'s steps, installed read-only over the candidate's copies (`installBaseGates`). A candidate that edits a step is run under the base step for the verdict, and its own step only as a diagnostic, as today. With the base checks passing, the merge gate's `trusted_base_checks` holds, so merge authority's rules can apply instead of always asking.
-- Both run the same files, so a green hub and a green Checks step mean the same thing.
+- **The hub.** Right after creating the repository, the runner turns hosted CI on with one fixed call (`amadan ci hosted <ns>/<repo> on`, the smallest size; the agent account is a writer on the repository it created). The hub runs `.amadan/ci.d` on every push, as for any Amadan repository.
+- **Equipo's Checks step.** `.equipo/gates.json` on `main` makes the base gates trusted (`base_gates.go`, `readBaseGates`): every candidate is checked by `main`'s steps, installed read-only over the candidate's copies (`installBaseGates`). With those passing, the merge gate's `trusted_base_checks` holds.
+- **Where they differ.** The hub runs the pushed files, the candidate's own. Equipo runs `main`'s files for the verdict and the candidate's only as a diagnostic (`judge.go`, `changedGate`). So they agree while a change leaves the steps alone and both run with what the steps need (Go, loopback). A change that edits or deletes a step can be green on the hub and red in Equipo. Equipo's verdict is the one the go-ahead uses, and the honest line (D2) reads from it.
### A3. The app contract
-A Go app that is meant to go live follows a short contract, which `20-starts` checks and Engineering's dispatch carries as a separate note (like the first-look note, jobs plan Task 3.3, never in the brief):
+What CARLOS runs and checks, and what this design adds on top. Engineering's dispatch carries it as a separate note when the project's kind is `go_app` (like the first-look note, jobs plan Task 3.3, never in the brief):
-- listen on `$PORT`, default `127.0.0.1:8080` (app spec 12.4);
-- keep its data in SQLite at `$CARLOS_DB`, and create the schema itself on first start (app spec 14.1);
-- answer `/healthz` with 200 and no data (app spec 15.1), and report its build at `/version` (14.2);
-- build with `CGO_ENABLED=0` for linux on amd64 and arm64 (7.5), with no assets outside the binary (6.2).
+- **CARLOS's own contract** (cli.md, "What an instance is started with" and `carlos vet --boot`): the binary is started as `<binary> --socket <path> --db <path>`, serves HTTP on that unix socket, and answers `GET /healthz` with 200 within ten seconds. Its database is the SQLite file at `--db`. Files beside it go in its working directory.
+- **This design's choices:** the app creates its schema itself on first start (app spec 14.1); `GET /version` answers the commit it was built from, read from the Go build's `vcs.revision` (`runtime/debug.ReadBuildInfo`), which the runner's build sets by building with `-buildvcs=true` from a checkout at exactly that commit (app spec 14.2 asks for a version endpoint, not this one); it builds with `CGO_ENABLED=0` for linux on amd64 and arm64 (7.5), with its pages and assets inside the binary (6.2).
### A4. Repositories that already exist without checks
-`recipes` and any other repository Equipo created before this ships. The first task Equipo runs on such a repository, for any reason, adds the starter checks for its kind as part of that task's change. That one change is checked by its own candidate steps (uncertified, as today); from its merge on, `main` holds trusted checks. The person is not asked separately (open question Q6).
+`recipes`, and any other repository Equipo created before this ships. The first task Equipo runs on such a repository, for any reason, adds the starter checks for its kind as part of that task's change. That one change is judged by its own candidate steps (uncertified, as today). From its merge on, `main` holds trusted checks. The person is not asked separately (Q6).
## 5. App previews
### B1. Where an app preview runs (v1)
-On the person's own primary runner, as a devbox link on their private network. That matches the places ruling that temporary sites default to the docs-t1 devbox, tailnet only, until CARLOS can host temporary apps safely (P4). CARLOS temporary deploys don't cover this today: cli.md says `--temporary` is for static sites, and `--kind binary` is refused with it. That is request P-A.
+On the person's own primary runner, on Linux only, as a devbox link on their private network. That matches the places ruling that temporary sites default to the docs-t1 devbox, tailnet only, until CARLOS can host temporary apps (P4). CARLOS temporary deploys don't cover apps today: cli.md says `--temporary` is for static sites, and `--kind binary` is refused with it (request P-A). A Mac runner runs no app preview in v1: its seatbelt profile is proven for checks, not for a long-running server, and it has no cgroups or network namespaces. The honest line says the app can't be tried before it goes live (D2).
A new preview mode, `app`, beside today's static export:
-- **Evidence.** Review reports `has_app_preview` when the candidate holds `release/app.json`: strict JSON, at most 4 KiB, `{"build": "go", "package": "<clean relative path>", "health": "/healthz"}`, with an optional `"seed": "<clean path>"`. The `go_app` template writes it. `schedulePreview` treats it as it treats `release/preview.json`, under the same `authorizePreview`, digest and once-per-candidate rules.
-- **Build.** In the checks sandbox (the same `Gate.Run` and dependency stage as Checks): `CGO_ENABLED=0 GOTOOLCHAIN=local GOFLAGS=-mod=readonly go build -trimpath -o <private>/app ./<package>` for the runner's own platform, with modules from the dependency stage, read-only. The binary's SHA-256 is the preview's digest, recorded and bound to the reviewed candidate, as the export digest is today.
-- **Run.** The binary starts in a fresh sandbox namespace with the checks profile: no network but loopback; `HOME` empty; an environment of exactly `PORT`, `CARLOS_DB=/data/app.db` and `TZ=UTC`; `/data` a new private directory; nothing else of the runner's mounted. The runner's sandbox helper forwards one unix socket from outside into the namespace's loopback port. `carlos devbox share --socket <that socket> eq-app-<task>` publishes it. The marker check that proves a static preview serves its export becomes a `GET <health>` through the link that answers 200 and a `GET /version` that names the candidate.
-- **Data.** Each preview starts from an empty database. If `seed` is set, its SQL (from the reviewed candidate, at most 1 MiB) runs once before the first request. A preview never gets a copy of live data, even for a change to an app that is already live (Q11). The data directory is deleted when the preview ends.
-- **First looks.** A request for an app still starts with a first look: one static page, as jobs spec K13 and K14 set out. That goes through the existing static preview within the two-minute target. The app preview follows once the full build is approved. Base shows "See the first look" first and "Try your app" once the app preview is up (section 7).
+- **Evidence.** Review reports `has_app_preview` when the candidate holds a valid `release/app.json` (strict JSON, at most 4 KiB, `build` is `go`, `package` and the optional `seed` are clean relative paths inside the tree). `schedulePreview` treats it as it treats `release/preview.json`, under the same `authorizePreview`, digest and once-per-candidate rules.
+- **Scan.** Before anything runs, the candidate's tree and its seed file go through the same secret scan static exports get (`preview_security.go`, gitleaks rules). A scan that can't run fails the preview with `preview_scanner` (jobs spec K6), never runs it unscanned.
+- **Build.** In the checks sandbox (the same `Gate.Run` and dependency stage as Checks): `CGO_ENABLED=0 GOTOOLCHAIN=local GOFLAGS=-mod=readonly go build -trimpath -buildvcs=true -o <private>/app ./<package>` from a checkout at the candidate, for the runner's own platform, with modules from the dependency stage, read-only. The binary's SHA-256 is the preview's digest, recorded and bound to the reviewed candidate as the export digest is today.
+- **Run** (B3 sets the confinement). The binary is started as CARLOS starts it: `app --socket /run/app.sock --db /data/app.db`, with `HOME` empty and `TZ=UTC` the only other variables.
+- **Proxy.** A small proxy in the runner's own process listens on a socket of its own and forwards to the app's socket. It is the only way in. On every response it sets the static preview headers (`previewHeaders`) with two changes for an app: `form-action 'self'` and `connect-src 'self'`. It drops any `Set-Cookie` with a `Domain` attribute, refuses a redirect whose `Location` leaves the preview's own origin, and caps request bodies at 1 MiB and responses at 10 MiB. Forms that post back to the app work; nothing on the page can send data to another origin through the browser. If the proxy can't start, the preview fails closed. `carlos devbox share --socket <proxy socket> eq-app-<task>` publishes the proxy, never the app.
+- **Proof.** The preview counts as up once `GET <health>` through the link answers 200 and `GET /version` names the candidate. That replaces the static preview's marker file.
+- **Data.** Each preview starts from an empty database. If `seed` is set, its SQL (from the reviewed candidate, scanned, at most 1 MiB) runs once, inside the same confinement, before the first request. A preview never gets a copy of live data, even for a change to an app that is already live (Q11). The data directory is deleted when the preview ends.
+- **Upgrade check, for a change to a live app.** In the same confinement, the runner builds `main`'s app too, starts it on a fresh database with the seed, stops it, starts the candidate on that database (`/healthz` 200), stops it, and starts `main`'s app on it again (`/healthz` 200). That shows the candidate opens the previous release's data and leaves it readable (app spec 14.1, 14.3). It only covers what the seed exercises, so the honest line says "with sample data". A failure is a finding for the fix round, like a failing check.
+- **First looks.** A request for an app still starts with a first look: one static page, as jobs spec K13 and K14 set out, through the existing static preview, within the two-minute target. The app preview follows once the full build is approved. Base shows "See the first look" first and "Try your app" once the app preview is up (section 7).
-### B2. Lifetime, limits and cost
+### B2. Lifetime, retries, limits and cost
-| what | limit |
+| what | rule |
|---|---|
-| an app preview's life | 24 hours from start, or until its job is done, dropped or replaced by a newer candidate's preview (Q3) |
-| idle | stopped after 2 hours with no request; the link then reads as expired, and Try again starts a fresh one (jobs spec K11, fourth case) |
+| life | 24 hours from start, or until its job is done, dropped or replaced by a newer candidate's preview (Q3) |
+| idle | stopped after 2 hours with no request |
+| after it stops | the link reads as expired. Try again is the existing person's preview retry (`retryPreview`, `previewRetryCheck` in `chat/preview_retry.go`): the same preview step's next attempt for the same candidate, idempotent by card revision and key like every K2 action. A newer candidate withdraws it |
| at once, per runner | 3 running app previews; a fourth waits, and the pill says it is waiting its turn |
-| size | 512 MiB of memory, one CPU's share, 1 GiB of disk for `/data`, enforced by the sandbox helper's cgroup; over it, the process is stopped and the preview reads as "couldn't start" |
+| size | 512 MiB of memory, one CPU's share, 64 processes, 1 GiB for `/data` (B3) |
+| logs | the last 1 MiB of the app's output, kept with the step and deleted with it |
| build | the Checks step's time limit (`MaxStep`) |
-The cost is the person's own machine time and nothing else: no CARLOS app, no hosted minutes, no model use. Hosted CI from A2 runs on the hub at the namespace's own CI terms.
+The cost is the person's own machine time: no CARLOS app, no hosted minutes, no model use. Hosted CI from A2 runs on the hub at the namespace's own CI terms (Q9).
### B3. Safety
-A preview runs code a model wrote. So:
+A preview runs code a model wrote, so the confinement is its own profile, not a reuse of the checks profile's word:
-- It runs only after Review approved that exact candidate (first-look review for first looks, full review for builds; jobs spec K14), and never on the hub or on CARLOS in v1.
-- It runs in the checks sandbox profile. On Linux that is bubblewrap with a private network namespace and seccomp. On a Mac it is seatbelt, and a Mac runner whose sandbox isn't proven (`ReasonSandboxUnproven`) runs no app preview at all. A runner that has ever run checks outside the sandbox (`markTainted`) runs no app preview either.
-- No secret is ever present: no forge credential, no CARLOS login or deploy credential, no model keys, no preview credential file (already outside every sandbox mount, `previewCredentialPlace`), and no person's data.
-- No outbound network: loopback only, so a preview can't reach the internet, the tailnet or the machine's other services. The forwarded socket is the only way in.
-- The link is private to the person's network (devbox `--allow` set to the person's login where the devbox supports it). It is never public in v1.
-- Every preview's start, stop and digest is audited (`preview.app.started`, `preview.app.stopped`), as static previews are.
+- **Only after Review** approved that exact candidate, and only on a runner whose sandbox is proven and has never run checks outside it (`markTainted`). Never on the hub or on CARLOS in v1.
+- **Processes.** bubblewrap with new user, PID, IPC, UTS and network namespaces (`--unshare-all`, no `--share-net`), seccomp as for checks, no capabilities, `--die-with-parent`, and a systemd user scope (`systemd-run --user --scope`) with `MemoryMax=512M`, `TasksMax=64` and `CPUQuota=100%`. A runner that can't create that scope with those limits runs no app preview.
+- **Files.** Mounted: the built binary, read-only; `/data`, a tmpfs of 1 GiB (so its size is the disk quota); `/tmp`, a tmpfs of 64 MiB; `/run` holding only the app's socket; nothing else of the runner's or the person's. No credential file of any kind is reachable (they already sit outside every sandbox mount, `previewCredentialPlace`).
+- **Network.** None: the network namespace has only loopback, so the app can't reach the internet, the tailnet or the machine's services. The proxy's socket is the only way in, and the proxy forwards to nothing else.
+- **The browser.** The proxy's headers and rules (B1) stop a page from loading or sending anything to another origin, framing, or redirecting away. The visitor's own local services are out of reach because nothing on the page may connect anywhere but the preview itself.
+- **The link.** Private to the person's network (devbox `--allow` set to the person's login where the devbox supports it). Never public in v1.
+- **Clean-up.** The runner records each running preview (step, scope, socket, data directory) in its state. On start it stops and deletes any it finds from before a crash or reboot, before taking new work.
+- **Audit.** Every start, stop and digest: `preview.app.started`, `preview.app.stopped`, as for static previews.
### B4. Later: previews on CARLOS
-Once CARLOS ships P-A (temporary binary apps with a throwaway database) and P4 (a scope for temporary apps only), the same `app` mode gains a CARLOS adapter: `carlos deploy --temporary --kind binary --ttl 1d` in a dedicated previews account, run inside CARLOS's own tenant sandbox, reachable away from the person's network. For a change to an app that is already live, `carlos canary` gives a preview on a host of its own, with its own config bundle (`--environment`). That needs P-C and P-D: a deploy credential that may promote `canary/<name>`, and a canary that is guaranteed an empty database of its own. Until then, changes to a live app are previewed on the runner like new ones.
+Once CARLOS ships P-A (temporary binary apps with a throwaway database) and P4 (a scope for temporary apps only), the `app` mode gains a CARLOS adapter: `carlos deploy --temporary --kind binary --ttl 1d` in a dedicated previews account, inside CARLOS's own tenant sandbox, reachable away from the person's network, with the same proxy rules applied at the edge (P-A asks for that too). For a change to an app that is already live, `carlos canary` gives a preview on a host of its own with its own config bundle (`--environment`). That needs P-C and P-D: a deploy credential that may promote `canary/<name>`, and a canary that is sure to get an empty database of its own. Until then, changes to a live app are previewed on the runner like new ones.
## 6. App go-live
-### C1. One tap: Put it live
+### C1. One tap: Put it live, and who may tap it
-For a job whose project is a `go_app` with an `app` place (C2), the go-ahead card asks "Your app is ready. Put it live?" with "Put it live" and "Not now" (DRAFT). One tap merges the approved candidate and then deploys the merged commit. The tap is bound to the candidate, as `answerMerge` is today. The deploy goes ahead on the same tap only when the merged commit's tree is exactly the approved candidate's tree, which is always so for a new repository. Otherwise, for example when someone else's change landed in between, a Publish-style card asks again for the merged result (`offerPublish`'s rule for sites, per merged commit).
+For a job whose project is a `go_app` with a confirmed `app` place (C2), the go-ahead card asks "Your app is ready. Put it live?" with "Put it live" and "Not now" (DRAFT).
-Merge authority never merges an app task on its own while the project has an app place: `main` ships, so `CritShips` fails and the gate asks (`mergegate/gate.go`, "it goes live as soon as it goes in"). That is today's rule applied to apps, not a new one.
+- **Who.** Only the task's creator, who must still be an owner, may tap it: today's rule for merging (`answerMerge`, `isOwner`) and for publishing (`publishRefusal`). A member who isn't an owner sees "Ready to try" and the line "{Owner} can put it live." (DRAFT). `go_live` only narrows this; it never lets anyone use an owner's login.
+- **What the tap is bound to.** The card stores a snapshot, as a publish card does: the candidate SHA, the place id and its revision, the project binding and its revision, the destination hash (console, account, app, region) and the deploy mode (`setup` for an app with none yet, `deploy` for one with its credential). The tap merges that candidate through `answerMerge`'s path. The deploy step it starts carries the snapshot.
+- **Merge, then deploy.** The deploy follows the merge on the same tap only when the merged commit's tree is exactly the approved candidate's tree, which is always so for a new repository. Otherwise, for example when someone else's change landed in between, the merged commit gets Checks and Review of its own, and then a second card asks for the merged result. That is a Publish-style card, one per merged commit, as `offerPublish` does for sites.
+- **No automatic merges for apps.** `mergegate` gains a criterion, `app_place`, that fails for every task of a project with an `app` place, whatever its merge policy says. `CritShips` alone isn't enough: it reads `Policy.MainShips`, which a project may have set to `no` before it had an app (`mergegate/gate.go`, `changeCriteria`). The criterion is checked where every merge is decided: `autoMerge`, `authorizeMerge` and `authorizeMergeLease`, so a merge already queued when a project gains an app place is refused before its request goes. The person's own tap still merges.
### C2. Where the app lives
The places spec gains a kind beside `site`: **`app`**, a CARLOS binary app on one console and account. It uses the same records (`chat_places`, `chat_project_places`), the same owner-only confirmation, and the same team default and project override.
-- **Account.** The team's default place for apps, or else the site default. By Paul's rulings that is Carloku account `paulca` for `paulca/` projects and `oficina` for oficina projects. The person's Base or Oficina account maps to these through the places chooser; code never guesses (Q4).
-- **Region.** `carlos deploy --region` from the place (the console's nearest by default). The place records it, so the Places page can say where the data lives.
-- **Name.** Minted by code from the project name: lower case letters, digits and dashes, at most 30 characters (`recipes`). When the account already holds that name, a dash and four random letters and digits are added (`recipes-k3x9`). The platform refuses a name whose address is taken (cli.md, `apps create`), and the runner tries a new suffix at most three times. A model never names the app.
+- **Account.** The team's default place for apps, else the site default. By Paul's rulings that is Carloku account `paulca` for `paulca/` projects and `oficina` for oficina projects. The person's Base or Oficina account maps to these through the places chooser; code never guesses (Q4).
+- **Region.** Chosen when the place is confirmed, from the regions the console offers, and recorded on the place. Every command names it (C3), because otherwise CARLOS picks a new app's region from the runner's timezone (cli.md, "deploy").
+- **Target.** `linux/arm64`, the platform's default (`--target`), unless the place records another.
+- **Name.** Minted by code from the project name: lower case letters, digits and dashes, at most 30 characters (`recipes`). When the account already holds that name, a dash and four random letters and digits are added (`recipes-k3x9`). The platform also refuses a name whose address is taken (cli.md, `apps create`); the runner tries a new suffix at most three times. A model never names the app.
-### C3. The first deploy, and the credential
+### C3. Deploying: one fixed path, one at a time
-As for a site's first publish (places spec §1, ruling 2), until CARLOS ships P2 and P3:
+**Command environment.** Every CARLOS command in this section runs as `site.go`'s do: from the runner's process, never a sandbox, in an empty private directory that is also `HOME`, with `CARLOS_CONFIG` naming a runner-written config that holds exactly the snapshot's destination, so no repository `.carlos/config` or default can steer it. Each command names `--console`, `--account-id` and `--app` explicitly. The runner refuses a dispatch whose console, account, app, region or target differs from the place it holds a login or credential for.
-1. At the person's tap, the runner holding the owner's CARLOS login on that console and account runs one fixed template: `carlos deploy --kind binary --target linux-arm64 --account-id <sqid> --console <o> --app <app> --env PORT=8080 --channel edge --timeout 5m --version <merge sha> --no-prompt <binary>`. It creates the app and its first instance, ships and promotes, and waits until the address serves the version (cli.md, "deploy"). The binary is built from the merged commit in the checks sandbox, as in B1, for `linux-arm64` (the platform's default target) or the place's recorded target.
-2. Right after, still with that login: `carlos apps build-probe --app <app> /version`, so later deploys prove the new process is running and not just adopted (cli.md, "build-probe"); then `carlos services create --role deploy --app <app> --rungs edge <name>`, whose secret the runner reads from the output, stores 0600 outside every sandbox mount, and never logs (as `site.go`).
-3. Before the deploy, `carlos vet` checks the built release against the platform contract. A refusal stops the deploy, and the pill says it couldn't go live, with Try again.
+**The artifact.** Built from the merged commit in the checks sandbox, as in B1, for the place's target, with `-buildvcs=true`. Its SHA-256 is the step's digest. Before anything is sent, the runner starts it in the B3 confinement and checks `/healthz` and `/version` (the same check as `20-starts`). `carlos vet --boot` can't do this beforehand: it checks a release that has already been shipped (cli.md, "carlos vet"), so it runs after ship and before promote (below).
-The owner's login is used only for these steps and only at a tap. Every later deploy uses the app's deploy credential (`CARLOS_SERVICE_TOKEN` and `CARLOS_CONSOLE` in the environment, never argv), which reaches that app's `edge` channel and nothing else.
+**First deploy (mode `setup`).** As for a site's first publish (places spec §1, ruling 2), with the owner's CARLOS login on that runner, until CARLOS ships P2 and P3. Each command is behind its own final check (`authorizeAppDeploy`, C8), and the step records a phase before each:
+
+1. `carlos apps create --app <app> --build-probe /version`, then `carlos apps region --app <app> --set <region>`. The build probe is set before anything is promoted, so the first deploy already proves the new process is running, not just adopted (cli.md, "build-probe"). The step records `app_created` with the app, console and account, as `site.go`'s `created` does, so a retry adopts this app and never creates another.
+2. `carlos deploy --kind binary --target <target> --region <region> --channel edge --timeout 5m --version <merge sha, 12 hex> --no-prompt <artifact>`. It creates the first instance, ships, promotes and waits until the build probe names the version.
+3. `carlos services create --role deploy --app <app> --rungs edge <name>`. The runner reads the secret from the output, stores it 0600 outside every sandbox mount, and never logs it (as `site.go`). A mint that restarts before storing its key is lost, and the next deploy asks for setup again, as for sites.
+
+The owner's login is used for these steps only, and only at an owner's tap.
+
+**Later deploys (mode `deploy`).** With the app's deploy credential (`CARLOS_SERVICE_TOKEN` and `CARLOS_CONSOLE` in the environment, never argv), which reaches that app's `edge` channel and nothing else: `carlos ship` the artifact with `--version <merge sha, 12 hex>`, then `carlos vet --app <app> --version <v> --boot`, then `carlos promote --app <app> <v> edge`, then wait for the build probe (P-B asks for one machine-readable result). A refused vet stops before promote, so nothing the app serves changes.
+
+**Proof.** A deploy counts as live only when the build probe names the version and the runner's own `GET /version` on the address names the merge SHA. A probe-less deploy never counts.
+
+**One at a time, never older over newer.** The project binding records `deployed_sha`, the merge SHA last confirmed live. The instance dispatches at most one deploy step per app at a time (a lease on the binding). Before ship and again before promote, `authorizeAppDeploy` refuses a deploy whose merge SHA is not a descendant of `deployed_sha` ("a newer version is already live"). That deploy settles as superseded and the job says it went live with the newer change (D1). So two jobs that merge in order and reach their deploys out of order leave the newer one live.
+
+**Interrupted.** A step restarted after a phase that may have changed CARLOS only reconciles, as `siteReconcile` does: it reads `carlos channels --app <app>` and the build probe. It never sends again. What it finds decides the outcome (C6).
### C4. The address
-The first deploy prints the app's platform address, `https://<app>.<account>.<apps domain>/` (cli.md, `apps create`). The runner reports it in the step's result. The instance stores it on the project's place binding, as a site's address is stored. It is then:
+The first deploy prints the app's platform address, `https://<app>.<account>.<apps domain>/` (cli.md, `apps create`). The runner reports it with the step's result, and the instance stores it on the project binding, as a site's address is stored. It is then:
-- the job card's link, rel empty, label "Open your app" (DRAFT): `jobSite` reads app places too, so a done job's pill and job view carry it (Base's `Card.Go`);
+- the job card's link, rel empty, label "Open your app" (DRAFT): `jobSite` reads app bindings too, so a done job's pill and job view carry it (Base's `Card.Go`);
- in the Assistant's `team_status` and `team_update` lines, with the approved "It is live at %s", so the reply says where it is;
- on Equipo's Places page.
@@ -141,75 +163,100 @@ Custom domains are later (Q8): attaching one needs a `publish` or `instance` cre
### C5. Data and backups
-A binary instance gets its own SQLite database (`CARLOS_DB`), replicated off the box continuously by the platform (`carlos routes`, replication `default` syncs on every change). Backups are that replica's history. An owner can read a copy at any point the platform keeps (`carlos db pull --at`) without touching the live app. What a host failure could lose is in the platform's declaration (app spec 8.1). Equipo records the region and the replication setting on the place; Base says nothing about either unless asked. Deleting the app is an owner's act on Equipo's Places page, never the Assistant's, and it says it moves the app to the Trash for 30 days (app spec 16.1).
+A binary instance gets its own SQLite database (`--db`), replicated off the box continuously by the platform (`carlos routes`: replication `default` syncs on every change). Backups are that replica's history. An owner can read a copy at any point the platform keeps (`carlos db pull --at`) without touching the live app. What a host failure could lose is in the platform's declaration (app spec 8.1). Equipo records the region and the replication setting on the place; Base says nothing about either unless asked. Deleting the app is an owner's act on Equipo's Places page, never the Assistant's. It says the app moves to the Trash for 30 days (cli.md, `apps delete`), so retiring and destroying stay distinct (app spec 16.1).
-### C6. Later changes
+### C6. Later changes, and when a deploy fails
-Every later change to a live app's code goes the same way: checks against `main`'s trusted steps, Review, an app preview, then "Put it live?" (C1). The deploy is `carlos deploy --kind binary --app <app> --channel edge --version <merge sha> --no-prompt <binary>` with the deploy credential. The app handles its own migrations (app spec 14.1). The starter checks can't prove a migration is safe to roll back, so Review's instructions for an app with a place add: "a schema change must leave data the previous release can still read (app spec 14.3)".
+Every later change to a live app's code goes the same way: checks by `main`'s trusted steps, Review, an app preview with the upgrade check (B1), then "Put it live?" (C1). The app handles its own migrations (app spec 14.1). Review's instructions for an app with a place add: "a schema change must leave data the previous release can still read (app spec 14.3)".
-If the deploy's wait fails, the earlier version keeps serving (cli.md: "the previous build keeps serving"). The pill reads "Didn't go live" with "The version before is still running." and Try again (jobs spec K6 row `causeGoingLive`).
+What a failed deploy means depends on where it stopped, so the step reports one of these, after reconciling:
+
+| where it stopped | what is serving | job (D1) | next step offered |
+|---|---|---|---|
+| before ship, or ship or vet refused | the version before (or nothing, for a first deploy) | Didn't go live | Try again |
+| shipped, not promoted | the version before | Didn't go live | Try again |
+| promoted, some boxes failed (cli.md: a failing box keeps its other instances on the build they were serving) | a mix | Partly live | Try again (`carlos promote --retry`); owners also get rollback on Equipo's task page (C7) |
+| promoted, probe never confirmed | unknown | Not confirmed | Try again, which reconciles first |
+| first deploy: app created, deploy failed | nothing yet | Didn't go live | Try again, which adopts the recorded app |
+| superseded by a newer change | the newer change | Done, with the newer change's address | none |
+
+"The version before is still running." is said only when `carlos channels` shows `edge` on the earlier version on every box.
### C7. Rollback
-`carlos rollback --app <app> edge` points the channel back at the version before. In v1 it is an owner's action on Equipo's task page, run with the deploy credential (P-E if the deploy role can't), audited, and gated by `go_live`. It never touches data. Base offers no rollback button in v1 (Q7).
+`carlos rollback --app <app> edge` points the channel back at the version before. In v1 it is an owner's action on Equipo's task page, run with the deploy credential (P-E if the deploy role can't), audited, gated by `go_live`, and it sets `deployed_sha` back. It never touches data. Base offers no rollback button in v1 (Q7).
-### C8. The `go_live` and `build` gates
+### C8. The `go_live` and `build` gates, and the last checks
-Following abilities spec §6.3 and §6.4:
+Following abilities spec §6.3 and §6.4, with the same boundary: a switch is checked where each action is decided, and an action already past its last check finishes.
-- `build` covers starter checks, previews (building and running them) and Try again on a preview.
-- `go_live` covers "Put it live" (the merge and the deploy as one decision), the first deploy, the build probe and the credential mint, every redeploy, a publish-style re-ask, Try again on a failed deploy, and rollback.
-- The last check is a new `authorizeAppDeploy`, beside `authorizePublish`. It runs at the deploy step's start and again right before the runner runs `carlos deploy`, in the transaction that decides, and refuses `ability_off`. A tap followed by the switch going off deploys nothing. A merge already sent to the hub still finishes, as abilities spec §6.4 says. The job then reads "Ready to try" with the approved-pending line "Putting it live is turned off for you. {Owner} can turn it on." (abilities register).
+- `build` covers every step of the job, as abilities §6.3 says, so starter checks, app previews and the upgrade check included: `Store.Authorize` refuses a preview step's start when the person lacks `build`. A preview already running when `build` goes off keeps running until it ends by its own rules (B2); no new one starts, and Try again is refused.
+- `go_live` covers "Put it live" (the merge and the deploy as one decision), the second card for a changed merged result, every deploy step, Try again on a failed deploy, and rollback.
+- `authorizeAppDeploy` is the last check, beside `authorizePublish`, with its rules: the current attempt, on the creator's primary runner, of a task Equipo merged at exactly this merge SHA and didn't cancel, decided by the creator, who is still an owner; the snapshot still equal to the card's; the place and binding at the snapshot's revisions; the built digest exactly the recorded one; the merge SHA a descendant of `deployed_sha`; the creator holding `go_live`. It runs at the step's start and again, each in the transaction that decides, before `apps create`, before `deploy` or `ship`, before `promote` and before the mint, with purposes `setup`, `deploy`, `promote` and `mint`. Every decision is audited.
+- So the switch going off after the tap but before a check refuses everything after that check. A command already sent finishes: an app already created stays (recorded, adopted by a later Try again), and a promote already sent can't be called back. Turning the switch off doesn't take an app down; that stays an owner's act.
+- When the merge went in and the deploy is refused for `go_live`, the job reads "Didn't go live" with the approved-pending abilities line "Putting it live is turned off for you. {Owner} can turn it on." and keeps Drop it. Turning `go_live` back on doesn't deploy by itself: the person taps Try again.
## 7. What Base shows
### D1. On the pill, in the job view and in the reply
+A merged app task isn't finished until its deploy settles. `jobState` treats a task of a project with an app place as working, status "Going live", from the tap until the deploy step reports, and keeps its preview up (`previewHeld`) until then. Only a confirmed deploy makes the job done.
+
| moment | pill status | detail line | link |
|---|---|---|---|
| first look up, app still building | Building it (jobs spec) | Building the full version from your first look. | See the first look |
| app preview building | Making it ready to try | Getting your app ready to try. | See the first look |
-| app preview up | Ready to try (approved) | the tested line (D2) | Try your app |
| waiting its turn for a preview | Ready soon | Waiting to start your app so you can try it. | |
-| putting it live | Going live | Putting your app live. | |
+| app preview up | Ready to try (approved) | the tested line (D2) | Try your app |
+| app preview ended | Ready to try | Your app's trial has ended. Try again for a fresh one. | |
+| putting it live | Going live | Putting your app live. | Try your app, while the preview is up |
| live | Done (approved) | Your app is live. | Open your app |
-| deploy failed | Didn't go live (jobs spec) | Your app didn't go live. The version before is still running. | Try again |
+| a newer change went live first | Done | A newer version of your app is live. | Open your app |
+| failed (C6, first three rows) | Didn't go live (jobs spec) | Your app didn't go live. The version before is still running. (only when C6 confirms it), else Your app didn't go live. | Try again |
+| partly live | Partly live | Your app is live in some places but not others. | Try again |
+| not confirmed | Not confirmed | Your app was sent, but it could not be confirmed. | Try again |
-The Assistant's reply after it goes live uses the approved "It is live at %s". The `noteDirection` and `jobNote` lines already say nothing of how; they gain the address when there is one.
+The Assistant's reply after it goes live uses the approved "It is live at %s". `jobNote` lines name the address when there is one and never say how.
### D2. Honest status: what was tested, and what wasn't
-The go-ahead card and the ready pill carry one line saying what was checked. It comes from the newest Checks result and the preview's outcome, in instance copy, and never names a tool or a step:
+The go-ahead card and the ready pill carry one line saying what was checked. It is read from the Checks result and the preview of the candidate the card asks about, never from an older candidate's, in instance copy, and it never names a tool or a step:
| what holds | line (DRAFT) |
|---|---|
| checks passed, app started, preview up | Tested: it builds, its tests pass and it starts. You can try it before it goes live. |
-| checks passed, no preview possible (`other` kind, sandbox unproven, runner busy past 24 h) | Its tests pass, but you can't try it before it goes live here. |
+| as above, a change to a live app, upgrade check passed | Tested: its tests pass, it starts, and it opens your existing data (checked with sample data). You can try it before it goes live. |
+| checks passed, no preview possible (`other` kind, a Mac runner, no confinement) | Its tests pass, but you can't try it before it goes live here. |
| no checks at all (`none`) | It hasn't been tested: there are no tests for it yet. |
+| checks failed and fix rounds used | Its tests still fail, so it can't go live as it is. |
| checks need the network (`needs_network`) | Its tests couldn't run here because they need the internet. |
| checks need a Mac (`needs_macos`) | Its tests need a Mac, and none was free to run them. |
| checks timed out | Its tests took too long and were stopped. |
+| checks couldn't run (`checks_unavailable`, `base_gate_unavailable`) or the scan couldn't run (`preview_scanner`) | It couldn't be tested just now. We'll try again shortly. |
| the preview failed to start | It passed its tests but didn't start, so you can't try it yet. |
+| the preview ended (expired or idle) | (D1 "app preview ended" line) |
+| waiting for a free slot | (D1 "waiting its turn" line) |
-The approved merge wording ("This is ready: it could not be fully tested. Go ahead?") stays for sites and Equipo's own work. For an app job, the line above replaces "could not be fully tested" on the card. The question "Your app is ready. Put it live?" follows it.
+The approved merge wording ("This is ready: it could not be fully tested. Go ahead?") stays for sites and Equipo's own work. For an app job, the line above stands in its place on the card, before the question "Your app is ready. Put it live?".
### D3. Base changes
-- `internal/equipo`: `CleanAt` already keeps job links with an empty rel and `first_look` links (jobs plan Task 1.15). No new field is needed: the address is the job's link, and the detail line is the card's detail.
-- Templates and `ask.js`: the "Open your app" link on a done pill uses the existing `.Go` drawing, so nothing new is drawn.
-- Native app: draws from the same fields, so nothing changes.
-- The Assistant's `base_apps` lists apps installed on Base; it does not list apps Equipo built. The Assistant's instructions say to read the job, not `base_apps`, for "where is my app" (operation note, not copy). Showing built apps on Base's Home is a separate question (Q10).
+- `internal/equipo`: `CleanAt` already keeps job links with an empty rel and `first_look` links (jobs plan Task 1.15). No new field is needed: the address is the job's link and the line is the card's detail.
+- Templates and `ask.js`: "Open your app" on a done pill is the existing `.Go` drawing.
+- Native app: draws from the same fields.
+- The Assistant's `base_apps` lists apps installed on Base, not apps Equipo built. The Assistant's operation notes say to read the job, not `base_apps`, for "where is my app" (model-facing, not copy). Showing built apps on Base's Home is a separate question (Q10).
## 8. Platform requests (CARLOS; nothing filed)
Places spec P2 to P7 stand. They cover first deploys without a person, consent credentials, a temporary-only scope, the devbox domain, JSON listings, and reading domains with a deploy credential. In addition:
-- **P-A. Temporary binary apps.** `carlos deploy --temporary --kind binary --ttl <1h..30d>`: a `tmp-` app with one instance, a database that is never replicated beyond the app's life and is purged with it, the smallest size by default, its own cap separate from the 20 static temporary apps, and `carlos gate` allowed on it. Today `--kind binary` is refused with `--temporary` (cli.md).
-- **P-B. `carlos deploy --json`.** One object with the address, version, app, instance and whether the build probe confirmed the new process, so the runner parses no human output (extends P6).
+- **P-A. Temporary binary apps.** `carlos deploy --temporary --kind binary --ttl <1h..30d>`: a `tmp-` app with one instance, a database that is never replicated beyond the app's life and is purged with it, the smallest size by default, its own cap separate from the 20 static temporary apps, `carlos gate` allowed on it, and edge-set response headers like the static `_headers` (so B1's proxy rules hold there too). Today `--kind binary` is refused with `--temporary` (cli.md).
+- **P-B. Machine-readable deploy, ship and promote.** One JSON object with the address, version, app, each box's rollout result and whether the build probe confirmed the new process, so the runner parses no human output and can tell C6's rows apart (extends P6).
- **P-C. Deploy credentials and canaries.** Let a `deploy` credential for one app promote to, list and remove that app's `canary/<name>` channels and their instances, and nothing more.
-- **P-D. A canary's data.** State, and enforce, that a canary instance starts with an empty database of its own and can never be pointed at the live instance's. Also allow a canary lease shorter than seven days.
+- **P-D. A canary's data.** State, and enforce, that a canary instance starts with an empty database of its own and can never be pointed at the live instance's; allow a lease shorter than seven days.
- **P-E. Rollback with a deploy credential.** Confirm that `carlos rollback --app <app> edge` works with an app-scoped `deploy` credential on its own rungs, or allow it.
-- **P-F. `carlos vet` for a deploy credential.** Machine-readable output, usable before the first deploy (no app yet) and with a deploy credential afterwards.
+- **P-F. Vet before ship.** `carlos vet --boot` for a local artifact, before any app exists, with JSON output. Until then the runner's own boot check (C3) stands in for it on a first deploy, and `vet` runs between ship and promote on later ones.
+- **P-G. The build probe's match rule.** Document how the probe compares the response body with the release's `--version` (prefix, substring or exact), so `/version` can be specified to match it.
## 9. The stale go-ahead (shipped separately)
@@ -217,52 +264,57 @@ Equipo branch `stale-goahead-card`, from `origin/main` 57f370c5. A go-ahead whos
## 10. Phases
-1. **Starter checks (S).** `create_project` `kind`, the three templates, hosted CI on at creation, and A4 for existing repositories. Equipo: runner and instance, one protocol bump.
+1. **Starter checks (S).** `create_project` `kind`, the three templates, hosted CI on at creation, A4 for existing repositories. Equipo runner and instance, one protocol bump.
2. **Honest status (S).** D2's lines from Checks and preview outcomes, in instance copy, on the go-ahead and the ready pill. Equipo only.
-3. **App go-live (M).** The `app` place kind, C1 to C8, the address on the job (C4), `authorizeAppDeploy`. Equipo instance and runner. Paul's login on docs-t1 for first deploys (places ruling 2). Finish line: `recipes` (after A4) goes live at its address from one tap in Base.
-4. **App previews on the runner (M to L).** B1 to B3. Equipo runner (sandbox helper, socket forward, devbox share) and instance (`release/app.json` evidence, preview mode `app`).
+3. **App go-live (M).** The `app` place kind, the `app_place` merge criterion, C1 to C8, `authorizeAppDeploy`, the deploy lease and `deployed_sha`, D1's going-live states, the address on the job. Equipo instance and runner. Paul's login on docs-t1 for first deploys (places ruling 2). Finish line: `recipes` (after A4) goes live at its address from one tap in Base.
+4. **App previews on the runner (M to L).** B1 to B3, including the proxy, the confinement and the upgrade check. Equipo runner and instance. Linux runners only.
5. **App previews on CARLOS (S, after P-A, P4, P-C, P-D).** B4.
-Phases 1 and 2 can ship in a day each and fix Paul's "could not be fully tested". Phase 3 gives the address. Phase 4 lets the person try the app first. Phase 3 doesn't wait for phase 4: until a preview exists, the honest line says the app can't be tried before it goes live.
+Phases 1 and 2 each take about a day and fix "could not be fully tested". Phase 3 gives the address. Phase 4 lets the person try the app first. Phase 3 doesn't wait for phase 4: until a preview exists, the honest line says the app can't be tried before it goes live.
## 11. Tests
Equipo:
-- `TestStartDefaultTemplates`: each kind's first commit is deterministic and holds exactly its files; `other` is today's empty tree; a retry recognises its own `main`; a `main` of someone else's is left alone (the existing `start_default_test.go` cases, for each template).
-- `TestStarterGoChecks` (runner, real Go): a minimal app that follows A3 passes `10-go` and `20-starts`; missing `go.mod`, a vet error, a failing test, no `/healthz` and a crash on start each fail with a plain reason; the steps never reach the network.
+- `TestStartDefaultTemplates`: each kind's first commit is deterministic and holds exactly its files; `other` is today's empty tree; a retry recognises its own `main`; someone else's `main` is left alone (the `start_default_test.go` cases, per template).
+- `TestStarterGoChecks` (runner, real Go): a minimal app that follows A3 passes `10-go` and `20-starts`; missing `go.mod`, no tests, a vet error, a failing test, an arm64 build failure, no `/healthz`, a wrong `/version`, a crash on start and losing its data across a restart each fail with a plain reason; the steps never reach the network.
- `TestStarterSiteChecks`: a broken local link, a missing title and an `http:` script each fail; a clean folder passes.
-- `TestTrustedStarterChecks`: on a repository started with `go_app`, a candidate that deletes `10-go` or `go.mod`'s check is judged by `main`'s steps; `BaseChecksSHA` is set; the gate's `trusted_base_checks` holds.
+- `TestTrustedStarterChecks`: on a `go_app` repository, a candidate that deletes `10-go` or changes `release/app.json`'s package is judged by `main`'s steps; `BaseChecksSHA` is set; `trusted_base_checks` holds. `TestHubAndChecksDiverge`: the same candidate is green on a hub fake running its own files and red in Equipo, and D2 reads Equipo's verdict.
- `TestHostedCIOnAtCreate`: one fixed call after `Forge.Create`, none for an adopted repository.
-- `TestAppPreviewSandbox`: the preview process sees no credential files, no network but loopback, only the three environment variables, and its own `/data`; the socket forward is the only listener outside; a fork bomb and an over-memory process are stopped; a tainted or unproven runner runs none.
-- `TestAppPreviewLifetime`: stopped at 24 h, after 2 h idle, at job end and when a newer candidate's preview starts; data deleted each time; the fourth preview waits.
-- `TestAppPreviewNeedsReview`: no preview without Review's approval of that candidate; `release/app.json` is refused when malformed, oversized or naming a path outside the tree.
-- `TestPutItLiveOneTap`: one tap merges and deploys when the merged tree equals the candidate's; with another change landed in between, a second card asks; merge authority never merges an app task with a place.
-- `TestAppFirstDeploy` (fake carlos): the fixed templates in order (vet, deploy, build-probe, services create); the secret goes only to the 0600 file; a taken name gets a suffix, at most three tries; the owner's login is used for nothing else.
-- `TestAppRedeploy`: later deploys use the deploy credential in the environment, never argv; a failed wait leaves the job "Didn't go live" with Try again.
-- `TestAppDeployAbilityOff`: `go_live` off between the tap and the deploy deploys nothing; `build` off stops previews; abilities spec T-cases for publish apply to app deploys.
-- `TestJobShowsAppAddress`: the done job's link is the address, label "Open your app"; `team_status` says "It is live at …"; nothing names machinery (extend `TestContractAssistantLaneLeaksNoMachinery`).
-- `TestHonestStatusLines`: each D2 row from its Checks and preview inputs.
+- `TestAppPreviewConfinement` (Linux): the process sees no credential file, no network but loopback, only its four mounts and three variables; writing past 1 GiB in `/data`, a fork bomb past 64 tasks and an allocation past 512 MiB are each stopped; the seed runs inside the same limits; a runner that can't create the scope, a tainted runner and a Mac runner run none.
+- `TestAppPreviewProxy`: every response carries the headers; a cross-origin redirect, a `Set-Cookie` with `Domain`, an oversized body and a page that fetches another origin (checked in a headless browser) are all stopped; same-origin forms work; no proxy, no preview.
+- `TestAppPreviewScan`: a secret in the tree or the seed refuses the preview; a scanner that can't run fails it as `preview_scanner`.
+- `TestAppPreviewLifetime`: stopped at 24 h, after 2 h idle, at job end and when a newer candidate's preview starts; data deleted each time; the fourth waits; Try again starts the next attempt once per tap and is refused after a newer candidate; a crash leaves nothing running after the runner restarts.
+- `TestAppUpgradeCheck`: a candidate that drops a column the previous release reads fails; one that adds a table passes.
+- `TestPutItLiveAuthority`: only the creator who is an owner may tap; a member sees the owner line; the snapshot binds the deploy; a place change, a binding change, the creator losing ownership and a lost credential between tap, setup, deploy and mint each refuse the next command.
+- `TestAppPlaceNeverAutoMerges`: with an app place, `autoMerge` asks even with `MainShips` `no`; a merge queued before the place was confirmed is refused at `authorizeMergeLease`; the person's tap merges.
+- `TestPutItLiveOneTap`: one tap merges and deploys when the trees match; with another change landed in between, the merged commit gets Checks and Review, then a second card.
+- `TestAppDeployOrder`: two merged changes whose deploys run in reverse order leave the newer live and settle the older as superseded; a duplicate tap starts one deploy; a delayed retry of an older deploy is refused.
+- `TestAppFirstDeploy` (fake carlos): `apps create --build-probe`, `apps region --set`, `deploy`, `services create`, in order, each behind its own final check; `CARLOS_CONFIG` names the runner's config and a hostile repository `.carlos/config` changes nothing; a region or target mismatch is refused; the secret only goes to the 0600 file; a taken name gets a suffix, at most three tries; a restart after `apps create` adopts the app.
+- `TestAppRedeploy` (fake carlos): ship, vet, promote with the deploy credential in the environment, never argv; a refused vet changes nothing served; each C6 row from its fake outcome, including a partial rollout and an unconfirmed probe, and a restart mid-step that only reconciles.
+- `TestAppDeployAbilityOff`: `go_live` off before each of `authorizeAppDeploy`'s checks refuses everything after it; a promote already sent finishes; turning it back on deploys nothing until Try again; `build` off stops a new preview and leaves a running one to its end.
+- `TestJobGoingLive`: a merged app task reads "Going live" until its deploy settles, keeps its preview up meanwhile, and is done only once confirmed; the done job's link is the address; `team_status` says "It is live at …"; nothing names machinery (extend `TestContractAssistantLaneLeaksNoMachinery`).
+- `TestHonestStatusLines`: each D2 row from its inputs, always for the card's own candidate, never an older one's.
Base:
-- `internal/browsertest`: a done job with an app address draws "Open your app" on the pill and in the job view, opens in a new tab, survives a reload; light and dark screenshots. No other Base code changes.
+- `internal/browsertest`: a done job with an app address draws "Open your app" on the pill and in the job view, opens in a new tab and survives a reload; a going-live job draws "Try your app"; light and dark screenshots. No other Base code changes.
-Staging (after phase 3): from Base, "Can you create a simple app for sharing recipes?" ends with one "Put it live" tap and an address that serves the app's `/healthz`, recorded in `docs/live-check.md`.
+Staging (after phase 3): from Base, "Can you create a simple app for sharing recipes?" ends with one "Put it live" tap and an address whose `/version` names the merged commit, recorded in `docs/live-check.md`.
## 12. Open questions, with recommendations
-- **Q1. One tap for an app to go live (merge and deploy), or two?** Recommended: one tap, "Put it live", when the merged result is exactly what was approved; a second card only when something else landed in between. Two taps for one decision is what left Paul with no address.
-- **Q2. Where app previews run until CARLOS can host temporary apps.** Recommended: on the person's own machine, in the checks sandbox, as a private link on their network (B1), matching the ruling for temporary sites. No public app previews until P-A and P4.
+- **Q1. One tap for an app to go live (merge and deploy), or two?** Recommended: one tap, "Put it live", when the merged result is exactly what was approved; a second card, after checks and review of the merged result, only when something else landed in between. Two taps for one decision is what left Paul with no address.
+- **Q2. Where app previews run until CARLOS can host temporary apps.** Recommended: on the person's own Linux machine, in the B3 confinement behind the B1 proxy, as a private link on their network, matching the ruling for temporary sites. No public app previews until P-A and P4; none on Mac runners in v1.
- **Q3. How long an app preview lives.** Recommended: 24 hours, stopped after 2 idle hours, Try again for a fresh one. It runs on the person's machine, so shorter than a static preview's 7 days.
-- **Q4. Which account a person's app goes in.** Recommended: the places default (Carloku `paulca` for Paul's projects, `oficina` for oficina's), confirmed once by an owner. For other members of a Base, the same team place, with the member as the creator; per-member accounts later if someone asks.
+- **Q4. Which account a person's app goes in, and who may put it live.** Recommended: the places default (Carloku `paulca` for Paul's projects, `oficina` for oficina's), confirmed once by an owner. Only an owner who created the task puts it live, as for merging and publishing today; a member's app waits at Ready to try for an owner. Per-member accounts and a "put it live for them" action are later designs (abilities spec Q4).
- **Q5. A repository whose kind is neither a Go app nor a site.** Recommended: no starter checks, and the honest line "It hasn't been tested: there are no tests for it yet." Add kinds when one comes up.
- **Q6. Existing repositories with no checks (`recipes`).** Recommended: the next task on each adds its starter checks as part of the change, without asking (A4). For `recipes`, Equipo opens that task when phase 1 ships, so phase 3's finish line has trusted checks.
- **Q7. Rollback from Base.** Recommended: not in v1. An owner can roll back from Equipo's task page. Revisit once apps with real data are live.
- **Q8. Custom domains.** Recommended: later, with the domain-buying flow. v1 gives every app its platform address.
- **Q9. Hosted CI cost.** Recommended: on at creation at the smallest size. An owner can turn it off per repository; Equipo's Checks step still runs.
- **Q10. Apps Equipo built on Base's Home.** Recommended: yes, as a separate small design, read from Equipo's jobs and places (Base stores nothing). Until then the job's link is the way back to the app.
-- **Q11. Data in previews.** Recommended: always an empty database, plus the reviewed seed file if there is one. Never a copy of live data, even for a change to a live app.
+- **Q11. Data in previews.** Recommended: always an empty database plus the reviewed seed file, if there is one. Never a copy of live data, even for a change to a live app.
- **Q12. Only Go apps in v1?** Recommended: yes. The app spec wants one compiled binary (12.1), and the family builds in Go. Other languages get the honest line until a template exists.
## Copy register (all DRAFT, for copy review)
@@ -273,28 +325,58 @@ Equipo instance copy, shown in Base:
|---|---|
| `assistant.outcome.app_question` | Your app is ready. Put it live? |
| `assistant.outcome.option.go_live` | Put it live |
-| `assistant.outcome.option.not_now` | Not now (approved, reused) |
+| `assistant.job.detail.owner_goes_live` | {Owner} can put it live. |
| `assistant.job.status.app_preparing` | Making it ready to try |
| `assistant.job.detail.app_preparing` | Getting your app ready to try. |
| `assistant.job.status.app_waiting` | Ready soon |
| `assistant.job.detail.app_waiting` | Waiting to start your app so you can try it. |
+| `assistant.job.detail.app_trial_ended` | Your app's trial has ended. Try again for a fresh one. |
| `assistant.job.status.going_live` | Going live |
| `assistant.job.detail.going_live` | Putting your app live. |
| `assistant.job.detail.app_live` | Your app is live. |
-| `assistant.job.detail.app_not_live` | Your app didn't go live. The version before is still running. |
+| `assistant.job.detail.app_superseded` | A newer version of your app is live. |
+| `assistant.job.detail.app_not_live_kept` | Your app didn't go live. The version before is still running. |
+| `assistant.job.detail.app_not_live` | Your app didn't go live. |
+| `assistant.job.status.app_partly` | Partly live |
+| `assistant.job.detail.app_partly` | Your app is live in some places but not others. |
+| `assistant.job.status.app_unconfirmed` | Not confirmed |
+| `assistant.job.detail.app_unconfirmed` | Your app was sent, but it could not be confirmed. |
| `assistant.job.app_preview` | Try your app |
| `assistant.job.app_open` | Open your app |
| `assistant.tested.all` | Tested: it builds, its tests pass and it starts. You can try it before it goes live. |
+| `assistant.tested.upgrade` | Tested: its tests pass, it starts, and it opens your existing data (checked with sample data). You can try it before it goes live. |
| `assistant.tested.no_preview` | Its tests pass, but you can't try it before it goes live here. |
| `assistant.tested.none` | It hasn't been tested: there are no tests for it yet. |
+| `assistant.tested.failing` | Its tests still fail, so it can't go live as it is. |
| `assistant.tested.needs_network` | Its tests couldn't run here because they need the internet. |
| `assistant.tested.needs_macos` | Its tests need a Mac, and none was free to run them. |
| `assistant.tested.timeout` | Its tests took too long and were stopped. |
+| `assistant.tested.unavailable` | It couldn't be tested just now. We'll try again shortly. |
| `assistant.tested.no_start` | It passed its tests but didn't start, so you can't try it yet. |
| `assistant.outcome.merge_done` | This went ahead. (COPY REVIEW PENDING on `stale-goahead-card`) |
-Reused, already approved: "Ready to try", "Done", "Finished.", "It is live at %s", "Not now". Reused from the jobs spec's DRAFT register: "Building it", "Building the full version from your first look.", "See the first look", "Didn't go live", "Try again". From the abilities register: "Putting it live is turned off for you. {Owner} can turn it on."
+Reused, already approved: "Ready to try", "Done", "Finished.", "It is live at %s", "Not now". Reused from the jobs spec's DRAFT register: "Building it", "Building the full version from your first look.", "See the first look", "Didn't go live", "Try again", "Drop it". From the abilities register: "Putting it live is turned off for you. {Owner} can turn it on."
-Equipo-only copy (Places page; reviewed with Equipo's copy): "Apps go to {console}, account {account}.", "{Project}: {app}, live at {address}.", "Its data is kept in {region} and backed up as it changes."
+Equipo-only copy (Places page; reviewed with Equipo's copy): "Apps go to {console}, account {account}, in {region}.", "{Project}: {app}, live at {address}.", "Its data is kept in {region} and backed up as it changes."
Model-facing (not copy, reviewed as code): the app contract note (A3), Review's migration line (C6), and the Assistant's "read the job, not base_apps" note (D3).
+
+## Review
+
+**Astra, round 1 (2026-11-28): not ready, 8 P1, 6 P2, 1 P3.** All addressed in revision 2:
+
+1. P1, browser exfiltration from a preview: the proxy with the static preview headers, cookie and redirect rules, body caps, and the secret scan of tree and seed; fail closed (B1, B3).
+2. P1, confinement not established: its own profile, Linux only, explicit namespaces, mounts, tmpfs quota, `TasksMax`, memory and CPU limits, bounded logs, crash clean-up; seed inside it; no Mac previews in v1 (B1, B2, B3).
+3. P1, `vet` can't check an unshipped binary: the runner's own boot check before a first deploy; ship, vet, promote for later ones; P-F rewritten (C3, §8).
+4. P1, app places didn't stop automatic merges: a new `app_place` criterion checked in `autoMerge`, `authorizeMerge` and `authorizeMergeLease` (C1).
+5. P1, publish authority and binding: creator who is an owner; the card's snapshot; `authorizeAppDeploy` with `publishRefusal`'s rules, checked before each command (C1, C8).
+6. P1, stale or out-of-order deploys and a changed merged result: one deploy per app, `deployed_sha` and the descendant rule, reconcile-only restarts; a changed merged tree gets Checks and Review before the second card (C1, C3).
+7. P1, "the version before is still running" was not guaranteed: C6's table of where a deploy stopped; the line only when confirmed (C6, D1).
+8. P1, first deploy not proven: build probe set at `apps create`, `/version` from `vcs.revision`, the runner's own check of the address; P-G (A3, C3, §8).
+9. P2, starter checks too weak: tests must exist, both architectures, `/version`, data kept across a restart; the upgrade check for later changes (A1, B1).
+10. P2, hub and Equipo differ: said where and why; a test (A2, §11).
+11. P2, ability boundary: abilities §6.3 and §6.4's boundary stated per check; `build` covers every step (C8).
+12. P2, job lifecycle: "Going live" until the deploy settles, preview held, switch-off after merge (D1, C8).
+13. P2, preview retry and status rows: `retryPreview` named; D2 rows for failing, unavailable, expired and waiting, bound to the card's candidate (B2, D2).
+14. P2, region and destination isolation: region on the place and every command; `CARLOS_CONFIG` and the explicit destination; refusal on mismatch (C2, C3).
+15. P3, attribution and register: CARLOS's contract separated from this design's choices; Trash from cli.md; every new line in the register.