oficina / alta Public

Clone
git clone https://amadan.net/oficina/alta

Plain git — no account needed to clone.

Download

Download this file

1# Alta
2
3Paul's team-provisioning app for the Oficina suite. A **team** is one
4CARLOS instance per app, each bound to its own standalone environment owned
5by CARLOS scope `alta`, attached at `<label>.<app>.oficina.works`,
6registered with Home as a consumer, plus a Home team with its first owner.
7
8Design: Home `implementation/team-provisioning-app.md` (APPROVED, round 3,
9discussion 92). Home side: `team-provisioning-amendment.md`, implemented at
10Home `82d9388` (activation's version rule relaxed at `0cee9ba`, which
11`homecompat` pins). CARLOS side: `team-scoped-credentials.md`, merged at
12platform `9bcbab0f5`, **not released**. Alta replaces
13`oficina/teams/provision-team.py`. **Not deployed.**
14
15## How a run goes
16
171. **Preflight** (Alta): the label is new and well-formed, both Home roles
18 answer a signed inspect, the directory is initialized, each app has its
19 team credential, nothing already holds the environment or the host.
202. **Plan**: Alta signs one plan per Home role with one shared plan id and
21 posts it. The run page shows the two Home confirm links and the plan
22 id's first 8 hex.
233. **Paul confirms on Home** — `https://oficina.works/operator/confirm`,
24 then `https://id.oficina.works/operator/confirm` (retyping the owner's
25 address), each behind a fresh Home sign-in. Home shows its own copy of
26 the plan. Each confirm opens a 15-minute window.
274. **Alta runs** the steps: owner-seed and seed-team at Home; per app,
28 provision and register the consumer, write the environment, create the
29 instance, attach the hostname, wait for it to serve, and — for apps with
30 roster mode — verify and activate; then the exact-keys audit, after
31 which Alta deletes every row holding the owner's address.
325. A run that outlives its window parks; **Continue under a new plan**
33 submits an `add-apps` plan for the same apps, confirmed again on Home.
34
35### Profiles and samples (Paul, 2026-11-12)
36
37Each create-team and add-apps run carries a **profile**, chosen on the run
38form, recorded on the run and shown with its plan on Alta's run page
39(Home's copy of the plan has no field for it):
40
41- **outside** (the default): the recipes below, unchanged. For anyone
42 else's team.
43- **own**: Paul's own teams. Differs only in `CALLS_QUALITY_REPORTS=on`,
44 `OFICINA_DASHBOARD_TEAM=<label>` on the apps that read it (Docs, Sheets,
45 Slides, Calendar), and Memoria's AI: the run leaves it off (memoria
46 refuses to boot with `MEMORIA_AI=on` and no key, and Alta never holds
47 the TensorX key); Paul sets `MEMORIA_TENSORX_KEY` (secret) and
48 `MEMORIA_AI=on` in the environment afterwards, and the audit admits the
49 two together and refuses either alone. Own teams may also take
50 **Equipo and Base** (below).
51- **samples**, a separate box: `DOCS_SAMPLE_DOCUMENTS=1`, for a sample
52 team only.
53
54Slides has uploads in both profiles (Paul, 2026-11-12): Slides'
55app-wide private-storage policy (`carlos instances enable --app slides
56--private-storage`, Paul's to run) gives every instance Alta creates its
57environment's own bucket at step 8, and CARLOS's objstore walk delivers
58`CARLOS_STORE_BUCKET`, `_REGION`, `_ACCESS_KEY`, `_SECRET_KEY` (and
59`_ENDPOINT` where the deployment has one). They are PLATFORM keys: Alta
60never writes them (the console guard refuses), and the audit admits the
61whole set on Slides only, optionally, since an instance created before
62the policy has none. Any other app holding them fails the audit. Step 7 records the choice each
63environment was written with (the team page shows it per app), and the
64audit checks against that. A written environment is never rewritten, so
65a run whose choice differs from an app's written one is refused
66(`profile-differs-<app>`). "Continue under a new plan" takes only the
67apps with steps still to do. Its form (on the team page) offers the
68profile and samples choice, defaulted to those apps' own (written, else
69the newest run naming them), so a wrong choice on an app not yet written
70— a create-team run's included, whose label is already spent — is
71corrected by continuing under the right one. A team whose apps are all
72finished, under choices that disagree, has nothing to continue and shows
73no Continue form.
74
75Known limit (left as ruled): Continue defaults to nothing when two
76unfinished apps' choices differ, and says `profile-differs-<app>`.
77Choosing one profile on the form continues both when at most one of
78them is written (the unwritten one takes the choice); two unfinished
79apps *written* under different choices cannot be continued from any
80form. A later run takes back out only a key
81exactly as Alta wrote it (`OFICINA_DASHBOARD_TEAM=<label>`,
82`DOCS_SAMPLE_DOCUMENTS=1`); the console guard refuses any set of
83`MEMORIA_AI` or `MEMORIA_TENSORX_KEY`.
84
85Labels: Alta's pattern, never `--` (`xn--` punycode), and never a reserved
86name (`ReservedLabels`: `oficina`, every app's name, and the suite's and
87platform's own names).
88
89### Equipo and Base (own teams only; team-bundle spec, 2026-11-30)
90
91Design: `docs/superpowers/specs/2026-11-29-team-bundle-design.md` and its
92plan, on branch `design/team-bundle`.
93
94- **Seeded, not roster.** Neither app has Home roster mode. Their owner
95 comes from `EQUIPO_OWNERS` and `BASE_OWNER`, so their recipes write the
96 owner's address, and Alta keeps it (sealed) until both environments
97 are written. Each serves a seeded `GET /api/team`. Step 11 activates
98 it only when the probe names this consumer and reports an owner
99 (`roster-owner-pending` parks until then).
100- **Removing someone at Home removes them from neither.** That is
101 accepted for own teams (Paul, 2026-11-30). Remove them in Equipo and
102 Base too.
103- **Own profile only.** Step 0 refuses either under `outside`
104 (`app-own-only`). The team page offers them only to a team whose apps
105 are all own, and never on the adoption label.
106- **Base comes last.** Step 0 refuses Base (`base-needs-team-apps`)
107 until the team has, or the run includes, every other app, Equipo
108 included. Its tile list (`BASE_OFICINA_APPS`, every other app) and
109 `BASE_EQUIPO_ORIGIN` then never depend on the run. A label over 19
110 characters cannot take Base (`label-too-long-for-base`). A team that
111 leaves out any app (Calls, say) cannot have Base, and a later
112 `retire-apps` leaves that app's tile in Base's list. `BASE_NAME` is the
113 label, because Alta keeps no display name in a recipe's inputs. Base has no
114 Store: no `BASE_PLATFORM_*`, `BASE_APPS_DOMAIN` or
115 `BASE_ASSERTION_KEY`.
116- **Created with the team, in practice.** Add-apps refuses Equipo or Base
117 once Alta has forgotten the owner (`owner-forgotten-seeded`): a retyped
118 address would become their owner on a shape check alone. It also
119 refuses them on a team with any app written under `outside`.
120- **No agent keys** (`<P>_AGENT_*`) on fresh instances, as for the six.
121 Agent access for fresh teams is a follow-up.
122- **Execution is Paul's post-run pair**, like Memoria's AI. Set both:
123 - `EQUIPO_EXECUTION_ENABLED=1`;
124 - `EQUIPO_EXECUTION_MARKER_PATH=/data/instances/<label>-equipo.<account>.oncarlos.com/execution/witness`,
125 the instance's own CARLOS directory.
126
127 The audit admits the exact pair together, and refuses half of it or a
128 path naming another instance. Alta's console guard refuses writing
129 either. App `equipo` is already under `--swap hold`, which is
130 app-wide.
131- **Closing a team** with these apps (spec §5.1 rule 4):
132 - `retire-apps` leaves the environment and the parked replica;
133 - before `carlos env release`, unset each Equipo and Base secret and
134 key (`carlos secrets unset`, `carlos env unset`);
135 - revoke the team's GitHub connections at GitHub;
136 - revoke Memoria's TensorX key at TensorX.
137
138### Retiring
139
140Retiring apps (`retire-apps`) disables the directory consumer, retires the
141credential consumer, detaches the hostname and deletes the instance. The
142parked database replica, the owned environment, and the team's label stay;
143labels and retired hostnames are never reused.
144
145## Configuration
146
147| Variable | Kind | What |
148|---|---|---|
149| `ALTA_ORIGIN` | env | Alta's own origin. The host is not ruled; the default is the unlisted platform address `https://alta.bds.oncarlos.com`. Change it here and in Home's `HOME_CONSUMERS` together. |
150| `ALTA_DEK` | secret | 32 bytes, standard base64: seals Alta's database columns. |
151| `ALTA_OPERATOR_SUBJECT` | env | Paul's Home person ref: the only identity that sees a page. |
152| `ALTA_HOME_ISSUER` | env | `https://id.oficina.works` |
153| `ALTA_HOME_CONSUMER_ID` | env | `alta` |
154| `ALTA_HOME_KEYS_BASE64` | env | Home's assertion public keys (the manifest every app has). Also written into each team app's `<P>_HOME_KEYS_BASE64`. |
155| `ALTA_HOME_DEK_BASE64` | secret | 32 bytes for the sign-in hand-off. |
156| `HOME_DIRECTORY_ORIGIN` | env | `https://oficina.works` |
157| `ALTA_OPERATOR_KEY` | secret | Alta's P-256 operator key (`alta keygen`). |
158| `ALTA_OPERATOR_PREFILTER` | secret | 32 bytes, base64url: Home's prefilter bearer. |
159| `ALTA_OPERATOR_INSTALLATION`, `_REGISTRY`, `_DEVICE` | env | Random once (`alta keygen`), pinned on Home. |
160| `ALTA_DIRECTORY_PROVISIONING_PUBLIC_KEY` | env | The directory's provisioning public key (base64url): Alta verifies every record with it and writes it into Docs' `DOCS_TEAM_OPERATOR_KEYS_BASE64`. |
161| `ALTA_CARLOS_DOCS`, `_SHEETS`, `_SLIDES`, `_CALENDAR`, `_CALLS`, `_MEMORIA` | secret | One CARLOS `team` credential per app, scope `alta`. Never an operate or instance token. |
162| `ALTA_CARLOS_ACCOUNT` | env | The account's **sqid**, default `bds` (the team doors 404 the account's name). |
163| `ALTA_CARLOS_CONSOLE` | env | Default `https://console.carloku.com`. |
164| `ALTA_CALLS_ZONE` | env | `CALLS_ZONE` for team Calls instances; default `UTC`. |
165
166`alta keygen` prints fresh operator material, the pins, and both roles'
167`HOME_OPERATOR_HTTP` with every verb Alta uses.
168
169## Deploying (checklist; nothing here has been done)
170
1711. **Hub repo**: create `oficina/alta` on amadan.net, then push `main`.
1722. **Production gate**: CARLOS `team-scoped-credentials` released, and every
173 box at its floor (`release.TeamEnvironmentFloor`, v0.30.0).
1743. **Team credentials** (Paul, person-only), one per app:
175
176 carlos services create --account oficina --role team --app docs --scope alta alta-docs
177 … sheets, slides, calendar, calls, memoria
178
179 then `carlos secrets set --app alta ALTA_CARLOS_<APP>=…`.
1804. **The CARLOS app** `alta` in account `oficina` (`bds`), served at its
181 platform address; `carlos apps build-probe --app alta --account oficina
182 /api/version`; Alta's own config from the table above.
1835. **Mail and relay**: each app's mail declared under the prefix its binary
184 reads — `DOCS_SMTP` for Docs — and the relay enabled for Calls, so the
185 CARLOS walks mint per-environment credentials. An app switched to
186 CARLOS mail submission (`carlos email submission on --app <a>`, Paul)
187 gets no credential at all: each team environment receives only
188 `<stem>_MAIL_FROM` (`CARLOS_MAIL_FROM`, or `DOCS_MAIL_FROM` for Docs),
189 and step 7 takes that as the app's mail. The switched binaries read
190 only that one From, so a switched app must be declared under
191 `CARLOS_SMTP` (Docs: `DOCS_SMTP`), even one whose SMTP also reads its
192 own prefix (Slides, Calendar, Calls); a From under any other stem fails
193 step 7 with `mail-prefix-<app>`; after redeclaring, wait for the walk
194 to take the stray From out before re-running. Alta is given no SMTP, From or
195 relay value. Slides' private-storage policy on (`carlos instances
196 enable --app slides --private-storage`, Paul), so each team Slides gets
197 its own bucket; Alta is given no store value either.
1986. **Versions**: ship team apps with `carlos ship --version` equal to the
199 app Makefile's `VERSION` (`git describe --tags --always`) if you want
200 the box's serving name and `/api/version` to match. Step 10 does not
201 require it: it records both, uses `/api/version` as the activation's
202 `app_version` and the box's name for `artifact_digest`, and notes a
203 difference in the audit.
2047. **DNS and certificates**: `*.<app>.oficina.works` → the deployment, per
205 app zone; Alta attaches explicit hosts.
2068. **Home**: add `"alta": "<ALTA_ORIGIN>"` as the 8th `HOME_CONSUMERS`
207 entry (credential role); set `HOME_OPERATOR_HTTP` on both roles (from
208 `alta keygen`, with `operator_subject` and, on the credential role,
209 `directory_provisioning_public_key` filled in) beside each role's
210 `HOME_OPERATOR_MATERIAL`; enable the directory's roster endpoint.
2119. **The owner** (Till) signs in once at `https://oficina.works`.
21210. **Amendment §12 pre-flight**: Paul confirms the production directory has
213 never issued a roster generation or consumer record, by typing it on
214 Alta's Initialize page. Alta's first production run is `initialize`.
21511. **`lagged`**: per app, `carlos env fork --from lagged --to lagged-team
216 --scope alta`, then rebind each instance with `--scope alta`; create the
217 team in Alta with "Moving a stopgap" ticked.
218
219## Where Alta follows the merged code, not the design text
220
221Home's `team-provisioning-app.md` is a separate repository; these are
222recorded here instead (Fable's rulings on oficina/alta #1):
223
224- **§5, Slides uploads**: the design says Slides ships with "No uploads
225 … no `CARLOS_STORE_*`". Paul ruled on 2026-11-12 that Slides uploads are
226 switched on app-wide (`carlos instances enable --app slides
227 --private-storage`, his step). Every Slides instance then gets its own
228 bucket at creation, and the audit admits CARLOS's five store keys on
229 Slides only, whole and by kind. Alta never writes them. Amend the
230 design's Slides row when Home's document is next touched.
231- **§3, the console path**: a team credential's doors take the account's
232 sqid, so the path is `/api/cli/apps/bds/<app>/…`, not
233 `/api/cli/apps/oficina/<app>/…` (`teamInScope` compares the path to the
234 credential's own account sqid).
235- **§6 step 10 and §7, the serving build**: there is no
236 `update_report.serving`. The box's report is `status.HostRollout`; the
237 team role reads it as `rollout` on the `GET /instances` list door
238 (`?q=<host>`), and `GET /instances/{host}` carries neither. Step 10
239 requires the instance awake, not transient, `config_pending` false, and
240 both `rollout.serving` and `/api/version` present; it does not require
241 them to be equal.
242- **§6 step 0, the mail prefix**: a team credential cannot read an app's
243 mail declaration. Alta checks a forked environment that already exists
244 at step 0, and every environment when the walk delivers (step 7, and
245 the audit), refusing a prefix the app does not read. Deploying step 5 is
246 the human check.
247- **§7, `app_version`**: Home now admits an observed printable token
248 (`^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$`, Home `0cee9ba`), so a
249 git-describe stamp activates. Alta mirrors that rule at step 10
250 (`activationVersion` in `provision/steps.go`): a version Home would
251 refuse parks there as `version-unacceptable` instead of failing
252 activation.
253- **§6 step 11, `/api/team`**: every app has roster mode — Docs, Sheets,
254 Slides, Calendar, Calls and Memoria (team mode on each app's main or
255 team-mode branch: Docs `e58a22f`, Sheets #52, Slides #33, Calendar #35,
256 Calls oficina/meet #31, Memoria #32). Each serves the readiness probe
257 once that build is deployed; until then it parks at
258 `no-readiness-probe` and its directory row stays pending.
259- **§4–§5, the owner's address**: no recipe writes it any more (no
260 stopgap allowlists), so the seed is its last use and Alta deletes it in
261 the pass that seeds the team. The rule still waits for any app whose
262 recipe holds the owner, should one return.
263- **Calls has no push**: `cmd/calls` does not read `CALLS_APNS_*` (on
264 main or team-mode), so a team's Calls sends no Apple notifications.
265 `CARLOS_RELAY` stays PLATFORM, minted per environment.
266- Memoria's AI is never turned on by Alta: no `MEMORIA_AI`, TensorX key,
267 siblings or logged mail in any recipe. An own team's audit admits the
268 pair Paul sets by hand (see Profiles).
269- **§11, Help**: the account menu has no Help items yet (no Colophon page).
270
271## Adopting the existing apps (`alta-adopt`)
272
273`alta-adopt` is a second binary, run on Paul's machine and never deployed.
274It joins the eight canonical apps (docs, sheets, slides, calendar, calls,
275memoria, equipo, base at `https://<app>.oficina.works`) to a Home directory team
276labelled `oficina`, named "Oficina", so oficina-connect can route an
277assistant's calls to them. On CARLOS it writes two keys per app,
278`<P>_AGENT_ISSUER = https://connect.oficina.works` and
279`<P>_AGENT_TEAM = <the team's SQID>`, and proves nothing else changed. It
280creates no instance and changes no Home key or `HOME_CONSUMERS`.
281
282The design is Home `implementation/existing-team-adoption.md`; the plan
283is `docs/superpowers/plans/2026-11-16-adoption-runner.md`. Every command
284is a dry run unless given `--apply`. Build it with `make adopt`.
285
286For adding Equipo to the already adopted `oficina` team, use
287[the Equipo rollout](docs/equipo-adoption.md). Equipo is adoption-only;
288Alta does not yet offer a recipe for new Equipo instances. Its app-side
289adoption contract must be deployed before `configure`.
290
291Base joins the same way, adoption-only, by
292[the Base rollout](docs/base-adoption.md). Its operations door already
293answers agent-access's challenge before adoption, so its delivery check
294holds that door instead of watching it move (Paul approved the rule
2952026-11-23).
296
297### Before the first run
298
299The shared production keyset comes first, before the CARLOS credential
300and the Home counts (critical path step 5; home 101 §5, with its
301corrections). Adoption and Alta share one operator signer, installation,
302registry and device on both Home roles, so this one keyset is what the
303config file carries.
304
305- **Paul approves one `alta keygen`** (Alta's operator key, the
306 prefilter and the pins) **and one `home team-keygen -subject
307 pr_tsoeky4xus2habsdlun2jvzmku`** (Home's side, for Paul's person ref).
308 One of each: the pins and key Home holds must be the ones in the
309 config file.
310- **The team configuration is applied to `oficina-id`, then to
311 `oficina`**, in that canaried order: the credential role first, checked,
312 then the directory. Follow home 101 §5 as corrected there, not an
313 earlier copy.
314- **Paul names the machine that holds the operator key.** `alta-adopt`
315 runs only there, and the config file and the state database stay there.
316
317- **The config file** (`--config`, mode 0600, Paul's own) holds Alta's
318 operator key, prefilter and pins, `ALTA_DEK`, the directory's
319 provisioning key, the console and account, the state database's path,
320 and `artifacts`.
321- **`home_issuer` must be `https://id.oficina.works`**, the runner's
322 `adopt.HomeIssuerOrigin`. Any other value is refused when the config is
323 loaded. The CARLOS preflight checks each app's `<P>_HOME_ISSUER`
324 against the same constant (`home-issuer-mismatch`).
325- **`artifacts`** maps each app to the SHA-256 of the release name Paul
326 reviewed, as 64 lowercase hex: the value `X-Carlos-Version` serves, for
327 example `printf %s v1.4.0 | sha256sum`. Activation is refused for an
328 app whose served release hashes to anything else.
329- **The CARLOS credential** is an Admin service token
330 (`carlos services create --account oficina --role admin
331 oficina-adoption`). It is passed on a file descriptor only
332 (`--carlos-token-fd 3 3<token-file`), held in memory and zeroed on exit.
333 It is never in the environment, the config or the state database.
334- **The state database** is the run's journal and Alta's operator stream.
335 Back it up after each session. Never edit, replace or delete it by hand.
336- Gated on CARLOS 522 Plan 1 (conditional writes and
337 `restart/scope`) being on the production console.
338
339### Phases
340
341Phases may fall in separate sessions on separate days. Home's plan windows
342last 15 minutes and are never extended, so each plan is its own short
343session. A delivery check has no age limit: it stays valid until the
344instance, the served version or the config it observed changes.
345
346| Phase | Command | What happens |
347|---|---|---|
348| 0a | `home-preflight --phase pre-initialize` | Both Home roles inspected, plus Paul's pasted table counts. |
349| 0b | `preflight` | Per app, read-only: the config's layers, any other instance that would inherit the keys (`inherits-<host>` stops the run), team-mode keys, identity, delivery. |
350| 1 | `initialize` | Directory `initialize`, after Paul types the §12 attestation. |
351| 2 | `home-preflight --phase pre-plan-a`, then `plan-a` | Owner-seed, seed-team, then provision and register (verify only) for all six. |
352| 3 | `configure --app <a>` | Per app: one conditional `PUT /config`, one restart of the canonical host only, the after snapshot, and the runner's delivery check. |
353| 4 | `activate --apps calendar` | Plan B: calendar, the canary, is re-observed and activated. |
354| 5 | `activate --apps docs,sheets,slides,calls,memoria` | Plan C. Refused until Plan B has activated calendar. |
355
356`initialize`, `plan-a` and `activate` open a plan. After Paul confirms it
357on Home, `advance --run <id> --apply` takes the run as far as it can go;
358run it again if it stops (`status` shows where every run is).
359
360### Paul's steps, in order
361
3621. **The shared production keyset** (see the prerequisite above). Approve
363 the one `alta keygen` and the `home team-keygen -subject
364 pr_tsoeky4xus2habsdlun2jvzmku`, apply the team configuration to
365 `oficina-id` and then `oficina`, and name the machine that holds the
366 operator key.
3672. **CARLOS credential.** Run `carlos services create --account oficina
368 --role admin oficina-adoption`, and pass the result to `alta-adopt`
369 only on a file descriptor.
3703. **Home counts, before initialize.** Run
371 `alta-adopt home-preflight --phase pre-initialize`. It prints eight
372 read-only queries; run each with `carlos db query` against Home's
373 directory and paste the counts. Rerun with `--apply` to record them.
3744. **CARLOS preflight.** Run `alta-adopt preflight`. Any code stops the
375 run; `inherits-<host>` means another instance shares the layer the keys
376 would go to. `artifact-mismatch` means the app is not serving the
377 release reviewed in `artifacts`. `operations-<shape>` means its
378 `/api/v1/operations` does not answer as it should before adoption: a
379 404, for Slides, Calls and Equipo their own 401, or for Base its own
380 agent-shaped 401.
3815. **Initialize.** Run `alta-adopt initialize --apply` and type the
382 attestation. Confirm on
383 [https://oficina.works/operator/confirm](https://oficina.works/operator/confirm)
384 with a fresh passkey in the system browser, then
385 `advance --run <id> --apply`.
3866. **Wait out the initialize window: 15 minutes from the confirmation.**
387 The pre-plan-a preflight refuses (`plan-open`) while it is open.
3887. **Home counts, before Plan A.** Run
389 `home-preflight --phase pre-plan-a --apply` with fresh counts. After
390 initialize, `roster_generation` and `roster_operator_receipts` hold one
391 row each; every other table is empty.
3928. **Plan A.** Run `plan-a --apply` and type the owner (Paul's own
393 address). Confirm on
394 [https://oficina.works/operator/confirm](https://oficina.works/operator/confirm),
395 then on
396 [https://id.oficina.works/operator/confirm](https://id.oficina.works/operator/confirm),
397 retyping the owner. Both pages should show the SQID, the six canonical
398 hosts, "Oficina" and the same 8-hex prefix. Then `advance`.
3999. **Configure.** For each app, `configure --app <a>` (dry run) and then
400 with `--apply`: one config write and one restart, of that host only.
401 Before writing, `configure` refuses as preflight does, so nothing is
402 written for an app that is not serving its reviewed release. It then
403 waits until the app serves agent-access's challenge, records the after
404 snapshot, then checks the delivery itself and records the check. The
405 app must serve the same release as before, the reviewed one, in both
406 the `/api/version` body and `X-Carlos-Version`, with no redirect;
407 `/healthz` must answer 200; and `/api/v1/operations` must now give
408 agent-access's answer where it gave a 404, and agent-access's challenge
409 where Slides and Calls gave their own 401. There is nothing to sign in
410 to and nothing to type.
41110. **Plan B.** Run `activate --apps calendar --apply`, confirm on both
412 pages, then `advance`.
41311. **Plan C.** Once Plan B's run is done, run `activate --apps
414 docs,sheets,slides,calls,memoria --apply`, confirm on both pages, then
415 `advance`.
41612. **Clean up.** `carlos services delete oficina-adoption`, and back up
417 the state database.
418
419### When a step stops
420
421- **Plan A fails before the team is seeded.** Stop. Home then holds no
422 team, and the runner has no way to restart a failed Plan A. Nothing at
423 Home needs undoing: an owner-seed receipt expires after 300 s and an
424 unconfirmed plan after 15 minutes. Leave the state database as it is,
425 and get a recovery procedure reviewed before doing anything else.
426- **Plan A's window closes after the seed.** Run `plan-a --apply` again:
427 it opens a continuation (`add-apps` for the seeded SQID) that provisions
428 and registers only the apps still missing. Confirm it on both pages and
429 `advance`.
430- **A plan lapses before confirmation.** `plan-a --apply` signs it again;
431 for Plans B and C, run `activate` again.
432- **A process dies mid-configure** (closed laptop, lost network). Run the
433 same `configure --app <a> --apply` again. It rereads the console and
434 continues from the journal: a write that landed is found, never sent
435 twice; the baseline is never retaken. A restart may be repeated. If
436 the process died after the restart, the delivery check is made again
437 with no second write or restart.
438- **The delivery check is refused** (`check-<code>`). Nothing is
439 recorded, and activation stays refused for that app. The code names
440 what is wrong: `check-not-delivered` (version, header, redirect, health
441 or the operations answer), `check-artifact-mismatch` or
442 `check-artifact-unreviewed` (the served release is not the reviewed
443 one in `artifacts`; checked before the write too, so this means it
444 changed since), `check-identity-<field>` or `check-config-<key>`
445 (the instance or its config moved since the after snapshot). Find out
446 why before going on. Once it is put right, the same `configure --app
447 <a> --apply` checks again.
448- **A stop** (`preserved-changed`, `identity-changed`,
449 `agent-keys-conflict`, `agent-keys-foreign`, `receipt-mismatch`,
450 `receipt-malformed`) is final for that app: every resume refuses again,
451 and the runner never unsets a value it did not write. Look at the
452 console first.
453- **Failed and stopped states stay closed.** A failed run and a stopped
454 write or rollback are never cleared by the runner. Going past one needs
455 a reviewed procedure first.
456- **Plan C is refused with `canary-not-active`.** Plan B has not yet
457 activated calendar, or calendar has since been rolled back or
458 disabled. Finish Plan B first. After a calendar rollback or disable,
459 Plan C stays refused: going past that needs a reviewed procedure.
460- **Activation parks with `observe-<codes>`.** The re-observation just
461 before activation no longer matches the journal; the codes name what
462 moved (`delivery-check-superseded`, `config-<key>`, `identity-<field>`,
463 `artifact-mismatch`, …). Nothing was activated. Find out what changed
464 before going on.
465
466### Every production write, and its rollback
467
468| # | Write | Where | Rollback |
469|---|---|---|---|
470| 1 | `directory.initialize` | Home directory | **None**, by design. Gated on the Home preflight and the §12 attestation. |
471| 2 | Plan submissions for initialize, A, B and C, both roles | Home `operator_plans` | An unconfirmed plan expires after 15 minutes and is swept. |
472| 3 | `credential.owner-seed` | Home credential | None needed: the receipt expires after 300 s. |
473| 4 | `directory.seed-team` `oficina` / "Oficina", Paul as owner | Home directory | None (nothing is deleted). The team is inert without a live instance, and the label is reserved. |
474| 5 | `directory.provision-consumer` ×6 | Home directory | `alta-adopt disable --app <a> --apply`: a retire-apps plan, then `directory.disable-consumer`. |
475| 6 | `credential.register-consumer` ×6 (verify only, nothing inserted) | Home credential | None needed. |
476| 7 | Conditional `PUT /config` of `<P>_AGENT_ISSUER` and `<P>_AGENT_TEAM`, one per app | CARLOS `oficina`, the canonical host's layer | `rollback-config --app <a> --apply`: a journalled conditional unset that refuses foreign values, **then the scoped restart (dry run first)**. Before the unset and before the restart it rereads the host, and stops if the instance or any preserved key has changed since the baseline. Complete only when the probe shows the old operations shape again. |
477| 8 | `POST …/restart/scope {"host"}` after its dry run, one per app | CARLOS, that host only | Restart again after the rollback. |
478| 9 | `directory.verify-consumer` per app | Home directory | Expires after 600 s. |
479| 10 | `directory.activate-consumer` per app | Home directory | Immediately: row 7's rollback, which stops delegated access at the app. Then `disable`. A revoke at connect also works. |
480
481From row 4 onward, keep Home on an adoption-capable build: **never
482downgrade it, restore an older snapshot, or delete rows.**
483
484### Rehearsal
485
486`adopt/rehearsal_test.go` runs the whole adoption against the fakes, in
487the order above, then again killed at every Home act and at every CARLOS
488act (before and after the PUT, after the restart, mid-rollback), resuming
489each time from the journal. `homecompat/adopt_flow_test.go` runs the Home
490half, with the preflight's own queries, against Home's real operator
491code.
492
493## Developing
494
495 make ci # vet, gofmt, tests, and the Home compatibility module
496 make release # linux/arm64, stamped with git describe
497 make adopt # the local adoption runner, releases/alta-adopt
498
499Tests run the state machine against `homeop/fakehome` and
500`console/fakeconsole` (including a crash after every act, a lost answer
501after every Home commit, and §8's guards), and against Home's real
502operator engine in `homecompat/`.
503