carlos / platform Public

console: first-run next steps (Getting started card)

A Getting started card at the top of the account apps page. It lists four
steps: connect your agent or terminal, put your first app live, add your
app's secrets, use your own domain. Steps 1 and 2 tick themselves from
data the page already loads (live person CLI tokens; one liveness
predicate over each app's verdict, observed versions and a static route's
own ready channel). Steps 3 and 4 are Mark done or Skip. Hide, Show, Skip
and Mark done are CSRF'd POSTs under /a/{sqid}/getting-started/, and per
person, per account state lives in getting_started_marks. Completion is
stored atomically and the card stays hidden after it. No new S3 reads.

Spec docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md
(rev 2.1, Paul approved 2026-11-08). Astra branch round 1 READY AFTER
FIXES, P2s applied. Census clean; the 9B8 re-pin is approved by Astra on
#280. Copy by the delegated Luna pass. Flakes filed: #665; #659 noted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from design-first-run-next-steps into main.
claude agent, operated by paul@keymail.dev b2f42c139805398b7bfab99996622ba4df382857 parent 5b6d537
29 files changed, +2,252 −8
  • docs/superpowers/plans/2026-11-08-first-run-next-steps.md +281 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-first-run-next-steps-branch-R1.md +17 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-first-run-next-steps-branch.md +44 −0
  • docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md +143 −0
  • docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps-R2.md +33 −0
  • docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps.md +43 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps-R2.md +42 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps.md +33 −0
  • docs/superpowers/specs/CONTROLLER-BRIEF-first-run-next-steps.md +66 −0
  • internal/console/claim_invariant_fixtures_test.go +4 −0
  • internal/console/claim_invariant_probes_nonapp_test.go +33 −0
  • internal/console/demo_members.go +3 −0
  • internal/console/gettingstarted.go +204 −0
  • internal/console/gettingstarted_handlers.go +90 −0
  • internal/console/gettingstarted_handlers_test.go +151 −0
  • internal/console/gettingstarted_page_test.go +351 −0
  • internal/console/gettingstarted_store.go +116 −0
  • internal/console/gettingstarted_store_test.go +168 −0
  • internal/console/gettingstarted_test.go +229 −0
  • internal/console/gettingstartedcopy.go +48 −0
  • internal/console/ownership.go +1 −0
  • internal/console/server.go +25 −0
  • internal/console/store.go +8 −0
  • internal/console/store_gate.go +8 −7
  • internal/console/templates/apps.html +3 −0
  • internal/console/templates/getting_started.html +69 −0
  • internal/console/testdata/claim-routes.txt +4 −0
  • internal/provision/first_run_next_steps_census_test.go +34 −0
  • internal/provision/plan9_b8_census_test.go +1 −1

CI passed — run details

