oficina / alta Public

Merge branch 'native/equipo-adoption' into main

claude agent, operated by paul@keymail.dev df1bd31070accbb3e99f83d7c99e937a7a00d7fb parent 61db317parent 96da7c5
26 files changed, +722 −66
  • README.md +8 −3
  • adopt/delivery.go +4 −4
  • adopt/delivery_test.go +2 −2
  • adopt/equipo_test.go +31 −0
  • adopt/homeidentity_test.go +1 −1
  • adopt/words.go +3 −3
  • cmd/alta-adopt/main.go +1 −1
  • docs/equipo-adoption.md +346 −0
  • docs/equipo-mutations.json +44 −0
  • docs/equipo-validation.md +35 −0
  • homecompat/adopt_flow_test.go +44 −5
  • homecompat/adopt_test.go +5 −5
  • homecompat/compat_test.go +4 −3
  • homecompat/go.mod +6 −6
  • homecompat/go.sum +20 −14
  • homeop/fakehome/fakehome.go +1 −1
  • homeop/protocol.go +2 −2
  • internal/web/app.go +3 −3
  • provision/adopt.go +7 −2
  • provision/adopt_test.go +1 −1
  • provision/apps.go +19 −4
  • provision/apps_test.go +2 −2
  • provision/engine.go +10 −0
  • provision/equipo_test.go +90 −0
  • provision/profile_test.go +4 −4
  • provision/store.go +29 −0

CI passed — run details

