oficina / alta Public

Admit Base to canonical adoption with its operations door held

Human

Prompt

Make Base adoptable by Alta, and propose a rule for Paul to approve. Add
base to homeop.CanonicalOrigin (https://base.oficina.works), provision.Apps
(AdoptionOnly, prefix BASE) and re-pin homecompat to Home's
base-in-directory commit, test-first following Equipo's. Base's
/api/v1/operations already answers agent-shaped 401s, so preflight would
refuse it; work out what the delivery check proves and propose the
smallest rule that keeps its guarantee for Base.

From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.

Summary

base joins homeop.CanonicalOrigin, provision.Apps (adoption-only, BASE,
CARLOS_SMTP) and fakehome's registry; the label was already reserved.
BaselineOps(base) is agent-401: Base's own door (Equipo's Assistant, on
Base host tokens) already gives agent-access's exact challenge, and Base
reads neither agent key, so its check holds the door instead of watching
it move. Delivered admits only agent-401 -> agent-401 for Base; a 404, an
app 401 or a 200 without a token is refused. homecompat pins Home 9dd7fc0
and gains TestCanonicalOriginIsHomes, pinning Alta's registry to Home's.
Agent notes
Tests were written first and failed (registry, delivery, preflight,
check, homecompat refused plans). The rule is PROPOSED, not ruled: see
docs/base-adoption.md. Re-pin homecompat to Home's merge commit of
base-in-directory before merging. Between the pins Home changed only
directorydata/canonical.go and a test, not internal/operator's protocol.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 11ac4d966e90e8ad65c2f8499a98ecb35e9ee63a parent df1bd31
19 files changed, +314 −25
  • adopt/base_test.go +129 −0
  • adopt/delivery.go +16 −4
  • adopt/delivery_test.go +17 −6
  • adopt/deliverycheck.go +2 −1
  • adopt/homeidentity_test.go +1 −1
  • adopt/rehearsal_test.go +2 −0
  • adopt/snapshot_test.go +4 −1
  • cmd/alta-adopt/main_test.go +6 −4
  • homecompat/adopt_flow_test.go +2 −0
  • homecompat/adopt_test.go +1 −1
  • homecompat/canonical_test.go +26 −0
  • homecompat/compat_test.go +1 −1
  • homecompat/go.mod +3 −3
  • homecompat/go.sum +7 −0
  • homeop/fakehome/fakehome.go +1 −1
  • homeop/protocol.go +1 −1
  • provision/adopt_test.go +1 −1
  • provision/apps.go +1 −0
  • provision/base_test.go +93 −0
