Answer Fable's whole-branch review: own-only fits the team, no retyped seeded owner, honest words
- P2-1: add-apps refuses an own-only app on a team with any app written under outside (app-own-only), not only on the run's profile - P2-2: add-apps refuses a seeded app whose environment is unwritten once Alta has forgotten the owner (owner-forgotten-seeded): a retyped address is checked for shape only and would become the app's owner - P2-3: operator-keys-invalid names the exact marker path instead of a page that doesn't show it - P3: dead AdoptionOnly loop gone; README says BASE_NAME is the label and what Base-last means for a team without every app
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+95
−8
README.md+8 −1internal/web/app.go+2 −1internal/web/words.go+2 −1provision/engine.go+50 −5provision/seeded_test.go+33 −0
CI passed — run details
CI log
=== vet === go vet ./... === fmt === === test === CGO_ENABLED=0 go test ./... ok amadan.net/oficina/alta/adopt 23.029s ok amadan.net/oficina/alta/carlosop (cached) ? amadan.net/oficina/alta/carlosop/fakecarlos [no test files] ok amadan.net/oficina/alta/cmd/alta 0.165s ok amadan.net/oficina/alta/cmd/alta-adopt 37.222s ok amadan.net/oficina/alta/console (cached) ? amadan.net/oficina/alta/console/fakeconsole [no test files] ok amadan.net/oficina/alta/homeop (cached) ok amadan.net/oficina/alta/homeop/fakehome (cached) ok amadan.net/oficina/alta/internal/web 0.117s ok amadan.net/oficina/alta/provision 13.354s === compat === cd homecompat && go vet ./... && CGO_ENABLED=0 go test ./... ok amadan.net/oficina/home/altacompat 0.850s
diff --git a/README.md b/README.md| index 132f782..2b594a0 100644 |
| --- a/README.md |
| +++ b/README.md |
| @@ -107,9 +107,16 @@ plan, on branch `design/team-bundle`. |
| until the team has, or the run includes, every other app, Equipo |
| included. Its tile list (`BASE_OFICINA_APPS`, every other app) and |
| `BASE_EQUIPO_ORIGIN` then never depend on the run. A label over 19 |
| - characters cannot take Base (`label-too-long-for-base`). Base has no |
| + characters cannot take Base (`label-too-long-for-base`). A team that |
| + leaves out any app (Calls, say) cannot have Base, and a later |
| + `retire-apps` leaves that app's tile in Base's list. `BASE_NAME` is the |
| + label, because Alta keeps no display name in a recipe's inputs. Base has no |
| Store: no `BASE_PLATFORM_*`, `BASE_APPS_DOMAIN` or |
| `BASE_ASSERTION_KEY`. |
| +- **Created with the team, in practice.** Add-apps refuses Equipo or Base |
| + once Alta has forgotten the owner (`owner-forgotten-seeded`): a retyped |
| + address would become their owner on a shape check alone. It also |
| + refuses them on a team with any app written under `outside`. |
| - **No agent keys** (`<P>_AGENT_*`) on fresh instances, as for the six. |
| Agent access for fresh teams is a follow-up. |
| - **Execution is Paul's post-run pair**, like Memoria's AI. Set both: |
diff --git a/internal/web/app.go b/internal/web/app.go| index 21306c3..0535a33 100644 |
| --- a/internal/web/app.go |
| +++ b/internal/web/app.go |
| @@ -460,7 +460,8 @@ func (a *App) team(w http.ResponseWriter, r *http.Request) { |
| var apps, addable []string |
| // An own-only app (Equipo, Base) is offered only to a team whose |
| // written apps are all under profile own, and never on the adoption |
| - // label (team-bundle spec §5.1 rule 3). Step 0 refuses it anyway. |
| + // label (team-bundle spec §5.1 rule 3). Add-apps refuses it as well |
| + // (ownOnlyFits). |
| own := t.Label != provision.AdoptionLabel |
| for s := range t.Apps { |
| if opt, written, _ := a.cfg.Store.WrittenOptions(ctx, t.Label, s); written && opt.Profile != provision.ProfileOwn { |
diff --git a/internal/web/words.go b/internal/web/words.go| index 7e17b91..3f366e5 100644 |
| --- a/internal/web/words.go |
| +++ b/internal/web/words.go |
| @@ -60,11 +60,12 @@ var words = map[string]string{ |
| "label-shape": "A label is 3–32 lower-case letters, digits and hyphens, starting with a letter and ending with a letter or digit", |
| "label-double-hyphen": "A label never has two hyphens together (that is how punycode names begin)", |
| "profile-unknown": "Choose a profile: own or outside", |
| - "operator-keys-invalid": "A post-run pair is not as the app reads it: for Memoria, MEMORIA_AI is the variable on and MEMORIA_TENSORX_KEY a secret; for Equipo, EQUIPO_EXECUTION_ENABLED is 1 and EQUIPO_EXECUTION_MARKER_PATH names this instance's own directory, exactly as the team page shows", |
| + "operator-keys-invalid": "A post-run pair is not as the app reads it: for Memoria, MEMORIA_AI is the variable on and MEMORIA_TENSORX_KEY a secret; for Equipo, EQUIPO_EXECUTION_ENABLED is 1 and EQUIPO_EXECUTION_MARKER_PATH is exactly /data/instances/<label>-equipo.<account>.oncarlos.com/execution/witness", |
| "audit-operator-partial": "A post-run pair is half set: MEMORIA_AI and MEMORIA_TENSORX_KEY go together, and so do EQUIPO_EXECUTION_ENABLED and EQUIPO_EXECUTION_MARKER_PATH", |
| "app-own-only": "Equipo and Base are for your own teams only: choose the own profile, or leave them out", |
| "label-too-long-for-base": "Base needs a label of 19 characters or fewer", |
| "base-needs-team-apps": "Base comes last: the team needs every other app, Equipo included, before Base is added", |
| + "owner-forgotten-seeded": "Alta no longer holds this team's owner, and Equipo and Base write it: create them with the team instead", |
| "probe-mode-mismatch": "The app's /api/team answers in a mode this recipe was not written for", |
| "name-shape": "Give the team a name", |
| "owner-shape": "That is not a plain email address", |
diff --git a/provision/engine.go b/provision/engine.go| index d2b3a51..7b6802c 100644 |
| --- a/provision/engine.go |
| +++ b/provision/engine.go |
| @@ -213,11 +213,6 @@ 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 |
| @@ -246,6 +241,9 @@ func (e *Engine) AddApps(ctx context.Context, label string, apps []string, opt R |
| if r := AppsRefusal(label, apps, active, opt.Profile); r != "" { |
| return 0, fail(r) |
| } |
| + if err := e.ownOnlyFits(ctx, t, apps); err != nil { |
| + return 0, err |
| + } |
| // An environment already written keeps its choice: step 7 is done and |
| // never rewrites it, so a run under another choice would finish while |
| // changing nothing. Refused, naming the app. |
| @@ -941,3 +939,50 @@ func num(d map[string]any, k string) int64 { |
| } |
| func contains(list []string, s string) bool { return slices.Contains(list, s) } |
| + |
| +// ownOnlyFits is add-apps' half of the own-only rule (team-bundle spec |
| +// §5.1 rule 3) beyond the run's own profile: |
| +// - an own-only app joins only a team whose every written app is own |
| +// (app-own-only), so an outside team never gains one by an own run; |
| +// - a seeded app whose environment is not yet written needs the owner's |
| +// address Home confirmed at create-team, still held: once Alta has |
| +// forgotten it, a retyped address (checked for shape only) would |
| +// become the app's owner (owner-forgotten-seeded). Such a team takes |
| +// Equipo and Base by creating them with the team. |
| +func (e *Engine) ownOnlyFits(ctx context.Context, t Team, apps []string) error { |
| + var seeded []string |
| + own := false |
| + for _, slug := range apps { |
| + if app, ok := AppBySlug(slug); ok && app.OwnOnly { |
| + own = true |
| + if NeedsOwner(app) { |
| + seeded = append(seeded, slug) |
| + } |
| + } |
| + } |
| + if !own { |
| + return nil |
| + } |
| + for a := range t.Apps { |
| + written, ok, err := e.cfg.Store.WrittenOptions(ctx, t.Label, a) |
| + if err != nil { |
| + return err |
| + } |
| + if ok && written.Profile != ProfileOwn { |
| + return fail("app-own-only") |
| + } |
| + } |
| + if _, held, err := e.cfg.Store.Owner(ctx, t.Label); err != nil { |
| + return err |
| + } else if held { |
| + return nil |
| + } |
| + for _, slug := range seeded { |
| + if _, written, err := e.cfg.Store.WrittenOptions(ctx, t.Label, slug); err != nil { |
| + return err |
| + } else if !written { |
| + return fail("owner-forgotten-seeded") |
| + } |
| + } |
| + return nil |
| +} |
diff --git a/provision/seeded_test.go b/provision/seeded_test.go| index b84f2f5..a707ac0 100644 |
| --- a/provision/seeded_test.go |
| +++ b/provision/seeded_test.go |
| @@ -236,3 +236,36 @@ func TestSeededProbeParks(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +// Add-apps can't slip an own-only app onto a team written under outside, |
| +// nor make a retyped (shape-checked only) address a seeded app's owner. |
| +func TestAddAppsOwnOnlyFits(t *testing.T) { |
| + for _, tc := range []struct { |
| + name string |
| + profile Profile |
| + want string |
| + }{ |
| + {"outside team, own run", ProfileOutside, "app-own-only"}, |
| + {"own team, owner forgotten", ProfileOwn, "owner-forgotten-seeded"}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + h := newHarness(t) |
| + h.initialized() |
| + e := h.engine(nil) |
| + run, err := e.CreateTeam(h.ctx(), NewTeam{Label: "campbells", Name: "Campbells", Owner: ownerCanary, Apps: []string{"docs"}, Options: RunOptions{Profile: tc.profile}}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + h.confirm("create-team") |
| + if r := h.drive(e, run, 40); r.State != "done" { |
| + t.Fatalf("create: %s %s", r.State, r.Code) |
| + } |
| + if _, held, _ := h.store.Owner(h.ctx(), "campbells"); held { |
| + t.Fatal("the owner is still held with no recipe needing it") |
| + } |
| + h.tick(3600e9) |
| + _, err = e.AddApps(h.ctx(), "campbells", []string{"equipo"}, RunOptions{Profile: ProfileOwn}) |
| + failCode(t, err, tc.want) |
| + }) |
| + } |
| +} |