CI log
=== vet ===
go vet ./...
=== fmt ===
=== test ===
CGO_ENABLED=0 go test ./...
ok  	amadan.net/oficina/alta/adopt	20.910s
ok  	amadan.net/oficina/alta/carlosop	(cached)
?   	amadan.net/oficina/alta/carlosop/fakecarlos	[no test files]
ok  	amadan.net/oficina/alta/cmd/alta	0.164s
ok  	amadan.net/oficina/alta/cmd/alta-adopt	36.919s
ok  	amadan.net/oficina/alta/console	(cached)
?   	amadan.net/oficina/alta/console/fakeconsole	[no test files]
ok  	amadan.net/oficina/alta/homeop	0.003s
ok  	amadan.net/oficina/alta/homeop/fakehome	0.047s
ok  	amadan.net/oficina/alta/internal/web	0.114s
ok  	amadan.net/oficina/alta/provision	12.059s
=== compat ===
cd homecompat && go vet ./... && CGO_ENABLED=0 go test ./...
go: downloading amadan.net/oficina/home v0.1.1-0.20261120144520-0a91dbee81b4
go: downloading amadan.net/oficina/home/handoff v0.0.0-20261120144520-0a91dbee81b4
go: downloading amadan.net/oficina/home/roster v0.0.0-20261120144520-0a91dbee81b4
go: downloading amadan.net/rastrillo/rastrillo v0.38.0
go: downloading github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3
ok  	amadan.net/oficina/home/altacompat	0.656s
diff --git a/README.md b/README.md
index bca1bb2..caa67bc 100644
--- a/README.md
+++ b/README.md
@@ -219,8 +219,8 @@ recorded here instead (Fable's rulings on oficina/alta #1):
## Adopting the six existing apps (`alta-adopt`)
`alta-adopt` is a second binary, run on Paul's machine and never deployed.
-It joins the six canonical apps (docs, sheets, slides, calendar, calls,
-memoria at `https://<app>.oficina.works`) to a Home directory team
+It joins the seven canonical apps (docs, sheets, slides, calendar, calls,
+memoria, equipo at `https://<app>.oficina.works`) to a Home directory team
labelled `oficina`, named "Oficina", so oficina-connect can route an
assistant's calls to them. On CARLOS it writes two keys per app,
`<P>_AGENT_ISSUER = https://connect.oficina.works` and
@@ -231,6 +231,11 @@ The design is Home `implementation/existing-team-adoption.md`; the plan
is `docs/superpowers/plans/2026-11-16-adoption-runner.md`. Every command
is a dry run unless given `--apply`. Build it with `make adopt`.
+For adding Equipo to the already adopted `oficina` team, use
+[the Equipo rollout](docs/equipo-adoption.md). Equipo is adoption-only;
+Alta does not yet offer a recipe for new Equipo instances. Its app-side
+adoption contract must be deployed before `configure`.
+
### Before the first run
The shared production keyset comes first, before the CARLOS credential
@@ -313,7 +318,7 @@ run it again if it stops (`status` shows where every run is).
would go to. `artifact-mismatch` means the app is not serving the
release reviewed in `artifacts`. `operations-<shape>` means its
`/api/v1/operations` does not answer as it should before adoption: a
- 404, or for Slides and Calls their own 401.
+ 404, or for Slides, Calls and Equipo their own 401.
5. **Initialize.** Run `alta-adopt initialize --apply` and type the
attestation. Confirm on
[https://oficina.works/operator/confirm](https://oficina.works/operator/confirm)
diff --git a/adopt/delivery.go b/adopt/delivery.go
index a26bcde..7d16101 100644
--- a/adopt/delivery.go
+++ b/adopt/delivery.go
@@ -17,8 +17,8 @@ import (
)
// OpsShape is what GET /api/v1/operations answers, reduced to the shapes
-// adoption tells apart. Slides and Calls already answer their own 401 there
-// (an app middleware, {"error":"unauthorized"}), so a bare 401 proves
+// adoption tells apart. Slides, Calls and Equipo already answer their own 401 there
+// (an app middleware with a non-agent error body), so a bare 401 proves
// nothing: only agent-access's own answer counts, in exactly the shape
// agent-access writes it (agent-access f08bfc1, http.go Authenticate,
// writeFailure and writeJSON).
@@ -33,12 +33,12 @@ const (
)
// BaselineOps is what app's operations door answers before adoption
-// (Paul, 2026-11-17, Home discussion 103): Slides and Calls their own
+// (Paul, 2026-11-17, Home discussion 103): Slides, Calls and Equipo their own
// middleware's 401, every other app a 404. Preflight refuses any other
// baseline, and Delivered holds each app to its own transition.
func BaselineOps(app provision.App) OpsShape {
switch app.Slug {
- case "slides", "calls":
+ case "slides", "calls", "equipo":
return OpsApp401
}
return OpsAbsent
diff --git a/adopt/delivery_test.go b/adopt/delivery_test.go
index 6a6eaab..3753933 100644
--- a/adopt/delivery_test.go
+++ b/adopt/delivery_test.go
@@ -331,7 +331,7 @@ func TestDeliveredHoldsEachAppToItsTransition(t *testing.T) {
for _, a := range provision.Apps {
t.Run(a.Slug, func(t *testing.T) {
var good, bad [][2]OpsShape
- if a.Slug == "slides" || a.Slug == "calls" {
+ if a.Slug == "slides" || a.Slug == "calls" || a.Slug == "equipo" {
good = [][2]OpsShape{{OpsApp401, OpsAgent401}}
bad = [][2]OpsShape{{OpsApp401, OpsAgent200}, {OpsApp401, OpsOther}, {OpsApp401, OpsApp401},
{OpsAbsent, OpsAgent401}, {OpsAbsent, OpsAgent200}}
@@ -360,7 +360,7 @@ func TestDeliveredHoldsEachAppToItsTransition(t *testing.T) {
func TestBaselineOps(t *testing.T) {
for _, a := range provision.Apps {
want := OpsAbsent
- if a.Slug == "slides" || a.Slug == "calls" {
+ if a.Slug == "slides" || a.Slug == "calls" || a.Slug == "equipo" {
want = OpsApp401
}
if got := BaselineOps(a); got != want {
diff --git a/adopt/equipo_test.go b/adopt/equipo_test.go
new file mode 100644
index 0000000..3100f0a
--- /dev/null
+++ b/adopt/equipo_test.go
@@ -0,0 +1,31 @@
+package adopt
+
+import (
+ "amadan.net/oficina/alta/provision"
+ "testing"
+)
+
+func TestEquipoAdoptionDelivery(t *testing.T) {
+ app, ok := provision.AppBySlug("equipo")
+ if !ok {
+ t.Fatal("Equipo missing")
+ }
+ if AgentKeys(app) != ([2]string{"EQUIPO_AGENT_ISSUER", "EQUIPO_AGENT_TEAM"}) {
+ t.Fatal("wrong Equipo agent keys")
+ }
+ if BaselineOps(app) != OpsApp401 {
+ t.Fatal("Equipo baseline is its API's own 401")
+ }
+ before := Delivery{Version: "v1.0.0", Header: "v1.0.0", Health: 200, Ops: OpsApp401}
+ after := before
+ after.Ops = OpsAgent401
+ if err := Delivered(app, before, after); err != nil {
+ t.Fatal(err)
+ }
+ for _, shape := range []OpsShape{OpsApp401, OpsAbsent, OpsAgent200, OpsOther} {
+ after.Ops = shape
+ if Delivered(app, before, after) == nil {
+ t.Fatalf("Equipo delivered with %s", shape)
+ }
+ }
+}
diff --git a/adopt/homeidentity_test.go b/adopt/homeidentity_test.go
index d7fcd98..8d30b9a 100644
--- a/adopt/homeidentity_test.go
+++ b/adopt/homeidentity_test.go
@@ -37,7 +37,7 @@ func secretHome(x *carlosFixture) {
// The adoption tuple's consumer is the bare slug for each of the six apps.
func TestAdoptionConsumerIsTheBareSlug(t *testing.T) {
- want := []string{"docs", "sheets", "slides", "calendar", "calls", "memoria"}
+ want := []string{"docs", "sheets", "slides", "calendar", "calls", "memoria", "equipo"}
if len(provision.Apps) != len(want) {
t.Fatalf("%d apps", len(provision.Apps))
}
diff --git a/adopt/words.go b/adopt/words.go
index eb9e9a4..2f2d892 100644
--- a/adopt/words.go
+++ b/adopt/words.go
@@ -28,7 +28,7 @@ func WriteSummary(keys [2]string, bundle string) string {
//
// The witness and live lines are gone, and the
// --carlos-token-fd line no longer names witness.
-const Usage = `alta-adopt adopts the six Oficina apps into the Oficina team at Home.
+const Usage = `alta-adopt adopts the Oficina apps into the Oficina team at Home.
Usage:
alta-adopt <command> --config <file> [flags]
@@ -42,11 +42,11 @@ Commands, in the order of a run:
preflight [--app <app>] check each app's CARLOS configuration (never writes)
initialize open Home's initialize plan on the directory
plan-a open Plan A: seed the team, then provision and
- register the six apps
+ register the apps
advance --run <id> take a run as far as it can go now
configure --app <app> write the app's two agent keys, restart it and
check it
- activate --apps <list> open Plan B (calendar) or Plan C (the other five)
+ activate --apps <list> open Plan B (calendar) or Plan C (the other apps)
rollback-config --app <app>
remove the app's two agent keys and restart it
disable --app <app> disable the app's team binding at Home
diff --git a/cmd/alta-adopt/main.go b/cmd/alta-adopt/main.go
index 69277d7..f389091 100644
--- a/cmd/alta-adopt/main.go
+++ b/cmd/alta-adopt/main.go
@@ -1,6 +1,6 @@
// Command alta-adopt is the existing-team adoption runner (Home
// implementation/existing-team-adoption.md): a local operator command
-// that adopts the six canonical Oficina apps into the Home directory team
+// that adopts the canonical Oficina apps into the Home directory team
// labelled oficina. It is never built into or deployed with alta.
//
// Home's half runs in Alta's own engine, on Alta's one operator signer,
diff --git a/docs/equipo-adoption.md b/docs/equipo-adoption.md
new file mode 100644
index 0000000..59c66cb
--- /dev/null
+++ b/docs/equipo-adoption.md
@@ -0,0 +1,346 @@
+# Add Equipo to the existing Oficina team
+
+Implementer: Codex GPT-6-Astra. Approved scope: Equipo's 2026-11-20
+native Oficina ID spec, E4. This runbook is for Paul on the Mac holding
+Alta's existing operator configuration and state. No commands here were
+executed against production with writes during implementation.
+
+## Prerequisites
+
+- Land and deploy the reviewed Home `native/equipo-in-directory` change to
+ **both** `oficina` and `oficina-id`; verify their `X-Carlos-Version`.
+- Land this Alta change and build `make adopt` on the operator Mac.
+ Before deleting Home's source branch after a squash merge, re-pin Alta's
+ test-only `homecompat` module to the Home merge commit and pass `make ci`.
+- The separately implemented Equipo adoption contract below must be
+ deployed at `https://equipo.oficina.works`, with its existing instance,
+ storage and access policy preserved. Its native exchange must also be
+ deployed before testing native sign-in.
+- Configure Equipo's existing Oficina ID integration **before** capturing
+ the adoption baseline: `EQUIPO_HOME_ISSUER=https://id.oficina.works`,
+ `EQUIPO_HOME_CONSUMER_ID=equipo`, `EQUIPO_HOME_KEYS_BASE64` containing the
+ pinned Home public key map, and `EQUIPO_HOME_DEK_BASE64` containing its
+ persistent 32-byte key. Use the Equipo rollout for this step: preserve an
+ existing DEK, never regenerate it. The key map is a base64-encoded JSON
+ object mapping key IDs to encoded public keys (`connect/config.go`).
+- Use a current CARLOS CLI with `services` and `db query`. Reuse the same
+ Alta config, state path, operator key and pins. Do not initialize again
+ or run keygen. Alta's web process must not run concurrently with the
+ adoption runner; both own the same signed streams.
+- Calendar's Plan B must still be active in the existing journal. The
+ runner checks this again before Equipo activation.
+
+Read-only observations on 2026-11-20, 14:42โ€“14:49 UTC: Home served
+`5e5ebe54f4c4eacfb6aa053919c91ebce0d05af8`; its default
+`HOME_CONSUMERS_BASE64` had ten entries, neither `equipo` nor its canonical
+origin. `/authorize?consumer=equipo&nonce=AAAAAAAAAAAAAAAAAAAAAA` answered
+400, with the identical Docs control answering 303. Equipo served
+`b6c76de2`, its operations path returned its generic API 401, and
+`/auth/start` redirected locally to `/signin`. The default Equipo env and
+secret-name listings contained none of the four `EQUIPO_HOME_*` keys.
+These are observations of that deployment, not evidence of a later release
+or of other config layers. Current live sign-in is a prerequisite, not
+something `alta-adopt configure` installs.
+
+## 1. Verify and register the canonical consumer
+
+Native assert and web authorize read the same effective registry. This
+public check creates no login session and prints no cookie/token:
+
+```sh
+curl -sS -o /dev/null -w 'Equipo consumer HTTP %{http_code}\n' \
+ 'https://id.oficina.works/authorize?consumer=equipo&nonce=AAAAAAAAAAAAAAAAAAAAAA'
+curl -sS -o /dev/null -w 'Docs control HTTP %{http_code}\n' \
+ 'https://id.oficina.works/authorize?consumer=docs&nonce=AAAAAAAAAAAAAAAAAAAAAA'
+```
+
+Expected: both 303. A 400 for Equipo with a 303 control means the consumer
+ID is not registered. A 303 establishes ID admission; the following manifest
+inspection establishes its exact origin. Canonical adoption requires the
+**env** registration. Its `credential.register-consumer` verifies this
+binding and returns the manifest digest; it never inserts a duplicate table
+row. A table-only registration needs a separately reviewed reconciliation,
+not another registration on top of it.
+
+Check the replica for an ID/origin collision (read-only, current CLI):
+
+```sh
+carlos db query --account oficina --app oficina-id \
+ "SELECT consumer_id,origin,state FROM consumers WHERE consumer_id='equipo' OR origin='https://equipo.oficina.works'"
+```
+
+Expected: no rows. If a row exists, stop; adding the same ID or origin to
+the env manifest would make Home refuse boot.
+
+On an otherwise unchanged deployment, Paul runs this to preserve the live
+manifest and add the exact binding. It reads only the public manifest from
+`carlos env list`, refuses an unexpected format or conflicting binding, and
+prints no credentials. Do not run concurrently with another manifest edit.
+
+```sh
+python3 - <<'PY'
+import base64, json, subprocess
+from pathlib import Path
+base = ['carlos', 'env']
+args = ['--account', 'oficina', '--app', 'oficina-id']
+text = subprocess.check_output(base + ['list'] + args, text=True)
+values = dict(line.split(None, 1) for line in text.splitlines()
+ if line.startswith(('HOME_CONSUMERS ', 'HOME_CONSUMERS_BASE64 ')))
+assert set(values) == {'HOME_CONSUMERS_BASE64'}, 'Inspect manifest format before changing it'
+manifest = json.loads(base64.b64decode(values['HOME_CONSUMERS_BASE64'], validate=True))
+origin = 'https://equipo.oficina.works'
+assert isinstance(manifest, dict) and 0 < len(manifest) <= 16
+assert all(isinstance(k, str) and isinstance(v, str) for k, v in manifest.items())
+assert manifest.get('equipo', origin) == origin, 'Equipo has a different origin'
+assert all(k == 'equipo' or v != origin for k, v in manifest.items()), 'Origin has another ID'
+if manifest.get('equipo') == origin:
+ print('Equipo already has the exact canonical env registration')
+else:
+ assert len(manifest) < 16, 'Env registry is full'
+ backup = Path.home() / '.oficina-id-consumers-before-equipo.b64'
+ with backup.open('x', encoding='ascii') as saved:
+ saved.write(values['HOME_CONSUMERS_BASE64'] + '\n')
+ backup.chmod(0o600)
+ manifest['equipo'] = origin
+ encoded = base64.b64encode(json.dumps(manifest, separators=(',', ':')).encode()).decode()
+ subprocess.run(base + ['set'] + args + ['HOME_CONSUMERS_BASE64=' + encoded], check=True)
+ print('Added equipo -> https://equipo.oficina.works; restart the credential service')
+PY
+carlos restart --account oficina --app oficina-id
+curl --fail --silent --show-error -D - https://id.oficina.works/healthz
+```
+
+Expected health: 200 and `X-Carlos-Version` naming the reviewed Home release.
+The backup is public consumer metadata; the exclusive create prevents
+overwriting the previous manifest. If it already exists, inspect it before
+another attempt. Keep it until health and consumer checks pass.
+
+If this manifest change makes the credential service unhealthy, restore the
+saved value immediately (only if no intervening manifest edit occurred),
+restart, and check health before investigating. This rolls back the manifest
+change, not an adoption or deployment:
+
+```sh
+python3 - <<'PY'
+import base64, json, subprocess
+from pathlib import Path
+old = (Path.home() / '.oficina-id-consumers-before-equipo.b64').read_text().strip()
+assert isinstance(json.loads(base64.b64decode(old, validate=True)), dict)
+subprocess.run(['carlos', 'env', 'set', '--account', 'oficina', '--app',
+ 'oficina-id', 'HOME_CONSUMERS_BASE64=' + old], check=True)
+PY
+carlos restart --account oficina --app oficina-id
+curl --fail --silent --show-error -D - https://id.oficina.works/healthz
+```
+
+On success, re-run the two public checks. Expected: Equipo and Docs both 303 after the
+process restarts. Home's native `assert` then accepts exactly
+`https://equipo.oficina.works`, with no port, slash, suffix or case variants.
+A complete native check still needs a real device grant and the deployed
+Equipo exchange; the public check alone is not a native end-to-end test.
+
+## 2. Build and select the existing operator state
+
+After both branches are reviewed and landed, run in the Alta checkout on
+the operator Mac (no live Alta server is required):
+
+```sh
+git fetch origin
+git switch main
+git pull --ff-only
+make adopt
+bash
+read -r -p 'Absolute path to the EXISTING alta-adopt config: ' ALTA_CONFIG
+read -r -p 'Absolute path to the existing short-lived CARLOS Admin token file: ' ALTA_TOKEN_FILE
+read -r -p 'Reviewed Equipo release name (X-Carlos-Version): ' EQUIPO_RELEASE
+ALTA_ADOPT="$PWD/releases/alta-adopt"
+"$ALTA_ADOPT" version
+"$ALTA_ADOPT" status --config "$ALTA_CONFIG"
+```
+
+Keep this Bash shell for the commands below. The token file must contain
+only the token, as the existing adoption setup requires. It is passed on FD
+3, never exported or stored in Alta's config/state. If its credential has
+expired, mint a fresh short-lived Admin credential using the existing
+operator procedure (`carlos services create --account oficina --role admin
+oficina-adoption`); keep its token out of command history. Revoke it after
+this session, as the original adoption runbook requires.
+
+Expected status: the `oficina` team is seeded, the original six apps'
+register steps are done, calendar has completed activation, and Equipo has
+no steps yet. No `oficina` run may be `planned`, `running` or `parked`:
+finish or resolve it before opening another Plan A, which supersedes an
+unfinished run. If Equipo is already registered, skip Plan A below. If it is
+already active, stop here: no repeat adoption is needed.
+
+Add the reviewed release's digest to `artifacts`, preserving every other
+config field, including the state path and keys. This is the SHA-256 of the
+**release name**, without a newline, not the binary's hash:
+
+```sh
+python3 - "$ALTA_CONFIG" "$EQUIPO_RELEASE" <<'PY'
+import hashlib, json, os, pathlib, stat, sys, tempfile
+p = pathlib.Path(sys.argv[1])
+st = p.stat()
+assert stat.S_ISREG(st.st_mode) and stat.S_IMODE(st.st_mode) == 0o600 and st.st_uid == os.getuid()
+cfg = json.loads(p.read_text())
+cfg.setdefault('artifacts', {})['equipo'] = hashlib.sha256(sys.argv[2].encode()).hexdigest()
+fd, tmp = tempfile.mkstemp(dir=p.parent, prefix='.equipo-config-')
+try:
+ with os.fdopen(fd, 'w') as f:
+ json.dump(cfg, f, indent=2)
+ f.write('\n')
+ os.replace(tmp, p)
+finally:
+ if os.path.exists(tmp): os.unlink(tmp)
+print('Equipo reviewed release recorded; keys and state path preserved')
+PY
+"$ALTA_ADOPT" preflight --config "$ALTA_CONFIG" --app equipo \
+ --carlos-token-fd 3 3<"$ALTA_TOKEN_FILE"
+```
+
+Expected: `equipo: ready`. No write. Missing Home identity, inherited keys
+on other instances, team-mode config, unreviewed release, or an unexpected
+operations response stops the run. Fix the reported cause, never remove the
+gate or edit the journal. All Equipo config and release preparation belongs
+before the first `configure`, which captures an immutable baseline.
+An unscoped `preflight` now includes Equipo and will refuse until its
+separate contract is deployed; use the explicit `--app equipo` above.
+
+## 3. Register Equipo against the already seeded team
+
+```sh
+"$ALTA_ADOPT" plan-a --config "$ALTA_CONFIG"
+"$ALTA_ADOPT" plan-a --config "$ALTA_CONFIG" --apply
+```
+
+Expected dry run: continuation of Plan A for **equipo only**. The applied
+command prints a run ID and both confirmation URLs. It binds the existing
+SQID and registers missing apps; it does not seed a second team. If other
+apps are listed, inspect the existing state before applying.
+
+Open `https://oficina.works/operator/confirm`, then
+`https://id.oficina.works/operator/confirm` in the system browser. Confirm
+with a fresh passkey; compare the plan prefix on both pages. Both must name
+Equipo and the existing team SQID. Complete each plan/confirmation/advance
+within its 15-minute window. No owner retyping or re-seeding is needed for
+this continuation.
+
+```sh
+read -r -p 'Registration run ID printed by plan-a: ' EQUIPO_REGISTER_RUN
+"$ALTA_ADOPT" advance --config "$ALTA_CONFIG" --run "$EQUIPO_REGISTER_RUN" --apply
+"$ALTA_ADOPT" status --config "$ALTA_CONFIG"
+```
+
+Expected: run `done awaiting-configuration`; Equipo provision and register
+steps done, directory row pending, existing team and registrations retained.
+Wait for any previous confirmation window to expire before opening another
+plan; never alter the clock or state to bypass `plan-open`.
+
+## 4. Configure and activate Equipo
+
+```sh
+"$ALTA_ADOPT" configure --config "$ALTA_CONFIG" --app equipo \
+ --carlos-token-fd 3 3<"$ALTA_TOKEN_FILE"
+"$ALTA_ADOPT" configure --config "$ALTA_CONFIG" --app equipo --apply \
+ --carlos-token-fd 3 3<"$ALTA_TOKEN_FILE"
+```
+
+Dry run names the two agent keys and their write layer. Apply writes them
+conditionally, restarts **only the canonical Equipo host**, waits for the
+agent-access challenge, and records the delivery check. Expected ending:
+`Delivery check recorded.` The release must stay the reviewed release.
+
+```sh
+"$ALTA_ADOPT" activate --config "$ALTA_CONFIG" --apps equipo \
+ --carlos-token-fd 3 3<"$ALTA_TOKEN_FILE"
+"$ALTA_ADOPT" activate --config "$ALTA_CONFIG" --apps equipo --apply \
+ --carlos-token-fd 3 3<"$ALTA_TOKEN_FILE"
+```
+
+Expected dry run: `equipo: ready`. Apply prints a **new** run ID. Confirm on
+both Home pages again, for Equipo and the same existing SQID and plan prefix.
+Then:
+
+```sh
+read -r -p 'Activation run ID printed by activate: ' EQUIPO_ACTIVATE_RUN
+"$ALTA_ADOPT" advance --config "$ALTA_CONFIG" --run "$EQUIPO_ACTIVATE_RUN" --apply \
+ --carlos-token-fd 3 3<"$ALTA_TOKEN_FILE"
+"$ALTA_ADOPT" status --config "$ALTA_CONFIG"
+carlos db query --account oficina --app oficina \
+ "SELECT t.label,i.app,i.origin,i.consumer_id,i.state FROM team_instances i JOIN teams t ON t.id=i.team_id WHERE t.label='oficina' AND i.app='equipo'"
+```
+
+Expected: activation run `done`, verify and activate steps done, and exactly
+`oficina | equipo | https://equipo.oficina.works | equipo | live` on the
+replica once caught up. A roster member's native `/api/native/teams` includes
+`{"app":"equipo","origin":"https://equipo.oficina.works","consumer_id":"equipo"}`.
+Equipo native lists Oficina and signs in after its separate native build is
+installed. Removed members and non-live instances remain excluded.
+Back up the state database with the existing procedure and revoke the
+session's Admin credential. Do not downgrade the journal or delete rows.
+
+## Contract the separate Equipo session must implement
+
+Reference inspected at [Docs commit 7de2d40](https://amadan.net/oficina/docs/commit/7de2d40c1c77a8b43544a4b47c7806411eafd65f):
+[agent access source](https://amadan.net/oficina/docs?ref=main&path=internal/docs/agent_access.go),
+[config wiring](https://amadan.net/oficina/docs?ref=main&path=cmd/docs/main.go),
+and `amadan.net/oficina/agent-access.git` (`http.go`, `remote.go`, registry
+and principal types). Docs pins `8ed8ba826000` at that revision. The file
+links follow main; reproduce the exact inspected implementation locally with:
+
+```sh
+git -C /Users/paulcampbell/amadan.net/oficina/docs show \
+ 7de2d40c1c77a8b43544a4b47c7806411eafd65f:internal/docs/agent_access.go
+```
+
+1. Read `EQUIPO_AGENT_ISSUER` and `EQUIPO_AGENT_TEAM` together. Both absent
+ leaves agent access disabled; partial/malformed config refuses boot.
+ Require valid Home identity config. Issuer is
+ `https://connect.oficina.works`; team is the Home directory **SQID**, not
+ `oficina`, an Equipo database team ID, or a hostname. If a separate team
+ mode is configured, the binding must agree; Alta adoption itself refuses
+ `EQUIPO_TEAM_*` keys and does not enable team mode.
+2. Mount agent routes ahead of Equipo's device/session authentication
+ middleware. `GET /api/v1/operations` takes no body. With no valid bearer,
+ answer **401**, `Cache-Control: no-store`, `Content-Type: application/json`,
+ exactly one `WWW-Authenticate: Bearer` (parameters are permitted), and
+ exactly `{"error":{"code":"unauthenticated","message":"Connect to Oficina first."}}`.
+ The message may be another nonempty string. No request ID, copy key,
+ wrapper fields, redirect, extra JSON value, or generic API 401 shape.
+3. Use agent-access's delegated `Authorization: Bearer <token>` contract,
+ not an Equipo device credential. `NewRemoteVerifier(agentIssuer,
+ equipoOrigin+"/api/v1", homeIssuer)` checks online at
+ `POST https://connect.oficina.works/api/v1/credential`, forwarding the
+ bearer and JSON `{"resource":"https://equipo.oficina.works/api/v1"}`.
+ It requires matching returned resource and identity issuer, plus a
+ nonempty subject and grant. Do not hand-roll a permissive substitute.
+ Resolve the Home person locally and enforce Equipo's current membership
+ and permissions, including revocation, as Docs' `prepareMode` does.
+4. With an authorized bearer, return 200 `{"operations":[...]}` with
+ descriptors filtered to the principal's team/scopes. Actual invocation
+ is `POST /api/v1/operations/{name}`, `Content-Type: application/json`,
+ raw operation arguments including the exact team SQID, with the same
+ bearer verification and current permissions. Use the shared registry's
+ schema/size checks, and Docs' permission/revocation recheck for writes.
+ Operation names and which Equipo actions to expose belong to that
+ session's approved contract. A fake public list added only to satisfy
+ Alta is not an integration.
+5. Keep `/healthz` at 200 and `/api/version` at the stamped version, with
+ `X-Carlos-Version` naming the same release (Alta `SameRelease` accepts
+ the existing git-describe/short-hash pair). No redirects on these probes.
+6. If `EQUIPO_HOME_ISSUER` or `EQUIPO_HOME_CONSUMER_ID` are stored as secrets,
+ `GET /auth/start` must directly return 302/303 to Home's exact
+ `/authorize?consumer=equipo&nonce=...`; Alta never follows it. Plain env
+ values are read from effective config instead. The normal app should
+ actually sign in with the same issuer/consumer in either case.
+
+Alta sends no bearer in its probes. For Equipo, like Calls and Slides, it
+requires the pre-configuration generic API **401** to change to the exact
+agent-access **401** above. An unauthenticated 200 is refused for these apps.
+`adopt/delivery.go` (`shape`, `BaselineOps`, `Delivered`) implements this;
+`adopt/observer.go` checks baseline/write/after/delivery-check evidence,
+calendar's active canary, reviewed release digest, unchanged instance and
+storage identity, every preserved config digest/source/layer, exact agent
+keys, and Home identity. `configure` writes only the two agent keys, so all
+Home credentials and unrelated config must be prepared before its baseline.
diff --git a/docs/equipo-mutations.json b/docs/equipo-mutations.json
new file mode 100644
index 0000000..a85d71c
--- /dev/null
+++ b/docs/equipo-mutations.json
@@ -0,0 +1,44 @@
+[
+ {
+ "mutation": "remove-equipo-registry",
+ "test": "TestEquipoAdoptionRegistry",
+ "result": "killed",
+ "output": "CGO_ENABLED=0 go test ./provision -run '^TestEquipoAdoptionRegistry' -count=1\n--- FAIL: TestEquipoAdoptionRegistry (0.00s)\n equipo_test.go:14: Equipo registry: {AdoptionOnly:false Slug: Name: Prefix: Roster:false MailPrefixes:[] SubmitPrefix: Relay:false Store:false Dashboard:false} false\nFAIL\nFAIL\tamadan.net/oficina/alta/provision\t0.308s\nFAIL"
+ },
+ {
+ "mutation": "remove-canonical-origin",
+ "test": "TestEquipoAdoptionRegistry",
+ "result": "killed",
+ "output": "CGO_ENABLED=0 go test ./provision -run '^TestEquipoAdoptionRegistry' -count=1\n--- FAIL: TestEquipoAdoptionRegistry (0.00s)\n equipo_test.go:25: Equipo adoption mapping missing\nFAIL\nFAIL\tamadan.net/oficina/alta/provision\t0.270s\nFAIL"
+ },
+ {
+ "mutation": "skip-existing-team-app-record",
+ "test": "TestEquipoJoinsExistingAdoption",
+ "result": "killed",
+ "output": "CGO_ENABLED=0 go test ./provision -run '^TestEquipoJoinsExistingAdoption' -count=1\n--- FAIL: TestEquipoJoinsExistingAdoption (0.04s)\n equipo_test.go:61: Equipo missing from existing local team\nFAIL\nFAIL\tamadan.net/oficina/alta/provision\t0.316s\nFAIL"
+ },
+ {
+ "mutation": "reserve-environment-during-adoption",
+ "test": "TestEquipoJoinsExistingAdoption",
+ "result": "killed",
+ "output": "CGO_ENABLED=0 go test ./provision -run '^TestEquipoJoinsExistingAdoption' -count=1\n--- FAIL: TestEquipoJoinsExistingAdoption (0.04s)\n equipo_test.go:65: adoption reserved environments: 1 <nil>\nFAIL\nFAIL\tamadan.net/oficina/alta/provision\t0.345s\nFAIL"
+ },
+ {
+ "mutation": "allow-fresh-equipo-provisioning",
+ "test": "TestEquipoCannotProvisionFreshInstances",
+ "result": "killed",
+ "output": "CGO_ENABLED=0 go test ./provision -run '^TestEquipoCannotProvisionFreshInstances' -count=1\n--- FAIL: TestEquipoCannotProvisionFreshInstances (0.02s)\n equipo_test.go:84: got <nil>, want failed: unknown-app\nFAIL\nFAIL\tamadan.net/oficina/alta/provision\t0.316s\nFAIL"
+ },
+ {
+ "mutation": "wrong-equipo-api-baseline",
+ "test": "TestEquipoAdoptionDelivery",
+ "result": "killed",
+ "output": "CGO_ENABLED=0 go test ./adopt -run '^TestEquipoAdoptionDelivery' -count=1\n--- FAIL: TestEquipoAdoptionDelivery (0.00s)\n equipo_test.go:17: Equipo baseline is its API's own 401\nFAIL\nFAIL\tamadan.net/oficina/alta/adopt\t0.330s\nFAIL"
+ },
+ {
+ "mutation": "accept-generic-api-challenge",
+ "test": "TestEquipoAdoptionDelivery",
+ "result": "killed",
+ "output": "CGO_ENABLED=0 go test ./adopt -run '^TestEquipoAdoptionDelivery' -count=1\n--- FAIL: TestEquipoAdoptionDelivery (0.00s)\n equipo_test.go:28: Equipo delivered with app-401\nFAIL\nFAIL\tamadan.net/oficina/alta/adopt\t0.365s\nFAIL"
+ }
+]
diff --git a/docs/equipo-validation.md b/docs/equipo-validation.md
new file mode 100644
index 0000000..9576910
--- /dev/null
+++ b/docs/equipo-validation.md
@@ -0,0 +1,35 @@
+# Equipo adoption validation โ€” 2026-11-20
+
+Implementer: Codex GPT-6-Astra. Scope: approved Equipo native Oficina ID
+spec decision E4, with Equipo's own adoption contract assigned separately.
+
+Tests were written first. Registry, canonical mapping, six-app continuation,
+fresh-instance refusal and delivery-shape tests failed before implementation.
+The real-Home compatibility flow also refused Equipo's directory plan at the
+old Home pin; it passes with Home `0a91dbee81b4360fef0b69035886a9f98af0e648`.
+The pin is in the test-only module. The intervening `internal/operator` diff
+is empty; the production wire protocol has not changed.
+
+`make ci` passed: dependency verification, vet, formatting, all root tests,
+and vet/tests in `homecompat`. The CLI rehearsal exercises the expanded app
+registry. The focused continuation test starts with the original six apps,
+adds only Equipo through both Home plans and confirmations, and verifies
+pending registration followed by live activation, one team, no second seed,
+no table consumer insertion, no environment reservation and no console call.
+The real-Home tests cover all seven canonical registrations and activation,
+and refusal when Equipo's canonical env consumer is absent.
+
+Seven deliberate mutations were killed by named behavioral tests. Complete
+failure output is in `equipo-mutations.json`: remove the registry entry,
+remove the canonical origin, skip the existing local team binding, reserve
+an environment during adoption, permit fresh Equipo provisioning, select the
+wrong operations baseline, and accept an unchanged generic API challenge.
+Each mutation was restored before the full gate.
+
+Equipo is adoption-only. Its full fresh-instance recipe and team mode are
+outside this change. Existing adoption delivery, release, identity, storage,
+config-preservation and calendar-canary gates remain in force. The separate
+Equipo contract and copy-paste operator procedure are in `equipo-adoption.md`.
+No live writes, merge or deployment were performed. Independent code-review
+attribution and CI results are recorded in the branch discussion; deployed
+canary review remains pending and is not authorized by this implementation.
diff --git a/homecompat/adopt_flow_test.go b/homecompat/adopt_flow_test.go
index 2b069a8..336e5c8 100644
--- a/homecompat/adopt_flow_test.go
+++ b/homecompat/adopt_flow_test.go
@@ -34,6 +34,8 @@ var served = map[string]struct{ body, header string }{
"calendar": {"v0.1.0-53-g800406a", "800406a"},
"calls": {"ef2335e9df94bf9be1561fcbb1335c87e7c6e4ca", "ef2335e9df94bf9be1561fcbb1335c87e7c6e4ca"},
"memoria": {"v0.1.0-47-g174fb45", "174fb45"},
+ // Synthetic supported Equipo release; production contract is a separate branch.
+ "equipo": {"v1.0.0", "v1.0.0"},
}
// observer stands in for the CARLOS half's activation gate: what it
@@ -115,7 +117,7 @@ func manifestDigest(t *testing.T, r *rig, env map[string]string) string {
func TestAdoptionFlowAgainstRealHome(t *testing.T) {
ctx := context.Background()
env := map[string]string{}
- for _, a := range apps {
+ for _, a := range adoptionApps {
env[a] = homeop.CanonicalOrigin(a)
}
r := newRigWith(t, env, nil)
@@ -179,7 +181,7 @@ func TestAdoptionFlowAgainstRealHome(t *testing.T) {
t.Fatalf("activate %v: %s %s", plan, got.State, got.Code)
}
}
- if len(obs.calls) != len(apps) {
+ if len(obs.calls) != len(adoptionApps) {
t.Fatalf("observed %v", obs.calls)
}
@@ -195,10 +197,10 @@ func TestAdoptionFlowAgainstRealHome(t *testing.T) {
t.Fatalf("teams %d", n)
}
// Every canonical binding is live, and there is no other.
- if n := count(r.home.dirDB, "SELECT count(*) FROM team_instances WHERE state='live' AND consumer_id=app AND origin='https://'||app||'.oficina.works'"); n != len(apps) {
+ if n := count(r.home.dirDB, "SELECT count(*) FROM team_instances WHERE state='live' AND consumer_id=app AND origin='https://'||app||'.oficina.works'"); n != len(adoptionApps) {
t.Fatalf("live canonical rows %d", n)
}
- if n := count(r.home.dirDB, "SELECT count(*) FROM team_instances"); n != len(apps) {
+ if n := count(r.home.dirDB, "SELECT count(*) FROM team_instances"); n != len(adoptionApps) {
t.Fatalf("team_instances %d", n)
}
// Register verified the env manifest and inserted nothing.
@@ -208,7 +210,7 @@ func TestAdoptionFlowAgainstRealHome(t *testing.T) {
if after := manifestDigest(t, r, env); after != before {
t.Fatal("the manifest digest changed")
}
- for _, a := range apps {
+ for _, a := range adoptionApps {
data, ok, err := r.store.Done(ctx, provision.AdoptionLabel, a, provision.StepRegister)
if err != nil || !ok || data["manifest_digest"] != before {
t.Fatalf("%s: register's manifest digest is not the unchanged one", a)
@@ -236,3 +238,40 @@ func TestAdoptionFlowAgainstRealHome(t *testing.T) {
}
}
}
+
+// Canonical adoption verifies a pre-existing env registration; it cannot
+// create one or turn a missing registration into a live native route.
+func TestEquipoAdoptionRequiresRegisteredConsumer(t *testing.T) {
+ ctx := context.Background()
+ env := map[string]string{}
+ for _, a := range apps {
+ env[a] = homeop.CanonicalOrigin(a)
+ }
+ r := newRigWith(t, env, nil)
+ run, err := r.engine.StartInitialize(ctx, provision.InitializeAttestation)
+ if err != nil {
+ t.Fatal(err)
+ }
+ r.home.confirm(t, "directory", "")
+ if got := r.drive(t, run); got.State != "done" {
+ t.Fatalf("initialize: %+v", got)
+ }
+ r.home.now = r.home.now.Add(homeop.WindowLifetime * time.Second)
+ run, err = r.engine.StartAdoption(ctx, "Oficina", owner)
+ if err != nil {
+ t.Fatal(err)
+ }
+ r.home.confirm(t, "directory", "")
+ r.home.confirm(t, "credential", owner)
+ if got := r.drive(t, run); got.State != "failed" || got.Code != "register-refused" {
+ t.Fatalf("unregistered Equipo: %s %s", got.State, got.Code)
+ }
+ var state string
+ if err := r.home.dirDB.QueryRow("SELECT state FROM team_instances WHERE consumer_id='equipo'").Scan(&state); err != nil || state != "pending" {
+ t.Fatalf("unregistered state: %s %v", state, err)
+ }
+ var n int
+ if err := r.home.credDB.QueryRow("SELECT count(*) FROM consumers").Scan(&n); err != nil || n != 0 {
+ t.Fatalf("adoption created consumers: %d %v", n, err)
+ }
+}
diff --git a/homecompat/adopt_test.go b/homecompat/adopt_test.go
index eebf136..fb265f1 100644
--- a/homecompat/adopt_test.go
+++ b/homecompat/adopt_test.go
@@ -22,7 +22,7 @@ import (
// carries the owner; its directory role the label and name.
func (r *rig) adoptionPlan(t *testing.T, role, existing string) []byte {
t.Helper()
- p, err := r.client.NewPlan(role, homeop.Token(), homeop.KindCreateTeam, apps, r.home.now)
+ p, err := r.client.NewPlan(role, homeop.Token(), homeop.KindCreateTeam, adoptionApps, r.home.now)
if err != nil {
t.Fatal(err)
}
@@ -81,7 +81,7 @@ func TestHomeAcceptsAltaSignedExistingTeamPlan(t *testing.T) {
}
views[role] = v
}
- if v := views[homeop.Directory]; v.Label != "oficina" || v.DisplayName != "Oficina" || len(v.Apps) != len(apps) {
+ if v := views[homeop.Directory]; v.Label != "oficina" || v.DisplayName != "Oficina" || len(v.Apps) != len(adoptionApps) {
t.Fatal("directory plan view lost label, name or apps")
}
}
@@ -95,7 +95,7 @@ func TestHomeAcceptsAltaSignedExistingTeamPlan(t *testing.T) {
func TestHomeAcceptsAdoptionContinuation(t *testing.T) {
ctx := context.Background()
env := map[string]string{}
- for _, a := range apps {
+ for _, a := range adoptionApps {
env[a] = homeop.CanonicalOrigin(a)
}
crash, crashed := false, false
@@ -152,7 +152,7 @@ func TestHomeAcceptsAdoptionContinuation(t *testing.T) {
v := r.home.confirm(t, role, "")
// sheets' register and everything after it are missing (Home lists
// a plan's apps sorted).
- if v.Kind != homeop.KindAddApps || v.ExistingTeam != team.TeamSQID || strings.Join(v.Apps, ",") != "calendar,calls,memoria,sheets,slides" || v.OwnerIndex != "" {
+ if v.Kind != homeop.KindAddApps || v.ExistingTeam != team.TeamSQID || strings.Join(v.Apps, ",") != "calendar,calls,equipo,memoria,sheets,slides" || v.OwnerIndex != "" {
t.Fatalf("%s continuation view: kind %s apps %v", role, v.Kind, v.Apps)
}
}
@@ -170,7 +170,7 @@ func TestHomeAcceptsAdoptionContinuation(t *testing.T) {
if n := count(r.home.dirDB, "SELECT count(*) FROM teams WHERE label='oficina'"); n != 1 {
t.Fatalf("teams %d", n)
}
- if n := count(r.home.dirDB, "SELECT count(*) FROM team_instances WHERE state='pending' AND consumer_id=app AND origin='https://'||app||'.oficina.works'"); n != len(apps) {
+ if n := count(r.home.dirDB, "SELECT count(*) FROM team_instances WHERE state='pending' AND consumer_id=app AND origin='https://'||app||'.oficina.works'"); n != len(adoptionApps) {
t.Fatalf("pending canonical rows %d", n)
}
if n := count(r.home.credDB, "SELECT count(*) FROM consumers"); n != 0 {
diff --git a/homecompat/compat_test.go b/homecompat/compat_test.go
index 1939646..9421fb2 100644
--- a/homecompat/compat_test.go
+++ b/homecompat/compat_test.go
@@ -49,6 +49,7 @@ const (
)
var apps = []string{"docs", "sheets", "slides", "calendar", "calls", "memoria"}
+var adoptionApps = append(append([]string(nil), apps...), "equipo")
type home struct {
now time.Time
@@ -123,7 +124,7 @@ func newHome(t *testing.T, alta *family.Keypair, prefilter string, installation,
}
return r.Origin == "https://"+r.Label+"."+r.App+".oficina.works"
}
- h.directory, err = operator.NewDirectory(de, ov, prov, []roster.Key{{ID: "page1", Public: base64.RawURLEncoding.EncodeToString(page.SignPub())}}, directorydata.Config{Apps: apps, ValidateRoute: route})
+ h.directory, err = operator.NewDirectory(de, ov, prov, []roster.Key{{ID: "page1", Public: base64.RawURLEncoding.EncodeToString(page.SignPub())}}, directorydata.Config{Apps: adoptionApps, ValidateRoute: route})
if err != nil {
t.Fatal(err)
}
@@ -169,7 +170,7 @@ func newHome(t *testing.T, alta *family.Keypair, prefilter string, installation,
for id, origin := range extraEnv {
env[id] = origin
}
- if h.credential, err = operator.NewCredentialHTTP(cred, h.provPub, env, apps, h.index, admit); err != nil {
+ if h.credential, err = operator.NewCredentialHTTP(cred, h.provPub, env, adoptionApps, h.index, admit); err != nil {
t.Fatal(err)
}
if h.credPlans, err = operator.NewPlanStore(h.credDB, "credential", sealer); err != nil {
@@ -222,7 +223,7 @@ func (h *home) handler(role string) http.Handler {
}
}
if r.URL.Path == "/operator/v1/plan" {
- p, err := v.VerifyPlan(body, apps, h.now)
+ p, err := v.VerifyPlan(body, adoptionApps, h.now)
if err != nil {
answer(403, "refused")
return
diff --git a/homecompat/go.mod b/homecompat/go.mod
index 0078288..e3b9f24 100644
--- a/homecompat/go.mod
+++ b/homecompat/go.mod
@@ -5,22 +5,22 @@
// exact Home commit Alta was written against.
module amadan.net/oficina/home/altacompat
-go 1.26
+go 1.26.0
toolchain go1.26.5
require (
amadan.net/oficina/alta v0.0.0
- amadan.net/oficina/home v0.1.1-0.20261116154649-16da7bad9395
- amadan.net/oficina/home/handoff v0.0.0-20261116154649-16da7bad9395
- amadan.net/oficina/home/roster v0.0.0-20261116154649-16da7bad9395
- amadan.net/rastrillo/rastrillo v0.29.1-0.20261028004840-5bb38c0ab31b
+ amadan.net/oficina/home v0.1.1-0.20261120144520-0a91dbee81b4
+ amadan.net/oficina/home/handoff v0.0.0-20261120144520-0a91dbee81b4
+ amadan.net/oficina/home/roster v0.0.0-20261120144520-0a91dbee81b4
+ amadan.net/rastrillo/rastrillo v0.38.0
)
require (
amadan.net/carlos/platform.git/launchctx v0.0.0-20260911135504-fb577f96f7d1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
- github.com/go-json-experiment/json v0.0.0-20250725192818-e39067aee2d2 // indirect
+ github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
diff --git a/homecompat/go.sum b/homecompat/go.sum
index 8fad547..f7dfeab 100644
--- a/homecompat/go.sum
+++ b/homecompat/go.sum
@@ -1,19 +1,21 @@
amadan.net/carlos/platform.git/launchctx v0.0.0-20260911135504-fb577f96f7d1 h1:RxwIRojWcVtwSdNAjtdz7y1bxHLh3GUgqT1TrXVKpyM=
amadan.net/carlos/platform.git/launchctx v0.0.0-20260911135504-fb577f96f7d1/go.mod h1:6fBmMWgtESLFXZURzu/HyRXM0vyLuo4+XGGdKuZ+wao=
-amadan.net/oficina/home v0.1.1-0.20261116154649-16da7bad9395 h1:5QEhaQTkxryVZSQlLpRehhmxJcjbfs7OK1yA2jiUUC8=
-amadan.net/oficina/home v0.1.1-0.20261116154649-16da7bad9395/go.mod h1:YQrPsuTn0bga002nJQ9P+MN4Kjl6lZianRJINDJ8On4=
-amadan.net/oficina/home/handoff v0.0.0-20261116154649-16da7bad9395 h1:r9TnQOObUFlvMqPn9e+fr8mwEU7ZS9RH26Fn6NSBUeE=
-amadan.net/oficina/home/handoff v0.0.0-20261116154649-16da7bad9395/go.mod h1:YISpzFJ+iMgrM0rUL032OSzsAQbP4/nozvXLCCOcn1k=
-amadan.net/oficina/home/roster v0.0.0-20261116154649-16da7bad9395 h1:CtVcBJvcspQRHQ68XJI0xOJg/lh5tpZ3ixbNaBmEhHY=
-amadan.net/oficina/home/roster v0.0.0-20261116154649-16da7bad9395/go.mod h1:gqshuXyDtFZUCYbhuZyV3Epc51pUcsLbpqAqiA5UiXg=
-amadan.net/rastrillo/rastrillo v0.29.1-0.20261028004840-5bb38c0ab31b h1:7rApPVcEQ4MReZ6Q1h6fydrxtQwjd6kk6MyzQfpHYjo=
-amadan.net/rastrillo/rastrillo v0.29.1-0.20261028004840-5bb38c0ab31b/go.mod h1:jSSeydqEvlm/fU3hhWoXFnyEaDgroR8LPRZSo9ZhhIM=
+amadan.net/oficina/home v0.1.1-0.20261120144520-0a91dbee81b4 h1:xpLleaJG/umCMsSpWyODojGPwYULiTsO/tuncxeRTZk=
+amadan.net/oficina/home v0.1.1-0.20261120144520-0a91dbee81b4/go.mod h1:BLttgK8HEPzRBX+to6ge6IN9k8RkLcTYofjFpuPzXnc=
+amadan.net/oficina/home/handoff v0.0.0-20261120144520-0a91dbee81b4 h1:vr1Z7uGKrKoU+WlSfQ7KrenUXiXPOCAXQ6OAZK0kWgI=
+amadan.net/oficina/home/handoff v0.0.0-20261120144520-0a91dbee81b4/go.mod h1:Mn5Rsm7Vcd6VZArBKMawza2yO+Fjo8KB1Ii6UcjcJHQ=
+amadan.net/oficina/home/roster v0.0.0-20261120144520-0a91dbee81b4 h1:89BUkdyiNA6jzDMpmrzuwD/6zo2qgLn8BKP6/w02Cjk=
+amadan.net/oficina/home/roster v0.0.0-20261120144520-0a91dbee81b4/go.mod h1:xmSzAVbHHfLcuQO7QnvwuXOQe4rCrA1xRyNIBiHTBqw=
+amadan.net/rastrillo/fiesta v1.5.0 h1:wKfTsL5zRMofJBAqOxNlCY7aCtgHCtfwvTPBMA+ZA20=
+amadan.net/rastrillo/fiesta v1.5.0/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
+amadan.net/rastrillo/rastrillo v0.38.0 h1:q8aPnVtKt4q+uNjfxBRCTizhVvj+HdjDJh1MhlkBPOc=
+amadan.net/rastrillo/rastrillo v0.38.0/go.mod h1:0bufVMz8D4aWvxvJjehW70T8Jsvytrp1YEwoIzFTKm8=
amadan.net/rastrillo/rastrillo/money v0.1.0 h1:MxU4oqNrW8abxRTkgZBv24OYNpFnvonajNqeLIzmmaM=
amadan.net/rastrillo/rastrillo/money v0.1.0/go.mod h1:cmgkjBEIQh1pFSYvQk0UU6oPYS8kSDypdT9+t4Flx0U=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
-github.com/go-json-experiment/json v0.0.0-20250725192818-e39067aee2d2 h1:iizUGZ9pEquQS5jTGkh4AqeeHCMbfbjeb0zMt0aEFzs=
-github.com/go-json-experiment/json v0.0.0-20250725192818-e39067aee2d2/go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M=
+github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 h1:UADEEmDKgfXbtnGJZ97beY5XLo9ZechG1nlU4KnRrkE=
+github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
@@ -40,8 +42,12 @@ github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
github.com/sqids/sqids-go v0.4.1 h1:eQKYzmAZbLlRwHeHYPF35QhgxwZHLnlmVj9AkIj/rrw=
github.com/sqids/sqids-go v0.4.1/go.mod h1:EMwHuPQgSNFS0A49jESTfIQS+066XQTVhukrzEPScl8=
-golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=
-golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=
+github.com/tdewolff/minify/v2 v2.24.19 h1:j2exx54gvrCFN9UiFm0Z5vbNWBFcuY5Ql1VmaM2Dkeo=
+github.com/tdewolff/minify/v2 v2.24.19/go.mod h1:HVgQO08FJeDxQx+lcFOVDi1IySi/77WlN/dDckCkZoA=
+github.com/tdewolff/parse/v2 v2.8.16 h1:bLk5svUOQRkW/Y2SJ+DeENSIkZBcTIkq+Atyv5D8feI=
+github.com/tdewolff/parse/v2 v2.8.16/go.mod h1:XdsoSFThlVIRIajAuqz1evNY7bagZS8LBOPA3aVopwQ=
+golang.org/x/mod v0.39.0 h1:UF5zwQdCRRUpHfyPwr7d4UrGiVeldIsogtzWVnczL74=
+golang.org/x/mod v0.39.0/go.mod h1:bvIbwjQ0HUFFf5AKukeeYQG4ZBUG9yxQbR9aEweIwYY=
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -49,8 +55,8 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
-golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE=
-golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk=
+golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI=
+golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo=
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ=
diff --git a/homeop/fakehome/fakehome.go b/homeop/fakehome/fakehome.go
index b1e2fce..fb600c7 100644
--- a/homeop/fakehome/fakehome.go
+++ b/homeop/fakehome/fakehome.go
@@ -38,7 +38,7 @@ import (
// observedVersion is Home's app_version rule (0cee9ba).
var observedVersion = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$`)
-var registry = []string{"docs", "sheets", "slides", "calendar", "calls", "memoria"}
+var registry = []string{"docs", "sheets", "slides", "calendar", "calls", "memoria", "equipo"}
type plan struct {
id, kind, label, name, owner string
diff --git a/homeop/protocol.go b/homeop/protocol.go
index 2972848..1636183 100644
--- a/homeop/protocol.go
+++ b/homeop/protocol.go
@@ -155,13 +155,13 @@ type Plan struct {
// CanonicalOrigin is Alta's one copy of Home's closed registry of the
// existing suite instances (internal/home/directorydata/canonical.go): the
-// six apps' consumer id is the slug and the origin is
+// canonical apps' consumer id is the slug and the origin is
// https://<app>.oficina.works. It is empty for any other app. It lives
// here, not in provision, because fakehome (imported by provision's tests)
// needs it too. homecompat pins it against Home's own.
func CanonicalOrigin(app string) string {
switch app {
- case "docs", "sheets", "slides", "memoria", "calendar", "calls":
+ case "docs", "sheets", "slides", "memoria", "calendar", "calls", "equipo":
return "https://" + app + ".oficina.works"
}
return ""
diff --git a/internal/web/app.go b/internal/web/app.go
index 2a93a8a..0ac82a5 100644
--- a/internal/web/app.go
+++ b/internal/web/app.go
@@ -314,7 +314,7 @@ func (a *App) teamRow(ctx context.Context, t provision.Team) teamRow {
}
func (a *App) newTeamForm(w http.ResponseWriter, r *http.Request) {
- a.render(w, r, http.StatusOK, "team_new", page{Title: "New team", Data: map[string]any{"Apps": provision.Apps, "Checked": map[string]bool{}, "Form": map[string]string{},
+ a.render(w, r, http.StatusOK, "team_new", page{Title: "New team", Data: map[string]any{"Apps": provision.ProvisioningApps(), "Checked": map[string]bool{}, "Form": map[string]string{},
"Options": optionsView(provision.RunOptions{Profile: provision.ProfileOutside})}})
}
@@ -374,7 +374,7 @@ func (a *App) createTeam(w http.ResponseWriter, r *http.Request) {
// The owner's address is echoed back into the form it came from,
// never logged or stored on a refusal.
a.render(w, r, http.StatusUnprocessableEntity, "team_new", page{Title: "New team", Error: describe(errorCode(err)),
- Data: map[string]any{"Apps": provision.Apps, "Checked": checked, "Form": map[string]string{"label": in.Label, "name": in.Name, "owner": in.Owner}, "Forked": in.Forked,
+ Data: map[string]any{"Apps": provision.ProvisioningApps(), "Checked": checked, "Form": map[string]string{"label": in.Label, "name": in.Name, "owner": in.Owner}, "Forked": in.Forked,
"Options": optionsView(in.Options)}})
return
}
@@ -461,7 +461,7 @@ func (a *App) team(w http.ResponseWriter, r *http.Request) {
for _, s := range provision.Slugs() {
if _, in := t.Apps[s]; in {
apps = append(apps, s)
- } else {
+ } else if spec, _ := provision.AppBySlug(s); !spec.AdoptionOnly {
addable = append(addable, s)
}
}
diff --git a/provision/adopt.go b/provision/adopt.go
index 6b03a09..62f618b 100644
--- a/provision/adopt.go
+++ b/provision/adopt.go
@@ -46,7 +46,7 @@ const adoptionName = "Oficina"
// - DisableAdopted: an ordinary retire-apps window on the directory
// alone, directory.disable-consumer and nothing else.
//
-// None of them touches the console or an instance: the six instances,
+// None of them touches the console or an instance: the existing instances,
// their environments and their keys are not Alta's.
// adoptionSteps is an adoption run's per-app pipeline: Plan A, a
@@ -61,7 +61,7 @@ func adoptionSteps(kind string) []string {
return []string{StepVerify, StepActivate}
}
-// StartAdoption opens Plan A for the six canonical apps. existing_team is
+// StartAdoption opens Plan A for the canonical apps. existing_team is
// the SQID the directory proposes now, read here; Home seeds the team at
// it or not at all.
func (e *Engine) StartAdoption(ctx context.Context, name, owner string) (int64, error) {
@@ -129,6 +129,11 @@ func (e *Engine) ContinueAdoption(ctx context.Context) (int64, error) {
if len(missing) == 0 {
return 0, fail("plan-a-complete")
}
+ // A newly supported app may not have been in the original Plan A.
+ // Record it locally too; AddAdoptionApps is idempotent on existing bindings.
+ if err := e.cfg.Store.AddAdoptionApps(ctx, missing); err != nil {
+ return 0, err
+ }
id, err := e.cfg.Store.NewAdoptionRun(ctx, homeop.KindCreateTeam, missing)
if err != nil {
return 0, err
diff --git a/provision/adopt_test.go b/provision/adopt_test.go
index 67194e6..211f258 100644
--- a/provision/adopt_test.go
+++ b/provision/adopt_test.go
@@ -954,7 +954,7 @@ func TestAdoptionContinuesAfterTheWindowCloses(t *testing.T) {
if r, _ := a.store.Run(a.ctx(), run); r.State != "superseded" {
t.Fatalf("stranded run %s", r.State)
}
- missing := "slides,calendar,calls,memoria"
+ missing := "slides,calendar,calls,memoria,equipo"
if r, _ := a.store.Run(a.ctx(), next); !r.Adoption || r.Kind != homeop.KindCreateTeam || strings.Join(r.Apps, ",") != missing {
t.Fatalf("continuation run %+v", r)
}
diff --git a/provision/apps.go b/provision/apps.go
index b6b26da..3e6ae67 100644
--- a/provision/apps.go
+++ b/provision/apps.go
@@ -30,7 +30,7 @@ var ReservedLabels = map[string]bool{
// Every app's name, provisioned by Alta or not yet: a team called
// "docs" would own docs.calls.oficina.works and read as an app.
"docs": true, "sheets": true, "slides": true, "calendar": true,
- "calls": true, "memoria": true, "fichas": true, "mapa": true,
+ "calls": true, "memoria": true, "equipo": true, "fichas": true, "mapa": true,
// The suite's and the platform's own hosts and paths.
"api": true, "auth": true, "healthz": true, "static": true, "www": true,
"id": true, "admin": true, "portero": true, "home": true, "alta": true,
@@ -60,9 +60,12 @@ const PublicDomain = "oficina.works"
// whether it has roster mode, which SMTP prefixes its binary reads, and
// whether it needs the platform relay.
type App struct {
- Slug string
- Name string
- Prefix string
+ // AdoptionOnly admits an existing canonical instance, without offering an
+ // unimplemented recipe for fresh team instances.
+ AdoptionOnly bool
+ Slug string
+ Name string
+ Prefix string
// Roster is true for an app with team (roster) mode on main. Only
// those reach steps 11โ€“12; the rest stop at 10 with their directory
// row pending (ยง6).
@@ -101,6 +104,18 @@ var Apps = []App{
{Slug: "calendar", Name: "Calendar", Prefix: "CALENDAR", Roster: true, MailPrefixes: []string{"CALENDAR_SMTP", "CARLOS_SMTP"}, SubmitPrefix: "CARLOS_SMTP", Dashboard: true},
{Slug: "calls", Name: "Calls", Prefix: "CALLS", Roster: true, MailPrefixes: []string{"CALLS_SMTP", "CARLOS_SMTP"}, SubmitPrefix: "CARLOS_SMTP", Relay: true},
{Slug: "memoria", Name: "Memoria", Prefix: "MEMORIA", Roster: true, MailPrefixes: []string{"CARLOS_SMTP"}, SubmitPrefix: "CARLOS_SMTP"},
+ {Slug: "equipo", Name: "Equipo", Prefix: "EQUIPO", AdoptionOnly: true, MailPrefixes: []string{"CARLOS_SMTP"}, SubmitPrefix: "CARLOS_SMTP"},
+}
+
+// ProvisioningApps are the apps with supported fresh-instance recipes.
+func ProvisioningApps() []App {
+ var out []App
+ for _, a := range Apps {
+ if !a.AdoptionOnly {
+ out = append(out, a)
+ }
+ }
+ return out
}
// AppBySlug finds a registry app.
diff --git a/provision/apps_test.go b/provision/apps_test.go
index 9417cd1..1e79b1f 100644
--- a/provision/apps_test.go
+++ b/provision/apps_test.go
@@ -53,7 +53,7 @@ func TestRosterRecipes(t *testing.T) {
t.Fatalf("%s recipe\n got %v\nwant %v", slug, got, names)
}
}
- for _, a := range Apps {
+ for _, a := range ProvisioningApps() {
if !a.Roster {
t.Fatalf("%s roster mode %v", a.Slug, a.Roster)
}
@@ -91,7 +91,7 @@ func TestCanonicalHelpersForOficina(t *testing.T) {
// TeamKeyNames is the recipe's <P>_TEAM_ five, by name.
func TestTeamKeyNamesMatchesRecipe(t *testing.T) {
in := Inputs{Label: "lagged", TeamSQID: "Uk", Record: []byte("{}"), Home: HomeConfig{Directory: "https://oficina.works", Provisioner: "AQ"}}
- for _, app := range Apps {
+ for _, app := range ProvisioningApps() {
want := TeamKeyNames(app)
if len(want) != 5 {
t.Fatalf("%s: %v", app.Slug, want)
diff --git a/provision/engine.go b/provision/engine.go
index 81848fa..58ab709 100644
--- a/provision/engine.go
+++ b/provision/engine.go
@@ -161,6 +161,11 @@ func validEnvironment(s string) bool {
// CreateTeam runs step 0 for a new team and, if it passes, records the
// label (for good) and submits the plans.
func (e *Engine) CreateTeam(ctx context.Context, in NewTeam) (int64, error) {
+ for _, slug := range in.Apps {
+ if app, ok := AppBySlug(slug); ok && app.AdoptionOnly {
+ return 0, fail("unknown-app")
+ }
+ }
in.Apps = SortApps(in.Apps)
env := EnvironmentName(in.Label, in.Forked)
opt, okOpt := in.Options.Normal()
@@ -208,6 +213,11 @@ func (e *Engine) CreateTeam(ctx context.Context, in NewTeam) (int64, error) {
// new plan of kind add-apps"). opt with no profile continues each app
// with its own choice (ContinuedOptions); a profile names a fresh one.
func (e *Engine) AddApps(ctx context.Context, label string, apps []string, opt RunOptions) (int64, error) {
+ for _, slug := range apps {
+ if app, ok := AppBySlug(slug); ok && app.AdoptionOnly {
+ return 0, fail("unknown-app")
+ }
+ }
apps = SortApps(apps)
// Home's adoption of the canonical apps is its own signed scope
// (existing_team on the plan, Home discussion 103); an ordinary
diff --git a/provision/equipo_test.go b/provision/equipo_test.go
new file mode 100644
index 0000000..fa5bec9
--- /dev/null
+++ b/provision/equipo_test.go
@@ -0,0 +1,90 @@
+package provision
+
+import (
+ "slices"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/alta/homeop"
+)
+
+func TestEquipoAdoptionRegistry(t *testing.T) {
+ app, ok := AppBySlug("equipo")
+ if !ok || app.Prefix != "EQUIPO" || app.Name != "Equipo" {
+ t.Fatalf("Equipo registry: %+v %v", app, ok)
+ }
+ for _, a := range ProvisioningApps() {
+ if a.Slug == "equipo" {
+ t.Fatal("Equipo advertised for fresh provisioning")
+ }
+ }
+ if !ReservedLabels["equipo"] {
+ t.Fatal("Equipo label is not reserved")
+ }
+ if homeop.CanonicalOrigin("equipo") != "https://equipo.oficina.works" || !slices.Equal(SortApps([]string{"equipo"}), []string{"equipo"}) {
+ t.Fatal("Equipo adoption mapping missing")
+ }
+}
+
+// A completed six-app adoption is extended without reseeding the team or
+// touching existing registrations. Both Home confirmations remain required.
+func TestEquipoJoinsExistingAdoption(t *testing.T) {
+ saved := Apps
+ t.Cleanup(func() { Apps = saved })
+ Apps = slices.DeleteFunc(slices.Clone(saved), func(a App) bool { return a.Slug == "equipo" })
+ a := newAdoption(t)
+ e := a.adopter(nil, newObserver())
+ a.planA(e)
+ oldTeam, _ := a.store.Team(a.ctx(), AdoptionLabel)
+ Apps = saved
+ a.home.AddEnvConsumer("equipo", "https://equipo.oficina.works")
+ a.tick(homeop.WindowLifetime * time.Second)
+ run, err := e.ContinueAdoption(a.ctx())
+ if err != nil {
+ t.Fatal(err)
+ }
+ r, _ := a.store.Run(a.ctx(), run)
+ if !slices.Equal(r.Apps, []string{"equipo"}) {
+ t.Fatalf("continuation: %v", r.Apps)
+ }
+ for role, p := range a.plans(run) {
+ if p.Kind != homeop.KindAddApps || p.ExistingTeam != oldTeam.TeamSQID || !slices.Equal(p.Apps, []string{"equipo"}) {
+ t.Fatalf("%s plan: %+v", role, p)
+ }
+ }
+ a.confirm(homeop.KindAddApps)
+ if r := a.drive(e, run, 10); r.State != "done" || r.Code != "awaiting-configuration" {
+ t.Fatalf("registration: %s %s", r.State, r.Code)
+ }
+ team, _ := a.store.Team(a.ctx(), AdoptionLabel)
+ if team.Apps["equipo"] != "active" {
+ t.Fatal("Equipo missing from existing local team")
+ }
+ var environments int
+ if err := a.store.DB().QueryRow("SELECT count(*) FROM environments").Scan(&environments); err != nil || environments != 0 {
+ t.Fatalf("adoption reserved environments: %d %v", environments, err)
+ }
+ if a.home.InstanceState("equipo") != "pending" {
+ t.Fatal("Equipo must stay pending before activation")
+ }
+ run = a.activate(e, "equipo")
+ if r := a.drive(e, run, 10); r.State != "done" || a.home.InstanceState("equipo") != "live" {
+ t.Fatalf("activation: %s %s", r.State, r.Code)
+ }
+ if a.home.TeamCount() != 1 || a.home.ConsumerCount() != 0 || a.home.Calls[homeop.DirectorySeedTeam] != 1 || a.home.Calls[homeop.CredentialOwnerSeed] != 1 || a.net.count() != 0 {
+ t.Fatal("adoption changed existing team, registry, or instances")
+ }
+}
+
+func TestEquipoCannotProvisionFreshInstances(t *testing.T) {
+ h := newHarness(t)
+ h.initialized()
+ e := h.engine(nil)
+ _, err := e.CreateTeam(h.ctx(), NewTeam{Label: "new-team", Name: "New", Owner: ownerCanary, Apps: []string{"docs", "equipo"}})
+ failCode(t, err, "unknown-app")
+ if err := h.store.CreateTeam(h.ctx(), "existing", "Existing", "existing", false, ownerCanary, []string{"docs"}); err != nil {
+ t.Fatal(err)
+ }
+ _, err = e.AddApps(h.ctx(), "existing", []string{"equipo"}, RunOptions{})
+ failCode(t, err, "unknown-app")
+}
diff --git a/provision/profile_test.go b/provision/profile_test.go
index 844cc59..5740794 100644
--- a/provision/profile_test.go
+++ b/provision/profile_test.go
@@ -17,7 +17,7 @@ import (
func TestReservedLabelsAreTheRuledList(t *testing.T) {
want := []string{
"oficina",
- "docs", "sheets", "slides", "calendar", "calls", "memoria", "fichas", "mapa",
+ "docs", "sheets", "slides", "calendar", "calls", "memoria", "equipo", "fichas", "mapa",
"api", "auth", "healthz", "static", "www", "id", "admin", "portero", "home", "alta", "base", "forget",
}
got := slices.Sorted(maps.Keys(ReservedLabels))
@@ -79,7 +79,7 @@ const outsideGolden = "3836921a89ecd9942eead9b48db0609ed5509586348231bb1c3608112
func recipesDigest(in Inputs) string {
var all [][]Key
- for _, a := range Apps {
+ for _, a := range ProvisioningApps() {
all = append(all, Recipe(a, in))
}
b, _ := json.Marshal(all)
@@ -137,7 +137,7 @@ func TestOwnDiffersOnlyInTheRuledKeys(t *testing.T) {
"memoria": {},
}
samples := Key{Name: "DOCS_SAMPLE_DOCUMENTS", Class: Set, Value: "1"}
- for _, app := range Apps {
+ for _, app := range ProvisioningApps() {
outside, own := goldenInputs, goldenInputs
outside.Profile, own.Profile = ProfileOutside, ProfileOwn
if d := recipeDiff(Recipe(app, outside), Recipe(app, own)); !maps.Equal(d, wantOwn[app.Slug]) {
@@ -177,7 +177,7 @@ func TestNoProfileWritesMemoriaAI(t *testing.T) {
if len(got) != 2 || got[0] != (OperatorKey{Name: "MEMORIA_AI", Value: "on"}) || got[1] != (OperatorKey{Name: "MEMORIA_TENSORX_KEY", Secret: true}) {
t.Fatalf("own memoria operator keys %v", got)
}
- for _, a := range Apps {
+ for _, a := range ProvisioningApps() {
if a.Slug != "memoria" && len(OperatorKeys(a, ProfileOwn)) != 0 {
t.Fatalf("%s has operator keys", a.Slug)
}
diff --git a/provision/store.go b/provision/store.go
index eeffa49..8e50300 100644
--- a/provision/store.go
+++ b/provision/store.go
@@ -216,6 +216,35 @@ func (s *Store) CreateAdoption(ctx context.Context, name, owner string, apps []s
return tx.Commit()
}
+// AddAdoptionApps records newly supported canonical apps in the existing
+// team. Adoption owns no environments and must never reserve one here.
+func (s *Store) AddAdoptionApps(ctx context.Context, apps []string) error {
+ if err := adoptionApps(apps); err != nil {
+ return err
+ }
+ t, err := s.Team(ctx, AdoptionLabel)
+ if err != nil {
+ return err
+ }
+ tx, err := s.db.BeginTx(ctx, nil)
+ if err != nil {
+ return err
+ }
+ defer tx.Rollback()
+ for _, app := range apps {
+ switch t.Apps[app] {
+ case "retired":
+ return errors.New("provision: retired adoption app")
+ case "active":
+ continue
+ }
+ if _, err := tx.ExecContext(ctx, "INSERT INTO team_apps(label,app,state) VALUES(?,?,'active')", AdoptionLabel, app); err != nil {
+ return err
+ }
+ }
+ return tx.Commit()
+}
+
// AddApps records apps joining a team (an add-apps run). A retired app is
// refused: its hostnames are dead for good.
func (s *Store) AddApps(ctx context.Context, label string, apps []string) error {