oficina / home Public

List live Equipo instances in the native directory

Co-Authored-By: Codex GPT-6-Astra <noreply@openai.com>
claude agent, operated by paul@keymail.dev 0a91dbee81b4360fef0b69035886a9f98af0e648 parent 17cdcaf
7 files changed, +212 −4
  • implementation/equipo-native-mutations.json +38 −0
  • implementation/equipo-native-validation.md +28 −0
  • internal/home/directory_native.go +2 −2
  • internal/home/directory_runtime.go +1 −0
  • internal/home/directory_runtime_test.go +1 −1
  • internal/home/directorydata/canonical.go +1 −1
  • internal/home/equipo_native_test.go +141 −0

CI passed — run details

CI log
amadan: .amadan/timeout: this job's budget is 20m0s (this runner allows up to 30m0s)
=== vet ===
CGO_ENABLED=0 go vet ./...
CGO_ENABLED=0 go vet -tags browser ./internal/home/
cd handoff && CGO_ENABLED=0 go vet ./...
cd roster && CGO_ENABLED=0 go vet ./...
cd dashboard && CGO_ENABLED=0 go vet ./...
cd connect && CGO_ENABLED=0 go vet ./...
cd teammode && CGO_ENABLED=0 go vet ./...
=== fmt ===
=== build ===
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./cmd/home ./cmd/oficina ./internal/operatorlaunch
cd handoff && CGO_ENABLED=0 go build ./...
cd roster && CGO_ENABLED=0 go build ./...
cd dashboard && CGO_ENABLED=0 go build ./...
cd connect && CGO_ENABLED=0 go build ./...
cd teammode && CGO_ENABLED=0 go build ./...
=== go-test ===
CGO_ENABLED=0 go test -count=1 ./...
?   	amadan.net/oficina/home/cmd/home	[no test files]
ok  	amadan.net/oficina/home/cmd/home-placeholder	1.031s
?   	amadan.net/oficina/home/cmd/oficina	[no test files]
ok  	amadan.net/oficina/home/internal/guardstest	0.229s
ok  	amadan.net/oficina/home/internal/home	54.499s
ok  	amadan.net/oficina/home/internal/home/directorydata	1.429s
ok  	amadan.net/oficina/home/internal/home/logtest	0.003s
ok  	amadan.net/oficina/home/internal/home/seal	0.003s
ok  	amadan.net/oficina/home/internal/home/sealtest	0.004s
ok  	amadan.net/oficina/home/internal/home/wisp	0.043s
ok  	amadan.net/oficina/home/internal/operator	6.588s
ok  	amadan.net/oficina/home/internal/operatorlaunch	4.119s
ok  	amadan.net/oficina/home/internal/provisioner	50.553s
cd handoff && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/handoff	0.679s
ok  	amadan.net/oficina/home/handoff/seal	0.002s
cd roster && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/roster	5.122s
cd dashboard && CGO_ENABLED=0 go test ./...
ok  	amadan.net/oficina/home/dashboard	0.011s
cd connect && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/connect	1.439s
ok  	amadan.net/oficina/home/connect/linkstore	0.441s
cd teammode && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/teammode	0.112s
?   	amadan.net/oficina/home/teammode/teammodetest	[no test files]
=== race ===
go test -race -count=1 ./internal/home/ ./internal/operator/ ./internal/operatorlaunch/ ./internal/home/directorydata/
ok  	amadan.net/oficina/home/internal/home	331.850s
ok  	amadan.net/oficina/home/internal/operator	83.446s
ok  	amadan.net/oficina/home/internal/operatorlaunch	22.415s
ok  	amadan.net/oficina/home/internal/home/directorydata	24.484s
ok  	amadan.net/oficina/home/internal/provisioner	401.884s
cd handoff && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/handoff	13.085s
ok  	amadan.net/oficina/home/handoff/seal	1.015s
cd roster && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/roster	6.980s
cd dashboard && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/dashboard	1.067s
cd connect && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/connect	6.424s
ok  	amadan.net/oficina/home/connect/linkstore	6.521s
cd teammode && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/teammode	1.983s
?   	amadan.net/oficina/home/teammode/teammodetest	[no test files]
diff --git a/implementation/equipo-native-mutations.json b/implementation/equipo-native-mutations.json
new file mode 100644
index 0000000..d1accee
--- /dev/null
+++ b/implementation/equipo-native-mutations.json
@@ -0,0 +1,38 @@
+[
+ {
+ "mutation": "remove-integrated-app",
+ "test": "TestEquipoDirectoryRoutes",
+ "result": "killed",
+ "output": "--- FAIL: TestEquipoDirectoryRoutes (0.00s)\n equipo_native_test.go:24: Equipo missing from integrated registry\n equipo_native_test.go:33: Equipo route refused: {TeamID:0 TeamSQID: Label:blue App:equipo Origin:https://blue.equipo.oficina.works ConsumerID:blue-equipo}\nFAIL\nFAIL\tamadan.net/oficina/home/internal/home\t0.374s\nFAIL"
+ },
+ {
+ "mutation": "remove-canonical-mapping",
+ "test": "TestEquipoDirectoryRoutes",
+ "result": "killed",
+ "output": "--- FAIL: TestEquipoDirectoryRoutes (0.00s)\n equipo_native_test.go:33: Equipo route refused: {TeamID:0 TeamSQID: Label:oficina App:equipo Origin:https://equipo.oficina.works ConsumerID:equipo}\n equipo_native_test.go:43: Equipo canonical origin missing\nFAIL\nFAIL\tamadan.net/oficina/home/internal/home\t0.367s\nFAIL"
+ },
+ {
+ "mutation": "remove-native-filter-entry",
+ "test": "TestNativeDirectoryEquipoLiveMembership",
+ "result": "killed",
+ "output": "--- FAIL: TestNativeDirectoryEquipoLiveMembership (0.08s)\n equipo_native_test.go:94: Equipo teams: []\nFAIL\nFAIL\tamadan.net/oficina/home/internal/home\t0.459s\nFAIL"
+ },
+ {
+ "mutation": "admit-pending-and-disabled",
+ "test": "TestNativeDirectoryEquipoLiveMembership",
+ "result": "killed",
+ "output": "--- FAIL: TestNativeDirectoryEquipoLiveMembership (0.08s)\n equipo_native_test.go:94: teams: 503 {\"error\":\"unavailable\"}\nFAIL\nFAIL\tamadan.net/oficina/home/internal/home\t0.445s\nFAIL"
+ },
+ {
+ "mutation": "admit-non-native-apps",
+ "test": "TestNativeDirectoryEquipoLiveMembership",
+ "result": "killed",
+ "output": "--- FAIL: TestNativeDirectoryEquipoLiveMembership (0.08s)\n equipo_native_test.go:94: Equipo teams: [{SQID:AAA111 Label:oficina Name:Oficina Role:member Apps:[{App:slides Origin:https://slides.oficina.works ConsumerID:slides}]} {SQID:BBB222 Label:blue Name:Blue Role:member Apps:[{App:equipo Origin:https://blue.equipo.oficina.works ConsumerID:blue-equipo}]}]\nFAIL\nFAIL\tamadan.net/oficina/home/internal/home\t0.460s\nFAIL"
+ },
+ {
+ "mutation": "admit-unregistered-equipo-origin",
+ "test": "TestNativeAssertEquipoRegisteredOrigins",
+ "result": "killed",
+ "output": "--- FAIL: TestNativeAssertEquipoRegisteredOrigins (0.06s)\n equipo_native_test.go:138: unregistered Equipo admitted: https://green.equipo.oficina.works 200\nFAIL\nFAIL\tamadan.net/oficina/home/internal/home\t0.442s\nFAIL"
+ }
+]
diff --git a/implementation/equipo-native-validation.md b/implementation/equipo-native-validation.md
new file mode 100644
index 0000000..729d185
--- /dev/null
+++ b/implementation/equipo-native-validation.md
@@ -0,0 +1,28 @@
+# Equipo native directory โ€” validation, 2026-11-20
+
+Implementer: Codex GPT-6-Astra. Authority: Equipo's approved
+2026-11-20 native Oficina ID spec, parts 3โ€“4 (E4).
+
+Tests were written first. Before implementation, `TestEquipoDirectoryRoutes`
+failed on the missing integrated registry and both routes/canonical mapping;
+`TestNativeDirectoryEquipoLiveMembership` returned an empty list. The
+assertion test already passed: the existing exact-origin consumer policy
+needs no production change.
+
+`make test` passed: vet, formatting, portable and linux/arm64 builds, all
+module tests and race checks. The Linux-only provisioner checks run in CI.
+No browser checks are needed: neither markup, styles nor framework pins moved.
+
+The new tests exercise canonical and team-host Equipo routes, exact app,
+origin and consumer ID output, pending/disabled/foreign-team exclusion,
+membership removal, and exclusion of live Slides from the native list.
+Assertions cover the canonical env consumer and an active table consumer;
+retired, unregistered, port, case, suffix and path variants are refused.
+
+Six deliberate mutations were killed by named behavioral tests, with their
+failure output in `equipo-native-mutations.json`. Every mutation was restored.
+No schema or native assertion policy changed.
+
+Deployment and operator work remain separate. The matching Alta branch
+`native/equipo-adoption` carries the rollout and Equipo contract notes.
+Neither branch is a deployment approval or a completed canary review.
diff --git a/internal/home/directory_native.go b/internal/home/directory_native.go
index efa8fbd..6cfa3a1 100644
--- a/internal/home/directory_native.go
+++ b/internal/home/directory_native.go
@@ -32,7 +32,7 @@ const (
)
// nativeTeamApps are the native apps; the list is filtered to them (ยง9).
-var nativeTeamApps = map[string]bool{"calls": true, "docs": true, "sheets": true, "calendar": true, "memoria": true}
+var nativeTeamApps = map[string]bool{"calls": true, "docs": true, "sheets": true, "calendar": true, "memoria": true, "equipo": true}
// directoryNativeExchange is POST /native/oficina-id {assertion, verifier,
// target?, choice?}. It verifies the assertion against the pinned keys with
@@ -157,7 +157,7 @@ type nativeTeam struct {
}
// directoryNativeTeams is GET /api/native/teams: the person's teams with
-// live instances of the five native apps, from Store.AgentChoices. Zero
+// live instances of the six native apps, from Store.AgentChoices. Zero
// teams is an empty list, never an error; the app then shows its help and
// may link noTeamsHelpPath.
func (a *App) directoryNativeTeams(w http.ResponseWriter, r *http.Request) {
diff --git a/internal/home/directory_runtime.go b/internal/home/directory_runtime.go
index ddffc69..8d54e4a 100644
--- a/internal/home/directory_runtime.go
+++ b/internal/home/directory_runtime.go
@@ -21,6 +21,7 @@ func directoryApps() []directoryApp {
{slug: "calendar", name: "Calendar", integrated: true},
{slug: "calls", name: "Calls", integrated: true},
{slug: "memoria", name: "Memoria", integrated: true},
+ {slug: "equipo", name: "Equipo", integrated: true},
}
}
diff --git a/internal/home/directory_runtime_test.go b/internal/home/directory_runtime_test.go
index f4e4d20..193bd61 100644
--- a/internal/home/directory_runtime_test.go
+++ b/internal/home/directory_runtime_test.go
@@ -122,7 +122,7 @@ func TestDirectoryRuntimeAnonymousReturnAndRoleSchemaSeparation(t *testing.T) {
}
}
apps := directoryApps()
- if len(apps) != 6 || apps[0].slug != "docs" || !apps[0].integrated || apps[0].provisionable || apps[0].foreignOrigin != "" {
+ if len(apps) != 7 || apps[0].slug != "docs" || !apps[0].integrated || apps[0].provisionable || apps[0].foreignOrigin != "" {
t.Fatal("registry advertised unsupported provisioning")
}
for _, app := range apps {
diff --git a/internal/home/directorydata/canonical.go b/internal/home/directorydata/canonical.go
index 47fdad9..9e84bdf 100644
--- a/internal/home/directorydata/canonical.go
+++ b/internal/home/directorydata/canonical.go
@@ -4,7 +4,7 @@ package directorydata
// does not authorize a write: only a confirmed operator adoption may bind one.
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/home/equipo_native_test.go b/internal/home/equipo_native_test.go
new file mode 100644
index 0000000..4b6708a
--- /dev/null
+++ b/internal/home/equipo_native_test.go
@@ -0,0 +1,141 @@
+package home
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/home/internal/home/directorydata"
+ "amadan.net/rastrillo/rastrillo/migrate"
+ "amadan.net/rastrillo/rastrillo/sessions"
+)
+
+func TestEquipoDirectoryRoutes(t *testing.T) {
+ found := false
+ for _, app := range directoryApps() {
+ if app.slug == "equipo" {
+ found = app.name == "Equipo" && app.integrated && !app.provisionable && app.foreignOrigin == ""
+ }
+ }
+ if !found {
+ t.Error("Equipo missing from integrated registry")
+ }
+ for _, label := range []string{"oficina", "blue"} {
+ origin, consumer := "https://blue.equipo.oficina.works", "blue-equipo"
+ if label == "oficina" {
+ origin, consumer = "https://equipo.oficina.works", "equipo"
+ }
+ route := directorydata.Route{Label: label, App: "equipo", Origin: origin, ConsumerID: consumer}
+ if !directoryRouteAllowed(route) {
+ t.Errorf("Equipo route refused: %+v", route)
+ }
+ for _, bad := range []string{origin + "/", origin + ":443", origin + ".evil.invalid", "https://other.equipo.oficina.works"} {
+ route.Origin = bad
+ if directoryRouteAllowed(route) {
+ t.Errorf("unsafe Equipo route admitted: %+v", route)
+ }
+ }
+ }
+ if directorydata.CanonicalOrigin("equipo") != "https://equipo.oficina.works" {
+ t.Error("Equipo canonical origin missing")
+ }
+ for _, r := range []directorydata.Route{
+ {Label: "other", App: "equipo", ConsumerID: "equipo", Origin: "https://equipo.oficina.works"},
+ {Label: "oficina", App: "equipo", ConsumerID: "other", Origin: "https://equipo.oficina.works"},
+ {Label: "oficina", App: "unknown", ConsumerID: "unknown", Origin: "https://unknown.oficina.works"},
+ } {
+ if directoryRouteAllowed(r) {
+ t.Errorf("canonical binding widened: %+v", r)
+ }
+ }
+}
+
+func TestNativeDirectoryEquipoLiveMembership(t *testing.T) {
+ f := newMountedChooser(t)
+ rec := httptest.NewRecorder()
+ req := httptest.NewRequest("GET", directoryOrigin+"/", nil)
+ if err := f.p.directory.sessions.SignIn(rec, req, sessions.Session{Subject: chooserPerson, Method: nativeSessionMethod, AuthTime: time.Now()}); err != nil {
+ t.Fatal(err)
+ }
+ cookie := sessionCookie(rec)
+ exec := func(q string, args ...any) {
+ t.Helper()
+ if _, err := f.p.directory.db.Writer().Exec(q, args...); err != nil {
+ t.Fatal(err)
+ }
+ }
+ canonical := f.team(t, "AAA111", "oficina", "Oficina", chooserPerson)
+ team := f.team(t, "BBB222", "blue", "Blue", chooserPerson)
+ foreign := f.team(t, "CCC333", "other", "Other", chooserOther)
+ // Keep a live, non-native Slides instance to pin the native-only filter.
+ exec("UPDATE team_instances SET state='disabled'")
+ exec("INSERT INTO team_instances VALUES(?,?,?,?,?)", canonical, "slides", "https://slides.oficina.works", "slides", "live")
+ exec("INSERT INTO team_instances VALUES(?,?,?,?,?)", canonical, "equipo", "https://equipo.oficina.works", "equipo", "pending")
+ exec("INSERT INTO team_instances VALUES(?,?,?,?,?)", team, "equipo", "https://blue.equipo.oficina.works", "blue-equipo", "live")
+ exec("INSERT INTO team_instances VALUES(?,?,?,?,?)", foreign, "equipo", "https://other.equipo.oficina.works", "other-equipo", "live")
+ read := func() []nativeTeam {
+ t.Helper()
+ w := directoryCall(t, f, http.MethodGet, nativeTeamsPath, "", cookie, nil)
+ var got []nativeTeam
+ if w.Code != 200 || json.Unmarshal(w.Body.Bytes(), &got) != nil {
+ t.Fatalf("teams: %d %s", w.Code, w.Body.String())
+ }
+ return got
+ }
+ check := func(got []nativeTeam, sqid, label, name, origin, consumer string) {
+ t.Helper()
+ if len(got) != 1 || got[0].SQID != sqid || got[0].Label != label || got[0].Name != name || got[0].Role != "member" || len(got[0].Apps) != 1 || got[0].Apps[0] != (nativeTeamApp{"equipo", origin, consumer}) {
+ t.Fatalf("Equipo teams: %+v", got)
+ }
+ }
+ check(read(), "BBB222", "blue", "Blue", "https://blue.equipo.oficina.works", "blue-equipo")
+ exec("UPDATE team_instances SET state='disabled' WHERE team_id=? AND app='equipo'", team)
+ if got := read(); len(got) != 0 {
+ t.Fatalf("pending or disabled Equipo visible: %+v", got)
+ }
+ exec("UPDATE team_instances SET state='live' WHERE team_id=? AND app='equipo'", canonical)
+ check(read(), "AAA111", "oficina", "Oficina", "https://equipo.oficina.works", "equipo")
+ exec("DELETE FROM memberships WHERE person_ref=?", chooserPerson)
+ if got := read(); len(got) != 0 {
+ t.Fatalf("removed member still sees Equipo: %+v", got)
+ }
+}
+
+func TestNativeAssertEquipoRegisteredOrigins(t *testing.T) {
+ app := newNativeApp(t)
+ if _, err := migrate.Apply(context.Background(), app.db, (Runtime{role: "credential"}).ServingSchema()); err != nil {
+ t.Fatal(err)
+ }
+ app.runtime.consumers["equipo"] = "https://equipo.oficina.works"
+ app.runtime.registry = newConsumerRegistry(app.runtime.consumers)
+ for _, row := range [][3]string{{"blue-equipo", "https://blue.equipo.oficina.works", "active"}, {"gone-equipo", "https://gone.equipo.oficina.works", "retired"}} {
+ if _, err := app.db.Writer().Exec("INSERT INTO consumers VALUES(?,?,'equipo',?,'2026-11-20',?)", row[0], row[1], row[2], fixtureToken(1)); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := app.runtime.registry.load(context.Background(), app.db.Writer(), Origin, app.runtime.keys); err != nil {
+ t.Fatal(err)
+ }
+ d := newDevice(t)
+ grant, _ := d.signInByCode(t, app, "equipo@example.invalid")
+ _, challenge := verifierFor(91)
+ for _, origin := range []string{"https://equipo.oficina.works", "https://blue.equipo.oficina.works"} {
+ w := d.assert(t, app, grant, origin, challenge)
+ if w.Code != 200 {
+ t.Fatalf("registered Equipo: %d %s", w.Code, w.Body.String())
+ }
+ claims := verifyAssertion(t, app, decodeReply(t, w)["assertion"].(string), origin)
+ if claims.Audience != origin || claims.Nonce != mustNativeNonce(t, challenge) || claims.ExpiresAt-claims.IssuedAt != 120 {
+ t.Fatalf("Equipo claims: %+v", claims)
+ }
+ }
+ for _, origin := range []string{"https://equipo.oficina.works/", "https://EQUIPO.oficina.works", "https://equipo.oficina.works:443", "https://equipo.oficina.works.evil.invalid", "https://green.equipo.oficina.works", "https://gone.equipo.oficina.works"} {
+ w := d.assert(t, app, grant, origin, challenge)
+ if w.Code != 400 || decodeReply(t, w)["error"] != "audience" {
+ t.Fatalf("unregistered Equipo admitted: %s %d", origin, w.Code)
+ }
+ }
+}