diff --git a/docs/superpowers/plans/2026-11-08-first-run-next-steps.md b/docs/superpowers/plans/2026-11-08-first-run-next-steps.md
new file mode 100644
index 000000000..59ea16d5c
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-08-first-run-next-steps.md
@@ -0,0 +1,281 @@
+# First-run next steps Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** A "Getting started" card at the top of `/a/<account>/` that ticks
+steps 1-2 from facts the page already has, lets the person Mark done or Skip
+steps 3-4, and can be hidden and brought back.
+
+**Architecture:** One new console-DB table of per-person, per-account marks
+(`getting_started_marks`, modelled on `app_stars`). A pure builder turns
+(marks, the viewer's CLI tokens, the apps page's already-assembled
+`AppView`s and `appRow`s, role) into a view model; `handleAccountHome`
+renders it through a new partial in `apps.html`. Four CSRF'd POST handlers
+modelled on `handleAppStar` write the marks.
+
+**Tech Stack:** Go, `database/sql` (SQLite console DB), `html/template`,
+one small static JS file for Copy.
+
+**Spec:** `docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md`
+(rev 2.1, binding).
+
+## Global Constraints
+
+- No new S3 reads on the apps page; only console-DB reads (marks, CLI tokens).
+- A step never shows done when it isn't: on any read error the step is NOT done
+ (log, never fail the page).
+- Copy: no em or en dashes; brand via `{{.ConsoleName}}` / `{console}`, never a
+ literal "Carloku"; no customer or tenant names. Strings live in one copy
+ struct (`gettingStartedCopy`, file `gettingstartedcopy.go`, pattern of
+ `applistcopy.go`); final strings come from the Luna pass and are applied
+ verbatim.
+- Existing console components only: `confirm-card`, `chip`, `btn`/`btn-sm`
+ `btn-secondary`, `linkish`, `<code>` blocks, `data-copy-target` Copy buttons
+ (as in `demo_claim.html`). No new colours, no left-border accents.
+- Works with JavaScript off: Copy buttons start `hidden` and JS un-hides them;
+ prompts are selectable text; every action is a plain `<form method="post">`.
+- Roles: `RoleOwner`, `RoleMember` only. Create-app link for both; the
+ browser domain link for owners only; everyone sees the CLI/agent route.
+- Go tests: only touched packages with `-run` locally; CI runs the full suite.
+ Go commands need the Bash sandbox disabled.
+
+## Review Focus
+
+1. An expired, revoked, `app` or `service` token must not tick step 1
+ (Task 2 `TestPersonConnected`).
+2. The app filter `?q=` must not change the card: liveness reads `p.Apps`
+ (every app), never the filtered lists (Task 4 `TestGettingStartedIgnoresFilter`).
+3. A POST naming another account, a missing/wrong `csrf`, or `step=connect`
+ on skip/done is refused and writes nothing (Task 3 tests).
+4. Marks are per account: hiding in account A leaves the card in account B
+ (Task 1 `TestGettingStartedMarksPerAccount`).
+5. Completion sticks: once all four are satisfied the `completed` mark is
+ stored and the card stays gone after a token expires; "Show getting
+ started" brings back live state (Task 4 `TestGettingStartedCompletionSticks`).
+
+---
+
+### Task 1: Marks table and store methods
+
+**Files:**
+- Create: `internal/console/gettingstarted_store.go`
+- Modify: `internal/console/store.go` (call the migration beside
+ `migrateAppStars` ~line 704; add the DELETE beside each `app_stars` DELETE in
+ `removeMemberTx` ~1559 and `ReapAccount` ~1811),
+ `internal/console/ownership.go` (~836, same), `internal/console/demo_members.go`
+ (~110, same), `internal/console/store_gate.go` (classify the table NonApp
+ beside `app_stars`)
+- Test: `internal/console/gettingstarted_store_test.go`
+
+**Interfaces:**
+- Produces:
+ - `type gsMark string` with consts `gsHidden = "hidden"`, `gsCompleted =
+ "completed"`, `gsSecretsDone = "secrets:done"`, `gsSecretsSkip =
+ "secrets:skip"`, `gsDomainDone = "domain:done"`, `gsDomainSkip = "domain:skip"`.
+ - `func (s *Store) migrateGettingStarted() error` — table
+ `getting_started_marks (account_id INTEGER NOT NULL, address TEXT NOT NULL,
+ mark TEXT NOT NULL, marked_at INTEGER NOT NULL, PRIMARY KEY (account_id,
+ address, mark))`.
+ - `func (s *Store) GettingStartedMarks(accountID int64, address string) (map[gsMark]bool, error)`
+ - `func (s *Store) SetGettingStartedMark(accountID int64, address string, m gsMark, now time.Time) error`
+ — idempotent insert; setting `secrets:done` deletes `secrets:skip` and vice
+ versa (same for domain), in one transaction.
+ - `func (s *Store) ResetGettingStarted(accountID int64, address string) error`
+ — deletes every mark for that person and account (Show).
+
+- [ ] **Step 1: Write failing tests**: `TestGettingStartedMarksRoundTrip`
+ (set hidden, read back `{hidden:true}`; repeat set is no error),
+ `TestGettingStartedDoneReplacesSkip` (skip then done leaves only
+ `secrets:done`), `TestGettingStartedReset` (all marks gone),
+ `TestGettingStartedMarksPerAccount` (mark in account 1 absent in account 2,
+ and for another address), `TestGettingStartedCleanup` (RemoveMember and
+ ReapAccount delete the person's / account's rows; follow the existing
+ app_stars cleanup tests' setup, `grep -n app_stars *_test.go`).
+- [ ] **Step 2: Run** `go test ./internal/console -run 'TestGettingStarted' -count=1` → FAIL (undefined).
+- [ ] **Step 3: Implement** the file, migration call, cleanup DELETEs and gate
+ classification (`{NonApp: "personal onboarding checklist marks keyed by
+ account and address; grants no app authority"}`). If a store-gate or
+ table-inventory test lists tables, add the new one there.
+- [ ] **Step 4: Run** the same command plus `-run 'TestGettingStarted|StoreGate|AppStar'` → PASS.
+- [ ] **Step 5: Commit** `console: getting-started marks table and store`.
+
+### Task 2: The facts and the view model (pure)
+
+**Files:**
+- Create: `internal/console/gettingstarted.go`, `internal/console/gettingstartedcopy.go`
+- Test: `internal/console/gettingstarted_test.go`
+
+**Interfaces:**
+- Consumes: Task 1 `gsMark` consts.
+- Produces:
+ - `func personConnected(tokens []CLIToken, now time.Time) bool` — true iff some
+ token has `Kind == ""`, `RevokedAt.IsZero()` and `ExpiresAt.After(now)`.
+ Person tokens always carry an expiry (`CLIToken.NeverExpires` is true only
+ for app/service kinds), so a zero or epoch expiry never ticks.
+ - `func appIsLive(row appRow, v AppView, acct string) bool` — THE predicate
+ (spec call 2): `row.Verdict == "ok"` AND (`row.Deployment.UniformVersion()
+ != "" || row.Deployment.Mixed()` OR some route with `rt.Account == acct &&
+ !rt.Platform && rt.Kind == "static"` whose OWN channel `rt.Channel` matches
+ a `v.Channels[i].Name` with `Err == ""` and `Version != ""`). Resolve an
+ empty `rt.Channel` the way `ladder.go` does (`release.Rung(rt.Channel)`);
+ if empty never resolves to a channel, it does not tick.
+ - `type gsStepState string` = `"done" | "skipped" | "open" | "muted"`.
+ - `type gsStep struct { Key string; State gsStepState; ... }` with keys
+ `"connect"`, `"deploy"`, `"secrets"`, `"domain"`.
+ - `type gettingStartedView struct { Steps []gsStep; CanCreate, IsOwner bool;
+ DomainApp string; Copy gettingStartedCopy }`.
+ - `func buildGettingStarted(marks map[gsMark]bool, connected, anyLive bool, role string, firstApp string, consoleName string) (view *gettingStartedView, complete bool)`
+ — returns `nil, false` when `hidden` or `completed` is set; else steps in
+ order, ticks 1-2 from facts, 3-4 from marks; the FIRST non-done/skipped
+ step is `open`, later ones `muted`; `complete` true when all four are
+ done/skipped (caller then stores `completed` and renders nothing).
+ `DomainApp` = `firstApp` (first app by the page's order) for the owner
+ link `/a/<sqid>/apps/<DomainApp>/settings/domains`; "" = no link.
+ `{console}` in copy is replaced with `consoleName` here.
+ - `gettingStartedCopy` struct and `approvedGettingStartedCopy` var holding
+ the strings below (drafts; Luna pass replaces them verbatim).
+
+Draft copy (for the Luna pass; keys are field names):
+```
+Title: Getting started
+Hide: Hide
+Show: Show getting started
+Done: Done
+Skipped: Skipped
+MarkDone: Mark done
+Skip: Skip
+Copy: Copy
+Copied: Copied
+ConnectTitle: Connect your agent or terminal
+ConnectBody: Ask your agent to sign in. It runs one command and gives you a link to approve.
+ConnectPrompt: Sign in to {console} with the carlos CLI: run carlos auth login --no-wait and give me the link it prints.
+ConnectCLI: carlos auth login
+DeployTitle: Put your first app live
+DeployBody: Ask your agent to deploy your app.
+DeployPrompt: Deploy this app to {console}. Use the carlos CLI; my account is ready.
+DeployCreate: Create an app here instead
+SecretsTitle: Add your app's secrets
+SecretsBody: If your app needs API keys or passwords, give them to your agent, or set them yourself with carlos secrets set.
+SecretsPrompt: Set the secrets my app needs on {console}
+DomainTitle: Use your own domain
+DomainBody: Point a domain you own at your app. Your agent can attach it with the carlos CLI.
+DomainCLI: carlos domains attach --app <app> <hostname>
+DomainLink: Attach a domain in settings
+SaveFailed: Could not save that. Please try again.
+```
+
+- [ ] **Step 1: Write failing tests**:
+ - `TestPersonConnected`: table: none → false; person live → true; person
+ expired (`ExpiresAt` = now-1s) → false; person revoked → false; `Kind
+ "app"` live → false; `Kind "service"` live → false.
+ - `TestAppIsLive` (spec guard tests): uniform version + ok → true; mixed + ok
+ → true; static-only site whose route channel `stable` has Version `v1`
+ → true; sole remote instance with `unknown` verdict and a version → false;
+ static route on `stable` with empty Version while `beta` has a version →
+ false; static channel with `Err` set → false; verdict `attention` with a
+ version → false; route of another account → false.
+ - `TestBuildGettingStarted`: fresh (nothing) → step 1 open, 2-4 muted;
+ connected → step 1 done, 2 open; connected+live+secrets:skip → 4 open;
+ all four → `nil, true`; hidden → `nil, false`; completed → `nil,
+ false`; member → `CanCreate` true, `IsOwner` false; no apps → `DomainApp ""`;
+ rendered copy contains no `{console}`, no "—" or "–".
+- [ ] **Step 2: Run** `go test ./internal/console -run 'TestPersonConnected|TestAppIsLive|TestBuildGettingStarted' -count=1` → FAIL.
+- [ ] **Step 3: Implement** both files.
+- [ ] **Step 4: Run** same → PASS.
+- [ ] **Step 5: Commit** `console: getting-started facts and view model`.
+
+### Task 3: Preference handlers (Opus: auth/CSRF)
+
+**Files:**
+- Create: `internal/console/gettingstarted_handlers.go`
+- Modify: `internal/console/server.go` (register beside the star route ~2129)
+- Test: `internal/console/gettingstarted_handlers_test.go`
+
+**Interfaces:**
+- Consumes: Task 1 store methods.
+- Produces routes (all POST, all `s.account(w, r)` for session + membership,
+ person = the session address, CSRF `subtle.ConstantTimeCompare(r.FormValue("csrf"), raw)`
+ exactly as `handleAppStar`; success → `303` to `accountHomeURL(acct.Sqid, "")`;
+ store error → 500 `renderMessage` with `SaveFailed`):
+ - `POST /a/{sqid}/getting-started/hide` → `gsHidden`
+ - `POST /a/{sqid}/getting-started/show` → `ResetGettingStarted`
+ - `POST /a/{sqid}/getting-started/skip` with `step=secrets|domain`
+ - `POST /a/{sqid}/getting-started/done` with `step=secrets|domain`
+ - any other `step` (incl. `connect`, `deploy`, empty) → 400, nothing written.
+- Demo accounts: if `s.demoMutationRefusal` has an account-level form, apply
+ it; otherwise the marks are personal and allowed (say which in the report).
+
+- [ ] **Step 1: Write failing tests** using the existing star-handler test
+ harness (`grep -n handleAppStar *_test.go` / `"/star"`):
+ `TestGettingStartedHideShow` (hide → mark set, 303 to `/a/<sqid>/`; show →
+ no marks), `TestGettingStartedSkipDone` (skip secrets → `secrets:skip`;
+ done domain → `domain:done`), `TestGettingStartedRefusesBadStep`
+ (`connect`, `deploy`, `""`, `x` → 400, no rows), `TestGettingStartedRefusesCSRF`
+ (missing and wrong csrf → 403, no rows), `TestGettingStartedRefusesStranger`
+ (non-member session → 404, no rows; no session → redirect to `/`),
+ `TestGettingStartedIgnoresFormAddress` (an `address=` form field naming
+ someone else writes the session person's row only).
+- [ ] **Step 2: Run** `go test ./internal/console -run 'TestGettingStarted(HideShow|SkipDone|Refuses|Ignores)' -count=1` → FAIL.
+- [ ] **Step 3: Implement** handlers and route registration.
+- [ ] **Step 4: Run** same → PASS.
+- [ ] **Step 5: Commit** `console: getting-started hide, show, skip, done`.
+
+### Task 4: The card on the apps page
+
+**Files:**
+- Create: `internal/console/templates/getting_started.html` (`{{define
+ "getting_started"}}`), `internal/console/static/getting_started.js`
+- Modify: `internal/console/server.go` (`page` gets `GettingStarted
+ *gettingStartedView` and `ShowGettingStarted bool`; `handleAccountHome`
+ ~4248 builds them), `internal/console/templates/apps.html` (include the
+ partial right after `</div>` closing `pagehead` in BOTH branches; the Show
+ form beside the Trash link at the bottom)
+- Test: `internal/console/gettingstarted_page_test.go`
+
+**Interfaces:**
+- Consumes: Tasks 1-3.
+- `handleAccountHome`: after the app rows are built, compute `anyLive` over
+ the zipped `views`/`p.Apps` (before filtering; keep the `AppView`s from
+ `assembleAppsNamed`), `tokens, err := s.store.CLITokens(addr)` (err → log,
+ `connected=false`), `marks, err := s.store.GettingStartedMarks(acct.ID, addr)`
+ (err → log, no card, no Show link), then `buildGettingStarted`. If
+ `complete`, `SetGettingStartedMark(gsCompleted)` (err → log) and render no
+ card. `ShowGettingStarted` = marks has `hidden` or `completed` (no card).
+- Card markup: a `confirm-card` section with `<h2>` Title, Hide form (`linkish`
+ button) top right, an `<ol>` of steps; done/skipped steps show a `chip` with
+ Done/Skipped and the title; the open step shows body, the prompt in a
+ `<code id="gs-prompt-<key>">` with a hidden `data-copy-target` Copy button,
+ and its actions (Create link if `CanCreate`; domain link if `IsOwner &&
+ DomainApp != ""`; Mark done/Skip forms for secrets/domain); muted steps show
+ only the title, muted (existing `small`/muted text class). Every form carries
+ `<input type="hidden" name="csrf" value="{{.CSRF}}">` (use whatever field the
+ star form uses).
+- JS: copy of `demo_claim.js`'s `[data-copy-target]` loop only; load it the way
+ other page scripts load (nonce/CSP as they do).
+
+- [ ] **Step 1: Write failing tests** with the existing account-home render
+ harness (`grep -n handleAccountHome *_test.go`):
+ `TestGettingStartedCardFresh` (new account, no tokens: card present, step
+ connect open with the prompt text, no "Carloku" literal, no `{console}`);
+ `TestGettingStartedIgnoresFilter` (live app + `?q=zzz` still shows deploy
+ done); `TestGettingStartedHiddenShowsLink` (hidden mark: no card, Show form
+ present); `TestGettingStartedCompletionSticks` (all satisfied → `completed`
+ stored and no card; then expire the token → still no card; reset → card
+ back with connect open); `TestGettingStartedMemberNoDomainLink` (member sees
+ no `/settings/domains` link, owner does); `TestGettingStartedNoS3`
+ (if the harness counts bucket calls, assert the same count with and without
+ the card; otherwise state in the report that only DB reads were added).
+- [ ] **Step 2: Run** `go test ./internal/console -run 'TestGettingStartedCard|TestGettingStartedIgnoresFilter|TestGettingStartedHidden|TestGettingStartedCompletion|TestGettingStartedMember|TestGettingStartedNoS3' -count=1` → FAIL.
+- [ ] **Step 3: Implement** template, JS, page fields and handler wiring.
+- [ ] **Step 4: Run** same plus `-run 'AccountHome|AppList|Template'` → PASS.
+- [ ] **Step 5: Render check:** dump the fresh-state and mid-state (connect
+ done, deploy open) pages from a test to `$TMPDIR`, screenshot with headless
+ chromium at 390 px and 1280 px wide; no horizontal scroll, buttons ≥ 40 px
+ tall, card matches the existing confirm-card look. Attach paths in the report.
+- [ ] **Step 6: Commit** `console: getting-started card on the apps page`.
+
+### After the tasks (controller)
+
+- Luna copy pass over `gettingstartedcopy.go`, apply verbatim, rerun Task 2/4 tests.
+- `make census-card`; whole-branch Astra review (max 3 rounds, stopping rules).
+- `gofmt -l .`, `go vet ./internal/console`, push, CI green, merge, release.
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-first-run-next-steps-branch-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-first-run-next-steps-branch-R1.md
new file mode 100644
index 000000000..8b6b3194d
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-first-run-next-steps-branch-R1.md
@@ -0,0 +1,17 @@
+No P1 findings. Three P2 findings:
+
+1. **P2 — Deployment: a static app can tick done before any route exists.**
+ [remoteRoute:472](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/remoteinstances.go:472) creates a `pending` static row when complete reports confirm no box serves the host. [summarize:7021](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/server.go:7021) nevertheless assigns `ok`, and [appIsLive:42](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/gettingstarted.go:42) accepts its channel pointer. A published version awaiting provisioning therefore completes step 2, potentially storing permanent completion.
+ **Fix:** exclude pending static rows from the predicate and add a regression covering an unprovisioned static record with a valid pointer. **Fault family:** deployment intent must not count as observed deployment.
+
+2. **P2 — Completion: an in-flight GET can undo Show.**
+ [fillGettingStarted:143](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/gettingstarted.go:143) reads marks separately from its completion write at line 159. [SetGettingStartedMark:68](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/gettingstarted_store.go:68) inserts unconditionally. Two GETs can read satisfied steps; the first completes, the person presses Show, and the second restores `completed` after Show deleted every mark. The card stays hidden despite steps 3–4 being reset. Reproduced using the implementation’s SQL in an in-memory database.
+ **Fix:** make completion insertion atomically conditional on both manual steps still being satisfied, or compare a reset generation. Add a deterministic interleaving test. **Fault family:** stale reads must not overwrite a person’s reset.
+
+3. **P2 — Deployment: valid custom channels never complete static-only apps.**
+ [appIsLive:38](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/gettingstarted.go:38) requires `release.Rung`, which rejects names outside the legacy ladder. However, [pipeline validation:269](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/release/pipeline.go:269) permits custom channels such as `production`. A deployed static site following that channel remains incomplete despite an `ok` verdict and a valid matching pointer.
+ **Fix:** remove the legacy-rung restriction; retain nonempty channel validation and the exact matching, error-free pointer check. Add a custom-channel regression. **Fault family:** liveness must support the platform’s valid channel vocabulary.
+
+Targeted Go tests could not start because the read-only sandbox prevents creating Go’s build directory. Cross-compilation remains unverified. No files changed; no full suites ran.
+
+**READY AFTER FIXES**
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-first-run-next-steps-branch.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-first-run-next-steps-branch.md
new file mode 100644
index 000000000..ece498baa
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-first-run-next-steps-branch.md
@@ -0,0 +1,44 @@
+# Review brief: branch design-first-run-next-steps (slice 1, first-run next steps), round 1 of 3
+
+Repo carlos/platform, branch `design-first-run-next-steps`, commit d81386a3f03e082377adafb50e6a96d01435d029.
+Under review: the code diff `3d0729b9..d81386a3f03e082377adafb50e6a96d01435d029` (internal/console only; ignore docs/).
+Authorities: the approved spec on this same branch,
+`docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md` (rev 2.1,
+Paul approved 2026-11-08; Astra spec rounds 1-2 done), and the plan
+`docs/superpowers/plans/2026-11-08-first-run-next-steps.md`. AGENTS.md on main.
+
+You are an independent reviewer. Read the spec, then the diff, and check every claim against the code.
+
+## Fixed: do not re-argue
+
+- Spec calls 1-6 (steps 3 and 4 person-ticked; one liveness predicate; person tokens only; who sees what; completion remembered; handler shape). Report only mechanisms that fail to honour them.
+- Copy strings are final (delegated copy pass); review wording only for house-rule breaks (em/en dashes, literal brand, tenant names).
+- Demo accounts may set marks (personal prefs, no demo refusal).
+
+## What to check
+
+1. Wrong ticks: can step 1 or 2 show done when it isn't? `personConnected`, `appIsLive` (internal/console/gettingstarted.go) against `summarize`, `observedDeployment`, `assembleChannels`, static-route channel resolution.
+2. The `completed` mark written on GET in `handleAccountHome`: can it be written from any state that is not all four satisfied, including read-error paths and concurrent Show?
+3. The four POST handlers (gettingstarted_handlers.go): session, membership, CSRF double-submit, person from session only, step allow-list; route registration; the claim-invariant fixtures/probes added.
+4. Cleanup: marks deleted on member removal, account reap, account deletion (ownership.go), demo member paths; store-gate classification.
+5. No new S3 reads on the apps page; read errors never fail the page.
+6. Template: JS-off behaviour, role gating (create link owner+member; domain link owner only), script allow-list change in icons_test.go, any XSS or URL-building risk (app names in hrefs).
+7. Cross-compile safety (darwin/windows) of anything touched.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the area, the problem, the evidence (file:line, verified), the failure scenario, a concrete fix and the invariant or trust boundary it breaks (its fault family). End with exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the full test suites.
diff --git a/docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md b/docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md
new file mode 100644
index 000000000..296c675a6
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md
@@ -0,0 +1,143 @@
+# First-run next steps (account "Getting started" checklist)
+
+Status: rev 2.1 for Paul, 2026-11-08. Astra round 2 READY AFTER FIXES,
+its two P2s applied (call 2). Astra round 1:
+`CODEX-FINDINGS-first-run-next-steps.md` (NOT READY: P1 domain detection,
+six P2s); accepted findings marked **(codex N)**, none declined. Slice 1 of "agent-first onboarding and
+console parity" (order Paul approved 2026-11-08: first-run page, console
+secrets, parity guard, MCP connector). Slice 0, agent login by link, is live
+in v0.34.27 (`2026-11-07-agent-login-link-design.md`).
+
+## Why
+
+A new Carloku user (2026-11-07) signed in, approved his agent and landed in
+his account with no sense of what to do next. Paul: "The Carloku account
+should be very clear on what next steps are for him", and the steps should
+"change with where he is". Paul's goal for the whole programme: a deployed
+app with as little friction as possible.
+
+Paul chose the checklist layout (option B) from mockups built in the real
+console styles on 2026-11-08.
+
+## What it is
+
+A "Getting started" card at the top of the account's apps page
+(`/a/<account>/`, template `apps.html`), above the apps list. It lists four
+steps in order, ticks the ones that are already true of the account, opens
+up the first step that isn't, and mutes the rest:
+
+1. **Connect your agent or terminal.** Done when the person viewing has at
+ least one live CLI token (`Store.CLITokens(address)`, unexpired, not
+ revoked). Open state: how to connect (`carlos auth login --no-wait` for an
+ agent; the link flow from slice 0), with a copyable prompt for an agent.
+2. **Put your first app live.** Done when any app in the account has a
+ running version (the same "deployed" fact the apps list already shows).
+ Open state: a copyable prompt for the agent ("Deploy this app to
+ {console}. Use the carlos CLI; my account is ready."), and "Create an app
+ here instead" linking the existing create-app page.
+3. **Add your app's secrets.** Not detected (see rev 2 below). Open
+ state: secrets can be given to the agent (copyable prompt: "Set the
+ secrets my app needs on {console}") or set with the CLI
+ (`carlos secrets set`); there is no console editor until slice 2, so the
+ step offers instructions, not a "set here" link (codex 7). Buttons:
+ "Mark done" and "Skip".
+4. **Use your own domain.** Not detected (see rev 2 below). Open state:
+ link the existing domain page for owners (browser attach is owner-only)
+ and the CLI command for everyone. Buttons: "Mark done" and "Skip".
+
+The card hides itself, for good, once all four are done, marked done or
+skipped (completion is remembered, call 5). "Hide" on the
+card hides it for that person on that account, permanently, with a small
+"Show getting started" link left in the page footer area to bring it back.
+
+## Goals
+
+- A new person always sees exactly one clear next thing to do, worded for
+ someone driving an agent, with the agent prompt one tap from the clipboard.
+- Steps 1 and 2 tick themselves from facts computed when the page renders.
+ Steps 3 and 4 are ticked by the person (Mark done or Skip): Carloku can't
+ tell cheaply or reliably when they are done (rev 2).
+- Uses only existing console components (confirm-card, chips, code block,
+ buttons); no new visual language. Works with JavaScript off (Copy is an
+ enhancement; the prompt is selectable text).
+- Cheap: no new S3 reads per page view beyond what the apps page already
+ does (Paul's S3-cost rule).
+
+## Non-goals
+
+- Secrets UI (slice 2), the parity table and guard (slice 3), the MCP
+ connector (slice 4).
+- Per-app next steps on each app's page (option C), a guided wizard, email
+ nudges, analytics on checklist use.
+- Changing the agent login flow or the apps list itself.
+
+## Anti-goals
+
+- Nagging: the card never reappears after Hide or completion unless asked.
+- Wrong ticks: a step must never show done when it isn't (e.g. a token
+ that's expired, an app whose only version was retired).
+- A slower apps page: the checklist must not add S3 round trips.
+
+## Constraints
+
+- Copy drafts go through the Luna copy pass (Paul's delegation for platform
+ UI copy); house rules: no em or en dashes, brand from `{console}` (never a
+ literal "Carloku"), no customer or tenant names.
+- Per-person, per-account state for Hide and Skip lives in the console's
+ database (small table or columns); no new bucket records.
+- Census: if any changed code is in the root binary's scope, a cross-family
+ approval on #280 (console code normally is not).
+- Release like v0.34.27: console only, through the agent manager (8a3d302).
+
+## Calls made after the builder check and Astra round 1 (mine)
+
+1. **Steps 3 and 4 are person-ticked, not detected.** Astra round 1 showed
+ that detecting them needs either new S3 reads or a derived fact kept in
+ step with a dozen writers (config PUT, sync, env fork, relay and scan and
+ mail credentials, storage and mail walks, removals, trash and purge), and
+ that domain attach creates aliases the page's views don't carry
+ **(codex 1, 2, 3)**. A wrong tick is worse than asking, so the person
+ presses "Mark done" or "Skip". Both are stored per person per account.
+2. **Step 2 is done when an app is affirmatively live,** decided by ONE
+ predicate (one function, with guard tests) over data the apps page
+ already loads, claiming "live", not "healthy" (the list has no
+ process-liveness evidence) **(codex 4, R2)**. An app counts when its
+ verdict is "ok" (never "unknown" or "attention": a remote instance that
+ is starting or stopping keeps its version but reports "unknown") AND
+ either (a) the "Observed versions" cell is non-empty
+ (`Deployment.UniformVersion` set or `Deployment.Mixed`), or (b) it is a
+ static route whose OWN channel has a valid, non-empty pointer in the
+ already-loaded `AppView.Channels` (static routes carry no observed
+ version; another channel or environment never satisfies it). Guard
+ tests: a static-only site ticks; a sole remote instance in a transient
+ state does not; a static route whose own channel is empty does not even
+ when another channel is set.
+3. **Step 1 counts person tokens only** (`Kind == ""`, not revoked, not
+ expired); app and service tokens never tick it. A slice 0 agent login is
+ a person token. Step 1 ticks in every account the person belongs to.
+4. **Who sees it:** everyone who can see the account's apps page. Each
+ action appears only if that viewer's role allows it (members can create
+ apps and read settings; browser domain attach is owner-only), otherwise
+ the step shows its text and the CLI or agent route.
+5. **Completion is remembered** **(codex 5):** the first time a person's
+ view shows all four steps done, skipped or marked done, a "completed"
+ mark is stored for that person and account, and the card stays hidden
+ even if a fact later changes (a token expires, an app is deleted).
+ "Show getting started" clears that person's completed mark, skips and
+ marks-done on that account, so the card shows the live state again.
+6. **Preference handlers** **(codex 6):** Hide, Show, Skip and Mark done are
+ POSTs under `/a/{sqid}/getting-started/...`, following `handleAppStar`
+ (applist.go): session required, account membership checked, the person
+ taken from the session (never the form), CSRF double-submit of the
+ session token, Skip and Mark done accepted for steps 3 and 4 only.
+ All state is in the console database, cleaned up with the account's
+ existing soft-delete cleanup (ownership.go) and per-person on member
+ removal.
+
+## Left to the builder
+
+Table/column shape for Hide and Skip, the exact "running version" predicate
+(reuse whatever the apps list uses), where "Show getting started" sits, and
+test structure. Facts that are expensive to compute (e.g. custom domains) may
+reuse data the page already loads or a cached account view; if a fact can't
+be had cheaply, say so in review rather than adding S3 reads.
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps-R2.md
new file mode 100644
index 000000000..1f1a9d08d
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps-R2.md
@@ -0,0 +1,33 @@
+1. R1 #1 — **Resolved:** manual domain completion removes the faulty detection.
+2. R1 #2 — **Resolved:** no derived settings fact remains.
+3. R1 #3 — **Resolved:** settings writers no longer need to maintain checklist state.
+4. R1 #4 — **Partly resolved:** health claims are narrowed, but the deployment predicate still misclassifies two cases below.
+5. R1 #5 — **Resolved:** completion persists; Show resets completion and manual step state.
+6. R1 #6 — **Resolved:** preference handlers specify POST, session identity, membership, CSRF and allowed steps.
+7. R1 #7 — **Resolved:** secrets instructions no longer promise an existing console editor.
+
+Reviewed `80402dd66c1eee4b2e44e1ffea469a9e2dbcc3a3`, round 2 of 3. **No P1; two P2 cases remain under R1 #4.**
+
+**P2 — A successfully deployed static site never completes step 2.**
+
+The [specified predicate](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md:100) requires `UniformVersion` or `Mixed`. However, [observedDeployment](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/deploymentstatus.go:50) excludes static routes from version observations, even when their registry version is populated. An account containing only a working static site therefore remains incomplete.
+
+Specify a static-route branch using the route’s own channel and its valid, nonempty pointer from the already-loaded `AppView.Channels`. An unrelated channel or environment must not satisfy it. These channel reads already occur in [loadAppFrame](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/appframe.go:107); no additional S3 reads are needed.
+
+Fault family: deployment completion must accurately represent the serving kind.
+
+**P2 — Excluding only “attention” allows an unknown deployment to tick “live.”**
+
+A sole remote instance can report a version while starting or stopping. [remoteRoute](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/remoteinstances.go:444) retains that version and sets `unknown` for the transient state. [summarize](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/server.go:7003) consequently returns `"unknown"`, while `UniformVersion` remains populated. The proposed predicate accepts this, despite the apps list explicitly withholding its “Deployed” verdict.
+
+Require affirmative deployment evidence. For the existing instance-row predicate, require `Verdict == "ok"` alongside the observed version. If evaluating individual routes instead, require at least one qualifying route with known state.
+
+Fault family: deployment completion must not overstate observed state.
+
+No additional S3 read is required by the remaining design: tokens and preferences use SQL, and deployment inputs are already loaded. The stated browser/CLI role distinctions match the handlers.
+
+R1 #4’s fault family has now recurred across two rounds. Under stopping rule 2, the choices are to refuse unsupported states, cut automatic deployment detection, or enforce one deployment predicate with guard tests. I recommend the last, covering both cases above and channel isolation. With no P1, apply the P2 fixes without another review round.
+
+No files changed. No tests or subagents run.
+
+READY AFTER FIXES
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps.md b/docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps.md
new file mode 100644
index 000000000..58cef6a42
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-first-run-next-steps.md
@@ -0,0 +1,43 @@
+Reviewed `fafa6933c4721b858b5082856d752716cd9ae527`, round 1 of 3. **One P1 and six P2 findings.** Console code is unchanged from the checkout’s `origin/main`.
+
+1. **P1 — Step 4 cannot recognise the normal custom-domain attach.**
+ Fault family: domain completion must reflect actual routing.
+ Spec lines 99–102 rely on `AppView.Domains`, but attaching a domain to an already deployed app creates an **alias**, never another route ([domainattach.go:176](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/domainattach.go:176)). That alias never enters this slice, so the step remains incomplete even after the domain works. Conversely, `remoteRoute` adds a `DomainView` for an instance record before any box reports its route ([remoteinstances.go:442](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/remoteinstances.go:442)).
+
+ Specify an account/app-scoped check covering local aliases and accepted remote alias reports, excluding pending rows, sidecars and platform hosts. Reusing `settingsDomains` would add reads: its claims lookup, `status.LoadBoxes`, and certificate-warm LIST/GETs ([appsettings.go:714](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/appsettings.go:714)). Name the data source that avoids those new S3 reads.
+
+2. **P2 — A successful settings request does not establish that settings exist.**
+ Fault family: step 3 must represent current, nonempty configuration.
+ Spec lines 90–98 include `config/sync`, which succeeds with no config and only touches the generation object ([apiconfig.go:800](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/apiconfig.go:800)). PUT also accepts `exec_delivery` alone, or an unset removing the last variable. A permanent account bit additionally survives deletion of the only configured app.
+
+ Define how the stored fact follows successful nonempty bundle contents, across default and named environments, removals, trash/restore and purge. Specify ordering for concurrent writes and delayed database updates so an older result cannot overwrite a newer one or affect a recreated app. Account deletion is a soft delete with explicit cleanup, so table cascades alone would not handle it ([ownership.go:819](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/ownership.go:819)).
+
+3. **P2 — The settings-writer inventory is incomplete.**
+ Fault family: every qualifying config write must update the derived fact.
+ Beyond config PUT, console-controlled writes include environment fork (`apienv.go:341`), relay credentials in default and named environments (`relayops.go:657`, `relayenv.go:74`), scan callback secrets (`scankeysync.go:49`), and mail-event verification keys (`apimail.go:920`). Storage grant/rotation and mail enable/rotation also write actual appconfig variables and secrets through [objstore/walk.go:882](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/objstore/walk.go:882) and [mail/walk.go:956](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/mail/walk.go:956), including named environments.
+
+ These are not merely store-record changes. Cover their successful config writes and corresponding removals, including background repair paths. Update at the config commit boundary: some handlers can fail after their config write has already succeeded.
+
+4. **P2 — Verdict `"ok"` does not prove a running, healthy version.**
+ Fault family: deployment completion must not overstate observed state.
+ Spec lines 103–105 equate these facts, but `summarize` returns `"ok"` for static/service-only routes without checking a version or channel pointer ([server.go:7005](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/server.go:7005)). Its source comment explicitly excludes process liveness ([server.go:2938](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/server.go:2938)).
+
+ Define the completion predicate by serving kind. For channel-backed static routes, check the relevant channel from the already-loaded view; an unrelated environment’s valid channel must not validate a route whose channel is missing. Either narrow the health claim to available evidence or identify an existing observation that supports it without new reads.
+
+5. **P2 — Automatic completion needs persistent dismissal state.**
+ Fault family: completion must not cause repeated onboarding.
+ Lines 46 and 72 require permanent hiding after completion, but only Hide and Skip have specified persistence. Recomputing visibility from live facts makes the card return when a token expires, an app is removed or a domain disappears. Persist completion per person/account, and define how Show clears it. Otherwise Show also immediately hides an already-complete card again.
+
+6. **P2 — Specify the preference-handler security contract.**
+ Fault family: only the authenticated person may change their account preferences.
+ Lines 82–83 specify storage scope but omit POST-only mutations, session validation, account membership and CSRF checks for Hide, Skip **and Show**. Require these explicitly, derive the person from the session, and accept skips only for steps 3 and 4. The existing [star handler](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/applist.go:175) provides the appropriate pattern.
+
+7. **P2 — “Set here” promises an editor that does not exist.**
+ Fault family: the offered action must complete the stated task.
+ Spec lines 39–41 send users to settings to add secrets before slice 2. The existing Environments section lists names and CLI instructions; it has no env/secret editor ([app_settings.html:267](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps/internal/console/templates/app_settings.html:267)). Until slice 2, describe this as instructions and provide the agent/CLI action directly.
+
+Step 1 is feasible without S3 reads: `CLITokens` uses SQL, excludes revoked tokens, and leaves kind/expiry filtering to the caller as specified. Role handling is also feasible: members can create apps and read settings; browser domain attachment is owner-only. Preserve those actual distinctions rather than applying one owner-only check to every action.
+
+No files changed. No tests or subagents run.
+
+NOT READY
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps-R2.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps-R2.md
new file mode 100644
index 000000000..fbdb7fb36
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps-R2.md
@@ -0,0 +1,42 @@
+# Review brief: spec "First-run next steps", round 2 of 3
+
+Repo carlos/platform, branch `design-first-run-next-steps`, commit: the
+commit that adds this file. Under review:
+`docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md`.
+Authorities: main's code (internal/console: apps.html, server.go apps render
+and summarize, authstore.go CLITokens, appsettings.go, apiconfig handlers,
+view.go AppView.Domains, the role checks on create-app/settings/domains).
+
+You are an independent reviewer. Read the spec, then the code it names, and
+check every claim against that code.
+
+Fixed, do not re-argue: Paul chose the checklist layout and the four steps
+(2026-11-08); the "Calls made after the builder check" are the author's and
+open to challenge on correctness, not taste.
+
+Check:
+1. Can each step's done-fact really be computed without new S3 reads per
+ page view, as specified? Name any read the spec misses.
+2. Wrong-tick risks (anti-goal): any case where a step shows done but isn't,
+ including expired tokens, retired versions, platform hosts counted as
+ custom domains, multi-environment apps.
+3. The "has saved settings" bit: every console write path that can save
+ env vars or secrets for an app, so none is missed; races; what happens on
+ account or app deletion.
+4. Role handling: viewers without permission must not get links that 403;
+ Hide/Skip handlers need CSRF and must be per person per account.
+5. Anything else that would make it not work or slow the apps page.
+
+Severity: P1 unsafe/would not work (blocks approval); P2 wrong or missing
+(fixed without another round); P3 polish (follow-up). End with exactly one
+verdict: READY, READY AFTER FIXES, or NOT READY. Do not edit files. No
+subagents. No full test suites.
+
+## Round 2
+
+Round 1: `CODEX-FINDINGS-first-run-next-steps.md` (P1 domain detection;
+P2 settings fact, writer inventory, verdict ok, completion persistence,
+handler contract, "set here"). The author cut detection of steps 3 and 4
+(person-ticked now) instead of building derived facts. First give one line
+per round-1 finding: resolved, partly, or not; then new findings. Item 3 of
+"Check" (the settings bit) no longer applies.
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps.md
new file mode 100644
index 000000000..6698f9a1e
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-first-run-next-steps.md
@@ -0,0 +1,33 @@
+# Review brief: spec "First-run next steps", round 1 of 3
+
+Repo carlos/platform, branch `design-first-run-next-steps`, commit: the
+commit that adds this file. Under review:
+`docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md`.
+Authorities: main's code (internal/console: apps.html, server.go apps render
+and summarize, authstore.go CLITokens, appsettings.go, apiconfig handlers,
+view.go AppView.Domains, the role checks on create-app/settings/domains).
+
+You are an independent reviewer. Read the spec, then the code it names, and
+check every claim against that code.
+
+Fixed, do not re-argue: Paul chose the checklist layout and the four steps
+(2026-11-08); the "Calls made after the builder check" are the author's and
+open to challenge on correctness, not taste.
+
+Check:
+1. Can each step's done-fact really be computed without new S3 reads per
+ page view, as specified? Name any read the spec misses.
+2. Wrong-tick risks (anti-goal): any case where a step shows done but isn't,
+ including expired tokens, retired versions, platform hosts counted as
+ custom domains, multi-environment apps.
+3. The "has saved settings" bit: every console write path that can save
+ env vars or secrets for an app, so none is missed; races; what happens on
+ account or app deletion.
+4. Role handling: viewers without permission must not get links that 403;
+ Hide/Skip handlers need CSRF and must be per person per account.
+5. Anything else that would make it not work or slow the apps page.
+
+Severity: P1 unsafe/would not work (blocks approval); P2 wrong or missing
+(fixed without another round); P3 polish (follow-up). End with exactly one
+verdict: READY, READY AFTER FIXES, or NOT READY. Do not edit files. No
+subagents. No full test suites.
diff --git a/docs/superpowers/specs/CONTROLLER-BRIEF-first-run-next-steps.md b/docs/superpowers/specs/CONTROLLER-BRIEF-first-run-next-steps.md
new file mode 100644
index 000000000..a55652404
--- /dev/null
+++ b/docs/superpowers/specs/CONTROLLER-BRIEF-first-run-next-steps.md
@@ -0,0 +1,66 @@
+# Controller brief: build slice 1, first-run next steps
+
+You are the controller for building slice 1 of "agent-first onboarding and
+console parity" in carlos/platform. Coordinator: session 55f1f6a
+(platform-44), which Paul talks to. Paul APPROVED the spec on 2026-11-08 and
+said go ahead with plan and build; under his ruling for this programme,
+"plan, build, reviews, Luna copy, merge and console release go ahead without
+asking". Escalate only the things below.
+
+Worktree: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-first-run-next-steps
+(branch design-first-run-next-steps; git identity already set; build here).
+Spec (binding): docs/superpowers/specs/2026-11-08-first-run-next-steps-design.md
+(rev 2.1; Astra spec rounds 1-2 done, round 2 READY AFTER FIXES applied).
+Read AGENTS.md first: stopping rules, census, local tests vs CI.
+
+## Do, in order
+
+1. Write the plan with superpowers:writing-plans to
+ docs/superpowers/plans/2026-11-08-first-run-next-steps.md. Keep it short
+ (the spec is small). Commit and push.
+2. Build it with superpowers:subagent-driven-development (implementers
+ Sonnet, Opus for anything touching auth/CSRF handlers or the deployment
+ predicate; per-task reviews sized to risk; whole-branch review by Astra:
+ `codex exec -m gpt-6-astra -c model_reasoning_effort="high" -s read-only
+ -c 'sandbox_permissions=["disk-full-read-access"]' -o <file> "<prompt>"
+ </dev/null`, brief from docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md,
+ max 3 rounds, stop at the first round with no P1, apply P2s without
+ another round).
+3. Mockup fidelity: any UI uses only existing console components (see the
+ spec; Paul rejected prototype-looking mockups). Check the page renders at
+ 390 px and desktop (chromium headless against a test-dumped page is fine).
+4. Copy: all strings through a Luna pass under Paul's delegation (memory
+ pattern: brief opens "You are the copy-review gate itself for this set...
+ do NOT run the copy-review skill or start any server"; `codex exec -m
+ gpt-5.6-luna -s workspace-write ... </dev/null`), house rules no em or en
+ dashes, brand via {console}, no customer or tenant names. Apply verbatim.
+5. Census: `make census-card`; if it moves, census-propose and get the
+ cross-family (Astra) verdict, record it on amadan discussion #280.
+6. CI green on the branch tip (if a flake bites, fix it on its own branch or
+ file it; don't retry blindly), merge main in if it moved (re-seal the
+ census overlay last), then `amadan branch merge carlos/platform
+ design-first-run-next-steps -squash -expect <full sha> -message ...`
+ (subject under 80 chars).
+7. Release: message the agent manager (`paseo send 8a3d302a-eac7-407c-b61c-f5ccc66b5544 "..."`)
+ for a console-only version, then run it with a release agent exactly like
+ v0.34.27 (~/.cache/release-v0.34.27/BRIEF.md is the template; follow the
+ manager's per-version brief; dev console first; flagship console under a
+ #421 lock; apt only if the manager says so). No boxes, no floors.
+8. Report: write ~/.cache/first-run-next-steps/REPORT.md (what shipped,
+ SHAs, review rounds, rulings you made with their cost if wrong) and
+ `paseo send 55f1f6a "<one paragraph + report path>"`.
+
+## Escalate to 55f1f6a (paseo send) and wait, instead of deciding
+
+- A spec gap that changes what a person sees beyond the spec's calls.
+- Stopping rule 2 (same fault family two rounds running).
+- Anything touching flagship beyond the console release, spend, or other
+ sessions' branches.
+
+## Environment
+
+Go commands need the Bash sandbox disabled (default GOCACHE, read-only in the
+sandbox); run only touched packages' tests with -run locally; CI runs the
+full suite. Never git stash; scratch in $TMPDIR, cleaned up. Never bind
+servers to 0.0.0.0. Never `pkill -f` a pattern matching your own command.
+Don't spawn Anthropic-model reviewers from Codex runs.
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go
index b848a2e97..a2761aae0 100644
--- a/internal/console/claim_invariant_fixtures_test.go
+++ b/internal/console/claim_invariant_fixtures_test.go
@@ -1057,6 +1057,10 @@ var claimFixtures = map[string]claimFixture{
"route POST /a/{sqid}/apps/{app}/star": claimNonApp("the viewer's own bookmark in app_stars, keyed by account, person and app lifetime; reads the app row, writes nothing of the app's"),
"route POST /a/{sqid}/delete": claimNonApp("deletes an account only when it holds no app: AppCount is re-checked before the step-up and DeleteAccount refuses otherwise"),
"route POST /a/{sqid}/errors/level": claimNonApp("the account-level error log level (telemetry account record)"),
+ "route POST /a/{sqid}/getting-started/done": claimNonApp("the viewer's own Getting started mark in getting_started_marks, keyed by account and person; touches no app"),
+ "route POST /a/{sqid}/getting-started/hide": claimNonApp("the viewer's own Getting started mark in getting_started_marks, keyed by account and person; touches no app"),
+ "route POST /a/{sqid}/getting-started/show": claimNonApp("clears the viewer's own Getting started marks in getting_started_marks; touches no app"),
+ "route POST /a/{sqid}/getting-started/skip": claimNonApp("the viewer's own Getting started mark in getting_started_marks, keyed by account and person; touches no app"),
"route POST /a/{sqid}/fleets/{fleet}/detach": claimNonApp("detaches a fleet box in the registry; places no app"),
"route POST /a/{sqid}/fleets/{fleet}/place": {door: &claimDoor{
apps: claimRefs("bab/titogo"),
diff --git a/internal/console/claim_invariant_probes_nonapp_test.go b/internal/console/claim_invariant_probes_nonapp_test.go
index 2614ce716..09d9e3fe5 100644
--- a/internal/console/claim_invariant_probes_nonapp_test.go
+++ b/internal/console/claim_invariant_probes_nonapp_test.go
@@ -668,6 +668,10 @@ var claimNonAppProbes = map[string]claimProbe{
return ""
},
},
+ "route POST /a/{sqid}/getting-started/hide": claimGettingStartedProbe("hide", nil, gsHidden, true),
+ "route POST /a/{sqid}/getting-started/skip": claimGettingStartedProbe("skip", []string{"step", "secrets"}, gsSecretsSkip, true),
+ "route POST /a/{sqid}/getting-started/done": claimGettingStartedProbe("done", []string{"step", "domain"}, gsDomainDone, true),
+ "route POST /a/{sqid}/getting-started/show": claimGettingStartedProbe("show", nil, gsHidden, false),
"route POST /a/{sqid}/errors/level": {
do: claimFormReply("/a/bab/errors/level", "level", "warn"),
status: http.StatusSeeOther, loc: "/a/bab/settings",
@@ -1514,3 +1518,32 @@ func claimBillingProblemWorld(t *testing.T, cx *claimCase) {
t.Fatal(err)
}
}
+
+// claimGettingStartedProbe drives one Getting started preference POST as the
+// owner. want says whether mark must be present afterwards; Show (want
+// false) is staged with mark already set, so its effect is the deletion.
+func claimGettingStartedProbe(action string, kv []string, mark gsMark, want bool) claimProbe {
+ form := append([]string{}, kv...)
+ return claimProbe{
+ setup: func(t *testing.T, cx *claimCase) {
+ if want {
+ return
+ }
+ if err := cx.st.SetGettingStartedMark(OpsAccountID, claimFxOwner, mark, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ },
+ do: claimFormReply("/a/bab/getting-started/"+action, form...),
+ status: http.StatusSeeOther, loc: "/a/bab/",
+ effect: func(t *testing.T, cx *claimCase, r claimReply) string {
+ marks, err := cx.st.GettingStartedMarks(OpsAccountID, claimFxOwner)
+ if err != nil {
+ return err.Error()
+ }
+ if marks[mark] != want {
+ return fmt.Sprintf("getting started %s: the owner's %s mark is %v, want %v", action, mark, marks[mark], want)
+ }
+ return ""
+ },
+ }
+}
diff --git a/internal/console/demo_members.go b/internal/console/demo_members.go
index 1b3748cc2..98624b10e 100644
--- a/internal/console/demo_members.go
+++ b/internal/console/demo_members.go
@@ -110,6 +110,9 @@ func removeDemoHoldingMemberWrite(accountID int64, address string, cfg demo.Conf
if _, err := tx.Exec(`DELETE FROM app_stars WHERE account_id = ? AND address = ?`, accountID, address); err != nil {
return err
}
+ if _, err := tx.Exec(`DELETE FROM getting_started_marks WHERE account_id = ? AND address = ?`, accountID, address); err != nil {
+ return err
+ }
_, err = tx.Exec(`DELETE FROM memberships WHERE account_id = ? AND address = ?`, accountID, address)
return err
}
diff --git a/internal/console/gettingstarted.go b/internal/console/gettingstarted.go
new file mode 100644
index 000000000..54eb20306
--- /dev/null
+++ b/internal/console/gettingstarted.go
@@ -0,0 +1,204 @@
+package console
+
+import (
+ "log"
+ "reflect"
+ "strings"
+ "time"
+)
+
+// personConnected: the person has a live CLI token of their own. Person
+// tokens always carry an expiry, so a zero expiry never ticks.
+func personConnected(tokens []CLIToken, now time.Time) bool {
+ for _, t := range tokens {
+ if t.Kind == "" && t.RevokedAt.IsZero() && t.ExpiresAt.After(now) {
+ return true
+ }
+ }
+ return false
+}
+
+// appIsLive is the one definition of "this app is live" for the checklist:
+// healthy, and either serving a version from instances or a static site
+// that a box serves, whose own channel points at a version.
+func appIsLive(row appRow, v AppView, acct string) bool {
+ if row.Verdict != "ok" {
+ return false
+ }
+ if row.Deployment.UniformVersion() != "" || row.Deployment.Mixed() {
+ return true
+ }
+ for _, rt := range v.Routes {
+ if rt.Account != acct || rt.Platform || rt.Kind != "static" {
+ continue
+ }
+ // Observed, not intended: "ready" is the one status a box serves
+ // (a local row's registry status, or remoteRoute's word for a host
+ // an accepted report names). "pending" is a record no box serves
+ // yet; creating, starting and issuing are being set up (healthWord
+ // calls them Setting up); failed and the hold statuses
+ // (registry.HoldStatuses) are not served; "" on a remote row is a
+ // host no report vouches for.
+ if rt.Status != "ready" {
+ continue
+ }
+ // An empty channel never resolves (view.go defaults it to stable
+ // before it gets here); it does not tick. Any other name the
+ // pipeline accepts is a channel, the legacy ladder or not.
+ if rt.Channel == "" {
+ continue
+ }
+ for _, ch := range v.Channels {
+ if ch.Name == rt.Channel && ch.Err == "" && ch.Version != "" {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+type gsStepState string
+
+const (
+ gsStateDone gsStepState = "done"
+ gsStateSkipped gsStepState = "skipped"
+ gsStateOpen gsStepState = "open"
+ gsStateMuted gsStepState = "muted"
+)
+
+type gsStep struct {
+ Key string // connect | deploy | secrets | domain
+ State gsStepState
+ Title string
+ Body string
+ // Prompt is the text to paste to an agent; CLI is the command to run.
+ Prompt string
+ CLI string
+}
+
+type gettingStartedView struct {
+ Steps []gsStep
+ CanCreate bool
+ IsOwner bool
+ DomainApp string
+ Copy gettingStartedCopy
+}
+
+// buildGettingStarted returns the card, or nil when the person hid it or it
+// already completed. complete is true when every step is done or skipped.
+func buildGettingStarted(marks map[gsMark]bool, connected, anyLive bool, role string, domainApp string, consoleName string) (view *gettingStartedView, complete bool) {
+ if marks[gsHidden] || marks[gsCompleted] {
+ return nil, false
+ }
+ c := gettingStartedCopyFor(approvedGettingStartedCopy, consoleName)
+ mark := func(done, skip gsMark) gsStepState {
+ switch {
+ case marks[done]:
+ return gsStateDone
+ case marks[skip]:
+ return gsStateSkipped
+ }
+ return gsStateOpen
+ }
+ fact := func(ok bool) gsStepState {
+ if ok {
+ return gsStateDone
+ }
+ return gsStateOpen
+ }
+ steps := []gsStep{
+ {Key: "connect", State: fact(connected), Title: c.ConnectTitle, Body: c.ConnectBody, Prompt: c.ConnectPrompt, CLI: c.ConnectCLI},
+ {Key: "deploy", State: fact(anyLive), Title: c.DeployTitle, Body: c.DeployBody, Prompt: c.DeployPrompt},
+ {Key: "secrets", State: mark(gsSecretsDone, gsSecretsSkip), Title: c.SecretsTitle, Body: c.SecretsBody, Prompt: c.SecretsPrompt},
+ {Key: "domain", State: mark(gsDomainDone, gsDomainSkip), Title: c.DomainTitle, Body: c.DomainBody, CLI: c.DomainCLI},
+ }
+ foundOpen := false
+ for i := range steps {
+ if steps[i].State != gsStateOpen {
+ continue
+ }
+ if foundOpen {
+ steps[i].State = gsStateMuted
+ }
+ foundOpen = true
+ }
+ if !foundOpen {
+ return nil, true
+ }
+ return &gettingStartedView{
+ Steps: steps,
+ CanCreate: role == RoleOwner || role == RoleMember,
+ IsOwner: role == RoleOwner,
+ DomainApp: domainApp,
+ Copy: c,
+ }, false
+}
+
+// fillGettingStarted puts the Getting started card on the account home.
+// live is the apps appIsLive calls live, over every app in the account,
+// not the filtered lists. Only console-database reads: no bucket call. A
+// failed read never fails the page: unread tokens leave step 1 open,
+// unread marks show no card and no Show link.
+func (s *Server) fillGettingStarted(p *page, acct *Account, addr, role string, live map[string]bool) {
+ now := time.Now()
+ connected := false
+ if tokens, err := s.store.CLITokens(addr); err != nil {
+ log.Printf("console: getting started tokens %s: %v", acct.Sqid, err)
+ } else {
+ connected = personConnected(tokens, now)
+ }
+ marks, err := s.store.GettingStartedMarks(acct.ID, addr)
+ if err != nil {
+ log.Printf("console: getting started marks %s: %v", acct.Sqid, err)
+ return
+ }
+ // The Show link outside the card reads the same filled-in copy.
+ p.GettingStartedCopy = gettingStartedCopyFor(approvedGettingStartedCopy, s.consoleName())
+ anyLive := len(live) > 0
+ view, complete := buildGettingStarted(marks, connected, anyLive, role, gsDomainApp(p.Apps, live), s.consoleName())
+ if complete {
+ if s.gsBeforeCompleteHook != nil {
+ s.gsBeforeCompleteHook()
+ }
+ // Conditional on the manual steps' marks still being there: a Show
+ // pressed since the read above wins (CompleteGettingStarted). Either
+ // way this response offers Show; the next one reads the live state.
+ if _, err := s.store.CompleteGettingStarted(acct.ID, addr, now); err != nil {
+ log.Printf("console: getting started completed %s: %v", acct.Sqid, err)
+ }
+ p.ShowGettingStarted = true
+ return
+ }
+ p.GettingStarted = view
+ p.ShowGettingStarted = view == nil
+}
+
+// gsDomainApp is the app the domain link names: the first live app in the
+// page's order (starred, regular, temporary), else the first app, else "".
+func gsDomainApp(apps []appRow, live map[string]bool) string {
+ starred, regular, temporary := partitionApps(apps)
+ first := ""
+ for _, rows := range [][]appRow{starred, regular, temporary} {
+ for _, r := range rows {
+ if live[r.App] {
+ return r.App
+ }
+ if first == "" {
+ first = r.App
+ }
+ }
+ }
+ return first
+}
+
+// gettingStartedCopyFor is c with {console} replaced by consoleName in
+// every string field, so no field can render the placeholder.
+func gettingStartedCopyFor(c gettingStartedCopy, consoleName string) gettingStartedCopy {
+ rv := reflect.ValueOf(&c).Elem()
+ for i := 0; i < rv.NumField(); i++ {
+ if f := rv.Field(i); f.Kind() == reflect.String {
+ f.SetString(strings.ReplaceAll(f.String(), "{console}", consoleName))
+ }
+ }
+ return c
+}
diff --git a/internal/console/gettingstarted_handlers.go b/internal/console/gettingstarted_handlers.go
new file mode 100644
index 000000000..5932cc4ed
--- /dev/null
+++ b/internal/console/gettingstarted_handlers.go
@@ -0,0 +1,90 @@
+package console
+
+import (
+ "crypto/subtle"
+ "log"
+ "net/http"
+ "time"
+)
+
+// The Getting started preference handlers are POST
+// /a/{sqid}/getting-started/{hide,show,skip,done}: any member, CSRF, the
+// person always the session's address (never a form field), so a member
+// can only change their own checklist. The marks are personal preferences
+// that grant nothing, so a demo account takes them like any other.
+
+// gsMarkFor is the mark Skip or Mark done records for step; only the
+// secrets and domain steps take one.
+var gsMarkFor = map[string]map[string]gsMark{
+ "skip": {"secrets": gsSecretsSkip, "domain": gsDomainSkip},
+ "done": {"secrets": gsSecretsDone, "domain": gsDomainDone},
+}
+
+// gettingStartedRequest gates a preference POST: session, membership and
+// CSRF. It answers the refusal itself when ok is false.
+func (s *Server) gettingStartedRequest(w http.ResponseWriter, r *http.Request) (addr string, acct *Account, ok bool) {
+ addr, raw, acct, _, ok := s.account(w, r)
+ if !ok {
+ return "", nil, false
+ }
+ if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf")), []byte(raw)) != 1 {
+ s.renderMessage(w, r, http.StatusForbidden, "Refused", "Cross-site request blocked.")
+ return "", nil, false
+ }
+ return addr, acct, true
+}
+
+// gettingStartedSaved finishes a preference POST: back to the account home,
+// or the save-failed message.
+func (s *Server) gettingStartedSaved(w http.ResponseWriter, r *http.Request, acct *Account, what string, err error) {
+ if err != nil {
+ log.Printf("console: getting started %s %s: %v", what, acct.Sqid, err)
+ s.renderMessage(w, r, http.StatusInternalServerError, "Error", approvedGettingStartedCopy.SaveFailed)
+ return
+ }
+ http.Redirect(w, r, accountHomeURL(acct.Sqid, ""), http.StatusSeeOther)
+}
+
+// handleGettingStartedHide is POST /a/{sqid}/getting-started/hide.
+func (s *Server) handleGettingStartedHide(w http.ResponseWriter, r *http.Request) {
+ addr, acct, ok := s.gettingStartedRequest(w, r)
+ if !ok {
+ return
+ }
+ s.gettingStartedSaved(w, r, acct, "hide", s.store.SetGettingStartedMark(acct.ID, addr, gsHidden, time.Now()))
+}
+
+// handleGettingStartedShow is POST /a/{sqid}/getting-started/show: it
+// clears every mark the person has in the account.
+func (s *Server) handleGettingStartedShow(w http.ResponseWriter, r *http.Request) {
+ addr, acct, ok := s.gettingStartedRequest(w, r)
+ if !ok {
+ return
+ }
+ s.gettingStartedSaved(w, r, acct, "show", s.store.ResetGettingStarted(acct.ID, addr))
+}
+
+// handleGettingStartedSkip is POST /a/{sqid}/getting-started/skip.
+func (s *Server) handleGettingStartedSkip(w http.ResponseWriter, r *http.Request) {
+ s.gettingStartedStep(w, r, "skip")
+}
+
+// handleGettingStartedDone is POST /a/{sqid}/getting-started/done.
+func (s *Server) handleGettingStartedDone(w http.ResponseWriter, r *http.Request) {
+ s.gettingStartedStep(w, r, "done")
+}
+
+// gettingStartedStep records Skip or Mark done for step=secrets|domain;
+// any other step is refused with nothing written.
+func (s *Server) gettingStartedStep(w http.ResponseWriter, r *http.Request, action string) {
+ addr, acct, ok := s.gettingStartedRequest(w, r)
+ if !ok {
+ return
+ }
+ m, ok := gsMarkFor[action][r.FormValue("step")]
+ if !ok {
+ s.renderMessage(w, r, http.StatusBadRequest, "Refused", "That request could not be read.")
+ return
+ }
+ s.gettingStartedSaved(w, r, acct, action, s.store.SetGettingStartedMark(acct.ID, addr, m, time.Now()))
+}
diff --git a/internal/console/gettingstarted_handlers_test.go b/internal/console/gettingstarted_handlers_test.go
new file mode 100644
index 000000000..1ce07addf
--- /dev/null
+++ b/internal/console/gettingstarted_handlers_test.go
@@ -0,0 +1,151 @@
+package console
+
+import (
+ "net/http"
+ "net/url"
+ "testing"
+ "time"
+)
+
+func gsMarksOf(t *testing.T, fx *consoleFixture, address string) map[gsMark]bool {
+ t.Helper()
+ got, err := fx.st.GettingStartedMarks(OpsAccountID, address)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return got
+}
+
+func gsPost(t *testing.T, fx *consoleFixture, c *http.Client, action string, form url.Values) (int, string) {
+ t.Helper()
+ status, loc, _ := postForm(t, c, fx.u("/getting-started/"+action), form)
+ return status, loc
+}
+
+func TestGettingStartedHideShow(t *testing.T) {
+ fx := newConsoleFixture(t)
+ paul, csrf := signInAs(t, fx, "paul@keymail.dev", "code-gs-hide")
+
+ if status, loc := gsPost(t, fx, paul, "hide", url.Values{"csrf": {csrf}}); status != http.StatusSeeOther || loc != fx.path("/") {
+ t.Fatalf("hide = %d %q, want 303 to %q", status, loc, fx.path("/"))
+ }
+ if got := gsMarksOf(t, fx, "paul@keymail.dev"); !got[gsHidden] || len(got) != 1 {
+ t.Fatalf("marks after hide = %v, want hidden", got)
+ }
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, "paul@keymail.dev", gsSecretsSkip, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if status, loc := gsPost(t, fx, paul, "show", url.Values{"csrf": {csrf}}); status != http.StatusSeeOther || loc != fx.path("/") {
+ t.Fatalf("show = %d %q, want 303 to %q", status, loc, fx.path("/"))
+ }
+ if got := gsMarksOf(t, fx, "paul@keymail.dev"); len(got) != 0 {
+ t.Fatalf("marks after show = %v, want none", got)
+ }
+}
+
+func TestGettingStartedSkipDone(t *testing.T) {
+ fx := newConsoleFixture(t)
+ paul, csrf := signInAs(t, fx, "paul@keymail.dev", "code-gs-skip")
+
+ if status, loc := gsPost(t, fx, paul, "skip", url.Values{"csrf": {csrf}, "step": {"secrets"}}); status != http.StatusSeeOther || loc != fx.path("/") {
+ t.Fatalf("skip secrets = %d %q", status, loc)
+ }
+ if status, loc := gsPost(t, fx, paul, "done", url.Values{"csrf": {csrf}, "step": {"domain"}}); status != http.StatusSeeOther || loc != fx.path("/") {
+ t.Fatalf("done domain = %d %q", status, loc)
+ }
+ got := gsMarksOf(t, fx, "paul@keymail.dev")
+ if !got[gsSecretsSkip] || !got[gsDomainDone] || len(got) != 2 {
+ t.Fatalf("marks = %v, want secrets:skip and domain:done", got)
+ }
+ // Done after skip replaces it.
+ if status, _ := gsPost(t, fx, paul, "done", url.Values{"csrf": {csrf}, "step": {"secrets"}}); status != http.StatusSeeOther {
+ t.Fatalf("done secrets = %d", status)
+ }
+ got = gsMarksOf(t, fx, "paul@keymail.dev")
+ if !got[gsSecretsDone] || got[gsSecretsSkip] || !got[gsDomainDone] || len(got) != 2 {
+ t.Fatalf("marks = %v, want secrets:done and domain:done", got)
+ }
+}
+
+func TestGettingStartedRefusesBadStep(t *testing.T) {
+ fx := newConsoleFixture(t)
+ paul, csrf := signInAs(t, fx, "paul@keymail.dev", "code-gs-step")
+ for _, action := range []string{"skip", "done"} {
+ for _, step := range []string{"connect", "deploy", "", "x"} {
+ if status, _ := gsPost(t, fx, paul, action, url.Values{"csrf": {csrf}, "step": {step}}); status != http.StatusBadRequest {
+ t.Errorf("%s step=%q = %d, want 400", action, step, status)
+ }
+ }
+ }
+ if got := gsMarksOf(t, fx, "paul@keymail.dev"); len(got) != 0 {
+ t.Fatalf("refused steps wrote marks: %v", got)
+ }
+}
+
+func TestGettingStartedRefusesCSRF(t *testing.T) {
+ fx := newConsoleFixture(t)
+ paul, _ := signInAs(t, fx, "paul@keymail.dev", "code-gs-csrf")
+ for _, action := range []string{"hide", "show", "skip", "done"} {
+ for name, form := range map[string]url.Values{
+ "missing": {"step": {"secrets"}},
+ "wrong": {"csrf": {"wrong"}, "step": {"secrets"}},
+ } {
+ if status, _ := gsPost(t, fx, paul, action, form); status != http.StatusForbidden {
+ t.Errorf("%s with %s csrf = %d, want 403", action, name, status)
+ }
+ }
+ }
+ if got := gsMarksOf(t, fx, "paul@keymail.dev"); len(got) != 0 {
+ t.Fatalf("refused requests wrote marks: %v", got)
+ }
+}
+
+func TestGettingStartedRefusesStranger(t *testing.T) {
+ fx := newConsoleFixture(t)
+ _, paulCSRF := signInAs(t, fx, "paul@keymail.dev", "code-gs-paul")
+ eve, eveCSRF := signInAs(t, fx, "eve@keymail.dev", "code-gs-eve")
+ anon := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
+ for _, action := range []string{"hide", "show", "skip", "done"} {
+ form := url.Values{"csrf": {eveCSRF}, "step": {"secrets"}}
+ if status, _ := gsPost(t, fx, eve, action, form); status != http.StatusNotFound {
+ t.Errorf("non-member %s = %d, want 404", action, status)
+ }
+ form = url.Values{"csrf": {paulCSRF}, "step": {"secrets"}}
+ if status, loc := gsPost(t, fx, anon, action, form); status != http.StatusFound || loc != "/" {
+ t.Errorf("signed-out %s = %d %q, want 302 to /", action, status, loc)
+ }
+ }
+ for _, addr := range []string{"eve@keymail.dev", "paul@keymail.dev"} {
+ if got := gsMarksOf(t, fx, addr); len(got) != 0 {
+ t.Fatalf("%s has marks %v after refused requests", addr, got)
+ }
+ }
+}
+
+func TestGettingStartedIgnoresFormAddress(t *testing.T) {
+ fx := newConsoleFixture(t)
+ if err := fx.st.AddMember(OpsAccountID, "kim@keymail.dev", RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ paul, csrf := signInAs(t, fx, "paul@keymail.dev", "code-gs-addr")
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, "kim@keymail.dev", gsHidden, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ for _, action := range []string{"skip", "show"} {
+ form := url.Values{"csrf": {csrf}, "step": {"domain"}, "address": {"kim@keymail.dev"}}
+ if status, _ := gsPost(t, fx, paul, action, form); status != http.StatusSeeOther {
+ t.Fatalf("%s = %d", action, status)
+ }
+ if action == "skip" {
+ if got := gsMarksOf(t, fx, "paul@keymail.dev"); !got[gsDomainSkip] || len(got) != 1 {
+ t.Fatalf("paul's marks = %v, want domain:skip", got)
+ }
+ }
+ }
+ if got := gsMarksOf(t, fx, "kim@keymail.dev"); !got[gsHidden] || len(got) != 1 {
+ t.Fatalf("kim's marks = %v, want only her own hidden mark", got)
+ }
+ if got := gsMarksOf(t, fx, "paul@keymail.dev"); len(got) != 0 {
+ t.Fatalf("paul's marks after show = %v, want none", got)
+ }
+}
diff --git a/internal/console/gettingstarted_page_test.go b/internal/console/gettingstarted_page_test.go
new file mode 100644
index 000000000..e01d18032
--- /dev/null
+++ b/internal/console/gettingstarted_page_test.go
@@ -0,0 +1,351 @@
+package console
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "regexp"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// gsRenderedState reads one step's rendered state off the account home, ""
+// when the card or the step is absent.
+func gsRenderedState(body, key string) string {
+ m := regexp.MustCompile(`data-gs-step="` + key + `" data-gs-state="([a-z]+)"`).FindStringSubmatch(body)
+ if m == nil {
+ return ""
+ }
+ return m[1]
+}
+
+func gsCardShown(body string) bool { return strings.Contains(body, `id="getting-started"`) }
+
+// gsStaticSite gives the fixture account a static-only app the real way: a
+// console app row, a registry static route on the app's own stable channel,
+// and a signed stable pointer in the bucket. No instance reports anything,
+// so only the static branch of appIsLive can tick it.
+func gsStaticSite(t *testing.T, fx *consoleFixture, app string) {
+ t.Helper()
+ if _, err := fx.st.CreateAppIn(OpsAccountID, app, "paul@keymail.dev", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ reg, err := registry.Open(fx.regPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer reg.Close()
+ if err := reg.Upsert(registry.Route{Host: app + ".carlosapp.dev", Kind: "static", Status: "ready", App: app, Channel: "stable"}); err != nil {
+ t.Fatal(err)
+ }
+ ctx := context.Background()
+ m := release.Manifest{
+ Schema: 1, App: app, Version: "s1", Kind: "binary", BuiltAt: "2026-11-01T10:00:00Z",
+ Artifacts: map[string]release.Artifact{"linux-amd64": {File: app}},
+ }
+ if err := release.Ship(ctx, fx.rel, release.OpsAccount, m, map[string][]byte{"linux-amd64": []byte("site")}); err != nil {
+ t.Fatal(err)
+ }
+ if err := release.Promote(ctx, fx.rel, fx.priv, release.OpsAccount, app, "stable", "s1"); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func gsHome(t *testing.T, fx *consoleFixture, c *http.Client, q string) string {
+ t.Helper()
+ u := fx.u("/")
+ if q != "" {
+ u += "?q=" + url.QueryEscape(q)
+ }
+ status, _, body := get(t, c, u)
+ if status != http.StatusOK {
+ t.Fatalf("GET %s = %d:\n%s", u, status, body)
+ }
+ return body
+}
+
+// A brand-new account with nobody connected: the card leads with Connect,
+// open, its prompt carrying this console's own name.
+func TestGettingStartedCardFresh(t *testing.T) {
+ fx := newConsoleFixtureWith(t, consoleFixtureOptions{WithKey: true, Tweak: func(c *Config) { c.ConsoleName = "Example Cloud" }})
+ const newID = 4243
+ if err := fx.st.CreateAccount(newID, "cdef", "Fresh", "paul@keymail.dev", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.AddMember(newID, "paul@keymail.dev", RoleOwner, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ paul, _ := signInAs(t, fx, "paul@keymail.dev", "code-gs-fresh")
+ status, _, body := get(t, paul, fx.ts.URL+"/a/cdef/")
+ if status != http.StatusOK {
+ t.Fatalf("GET fresh account = %d", status)
+ }
+ if !gsCardShown(body) {
+ t.Fatalf("no Getting started card on a fresh account:\n%s", body)
+ }
+ for key, want := range map[string]string{"connect": "open", "deploy": "muted", "secrets": "muted", "domain": "muted"} {
+ if got := gsRenderedState(body, key); got != want {
+ t.Errorf("step %s = %q, want %q", key, got, want)
+ }
+ }
+ prompt := `<code id="gs-prompt-connect">Sign in to Example Cloud with the carlos CLI: run carlos auth login --no-wait and give me the link it prints.</code>`
+ if !strings.Contains(body, prompt) {
+ t.Errorf("connect prompt missing or wrong; want %s", prompt)
+ }
+ // The copy button starts hidden (with JavaScript off the prompt is plain
+ // text) and the card's own inline script un-hides it; customer pages
+ // load nothing from /static/.
+ card0 := gsCard(t, body)
+ if !regexp.MustCompile(`data-copy-target="gs-prompt-connect"[^>]* hidden>`).MatchString(card0) {
+ t.Error("the prompt has no copy button, or it does not start hidden")
+ }
+ if !strings.Contains(body, `querySelectorAll("[data-copy-target]")`) || !strings.Contains(body, "copy.hidden = false") {
+ t.Error("the card carries no inline copy script")
+ }
+ if strings.Contains(body, "/static/") {
+ t.Error("the account home loads a /static/ asset")
+ }
+ for _, bad := range []string{"Carloku", "{console}"} {
+ if strings.Contains(body, bad) {
+ t.Errorf("page contains %q", bad)
+ }
+ }
+ // Dashes: the page's own chrome uses em dashes elsewhere, so check the
+ // card alone.
+ card := gsCard(t, body)
+ for _, bad := range []string{"—", "–", "Carloku", "{console}"} {
+ if strings.Contains(card, bad) {
+ t.Errorf("card contains %q:\n%s", bad, card)
+ }
+ }
+ if !strings.Contains(card, `name="csrf" value="`) {
+ t.Error("the Hide form carries no csrf")
+ }
+}
+
+// gsCard is the card's markup alone.
+func gsCard(t *testing.T, body string) string {
+ t.Helper()
+ _, rest, ok := strings.Cut(body, `id="getting-started"`)
+ if !ok {
+ t.Fatal("no card")
+ }
+ card, _, ok := strings.Cut(rest, "</section>")
+ if !ok {
+ t.Fatal("card never closes")
+ }
+ return card
+}
+
+// Liveness is over every app, never the filtered lists: a static-only site
+// ticks step 2 through the real view wiring, and a filter that hides it
+// does not untick it.
+func TestGettingStartedIgnoresFilter(t *testing.T) {
+ fx := newConsoleFixture(t)
+ paul, _ := signInAs(t, fx, "paul@keymail.dev", "code-gs-filter")
+ // The fixture's kass reports v1; a failed instance takes it off live.
+ reg, err := registry.Open(fx.regPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := reg.Upsert(registry.Route{Host: "kass.carlosapp.dev", Kind: "instance", Status: "failed",
+ Version: "v1", App: "kass", Channel: "stable", Addr: "127.0.0.1:9001"}); err != nil {
+ t.Fatal(err)
+ }
+ reg.Close()
+ if got := gsRenderedState(gsHome(t, fx, paul, ""), "deploy"); got != "muted" {
+ t.Fatalf("deploy before any live app = %q, want muted", got)
+ }
+ gsStaticSite(t, fx, "site")
+ for _, q := range []string{"", "zzz"} {
+ body := gsHome(t, fx, paul, q)
+ if got := gsRenderedState(body, "deploy"); got != "done" {
+ t.Fatalf("q=%q: deploy = %q, want done", q, got)
+ }
+ if got := gsRenderedState(body, "connect"); got != "open" {
+ t.Fatalf("q=%q: connect = %q, want open", q, got)
+ }
+ }
+}
+
+func TestGettingStartedHiddenShowsLink(t *testing.T) {
+ fx := newConsoleFixture(t)
+ paul, _ := signInAs(t, fx, "paul@keymail.dev", "code-gs-hidden")
+ show := `action="` + fx.path("/getting-started/show") + `"`
+ body := gsHome(t, fx, paul, "")
+ if !gsCardShown(body) || strings.Contains(body, show) {
+ t.Fatal("before hiding: want the card and no Show form")
+ }
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, "paul@keymail.dev", gsHidden, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ body = gsHome(t, fx, paul, "")
+ if gsCardShown(body) {
+ t.Fatal("hidden card still rendered")
+ }
+ if label := gettingStartedCopyFor(approvedGettingStartedCopy, fx.srv.consoleName()).Show; !strings.Contains(body, show) || !strings.Contains(body, label) {
+ t.Fatalf("no Show getting started form:\n%s", body)
+ }
+}
+
+func TestGettingStartedCompletionSticks(t *testing.T) {
+ fx := newConsoleFixture(t)
+ gsStaticSite(t, fx, "site")
+ cliToken(t, fx, "paul@keymail.dev", "code-gs-done-cli")
+ paul, csrf := signInAs(t, fx, "paul@keymail.dev", "code-gs-done")
+ for _, m := range []gsMark{gsSecretsDone, gsDomainSkip} {
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, "paul@keymail.dev", m, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ }
+ body := gsHome(t, fx, paul, "")
+ if gsCardShown(body) {
+ t.Fatal("a complete checklist still shows")
+ }
+ if !gsMarksOf(t, fx, "paul@keymail.dev")[gsCompleted] {
+ t.Fatal("completion was not stored")
+ }
+ if !strings.Contains(body, fx.path("/getting-started/show")) {
+ t.Error("no Show form after completion")
+ }
+ // The token expires: the stored completion keeps the card away.
+ if _, err := fx.st.db.Exec(`UPDATE cli_tokens SET expires_at = ? WHERE address = ?`, time.Now().Add(-time.Hour).Unix(), "paul@keymail.dev"); err != nil {
+ t.Fatal(err)
+ }
+ if gsCardShown(gsHome(t, fx, paul, "")) {
+ t.Fatal("card came back after a fact changed")
+ }
+ // Show clears it: the live state again, connect open.
+ if status, _ := gsPost(t, fx, paul, "show", url.Values{"csrf": {csrf}}); status != http.StatusSeeOther {
+ t.Fatalf("show = %d", status)
+ }
+ body = gsHome(t, fx, paul, "")
+ if got := gsRenderedState(body, "connect"); got != "open" {
+ t.Fatalf("after show, connect = %q, want open", got)
+ }
+ if got := gsRenderedState(body, "deploy"); got != "done" {
+ t.Fatalf("after show, deploy = %q, want done", got)
+ }
+}
+
+// A Show pressed while an account-home read is in flight wins: the read
+// saw every step satisfied, then the person reset, then the read's
+// completion write lands. It must not store completed over the reset.
+func TestGettingStartedResetBeatsStaleCompletion(t *testing.T) {
+ fx := newConsoleFixture(t)
+ gsStaticSite(t, fx, "site")
+ cliToken(t, fx, "paul@keymail.dev", "code-gs-race-cli")
+ paul, _ := signInAs(t, fx, "paul@keymail.dev", "code-gs-race")
+ for _, m := range []gsMark{gsSecretsDone, gsDomainSkip} {
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, "paul@keymail.dev", m, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ }
+ fx.srv.gsBeforeCompleteHook = func() {
+ if err := fx.st.ResetGettingStarted(OpsAccountID, "paul@keymail.dev"); err != nil {
+ t.Error(err)
+ }
+ }
+ gsHome(t, fx, paul, "")
+ fx.srv.gsBeforeCompleteHook = nil
+ if gsMarksOf(t, fx, "paul@keymail.dev")[gsCompleted] {
+ t.Fatal("a stale read stored completed over the reset")
+ }
+ body := gsHome(t, fx, paul, "")
+ if got := gsRenderedState(body, "secrets"); got != "open" {
+ t.Fatalf("after the reset, secrets = %q, want open (card shown: %v)", got, gsCardShown(body))
+ }
+}
+
+// Browser domain attach is owner-only: with the domain step open, the owner
+// gets the settings link, a member only the CLI route.
+func TestGettingStartedMemberNoDomainLink(t *testing.T) {
+ fx := newConsoleFixture(t)
+ if err := fx.st.AddMember(OpsAccountID, "kim@keymail.dev", RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ gsStaticSite(t, fx, "site")
+ link := fx.path("/apps/kass/settings/domains")
+ for _, who := range []struct {
+ addr string
+ want bool
+ }{{"paul@keymail.dev", true}, {"kim@keymail.dev", false}} {
+ cliToken(t, fx, who.addr, "code-gs-dom-cli-"+who.addr)
+ c, _ := signInAs(t, fx, who.addr, "code-gs-dom-"+who.addr)
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, who.addr, gsSecretsSkip, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ body := gsHome(t, fx, c, "")
+ if got := gsRenderedState(body, "domain"); got != "open" {
+ t.Fatalf("%s: domain = %q, want open", who.addr, got)
+ }
+ card := gsCard(t, body)
+ if got := strings.Contains(card, link); got != who.want {
+ t.Errorf("%s: domain link present = %v, want %v", who.addr, got, who.want)
+ }
+ if !strings.Contains(card, "carlos domains attach --app &lt;app&gt; &lt;hostname&gt;") {
+ t.Errorf("%s: no CLI route on the domain step", who.addr)
+ }
+ if !strings.Contains(card, fx.path("/getting-started/done")) || !strings.Contains(card, fx.path("/getting-started/skip")) {
+ t.Errorf("%s: no Mark done / Skip forms", who.addr)
+ }
+ }
+}
+
+// The owner's domain link names the first live app the page lists, not
+// merely the first app: kass comes first but has failed, so the link goes
+// to the static site that is live.
+func TestGettingStartedDomainLinkFirstLiveApp(t *testing.T) {
+ fx := newConsoleFixture(t)
+ reg, err := registry.Open(fx.regPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := reg.Upsert(registry.Route{Host: "kass.carlosapp.dev", Kind: "instance", Status: "failed",
+ Version: "v1", App: "kass", Channel: "stable", Addr: "127.0.0.1:9001"}); err != nil {
+ t.Fatal(err)
+ }
+ reg.Close()
+ gsStaticSite(t, fx, "site")
+ cliToken(t, fx, "paul@keymail.dev", "code-gs-live-dom-cli")
+ paul, _ := signInAs(t, fx, "paul@keymail.dev", "code-gs-live-dom")
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, "paul@keymail.dev", gsSecretsSkip, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ body := gsHome(t, fx, paul, "")
+ if got := gsRenderedState(body, "domain"); got != "open" {
+ t.Fatalf("domain = %q, want open", got)
+ }
+ card := gsCard(t, body)
+ if !strings.Contains(card, fx.path("/apps/site/settings/domains")) || strings.Contains(card, fx.path("/apps/kass/settings/domains")) {
+ t.Fatalf("domain link does not name the first live app:\n%s", card)
+ }
+}
+
+// The card reads only the console database: rendering it costs no S3
+// request beyond what the page already makes.
+func TestGettingStartedNoS3(t *testing.T) {
+ lat := &perfLatency{}
+ fx := newConsoleFixtureWith(t, consoleFixtureOptions{WithKey: true, S3: lat})
+ paul, _ := signInAs(t, fx, "paul@keymail.dev", "code-gs-s3")
+ count := func() int64 {
+ t.Helper()
+ before, _ := lat.Calls()
+ gsHome(t, fx, paul, "")
+ after, _ := lat.Calls()
+ return after - before
+ }
+ count() // warm whatever the page caches
+ withCard := count()
+ if err := fx.st.SetGettingStartedMark(OpsAccountID, "paul@keymail.dev", gsHidden, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ without := count()
+ if withCard != without {
+ t.Fatalf("S3 requests with the card = %d, without = %d", withCard, without)
+ }
+}
diff --git a/internal/console/gettingstarted_store.go b/internal/console/gettingstarted_store.go
new file mode 100644
index 000000000..f7278bfa7
--- /dev/null
+++ b/internal/console/gettingstarted_store.go
@@ -0,0 +1,116 @@
+package console
+
+import (
+ "errors"
+ "time"
+)
+
+// gsMark is one person's note on the Getting started checklist in one
+// account.
+type gsMark string
+
+const (
+ gsHidden gsMark = "hidden"
+ gsCompleted gsMark = "completed"
+ gsSecretsDone gsMark = "secrets:done"
+ gsSecretsSkip gsMark = "secrets:skip"
+ gsDomainDone gsMark = "domain:done"
+ gsDomainSkip gsMark = "domain:skip"
+)
+
+// gsOpposite is the mark that done/skip replaces.
+var gsOpposite = map[gsMark]gsMark{
+ gsSecretsDone: gsSecretsSkip,
+ gsSecretsSkip: gsSecretsDone,
+ gsDomainDone: gsDomainSkip,
+ gsDomainSkip: gsDomainDone,
+}
+
+func (s *Store) migrateGettingStarted() error {
+ _, err := s.db.Exec(`CREATE TABLE IF NOT EXISTS getting_started_marks (
+ account_id INTEGER NOT NULL,
+ address TEXT NOT NULL,
+ mark TEXT NOT NULL,
+ marked_at INTEGER NOT NULL,
+ PRIMARY KEY (account_id, address, mark)
+);`)
+ return err
+}
+
+// GettingStartedMarks is the set of marks address has set in the account.
+func (s *Store) GettingStartedMarks(accountID int64, address string) (map[gsMark]bool, error) {
+ rows, err := s.db.Query(`SELECT mark FROM getting_started_marks WHERE account_id = ? AND address = ?`, accountID, address)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ out := map[gsMark]bool{}
+ for rows.Next() {
+ var m string
+ if err := rows.Scan(&m); err != nil {
+ return nil, err
+ }
+ out[gsMark(m)] = true
+ }
+ return out, rows.Err()
+}
+
+// errGettingStartedCompleted: completed is never set unconditionally; see
+// CompleteGettingStarted.
+var errGettingStartedCompleted = errors.New("getting started: completed is written by CompleteGettingStarted")
+
+// SetGettingStartedMark records m; repeating it is a no-op. Setting a done
+// mark clears its skip mark, and the other way round, in one transaction.
+// It refuses gsCompleted.
+func (s *Store) SetGettingStartedMark(accountID int64, address string, m gsMark, now time.Time) error {
+ if m == gsCompleted {
+ return errGettingStartedCompleted
+ }
+ tx, err := s.db.Begin()
+ if err != nil {
+ return err
+ }
+ defer tx.Rollback()
+ if opp, ok := gsOpposite[m]; ok {
+ if _, err := tx.Exec(`DELETE FROM getting_started_marks WHERE account_id = ? AND address = ? AND mark = ?`, accountID, address, string(opp)); err != nil {
+ return err
+ }
+ }
+ if _, err := tx.Exec(`INSERT INTO getting_started_marks (account_id, address, mark, marked_at) VALUES (?, ?, ?, ?)
+ON CONFLICT (account_id, address, mark) DO NOTHING`, accountID, address, string(m), now.Unix()); err != nil {
+ return err
+ }
+ return tx.Commit()
+}
+
+// CompleteGettingStarted records completed for address in the account, but
+// only while both manual steps are still satisfied in the database (secrets
+// done or skipped, and domain done or skipped), checked in the same
+// statement as the write. A page read that saw every step satisfied cannot
+// then undo a Show pressed since: the reset deleted those marks, so the
+// write finds nothing to stand on. ok reports whether completed is stored
+// (already present counts).
+func (s *Store) CompleteGettingStarted(accountID int64, address string, now time.Time) (ok bool, err error) {
+ if _, err := s.db.Exec(`INSERT INTO getting_started_marks (account_id, address, mark, marked_at)
+SELECT ?, ?, ?, ?
+WHERE EXISTS (SELECT 1 FROM getting_started_marks WHERE account_id = ? AND address = ? AND mark IN (?, ?))
+ AND EXISTS (SELECT 1 FROM getting_started_marks WHERE account_id = ? AND address = ? AND mark IN (?, ?))
+ON CONFLICT (account_id, address, mark) DO NOTHING`,
+ accountID, address, string(gsCompleted), now.Unix(),
+ accountID, address, string(gsSecretsDone), string(gsSecretsSkip),
+ accountID, address, string(gsDomainDone), string(gsDomainSkip)); err != nil {
+ return false, err
+ }
+ var n int
+ if err := s.db.QueryRow(`SELECT COUNT(*) FROM getting_started_marks WHERE account_id = ? AND address = ? AND mark = ?`,
+ accountID, address, string(gsCompleted)).Scan(&n); err != nil {
+ return false, err
+ }
+ return n > 0, nil
+}
+
+// ResetGettingStarted deletes every mark address has in the account (Show).
+func (s *Store) ResetGettingStarted(accountID int64, address string) error {
+ _, err := s.db.Exec(`DELETE FROM getting_started_marks WHERE account_id = ? AND address = ?`, accountID, address)
+ return err
+}
diff --git a/internal/console/gettingstarted_store_test.go b/internal/console/gettingstarted_store_test.go
new file mode 100644
index 000000000..1403fcf7e
--- /dev/null
+++ b/internal/console/gettingstarted_store_test.go
@@ -0,0 +1,168 @@
+package console
+
+import (
+ "reflect"
+ "testing"
+ "time"
+)
+
+func TestGettingStartedMarksRoundTrip(t *testing.T) {
+ st := openTestStore(t)
+ now := time.Now()
+ if err := st.SetGettingStartedMark(1, "a@example.com", gsHidden, now); err != nil {
+ t.Fatal(err)
+ }
+ if err := st.SetGettingStartedMark(1, "a@example.com", gsHidden, now); err != nil {
+ t.Fatal(err)
+ }
+ got, err := st.GettingStartedMarks(1, "a@example.com")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if want := map[gsMark]bool{gsHidden: true}; !reflect.DeepEqual(got, want) {
+ t.Fatalf("got %v want %v", got, want)
+ }
+}
+
+func TestGettingStartedDoneReplacesSkip(t *testing.T) {
+ st := openTestStore(t)
+ now := time.Now()
+ for _, c := range [][2]gsMark{{gsSecretsSkip, gsSecretsDone}, {gsSecretsDone, gsSecretsSkip}, {gsDomainSkip, gsDomainDone}, {gsDomainDone, gsDomainSkip}} {
+ addr := "p-" + string(c[0]) + "@example.com"
+ for _, m := range c {
+ if err := st.SetGettingStartedMark(1, addr, m, now); err != nil {
+ t.Fatal(err)
+ }
+ }
+ got, err := st.GettingStartedMarks(1, addr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if want := map[gsMark]bool{c[1]: true}; !reflect.DeepEqual(got, want) {
+ t.Fatalf("%v: got %v want %v", c, got, want)
+ }
+ }
+}
+
+func TestGettingStartedReset(t *testing.T) {
+ st := openTestStore(t)
+ now := time.Now()
+ for _, m := range []gsMark{gsHidden, gsSecretsDone, gsDomainSkip} {
+ if err := st.SetGettingStartedMark(1, "a@example.com", m, now); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if ok, err := st.CompleteGettingStarted(1, "a@example.com", now); err != nil || !ok {
+ t.Fatalf("complete: %v %v", ok, err)
+ }
+ if err := st.SetGettingStartedMark(1, "b@example.com", gsHidden, now); err != nil {
+ t.Fatal(err)
+ }
+ if err := st.ResetGettingStarted(1, "a@example.com"); err != nil {
+ t.Fatal(err)
+ }
+ got, err := st.GettingStartedMarks(1, "a@example.com")
+ if err != nil || len(got) != 0 {
+ t.Fatalf("after reset: %v %v", got, err)
+ }
+ if other, _ := st.GettingStartedMarks(1, "b@example.com"); !other[gsHidden] {
+ t.Fatal("reset touched another person")
+ }
+}
+
+func TestGettingStartedMarksPerAccount(t *testing.T) {
+ st := openTestStore(t)
+ if err := st.SetGettingStartedMark(1, "a@example.com", gsHidden, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if got, _ := st.GettingStartedMarks(2, "a@example.com"); len(got) != 0 {
+ t.Fatalf("leaked to account 2: %v", got)
+ }
+ if got, _ := st.GettingStartedMarks(1, "b@example.com"); len(got) != 0 {
+ t.Fatalf("leaked to another address: %v", got)
+ }
+}
+
+func TestGettingStartedCleanup(t *testing.T) {
+ now := time.Now()
+ st := openTestStore(t)
+ id := tempStoreAccount(t, st)
+ if err := st.AddMember(id, "member@example.com", RoleMember, now); err != nil {
+ t.Fatal(err)
+ }
+ if err := st.SetGettingStartedMark(id, "member@example.com", gsHidden, now); err != nil {
+ t.Fatal(err)
+ }
+ if err := st.RemoveMember(id, "member@example.com"); err != nil {
+ t.Fatal(err)
+ }
+ if got, err := st.GettingStartedMarks(id, "member@example.com"); err != nil || len(got) != 0 {
+ t.Fatalf("after RemoveMember: %v %v", got, err)
+ }
+ for _, reap := range []bool{false, true} {
+ st := openTestStore(t)
+ id := tempStoreAccount(t, st)
+ if err := st.SetGettingStartedMark(id, "member@example.com", gsHidden, now); err != nil {
+ t.Fatal(err)
+ }
+ var err error
+ if reap {
+ err = st.ReapAccount(id, now)
+ } else {
+ err = st.DeleteAccount(id, now)
+ }
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got, err := st.GettingStartedMarks(id, "member@example.com"); err != nil || len(got) != 0 {
+ t.Fatalf("reap=%v: %v %v", reap, got, err)
+ }
+ }
+}
+
+// Completed is written only while both manual steps are still satisfied in
+// the database, in the same statement, and SetGettingStartedMark refuses it.
+func TestGettingStartedCompleteConditional(t *testing.T) {
+ st := openTestStore(t)
+ now := time.Now()
+ const addr = "a@example.com"
+ complete := func(want bool) {
+ t.Helper()
+ ok, err := st.CompleteGettingStarted(1, addr, now)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got, _ := st.GettingStartedMarks(1, addr)
+ if ok != want || got[gsCompleted] != want {
+ t.Fatalf("complete = %v, stored %v, want %v (marks %v)", ok, got[gsCompleted], want, got)
+ }
+ }
+ complete(false) // nothing marked
+ if err := st.SetGettingStartedMark(1, addr, gsSecretsDone, now); err != nil {
+ t.Fatal(err)
+ }
+ complete(false) // domain unmarked
+ // Another person's or account's domain mark does not count.
+ if err := st.SetGettingStartedMark(2, addr, gsDomainSkip, now); err != nil {
+ t.Fatal(err)
+ }
+ if err := st.SetGettingStartedMark(1, "b@example.com", gsDomainSkip, now); err != nil {
+ t.Fatal(err)
+ }
+ complete(false)
+ if err := st.SetGettingStartedMark(1, addr, gsDomainSkip, now); err != nil {
+ t.Fatal(err)
+ }
+ complete(true)
+ complete(true) // repeating it is a no-op
+ if err := st.ResetGettingStarted(1, addr); err != nil {
+ t.Fatal(err)
+ }
+ complete(false)
+ if err := st.SetGettingStartedMark(1, addr, gsCompleted, now); err == nil {
+ t.Fatal("SetGettingStartedMark wrote completed unconditionally")
+ }
+ if got, _ := st.GettingStartedMarks(1, addr); got[gsCompleted] {
+ t.Fatal("refused completed was stored")
+ }
+}
diff --git a/internal/console/gettingstarted_test.go b/internal/console/gettingstarted_test.go
new file mode 100644
index 000000000..cf5b220d9
--- /dev/null
+++ b/internal/console/gettingstarted_test.go
@@ -0,0 +1,229 @@
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/provision"
+)
+
+func TestPersonConnected(t *testing.T) {
+ now := time.Date(2026, 11, 8, 12, 0, 0, 0, time.UTC)
+ live := now.Add(time.Hour)
+ cases := []struct {
+ name string
+ toks []CLIToken
+ want bool
+ }{
+ {"none", nil, false},
+ {"person live", []CLIToken{{ExpiresAt: live}}, true},
+ {"person expired", []CLIToken{{ExpiresAt: now.Add(-time.Second)}}, false},
+ {"person revoked", []CLIToken{{ExpiresAt: live, RevokedAt: now.Add(-time.Minute)}}, false},
+ {"person zero expiry", []CLIToken{{}}, false},
+ {"app live", []CLIToken{{Kind: "app", ExpiresAt: live}}, false},
+ {"service live", []CLIToken{{Kind: "service", ExpiresAt: live}}, false},
+ }
+ for _, c := range cases {
+ if got := personConnected(c.toks, now); got != c.want {
+ t.Errorf("%s: got %v want %v", c.name, got, c.want)
+ }
+ }
+}
+
+func TestAppIsLive(t *testing.T) {
+ uniform := DeploymentStatus{RouteCount: 1, ReportedCount: 1, Versions: []DeploymentVersion{{"v1", 1}}}
+ mixed := DeploymentStatus{RouteCount: 2, ReportedCount: 2, Versions: []DeploymentVersion{{"v1", 1}, {"v2", 1}}}
+ unknown := DeploymentStatus{RouteCount: 1, UnknownCount: 1}
+ static := func(acct, ch string) RouteView {
+ return RouteView{Host: "s.example.com", Kind: "static", Status: "ready", Channel: ch, Account: acct}
+ }
+ staticIn := func(status string) RouteView {
+ rv := static("a", "stable")
+ rv.Status = status
+ return rv
+ }
+ stableV1 := []ChannelView{{Name: "stable", Version: "v1"}}
+ cases := []struct {
+ name string
+ row appRow
+ v AppView
+ want bool
+ }{
+ {"uniform ok", appRow{Verdict: "ok", Deployment: uniform}, AppView{}, true},
+ {"mixed ok", appRow{Verdict: "ok", Deployment: mixed}, AppView{}, true},
+ {"static stable v1", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{static("a", "stable")}, Channels: []ChannelView{{Name: "stable", Version: "v1"}}}, true},
+ {"unknown verdict with version", appRow{Verdict: "unknown", Deployment: uniform}, AppView{}, false},
+ {"unknown instance", appRow{Verdict: "ok", Deployment: unknown}, AppView{}, false},
+ {"static own channel empty, other has version", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{static("a", "stable")},
+ Channels: []ChannelView{{Name: "stable"}, {Name: "beta", Version: "v1"}}}, false},
+ {"static channel err", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{static("a", "stable")}, Channels: []ChannelView{{Name: "stable", Version: "v1", Err: "boom"}}}, false},
+ {"attention with version", appRow{Verdict: "attention", Deployment: uniform}, AppView{}, false},
+ {"other account route", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{static("b", "stable")}, Channels: []ChannelView{{Name: "stable", Version: "v1"}}}, false},
+ {"platform route", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{{Kind: "static", Channel: "stable", Account: "a", Platform: true}},
+ Channels: []ChannelView{{Name: "stable", Version: "v1"}}}, false},
+ {"empty route channel", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{static("a", "")}, Channels: []ChannelView{{Name: "", Version: "v1"}}}, false},
+ // Deployment intent is not observed deployment: a static route no
+ // box serves yet (remoteRoute's "pending"), one still being set up,
+ // failed, held by a move, or with no status at all never ticks,
+ // whatever its channel points at.
+ {"static pending", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("pending")}, Channels: stableV1}, false},
+ {"static creating", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("creating")}, Channels: stableV1}, false},
+ {"static starting", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("starting")}, Channels: stableV1}, false},
+ {"static issuing", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("issuing")}, Channels: stableV1}, false},
+ {"static failed", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("failed")}, Channels: stableV1}, false},
+ {"static moving", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("moving")}, Channels: stableV1}, false},
+ {"static no status", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("")}, Channels: stableV1}, false},
+ // A custom channel name the pipeline accepts is a channel like any
+ // other.
+ {"static custom channel", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{static("a", "production")}, Channels: []ChannelView{{Name: "production", Version: "v1"}}}, true},
+ {"static custom channel, other has version", appRow{Verdict: "ok"}, AppView{
+ Routes: []RouteView{static("a", "production")},
+ Channels: []ChannelView{{Name: "production"}, {Name: "stable", Version: "v1"}}}, false},
+ }
+ for _, c := range cases {
+ if got := appIsLive(c.row, c.v, "a"); got != c.want {
+ t.Errorf("%s: got %v want %v", c.name, got, c.want)
+ }
+ }
+}
+
+// The pending static row the real wiring builds: a record whose route no
+// box serves yet, read from a complete set of box reports, under an app
+// whose own channel has a valid pointer. summarize calls it Deployed; the
+// checklist must not call it live.
+func TestAppIsLivePendingRemoteStatic(t *testing.T) {
+ f := foldFleetReports(nil, true, time.Now())
+ rv, dv := remoteRoute(provision.Record{Host: "s.example.com", App: "shop", Account: "a", Kind: "static"}, nil, factsOf(f, "a", "shop"), "a", DNSTargets{})
+ if rv.Status != "pending" {
+ t.Fatalf("fixture: remote static status = %q, want pending", rv.Status)
+ }
+ view := AppView{App: "shop", Routes: []RouteView{rv}, Domains: []DomainView{dv},
+ Channels: []ChannelView{{Name: "stable", Version: "v1"}}}
+ row := summarize(view, "a")
+ if row.Verdict != "ok" {
+ t.Fatalf("fixture: verdict = %q, want ok", row.Verdict)
+ }
+ if appIsLive(row, view, "a") {
+ t.Fatal("a static record no box serves yet counted as live")
+ }
+}
+
+func gsStates(v *gettingStartedView) string {
+ var out []string
+ for _, s := range v.Steps {
+ out = append(out, string(s.State))
+ }
+ return strings.Join(out, ",")
+}
+
+func TestBuildGettingStarted(t *testing.T) {
+ none := map[gsMark]bool{}
+ v, done := buildGettingStarted(none, false, false, RoleOwner, "shop", "Carloku")
+ if done || v == nil || gsStates(v) != "open,muted,muted,muted" {
+ t.Fatalf("fresh: %v %v", v, done)
+ }
+ v, _ = buildGettingStarted(none, true, false, RoleOwner, "shop", "Carloku")
+ if gsStates(v) != "done,open,muted,muted" {
+ t.Errorf("connected: %s", gsStates(v))
+ }
+ v, _ = buildGettingStarted(map[gsMark]bool{gsSecretsSkip: true}, true, true, RoleOwner, "shop", "Carloku")
+ if gsStates(v) != "done,done,skipped,open" {
+ t.Errorf("secrets skip: %s", gsStates(v))
+ }
+ all := map[gsMark]bool{gsSecretsDone: true, gsDomainSkip: true}
+ if v, done := buildGettingStarted(all, true, true, RoleOwner, "shop", "Carloku"); v != nil || !done {
+ t.Errorf("all four: %v %v", v, done)
+ }
+ for _, m := range []gsMark{gsHidden, gsCompleted} {
+ if v, done := buildGettingStarted(map[gsMark]bool{m: true}, false, false, RoleOwner, "", "Carloku"); v != nil || done {
+ t.Errorf("%s: %v %v", m, v, done)
+ }
+ }
+ v, _ = buildGettingStarted(none, false, false, RoleMember, "shop", "Carloku")
+ if !v.CanCreate || v.IsOwner {
+ t.Errorf("member: %+v", v)
+ }
+ v, _ = buildGettingStarted(none, false, false, RoleOwner, "", "Carloku")
+ if v.DomainApp != "" || !v.CanCreate || !v.IsOwner {
+ t.Errorf("no apps: %+v", v)
+ }
+ v, _ = buildGettingStarted(none, false, false, RoleOwner, "shop", "Carloku")
+ if v.DomainApp != "shop" {
+ t.Errorf("domain app %q", v.DomainApp)
+ }
+ all2 := strings.Join(gsCopyFields(t, v.Copy), "\n")
+ for _, s := range v.Steps {
+ all2 += s.Title + s.Body + s.Prompt + s.CLI
+ }
+ if strings.Contains(all2, "{console}") || strings.ContainsAny(all2, "—–") {
+ t.Errorf("bad copy: %q", all2)
+ }
+ if !strings.Contains(v.Copy.ConnectPrompt, "Carloku") || v.Copy.ConnectCLI != "carlos auth login --no-wait" {
+ t.Errorf("copy: %+v", v.Copy)
+ }
+}
+
+func TestGettingStartedDomainAppOrder(t *testing.T) {
+ apps := []appRow{{App: "b"}, {App: "a", Starred: true}, {App: "c"}, {App: "t", ExpiresAt: time.Now()}}
+ for _, c := range []struct {
+ live map[string]bool
+ want string
+ }{
+ {nil, "a"},
+ {map[string]bool{"c": true}, "c"},
+ {map[string]bool{"c": true, "b": true}, "b"},
+ {map[string]bool{"t": true}, "t"},
+ {map[string]bool{"a": true, "b": true}, "a"},
+ } {
+ if got := gsDomainApp(apps, c.live); got != c.want {
+ t.Errorf("live %v: got %q want %q", c.live, got, c.want)
+ }
+ }
+ if got := gsDomainApp(nil, nil); got != "" {
+ t.Errorf("no apps: %q", got)
+ }
+}
+
+// gsCopyFields is every string field of c, failing on a field of any other
+// kind so a new field cannot slip past the scans.
+func gsCopyFields(t *testing.T, c gettingStartedCopy) []string {
+ t.Helper()
+ rv := reflect.ValueOf(c)
+ var out []string
+ for i := 0; i < rv.NumField(); i++ {
+ f := rv.Field(i)
+ if f.Kind() != reflect.String {
+ t.Fatalf("copy field %s is a %s, not a string", rv.Type().Field(i).Name, f.Kind())
+ }
+ out = append(out, f.String())
+ }
+ return out
+}
+
+// {console} is filled in on every field, not only the prompts.
+func TestGettingStartedCopyFillsEveryField(t *testing.T) {
+ var all gettingStartedCopy
+ rv := reflect.ValueOf(&all).Elem()
+ for i := 0; i < rv.NumField(); i++ {
+ rv.Field(i).SetString("on {console} and {console}")
+ }
+ for i, got := range gsCopyFields(t, gettingStartedCopyFor(all, "Example Cloud")) {
+ if got != "on Example Cloud and Example Cloud" {
+ t.Errorf("field %s = %q", rv.Type().Field(i).Name, got)
+ }
+ }
+ for _, f := range gsCopyFields(t, gettingStartedCopyFor(approvedGettingStartedCopy, "Example Cloud")) {
+ if strings.Contains(f, "{console}") || strings.ContainsAny(f, "—–") {
+ t.Errorf("approved copy field %q", f)
+ }
+ }
+}
diff --git a/internal/console/gettingstartedcopy.go b/internal/console/gettingstartedcopy.go
new file mode 100644
index 000000000..3d8e88343
--- /dev/null
+++ b/internal/console/gettingstartedcopy.go
@@ -0,0 +1,48 @@
+package console
+
+// gettingStartedCopy is every string on the Getting started card. Every
+// field has {console} filled in by gettingStartedCopyFor; keep them all
+// strings.
+type gettingStartedCopy struct {
+ Title, Hide, Show, Done, Skipped, MarkDone, Skip, Copy, Copied string
+
+ ConnectTitle, ConnectBody, ConnectPrompt, ConnectCLI string
+ DeployTitle, DeployBody, DeployPrompt, DeployCreate string
+ SecretsTitle, SecretsBody, SecretsPrompt string
+ DomainTitle, DomainBody, DomainCLI, DomainLink string
+
+ SaveFailed string
+}
+
+var approvedGettingStartedCopy = gettingStartedCopy{
+ Title: "Getting started",
+ Hide: "Hide",
+ Show: "Show getting started",
+ Done: "Done",
+ Skipped: "Skipped",
+ MarkDone: "Mark done",
+ Skip: "Skip",
+ Copy: "Copy",
+ Copied: "Copied",
+
+ ConnectTitle: "Connect your agent or terminal",
+ ConnectBody: "Ask your agent to sign in. It runs one command and gives you a link to approve.",
+ ConnectPrompt: "Sign in to {console} with the carlos CLI: run carlos auth login --no-wait and give me the link it prints.",
+ ConnectCLI: "carlos auth login --no-wait",
+
+ DeployTitle: "Put your first app live",
+ DeployBody: "Ask your agent to deploy your app.",
+ DeployPrompt: "Deploy this app to {console}. Use the carlos CLI; my account is ready.",
+ DeployCreate: "Create an app here instead",
+
+ SecretsTitle: "Add your app's secrets",
+ SecretsBody: "If your app needs API keys or passwords, give them to your agent, or set them yourself with carlos secrets set.",
+ SecretsPrompt: "Set the secrets my app needs on {console}",
+
+ DomainTitle: "Use your own domain",
+ DomainBody: "Point a domain you own at your app. Your agent can attach it with the carlos CLI.",
+ DomainCLI: "carlos domains attach --app <app> <hostname>",
+ DomainLink: "Attach a domain in settings",
+
+ SaveFailed: "Could not save that. Please try again.",
+}
diff --git a/internal/console/ownership.go b/internal/console/ownership.go
index 56d464b19..01f442259 100644
--- a/internal/console/ownership.go
+++ b/internal/console/ownership.go
@@ -834,6 +834,7 @@ func (s *Store) DeleteAccount(accountID int64, now time.Time) error {
}
for _, stmt := range []string{
`DELETE FROM app_stars WHERE account_id = ?`,
+ `DELETE FROM getting_started_marks WHERE account_id = ?`,
`DELETE FROM memberships WHERE account_id = ?`,
`DELETE FROM invites WHERE account_id = ?`,
} {
diff --git a/internal/console/server.go b/internal/console/server.go
index 42670a55c..8f97287b9 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -1545,6 +1545,9 @@ type Server struct {
// the follower check and the final record comparison, holding the app
// lock. Tests only.
retireBeforeDeleteHook func()
+ // gsBeforeCompleteHook, when set, runs on the account home between the
+ // Getting started marks read and the completion write. Tests only.
+ gsBeforeCompleteHook func()
// startedAt overrides when this console started (zero: the process
// start, processStart; tests set it), and deletions is when it last
// began deleting an instance or sidecar record of each app (acct + "/"
@@ -2128,6 +2131,12 @@ func NewServer(cfg Config, st *Store) (*Server, error) {
// (owners) (applist.go).
s.registerRoute("POST /a/{sqid}/apps/{app}/star", s.handleAppStar)
s.registerRoute("POST /a/{sqid}/apps/{app}/extend", s.handleAppExtend)
+ // The Getting started card's preferences (any member, the viewer's own)
+ // (gettingstarted_handlers.go).
+ s.registerRoute("POST /a/{sqid}/getting-started/hide", s.handleGettingStartedHide)
+ s.registerRoute("POST /a/{sqid}/getting-started/show", s.handleGettingStartedShow)
+ s.registerRoute("POST /a/{sqid}/getting-started/skip", s.handleGettingStartedSkip)
+ s.registerRoute("POST /a/{sqid}/getting-started/done", s.handleGettingStartedDone)
s.registerRoute("POST /a/{sqid}/apps/{app}/delete", s.handleAppDelete)
s.registerRoute("POST /a/{sqid}/apps/{app}/move", s.handleAppMoveAccount)
// The control-plane flag's two directions, both browser-only and both
@@ -2642,6 +2651,15 @@ type page struct {
Trashed []TrashedAppView
TrashN int
+ // The account home's Getting started card (gettingstarted.go), nil when
+ // it does not show; ShowGettingStarted offers the link that brings back
+ // a card the viewer hid or completed.
+ GettingStarted *gettingStartedView
+ ShowGettingStarted bool
+ // GettingStartedCopy is the card's strings, {console} filled in, for
+ // the Show link the page offers when there is no card to carry them.
+ GettingStartedCopy gettingStartedCopy
+
// ExpiresAt is when a temporary app moves to the Trash; zero for a
// permanent one. appnav shows it with the Keep button.
ExpiresAt time.Time
@@ -4261,6 +4279,8 @@ func (s *Server) handleAccountHome(w http.ResponseWriter, r *http.Request) {
s.renderMessage(w, r, http.StatusInternalServerError, "Error", "Could not read your apps. Please try again.")
return
}
+ // live is the apps appIsLive calls live, over every app.
+ live := map[string]bool{}
if len(apps) > 0 {
views, err := s.assembleAppsNamed(r.Context(), acct.Sqid, acct.Name, apps)
if err != nil {
@@ -4274,6 +4294,10 @@ func (s *Server) handleAccountHome(w http.ResponseWriter, r *http.Request) {
row.Region = s.regionFactsFor(acct, v.App, v.routeFleet, true)
row.Elsewhere = elsewhereCounts(v.Routes, acct.Sqid, row.Region)
p.Apps = append(p.Apps, row)
+ // Over every app, before the q filter narrows the lists.
+ if appIsLive(row, v, acct.Sqid) {
+ live[v.App] = true
+ }
}
// The viewer's stars, the expiries and the q filter (applist.go).
if err := s.fillAppLists(&p, acct, addr, r.URL.Query().Get("q")); err != nil {
@@ -4289,6 +4313,7 @@ func (s *Server) handleAccountHome(w http.ResponseWriter, r *http.Request) {
} else {
p.TrashN = len(trashed)
}
+ s.fillGettingStarted(&p, acct, addr, role, live)
s.render(w, http.StatusOK, "apps", p)
}
diff --git a/internal/console/store.go b/internal/console/store.go
index 7803e63d6..1cf9e4a83 100644
--- a/internal/console/store.go
+++ b/internal/console/store.go
@@ -704,6 +704,10 @@ func (s *Store) migrate() error {
if err := s.migrateAppStars(); err != nil {
return err
}
+ // The Getting started checklist's personal marks (gettingstarted_store.go).
+ if err := s.migrateGettingStarted(); err != nil {
+ return err
+ }
// Plans 6b's seat count on the plan row (planmembers.go).
if err := s.migratePlanSeats(); err != nil {
return err
@@ -1559,6 +1563,9 @@ func removeMemberTx(tx *sql.Tx, accountID int64, address string) error {
if _, err := tx.Exec(`DELETE FROM app_stars WHERE account_id = ? AND address = ?`, accountID, address); err != nil {
return err
}
+ if _, err := tx.Exec(`DELETE FROM getting_started_marks WHERE account_id = ? AND address = ?`, accountID, address); err != nil {
+ return err
+ }
_, err := tx.Exec(`DELETE FROM memberships WHERE account_id = ? AND address = ?`,
accountID, address)
return err
@@ -1809,6 +1816,7 @@ func (s *Store) ReapAccount(accountID int64, now time.Time) error {
defer tx.Rollback()
for _, stmt := range []string{
`DELETE FROM app_stars WHERE account_id = ?`,
+ `DELETE FROM getting_started_marks WHERE account_id = ?`,
`DELETE FROM memberships WHERE account_id = ?`,
`DELETE FROM invites WHERE account_id = ?`,
`DELETE FROM apps WHERE account_id = ?`,
diff --git a/internal/console/store_gate.go b/internal/console/store_gate.go
index f815fb9d4..da130566a 100644
--- a/internal/console/store_gate.go
+++ b/internal/console/store_gate.go
@@ -205,13 +205,14 @@ var claimSQLTables = map[string]claimSQLTable{
// Jobs carry demo identity and durable spool metadata; source outbox rows
// carry only a job ID. Neither is safe to write with an ordinary app permit.
// The opaque IDs below are refusal-only scopes, never matched to a permit.
- "demo_jobs": {App: "demo_id", Refuse: "anonymous demo jobs require claims mode off"},
- "demo_job_outbox": {App: "job_id", Refuse: "anonymous demo source outbox requires claims mode off"},
- "demo_apps": {Account: "account_id", App: "app", Refuse: "anonymous demos require claims mode off"},
- "demo_admissions": {NonApp: "anonymous attempt budget, keyed by salted IP hash and time; names no app"},
- "demo_spent_tokens": {NonApp: "spent credential hashes, refusal reasons and retention times only; names no app and grants no authority"},
- "demo_settings": {NonApp: "deployment salt for anonymous admission; names no app"},
- "app_stars": {NonApp: "personal bookmarks keyed by account, address and app lifetime; grants no app authority"},
+ "demo_jobs": {App: "demo_id", Refuse: "anonymous demo jobs require claims mode off"},
+ "demo_job_outbox": {App: "job_id", Refuse: "anonymous demo source outbox requires claims mode off"},
+ "demo_apps": {Account: "account_id", App: "app", Refuse: "anonymous demos require claims mode off"},
+ "demo_admissions": {NonApp: "anonymous attempt budget, keyed by salted IP hash and time; names no app"},
+ "demo_spent_tokens": {NonApp: "spent credential hashes, refusal reasons and retention times only; names no app and grants no authority"},
+ "demo_settings": {NonApp: "deployment salt for anonymous admission; names no app"},
+ "getting_started_marks": {NonApp: "personal onboarding checklist marks keyed by account and address; grants no app authority"},
+ "app_stars": {NonApp: "personal bookmarks keyed by account, address and app lifetime; grants no app authority"},
// ---- app-scoped: gated ----
"apps": {Account: "account_id", App: "app", AppID: "app_id", Terminal: claimAppsTerminal},
// Legacy per-app grants carry no account column, so a permit for app
diff --git a/internal/console/templates/apps.html b/internal/console/templates/apps.html
index b5afd9792..771bdca81 100644
--- a/internal/console/templates/apps.html
+++ b/internal/console/templates/apps.html
@@ -7,6 +7,7 @@
{{if .Apps}}
<h1>Apps</h1>
</div>
+{{template "getting_started" .}}
<form class="app-filter" method="get" action="{{.Base}}/">
<label for="app-filter">{{.AppListCopy.Filter}}</label>
<input id="app-filter" name="q" type="search" value="{{.AppFilter}}" placeholder="{{.AppListCopy.FilterPlaceholder}}" autocomplete="off" aria-controls="app-lists">
@@ -67,10 +68,12 @@
{{else}}
<h1>Welcome to {{.ConsoleName}}</h1>
</div>
+{{template "getting_started" .}}
<p>The account <strong>{{.Account.Name}}</strong> is ready. No apps live here yet — claim a name below and it's yours.</p>
{{end}}
{{if .TrashN}}<p class="small"><a href="{{.Nav}}/trash">Trash ({{.TrashN}})</a>: deleted apps you can still
restore, each until the date shown there.</p>{{end}}
+{{template "getting_started_show" .}}
<p><a class="btn" href="{{.Nav}}/apps/new">Create app</a></p>
<style>
diff --git a/internal/console/templates/getting_started.html b/internal/console/templates/getting_started.html
new file mode 100644
index 000000000..4b3088306
--- /dev/null
+++ b/internal/console/templates/getting_started.html
@@ -0,0 +1,69 @@
+{{define "getting_started"}}{{with .GettingStarted}}{{$c := .Copy}}
+<section class="confirm-card gs-card" id="getting-started" aria-labelledby="gs-title">
+<div class="sectionhead"><h2 id="gs-title">{{$c.Title}}</h2>
+<form method="post" action="{{$.Base}}/getting-started/hide"><input type="hidden" name="csrf" value="{{$.CSRF}}"><button class="linkish" type="submit">{{$c.Hide}}</button></form></div>
+<ol class="gs-steps">
+{{range .Steps}}<li class="gs-step" data-gs-step="{{.Key}}" data-gs-state="{{.State}}"{{if eq .State "open"}} aria-current="step"{{end}}>
+{{if eq .State "done"}}<span class="chip chip-health-ok">{{$c.Done}}</span> <span class="gs-title">{{.Title}}</span>
+{{else if eq .State "skipped"}}<span class="chip chip-env">{{$c.Skipped}}</span> <span class="gs-title">{{.Title}}</span>
+{{else if eq .State "muted"}}<span class="gs-title small">{{.Title}}</span>
+{{else}}<strong class="gs-title">{{.Title}}</strong>
+<p>{{.Body}}</p>
+{{if .Prompt}}<div class="gs-paste"><code id="gs-prompt-{{.Key}}">{{.Prompt}}</code><button class="btn-sm btn-secondary" type="button" data-copy-target="gs-prompt-{{.Key}}" data-copy="{{$c.Copy}}" data-copied="{{$c.Copied}}" aria-live="polite" hidden>{{$c.Copy}}</button></div>{{end}}
+{{if .CLI}}<div class="gs-paste"><code id="gs-cli-{{.Key}}">{{.CLI}}</code><button class="btn-sm btn-secondary" type="button" data-copy-target="gs-cli-{{.Key}}" data-copy="{{$c.Copy}}" data-copied="{{$c.Copied}}" aria-live="polite" hidden>{{$c.Copy}}</button></div>{{end}}
+{{if or (and (eq .Key "deploy") $.GettingStarted.CanCreate) (eq .Key "secrets") (eq .Key "domain")}}<div class="gs-actions">
+{{if and (eq .Key "deploy") $.GettingStarted.CanCreate}}<a class="btn btn-sm btn-secondary" href="{{$.Nav}}/apps/new">{{$c.DeployCreate}}</a>{{end}}
+{{if and (eq .Key "domain") $.GettingStarted.IsOwner $.GettingStarted.DomainApp}}<a class="btn btn-sm btn-secondary" href="{{$.Base}}/apps/{{$.GettingStarted.DomainApp}}/settings/domains">{{$c.DomainLink}}</a>{{end}}
+{{if or (eq .Key "secrets") (eq .Key "domain")}}<form method="post" action="{{$.Base}}/getting-started/done"><input type="hidden" name="csrf" value="{{$.CSRF}}"><input type="hidden" name="step" value="{{.Key}}"><button class="btn-sm" type="submit">{{$c.MarkDone}}</button></form>
+<form method="post" action="{{$.Base}}/getting-started/skip"><input type="hidden" name="csrf" value="{{$.CSRF}}"><input type="hidden" name="step" value="{{.Key}}"><button class="btn-sm btn-secondary" type="submit">{{$c.Skip}}</button></form>{{end}}
+</div>{{end}}
+{{end}}</li>
+{{end}}</ol>
+</section>
+<style>
+.gs-card { margin: 1rem 0 1.5rem; }
+.gs-card .sectionhead { margin: 0; }
+.gs-card .sectionhead form { margin: 0; }
+.gs-card .sectionhead button.linkish { min-height: 40px; min-width: 40px; }
+.gs-steps { margin: 0.5rem 0 0; padding-left: 1.5rem; }
+.gs-steps > li { padding: 0.6rem 0; }
+.gs-steps > li + li { border-top: 1px solid var(--rule); }
+.gs-steps .chip { margin: 0 0.4rem 0 0; }
+.gs-steps strong.gs-title { display: block; }
+.gs-steps p { margin: 0.35rem 0 0.75rem; }
+.gs-paste { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; margin: 0 0 0.6rem; padding: 0.6rem; border: 1px solid var(--rule); border-radius: var(--rst-radius-sm); background: var(--rst-surface-2); }
+.gs-paste code { background: transparent; padding: 0; white-space: normal; overflow-wrap: anywhere; font-size: 0.84rem; }
+.gs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
+.gs-actions form { margin: 0; }
+.gs-card .btn-sm { display: inline-flex; align-items: center; min-height: 40px; font-size: 0.85rem; }
+@media (max-width: 30rem) {
+.gs-paste { grid-template-columns: minmax(0, 1fr); }
+.gs-paste button { justify-self: start; }
+}
+</style>
+<script>
+// The card's Copy buttons: hidden until this runs, so with JavaScript off
+// the prompt is plain, selectable text and no dead button shows.
+(function () {
+ "use strict";
+ var card = document.getElementById("getting-started");
+ if (!card || !navigator.clipboard || typeof navigator.clipboard.writeText !== "function") return;
+ card.querySelectorAll("[data-copy-target]").forEach(function (copy) {
+ var command = document.getElementById(copy.dataset.copyTarget);
+ if (!command || !card.contains(command)) return;
+ copy.hidden = false;
+ var reset;
+ copy.addEventListener("click", function () {
+ navigator.clipboard.writeText(command.textContent).then(function () {
+ copy.textContent = copy.dataset.copied;
+ clearTimeout(reset);
+ reset = setTimeout(function () { copy.textContent = copy.dataset.copy; }, 2000);
+ }, function () { copy.hidden = true; });
+ });
+ });
+})();
+</script>
+{{end}}{{end}}
+
+{{define "getting_started_show"}}{{if .ShowGettingStarted}}<form class="gs-show small" method="post" action="{{.Base}}/getting-started/show"><input type="hidden" name="csrf" value="{{.CSRF}}"><button class="linkish" type="submit">{{.GettingStartedCopy.Show}}</button></form>
+<style>.gs-show { margin: 0 0 1rem; }.gs-show button.linkish { min-height: 40px; }</style>{{end}}{{end}}
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt
index e5b489801..0875511de 100644
--- a/internal/console/testdata/claim-routes.txt
+++ b/internal/console/testdata/claim-routes.txt
@@ -216,6 +216,10 @@ route POST /a/{sqid}/fleets/{fleet}/detach
route POST /a/{sqid}/fleets/{fleet}/place
route POST /a/{sqid}/fleets/{fleet}/rotate
route POST /a/{sqid}/fleets/{fleet}/tags
+route POST /a/{sqid}/getting-started/done
+route POST /a/{sqid}/getting-started/hide
+route POST /a/{sqid}/getting-started/show
+route POST /a/{sqid}/getting-started/skip
route POST /a/{sqid}/invite
route POST /a/{sqid}/invite/revoke
route POST /a/{sqid}/members/remove
diff --git a/internal/provision/first_run_next_steps_census_test.go b/internal/provision/first_run_next_steps_census_test.go
new file mode 100644
index 000000000..bcd2ae08f
--- /dev/null
+++ b/internal/provision/first_run_next_steps_census_test.go
@@ -0,0 +1,34 @@
+package provision
+
+// Record-write census entry for the account home's Getting started card
+// (branch design-first-run-next-steps), layered on
+// claimSourceWriteCensusInventory (main's newest). Reviewed by the branch's
+// fix implementer against git diff main -- internal/console/server.go. No
+// record write is added, moved or reclassified:
+// - NewServer: the only change is four registrations,
+// POST /a/{sqid}/getting-started/{hide,show,skip,done}
+// (internal/console/gettingstarted_handlers.go), and their comment.
+// The handlers write the console's SQLite getting_started_marks table
+// only (gettingstarted_store.go); none writes a bucket record. Kinds
+// are unchanged: the existing "instances" literal keeps it a key-site.
+func firstRunNextStepsWriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), claimSourceWriteCensusInventory()...)
+ repins := []censusEntry{
+ {"internal/console/server.go", "NewServer", "key-site", "lit:instances", "573178a5ac4a392c58c942cedc0538b58b7796256e276a6f5c1de9566585e826"},
+ }
+ for _, r := range repins {
+ found := false
+ for i, e := range entries {
+ if e.File == r.File && e.Unit == r.Unit {
+ if e.Class != r.Class || e.Kinds != r.Kinds {
+ panic("first-run next steps re-pin changes the class or kinds of " + r.File + ":" + r.Unit)
+ }
+ entries[i], found = r, true
+ }
+ }
+ if !found {
+ panic("first-run next steps re-pin of an unlisted unit " + r.File + ":" + r.Unit)
+ }
+ }
+ return entries
+}
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index 5f3d95215..76eebb71b 100644
--- a/internal/provision/plan9_b8_census_test.go
+++ b/internal/provision/plan9_b8_census_test.go
@@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) {
if len(got) < 100 {
t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root)
}
- inventory := claimSourceWriteCensusInventory()
+ inventory := firstRunNextStepsWriteCensusInventory()
problems := append(censusDiff(inventory, got), censusPolicy(inventory)...)
if len(problems) > 0 {
t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n "))