diff --git a/adopt/base_test.go b/adopt/base_test.go
new file mode 100644
index 0000000..c1bb068
--- /dev/null
+++ b/adopt/base_test.go
@@ -0,0 +1,129 @@
+package adopt
+
+import (
+ "net/http"
+ "testing"
+
+ "amadan.net/oficina/alta/provision"
+)
+
+// baseOps401 is Base's own operations door answering a request with no
+// host token, byte for byte as carlos/base 3f8e6d1 writes it
+// (internal/operations/operations.go serve and fail): Base serves
+// Equipo's Assistant there in agent-access's shapes, before any adoption.
+func baseOps401(w http.ResponseWriter) {
+ w.Header().Set("Cache-Control", "no-store")
+ w.Header().Set("WWW-Authenticate", "Bearer")
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusUnauthorized)
+ _, _ = w.Write([]byte("{\"error\":{\"code\":\"unauthenticated\",\"message\":\"Base did not accept this token.\"}}\n"))
+}
+
+// Base's door already gives agent-access's challenge, so the strict
+// classifier cannot tell it from agent-access. That is why Base's
+// baseline is agent-401 and not a 404 or an app 401.
+func TestBaseDoorIsAgentShapedBeforeAdoption(t *testing.T) {
+ if got := probeOf(t, &site{version: "v1", header: "v1", health: 200, ops: baseOps401}).Ops; got != OpsAgent401 {
+ t.Fatalf("Base's own door classified %q", got)
+ }
+}
+
+// The held-door rule (proposed for Paul's ruling, docs/base-adoption.md):
+// Base's door answers agent-access's challenge before configure and must
+// still answer it, and only it, after the restart. Every other move is
+// refused, an unauthenticated 200 included.
+func TestBaseAdoptionDelivery(t *testing.T) {
+ app, ok := provision.AppBySlug("base")
+ if !ok {
+ t.Fatal("Base missing")
+ }
+ if AgentKeys(app) != ([2]string{"BASE_AGENT_ISSUER", "BASE_AGENT_TEAM"}) {
+ t.Fatal("wrong Base agent keys")
+ }
+ if BaselineOps(app) != OpsAgent401 {
+ t.Fatal("Base's baseline is its own door's agent-shaped 401")
+ }
+ before := Delivery{Version: "v1.0.0", Header: "v1.0.0", Health: 200, Ops: OpsAgent401}
+ after := before
+ if err := Delivered(app, before, after); err != nil {
+ t.Fatalf("held door refused: %v", err)
+ }
+ for _, shape := range []OpsShape{OpsApp401, OpsAbsent, OpsAgent200, OpsOther} {
+ after.Ops = shape
+ if Delivered(app, before, after) == nil {
+ t.Fatalf("Base delivered with %s", shape)
+ }
+ }
+ for _, shape := range []OpsShape{OpsApp401, OpsAbsent, OpsAgent200, OpsOther, ""} {
+ before.Ops = shape
+ if Delivered(app, before, Delivery{Version: "v1.0.0", Header: "v1.0.0", Health: 200, Ops: OpsAgent401}) == nil {
+ t.Fatalf("Base delivered from a %q baseline", shape)
+ }
+ }
+ // The rest of the check is not relaxed for Base.
+ held := Delivery{Version: "v1.0.0", Header: "v1.0.0", Health: 200, Ops: OpsAgent401}
+ for name, now := range map[string]Delivery{
+ "version": {Version: "v1.0.1", Header: "v1.0.0", Health: 200, Ops: OpsAgent401},
+ "header": {Version: "v1.0.0", Header: "v1.0.1", Health: 200, Ops: OpsAgent401},
+ "health": {Version: "v1.0.0", Header: "v1.0.0", Health: 503, Ops: OpsAgent401},
+ "redirect": {Version: "v1.0.0", Header: "v1.0.0", Health: 200, Ops: OpsAgent401, Redirected: true},
+ } {
+ if Delivered(app, held, now) == nil {
+ t.Fatalf("Base delivered with a changed %s", name)
+ }
+ }
+ // A rollback restart holds the same door, as for every app.
+ if err := Reverted(held, held); err != nil {
+ t.Fatalf("Base rollback refused: %v", err)
+ }
+}
+
+// Preflight admits Base only with its door giving agent-access's
+// challenge: a 404 or an app 401 means the canonical host is not serving
+// the Base release whose door the held rule describes.
+func TestPreflightHoldsBaseToItsDoor(t *testing.T) {
+ for _, c := range []struct {
+ ops func(w http.ResponseWriter)
+ want string
+ }{
+ {baseOps401, ""},
+ {agent401, ""},
+ {nil, "operations-absent"},
+ {app401, "operations-app-401"},
+ {agent200(`{"operations":[]}`), "operations-agent-200"},
+ } {
+ x := newCarlosFixture(t, "base")
+ x.site.ops = c.ops
+ _, codes := x.preflight(t, nil)
+ if c.want == "" {
+ wantCodes(t, codes)
+ continue
+ }
+ wantCodes(t, codes, c.want)
+ }
+}
+
+// The runner's whole delivery check records for Base with its door
+// held, and refuses when the door stops answering as it did.
+func TestCheckDeliveryRecordsBaseWithItsDoorHeld(t *testing.T) {
+ w := newCheckFixture(t, "base")
+ w.site.ops = baseOps401
+ if err := w.check(); err != nil {
+ t.Fatalf("Base check refused: %v", err)
+ }
+ if _, ok, err := w.s.DeliveryCheck(t.Context(), "base"); err != nil || !ok {
+ t.Fatalf("no check recorded (ok %v, err %v)", ok, err)
+ }
+ for name, ops := range map[string]func(http.ResponseWriter){
+ "absent": nil,
+ "app-401": app401,
+ "open": agent200(`{"operations":[]}`),
+ } {
+ w := newCheckFixture(t, "base")
+ w.site.ops = ops
+ if err := w.check(); err == nil {
+ t.Fatalf("Base check recorded with its door %s", name)
+ }
+ w.noCheck(t)
+ }
+}
diff --git a/adopt/delivery.go b/adopt/delivery.go
index 7d16101..e6abe9c 100644
--- a/adopt/delivery.go
+++ b/adopt/delivery.go
@@ -21,7 +21,8 @@ import (
// (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).
+// writeFailure and writeJSON). Base's own door, which serves Equipo's
+// Assistant on a Base host token, already writes that exact shape.
type OpsShape string
const (
@@ -36,10 +37,19 @@ const (
// (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.
+//
+// Base is the one held door (proposed for Paul's ruling,
+// docs/base-adoption.md): its /api/v1/operations is already agent-shaped
+// before adoption (carlos/base internal/operations: a Bearer challenge,
+// no-store, error.code unauthenticated), and Base reads neither agent key,
+// so no restart can move it. Its baseline is agent-401 and Delivered
+// requires agent-401 still, never a 200 without a token.
func BaselineOps(app provision.App) OpsShape {
switch app.Slug {
case "slides", "calls", "equipo":
return OpsApp401
+ case "base":
+ return OpsAgent401
}
return OpsAbsent
}
@@ -251,8 +261,9 @@ func sameServing(before, now Delivery) error {
// version and header, no redirect, health 200, and the operations door
// moved as app's must (Paul, 2026-11-17). Before, it answered as
// BaselineOps(app) says; now, a 404 must have become agent-401 or
-// agent-200, and Slides' and Calls' own 401 must have become agent-401,
-// agent-access's challenge.
+// agent-200, Slides', Calls' and Equipo's own 401 must have become
+// agent-401, agent-access's challenge, and Base's agent-401 must still be
+// agent-401 (the held door: for Base this proves no delivery of the keys).
func Delivered(app provision.App, before, now Delivery) error {
if err := sameServing(before, now); err != nil {
return err
@@ -262,7 +273,8 @@ func Delivered(app provision.App, before, now Delivery) error {
// opsMoved is Delivered's operations-door rule: the door answered before
// as BaselineOps(app) says, and now gives agent-access's own answer as
-// app's must.
+// app's must. A 200 counts only from a 404, so Base's held door (an
+// agent-401 baseline) passes only as agent-401.
func opsMoved(app provision.App, before, now Delivery) error {
if before.Ops != BaselineOps(app) {
return errors.New("adopt: the operations door did not answer before the change as this app's does")
diff --git a/adopt/delivery_test.go b/adopt/delivery_test.go
index 3753933..84c77dc 100644
--- a/adopt/delivery_test.go
+++ b/adopt/delivery_test.go
@@ -324,24 +324,32 @@ func TestDeliveredRefusesVersionOrHeaderChange(t *testing.T) {
}
// The operations door must move as the app's must (Paul, 2026-11-17): for
-// four apps a 404 to agent-access's challenge or list, for Slides and
-// Calls their own 401 to agent-access's challenge, and nothing else.
+// four apps a 404 to agent-access's challenge or list, for Slides, Calls
+// and Equipo their own 401 to agent-access's challenge, for Base its own
+// agent-shaped 401 held (proposed, docs/base-adoption.md), and nothing else.
func TestDeliveredHoldsEachAppToItsTransition(t *testing.T) {
d := func(ops OpsShape) Delivery { return dl("v1", "v1", 200, ops) }
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" || a.Slug == "equipo" {
+ switch a.Slug {
+ case "base":
+ good = [][2]OpsShape{{OpsAgent401, OpsAgent401}}
+ bad = [][2]OpsShape{{OpsAgent401, OpsAgent200}, {OpsAgent401, OpsOther}, {OpsAgent401, OpsApp401},
+ {OpsAgent401, OpsAbsent}, {OpsAbsent, OpsAgent401}, {OpsApp401, OpsAgent401}}
+ case "slides", "calls", "equipo":
good = [][2]OpsShape{{OpsApp401, OpsAgent401}}
bad = [][2]OpsShape{{OpsApp401, OpsAgent200}, {OpsApp401, OpsOther}, {OpsApp401, OpsApp401},
{OpsAbsent, OpsAgent401}, {OpsAbsent, OpsAgent200}}
- } else {
+ default:
good = [][2]OpsShape{{OpsAbsent, OpsAgent401}, {OpsAbsent, OpsAgent200}}
bad = [][2]OpsShape{{OpsAbsent, OpsOther}, {OpsAbsent, OpsApp401}, {OpsAbsent, OpsAbsent},
{OpsApp401, OpsAgent401}, {OpsApp401, OpsAgent200}}
}
for _, before := range []OpsShape{OpsOther, OpsAgent200, OpsAgent401, ""} {
- bad = append(bad, [2]OpsShape{before, OpsAgent401})
+ if before != BaselineOps(a) {
+ bad = append(bad, [2]OpsShape{before, OpsAgent401})
+ }
}
for _, c := range good {
if err := Delivered(a, d(c[0]), d(c[1])); err != nil {
@@ -360,8 +368,11 @@ func TestDeliveredHoldsEachAppToItsTransition(t *testing.T) {
func TestBaselineOps(t *testing.T) {
for _, a := range provision.Apps {
want := OpsAbsent
- if a.Slug == "slides" || a.Slug == "calls" || a.Slug == "equipo" {
+ switch a.Slug {
+ case "slides", "calls", "equipo":
want = OpsApp401
+ case "base":
+ want = OpsAgent401
}
if got := BaselineOps(a); got != want {
t.Fatalf("%s: %q, want %q", a.Slug, got, want)
diff --git a/adopt/deliverycheck.go b/adopt/deliverycheck.go
index b151749..7591d20 100644
--- a/adopt/deliverycheck.go
+++ b/adopt/deliverycheck.go
@@ -30,7 +30,8 @@ import (
// (check-not-delivered): the canonical HTTPS /api/version body and
// X-Carlos-Version unchanged, no redirect, /healthz 200, and GET
// /api/v1/operations moved as the app's must: a 404 to agent-access's
-// challenge or list, Slides' and Calls' own 401 to its challenge;
+// challenge or list, Slides', Calls' and Equipo's own 401 to its
+// challenge, Base's challenge held (BaselineOps);
// - the served release, X-Carlos-Version, hashes to artifact
// (check-artifact-mismatch);
// - the fresh identity equals the after snapshot's
diff --git a/adopt/homeidentity_test.go b/adopt/homeidentity_test.go
index 8d30b9a..c4ed04b 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", "equipo"}
+ want := []string{"docs", "sheets", "slides", "calendar", "calls", "memoria", "equipo", "base"}
if len(provision.Apps) != len(want) {
t.Fatalf("%d apps", len(provision.Apps))
}
diff --git a/adopt/rehearsal_test.go b/adopt/rehearsal_test.go
index 51403ec..83e0077 100644
--- a/adopt/rehearsal_test.go
+++ b/adopt/rehearsal_test.go
@@ -262,6 +262,8 @@ func (r *rehearsal) site(w http.ResponseWriter, req *http.Request) {
agent401(w)
case BaselineOps(a) == OpsApp401:
app401(w)
+ case BaselineOps(a) == OpsAgent401:
+ baseOps401(w) // Base's own door, held through adoption
default:
http.NotFound(w, req)
}
diff --git a/adopt/snapshot_test.go b/adopt/snapshot_test.go
index 2a1c469..2223d0a 100644
--- a/adopt/snapshot_test.go
+++ b/adopt/snapshot_test.go
@@ -83,8 +83,11 @@ func newCarlosFixture(t *testing.T, slug string) *carlosFixture {
t.Cleanup(c.Close)
s := &site{version: valueVersion, header: valueVersion, health: 200}
- if BaselineOps(app) == OpsApp401 {
+ switch BaselineOps(app) {
+ case OpsApp401:
s.ops = app401
+ case OpsAgent401:
+ s.ops = agent401
}
srv := httptest.NewTLSServer(s.handler())
t.Cleanup(srv.Close)
diff --git a/cmd/alta-adopt/main_test.go b/cmd/alta-adopt/main_test.go
index 5c30b29..9315ae1 100644
--- a/cmd/alta-adopt/main_test.go
+++ b/cmd/alta-adopt/main_test.go
@@ -204,10 +204,12 @@ func (r *rig) site(w http.ResponseWriter, req *http.Request) {
case "/healthz":
w.WriteHeader(http.StatusOK)
case "/api/v1/operations":
- if !r.serving(slug) {
- // Slides and Calls answer their own middleware's 401 before
- // adoption; the others have no such route.
- if a, _ := provision.AppBySlug(slug); adopt.BaselineOps(a) == adopt.OpsApp401 {
+ // Base's own door already answers the challenge below, before
+ // adoption and after it (the held door).
+ if a, _ := provision.AppBySlug(slug); !r.serving(slug) && adopt.BaselineOps(a) != adopt.OpsAgent401 {
+ // Slides, Calls and Equipo answer their own middleware's 401
+ // before adoption; the others have no such route.
+ if adopt.BaselineOps(a) == adopt.OpsApp401 {
w.WriteHeader(http.StatusUnauthorized)
_, _ = io.WriteString(w, `{"error":"unauthorized"}`)
return
diff --git a/homecompat/adopt_flow_test.go b/homecompat/adopt_flow_test.go
index 336e5c8..1ff6ecb 100644
--- a/homecompat/adopt_flow_test.go
+++ b/homecompat/adopt_flow_test.go
@@ -36,6 +36,8 @@ var served = map[string]struct{ body, header string }{
"memoria": {"v0.1.0-47-g174fb45", "174fb45"},
// Synthetic supported Equipo release; production contract is a separate branch.
"equipo": {"v1.0.0", "v1.0.0"},
+ // Base's live release on 2026-11-23 (carlos/base main).
+ "base": {"3f8e6d1", "3f8e6d1"},
}
// observer stands in for the CARLOS half's activation gate: what it
diff --git a/homecompat/adopt_test.go b/homecompat/adopt_test.go
index fb265f1..469aa95 100644
--- a/homecompat/adopt_test.go
+++ b/homecompat/adopt_test.go
@@ -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,equipo,memoria,sheets,slides" || v.OwnerIndex != "" {
+ if v.Kind != homeop.KindAddApps || v.ExistingTeam != team.TeamSQID || strings.Join(v.Apps, ",") != "base,calendar,calls,equipo,memoria,sheets,slides" || v.OwnerIndex != "" {
t.Fatalf("%s continuation view: kind %s apps %v", role, v.Kind, v.Apps)
}
}
diff --git a/homecompat/canonical_test.go b/homecompat/canonical_test.go
new file mode 100644
index 0000000..5ffc68e
--- /dev/null
+++ b/homecompat/canonical_test.go
@@ -0,0 +1,26 @@
+package altacompat
+
+import (
+ "testing"
+
+ "amadan.net/oficina/alta/homeop"
+ "amadan.net/oficina/alta/provision"
+ "amadan.net/oficina/home/internal/home/directorydata"
+)
+
+// homeop.CanonicalOrigin is Alta's copy of Home's closed registry of
+// canonical instances. It must agree with Home's at the pinned commit for
+// every app Alta knows and for names neither may admit: an app Alta adopts
+// that Home does not bind is a plan Home refuses, and the reverse is an
+// app Alta would never offer.
+func TestCanonicalOriginIsHomes(t *testing.T) {
+ names := append(provision.Slugs(), "fichas", "mapa", "alta", "home", "", "Base", "base.oficina.works")
+ for _, app := range names {
+ if got, want := homeop.CanonicalOrigin(app), directorydata.CanonicalOrigin(app); got != want {
+ t.Errorf("CanonicalOrigin(%q): Alta %q, Home %q", app, got, want)
+ }
+ }
+ if homeop.CanonicalOrigin("base") != "https://base.oficina.works" {
+ t.Fatal("Base's canonical origin")
+ }
+}
diff --git a/homecompat/compat_test.go b/homecompat/compat_test.go
index 9421fb2..6494280 100644
--- a/homecompat/compat_test.go
+++ b/homecompat/compat_test.go
@@ -49,7 +49,7 @@ const (
)
var apps = []string{"docs", "sheets", "slides", "calendar", "calls", "memoria"}
-var adoptionApps = append(append([]string(nil), apps...), "equipo")
+var adoptionApps = append(append([]string(nil), apps...), "equipo", "base")
type home struct {
now time.Time
diff --git a/homecompat/go.mod b/homecompat/go.mod
index e3b9f24..f7b6df3 100644
--- a/homecompat/go.mod
+++ b/homecompat/go.mod
@@ -11,9 +11,9 @@ toolchain go1.26.5
require (
amadan.net/oficina/alta v0.0.0
- 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/oficina/home v0.1.1-0.20261123184145-9dd7fc0d3479
+ amadan.net/oficina/home/handoff v0.0.0-20261123184145-9dd7fc0d3479
+ amadan.net/oficina/home/roster v0.0.0-20261123184145-9dd7fc0d3479
amadan.net/rastrillo/rastrillo v0.38.0
)
diff --git a/homecompat/go.sum b/homecompat/go.sum
index f7dfeab..17ad786 100644
--- a/homecompat/go.sum
+++ b/homecompat/go.sum
@@ -2,12 +2,19 @@ amadan.net/carlos/platform.git/launchctx v0.0.0-20260911135504-fb577f96f7d1 h1:R
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.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 v0.1.1-0.20261123184145-9dd7fc0d3479 h1:hOUYDiV6uS10Q/MKQVvzUb1HVCeEXucF0KvE6HWG1/A=
+amadan.net/oficina/home v0.1.1-0.20261123184145-9dd7fc0d3479/go.mod h1:cQRud+PB1eu8PjY4xV0XlyNph9TYh5lJV4YAEc+8qik=
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/handoff v0.0.0-20261123184145-9dd7fc0d3479 h1:TYShc2wfKwBp8ywWJBcP2SdF3JaC4n8uHHV3buU6/Fs=
+amadan.net/oficina/home/handoff v0.0.0-20261123184145-9dd7fc0d3479/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/oficina/home/roster v0.0.0-20261123184145-9dd7fc0d3479 h1:JaXqojIk2Sz2hP/fm42anPRrm3U3ejRMlxoURRP2FcQ=
+amadan.net/oficina/home/roster v0.0.0-20261123184145-9dd7fc0d3479/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/fiesta v1.6.0 h1:ntdiZ/rvKd8wVxnlwkbaB8n0Fop9tIFL7bgJ3MUN3E4=
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=
diff --git a/homeop/fakehome/fakehome.go b/homeop/fakehome/fakehome.go
index fb600c7..0f47a00 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", "equipo"}
+var registry = []string{"docs", "sheets", "slides", "calendar", "calls", "memoria", "equipo", "base"}
type plan struct {
id, kind, label, name, owner string
diff --git a/homeop/protocol.go b/homeop/protocol.go
index 1636183..ad60ee3 100644
--- a/homeop/protocol.go
+++ b/homeop/protocol.go
@@ -161,7 +161,7 @@ type Plan struct {
// needs it too. homecompat pins it against Home's own.
func CanonicalOrigin(app string) string {
switch app {
- case "docs", "sheets", "slides", "memoria", "calendar", "calls", "equipo":
+ case "docs", "sheets", "slides", "memoria", "calendar", "calls", "equipo", "base":
return "https://" + app + ".oficina.works"
}
return ""
diff --git a/provision/adopt_test.go b/provision/adopt_test.go
index 211f258..675fa4d 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,equipo"
+ missing := "slides,calendar,calls,memoria,equipo,base"
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 3e6ae67..166bb39 100644
--- a/provision/apps.go
+++ b/provision/apps.go
@@ -105,6 +105,7 @@ var Apps = []App{
{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"},
+ {Slug: "base", Name: "Base", Prefix: "BASE", AdoptionOnly: true, MailPrefixes: []string{"CARLOS_SMTP"}, SubmitPrefix: "CARLOS_SMTP"},
}
// ProvisioningApps are the apps with supported fresh-instance recipes.
diff --git a/provision/base_test.go b/provision/base_test.go
new file mode 100644
index 0000000..88dbde4
--- /dev/null
+++ b/provision/base_test.go
@@ -0,0 +1,93 @@
+package provision
+
+import (
+ "slices"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/alta/homeop"
+)
+
+// Base joins canonical adoption as Equipo did: adoption-only, env prefix
+// BASE (Base reads BASE_HOME_ISSUER and BASE_HOME_CONSUMER_ID), and the
+// label was already reserved.
+func TestBaseAdoptionRegistry(t *testing.T) {
+ app, ok := AppBySlug("base")
+ if !ok || app.Prefix != "BASE" || app.Name != "Base" || !app.AdoptionOnly || app.Roster {
+ t.Fatalf("Base registry: %+v %v", app, ok)
+ }
+ for _, a := range ProvisioningApps() {
+ if a.Slug == "base" {
+ t.Fatal("Base advertised for fresh provisioning")
+ }
+ }
+ if !ReservedLabels["base"] {
+ t.Fatal("Base label is not reserved")
+ }
+ if homeop.CanonicalOrigin("base") != "https://base.oficina.works" || !slices.Equal(SortApps([]string{"base"}), []string{"base"}) {
+ t.Fatal("Base adoption mapping missing")
+ }
+}
+
+// A completed seven-app adoption is extended without reseeding the team or
+// touching existing registrations. Both Home confirmations remain required.
+func TestBaseJoinsExistingAdoption(t *testing.T) {
+ saved := Apps
+ t.Cleanup(func() { Apps = saved })
+ Apps = slices.DeleteFunc(slices.Clone(saved), func(a App) bool { return a.Slug == "base" })
+ a := newAdoption(t)
+ e := a.adopter(nil, newObserver())
+ a.planA(e)
+ oldTeam, _ := a.store.Team(a.ctx(), AdoptionLabel)
+ Apps = saved
+ a.home.AddEnvConsumer("base", "https://base.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{"base"}) {
+ 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{"base"}) {
+ 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["base"] != "active" {
+ t.Fatal("Base 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("base") != "pending" {
+ t.Fatal("Base must stay pending before activation")
+ }
+ run = a.activate(e, "base")
+ if r := a.drive(e, run, 10); r.State != "done" || a.home.InstanceState("base") != "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 TestBaseCannotProvisionFreshInstances(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", "base"}})
+ 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{"base"}, RunOptions{})
+ failCode(t, err, "unknown-app")
+}