| 1 | # alta |
| 2 | |
| 3 | Alta (*dar de alta*, to enrol) is Paul's team-provisioning app: it creates |
| 4 | a **team** — one CARLOS instance per Oficina app, each bound to its own |
| 5 | standalone environment owned by scope `alta`, attached at |
| 6 | `<label>.<app>.oficina.works`, registered with Home — through Home's signed |
| 7 | operator endpoint and the CARLOS `team` credential. Paul-only, separate from |
| 8 | Home. |
| 9 | |
| 10 | The design is Home's `implementation/team-provisioning-app.md` (APPROVED, |
| 11 | discussion 92), with `team-provisioning-amendment.md` (the Home endpoint, |
| 12 | implemented at Home `82d9388`; `homecompat` pins `0cee9ba`) and carlos/platform |
| 13 | `implementation/team-scoped-credentials.md` (merged `9bcbab0f5`, not |
| 14 | released). Read all three before changing behaviour here; a change that |
| 15 | departs from them needs the same review they had. |
| 16 | |
| 17 | A [rastrillo](https://amadan.net/rastrillo/rastrillo) app, on the current |
| 18 | `amadan.net/rastrillo/rastrillo` import path (never the frozen |
| 19 | `github.com/carlosframework/rastrillo` one), styled with estilo. |
| 20 | |
| 21 | ## Layout |
| 22 | |
| 23 | - `homeop/` — Alta's half of Home's operator endpoint: the signed |
| 24 | operation, plan and inspect challenge, every verb's input and Home's |
| 25 | result, **field for field and tag for tag as Home's |
| 26 | `internal/operator` declares them** (Home re-encodes what it decodes and |
| 27 | compares bytes; a moved field is a refused request). `homeop/fakehome` is |
| 28 | an in-memory Home for the engine's tests. |
| 29 | - `console/` — the CARLOS console client: one `team` credential per app, |
| 30 | the account by **sqid** (`bds`), client-side envelope sealing, and the §8 |
| 31 | guards every request passes before it is sent. `console/fakeconsole` is |
| 32 | the console as a team credential meets it, with the platform walks. |
| 33 | - `provision/` — Alta's sealed SQLite state (`store.go`, |
| 34 | `migrations/`), the per-app recipes (`apps.go`, §5's GENERATED / SET / |
| 35 | PLATFORM), and the §6 state machine (`engine.go`, `steps.go`). |
| 36 | - `internal/web/` — the pages (§11), Home sign-in, the operator-only gate. |
| 37 | - `cmd/alta/` — serving, and `alta keygen`. |
| 38 | - `homecompat/` — a separate, test-only module that runs Alta's engine |
| 39 | against **Home's real operator code** at the pinned commit. It takes a |
| 40 | module path under `amadan.net/oficina/home/` because Go admits imports of |
| 41 | Home's `internal/` only from there; it is never built into anything. |
| 42 | Bump its `go.mod` pin when Home's operator code changes, and re-read the |
| 43 | diff of `internal/operator` against `homeop/protocol.go`. |
| 44 | |
| 45 | ## Rules Alta holds hard |
| 46 | |
| 47 | - **Alta never holds a platform credential.** No SMTP password, no |
| 48 | `CARLOS_RELAY`, no TURN secret, no operate or instance token. PLATFORM |
| 49 | keys are waited for, never written; the guard refuses every prefix's SMTP |
| 50 | five, the relay, the mail-events key, scan callback secrets and store |
| 51 | coordinates, whatever the recipe says. |
| 52 | - **Generated keys are never regenerated.** Existence is checked by name; |
| 53 | a DEK that changes under a database makes it unreadable. |
| 54 | - **Nothing is inferred from a timeout.** A request is stored, sealed, |
| 55 | before it is sent; a lost answer is recovered by exact replay. A refused |
| 56 | request never consumed a sequence. |
| 57 | - **Nothing is deleted to clean up**, and labels and retired hostnames are |
| 58 | never reused. The only DELETEs are §9's, inside a retire-apps run. |
| 59 | - **No address at rest once it is no longer needed.** The owner's address |
| 60 | lives sealed in `owner_inputs`, the credential plan and the owner-seed |
| 61 | request until the seed has committed and every recipe that writes it (a |
| 62 | stopgap allowlist, or a seeded app's owner: `EQUIPO_OWNERS`, |
| 63 | `BASE_OWNER`) is written, then all three are deleted (`secure_delete`). |
| 64 | - **Logs carry step keys and fixed codes only**: never a label, an address, |
| 65 | a key or a platform value. |
| 66 | - Screens work without JavaScript; the only script is estilo's `busy.js`. |
| 67 | Destructive actions have their own confirm page with a typed label. |
| 68 | - The gate is `make ci` (vet, gofmt, tests, homecompat), the same |
| 69 | definition CI runs. `CGO_ENABLED=0` throughout. Use `make`, not bare |
| 70 | `go test`: the Makefile pins the toolchain. |
| 71 | |
| 72 | ## Serving |
| 73 | |
| 74 | `rastrillo.Resolve` + `Serve` speak the CARLOS activation contract; |
| 75 | `./alta -addr :8080` serves anywhere. `GET /healthz` and `GET |
| 76 | /api/version` are the framework's. Alta hibernates: a run waiting on a |
| 77 | domain or a walk advances when Paul next opens a page or presses Resume, |
| 78 | and every 20 s while the process is awake. |
| 79 | |
| 80 | ## Deploying |
| 81 | |
| 82 | Not before the CARLOS team credential and its floor release exist (Paul's |
| 83 | condition on ruling 8). The checklist is the README's "Deploying". No live |
| 84 | CARLOS writes, no AWS and no deploys from an agent session. |
| 85 | |
| 86 | ## Work in a worktree, and catch main up first |
| 87 | |
| 88 | git -C <repo> fetch origin |
| 89 | git -C <repo> worktree add ../<repo>-<task> -b <branch> origin/main |
| 90 | |
| 91 | Several sessions share this machine; a checkout has one HEAD between all of |
| 92 | them. Remove the worktree when the work has landed. |
| 93 | |