oficina / alta Public

Ordinary add-apps and retire refuse the reserved label too

Home now reserves oficina for adoption only: ordinary create-team and
add-apps (and native seed) refuse it, and adopting the canonical apps is a
distinct signed existing_team scope on the plan (Home discussion 103, design
approved after revisions). Alta's add-apps executor cannot run adoption by
accepting the label, so AddApps refuses it as label-reserved before anything
is planned or recorded, and RetireApps refuses it as well (a destructive run
under the canonical label is never Alta's). Tested; removing the add-apps
guard fails the test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev ab61885655e35632f2719407a715921ac72e0269 parent d11844b
2 files changed, +18 −0
  • provision/engine.go +10 −0
  • provision/engine_test.go +8 −0

CI passed — run details

diff --git a/provision/engine.go b/provision/engine.go
index d7bc7a1..226fd33 100644
--- a/provision/engine.go
+++ b/provision/engine.go
@@ -200,6 +200,13 @@ func (e *Engine) CreateTeam(ctx context.Context, in NewTeam) (int64, error) {
// new plan of kind add-apps").
func (e *Engine) AddApps(ctx context.Context, label string, apps []string) (int64, error) {
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
+ // add-apps under the reserved label is refused there, so it is refused
+ // here before anything is planned or recorded.
+ if ReservedLabels[label] {
+ return 0, fail("label-reserved")
+ }
t, err := e.cfg.Store.Team(ctx, label)
if err != nil {
return 0, fail("no-team")
@@ -264,6 +271,9 @@ func (e *Engine) resumeCreate(ctx context.Context, t Team, apps []string) (int64
// RetireApps starts a deprovision run (§9). typed must equal the label.
func (e *Engine) RetireApps(ctx context.Context, label string, apps []string, typed string) (int64, error) {
apps = SortApps(apps)
+ if ReservedLabels[label] {
+ return 0, fail("label-reserved")
+ }
if typed != label {
return 0, fail("label-mismatch")
}
diff --git a/provision/engine_test.go b/provision/engine_test.go
index 3cd9891..78785f2 100644
--- a/provision/engine_test.go
+++ b/provision/engine_test.go
@@ -321,6 +321,14 @@ func TestLabelsAreNeverReused(t *testing.T) {
if used, err := h.store.LabelUsed(h.ctx(), "oficina"); err != nil || used {
t.Fatalf("a refused reserved label was recorded: %v %v", used, err)
}
+ // Ordinary add-apps and retire refuse it too: adopting the canonical
+ // apps is Home's own signed scope, never an ordinary plan under the label.
+ if _, err := e.AddApps(h.ctx(), "oficina", []string{"docs"}); !errors.As(err, &fl) || fl.Code != "label-reserved" {
+ t.Fatalf("add-apps under the reserved label: %v", err)
+ }
+ if _, err := e.RetireApps(h.ctx(), "oficina", []string{"docs"}, "oficina"); !errors.As(err, &fl) || fl.Code != "label-reserved" {
+ t.Fatalf("retire under the reserved label: %v", err)
+ }
// Alta's label rule is tighter than Home's.
for _, bad := range []string{"a", "Lagged", "-lag", "lag-", strings.Repeat("a", 33), "la_g"} {
if _, err := e.CreateTeam(h.ctx(), NewTeam{Label: bad, Name: "x", Owner: ownerCanary, Apps: []string{"docs"}}); !errors.As(err, &fl) || fl.Code != "label-shape" {