oficina / equipo Public

test: cover Plan 3 screens in the perf gate

codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev 35a5095ce5310d685e64ff77f4fc5b391c72fe25 parent 57c8022
4 files changed, +185 −1
  • .rastrillo/budgets.txt +2 −0
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +37 −0
  • internal/equipotest/perf_plan3_test.go +134 −0
  • internal/equipotest/perf_test.go +12 −1
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index db729bd2..1c26ae86 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -32,3 +32,5 @@ size internal/plan3test - 11600 Task 21 adds the mandated 3b onboarding, termina
time internal/runner/forge 15s Plan 3 CI repair measured 10.527s for the full package (controller CI 10.407s); 15s leaves 42 percent headroom for local Git publication, exact-head readback and durable receipts on the shared runner.
time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full package (controller CI 10.709s); 15s leaves 40 percent above CI for account locking, policy validation, terminal-login fixtures and fsynced credential refresh.
+
+perf GET /releases/* skip Verified runner release file downloads, not browser GET screens.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 3a40a691..5655186a 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5499,3 +5499,40 @@ Final restored-source verification: all commands below exited 0.
- `git -C /home/paulca/amadan.net/oficina/equipo-plan-3 diff --check` and staged diff check: clean.
Thirty-one distinct guard mutations failed their tests and were restored. No source or test budget was raised. `make ci`, live provider tests, sign-ins and enrolment were not run. The full I5 gate remains the controller’s responsibility.
+
+
+## Task CI perf gate repair
+
+Added 29 missing parameterised GET paths with populated fixtures and content checks; recorded the verified release-file mount as a download skip. All screen budgets remain 150ms and boot remains 500ms. No production code or app-owned copy changed.
+
+`CGO_ENABLED=0 GOTOOLCHAIN=go1.26.10 nice -n 10 go test -tags perf -count=1 -p 1 -parallel 1 -run '^TestPerfScreens$' /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipotest` reproduced the existing failure before implementation, exit 1. The controller log contains 29 missing parameterised paths plus one opaque release mount, 30 coverage errors in total. The same command passed after seeding and mapping the resources. During fixture construction, the gate also caught invalid template-diff/thread content expectations and a finished question attempt; these were corrected by checking returned template/thread content and giving rendered evidence its own task.
+
+The same command ran for each mutation below. Every mutation was restored immediately; final `make perf` passed on restored files. These are test-fixture and coverage checks; no production guard was added or changed.
+
+| Mutation, applied separately | Observed failure, exit 1 |
+| --- | --- |
+| Delete `/api/v1/tasks/{id}/plan` from Paths | Parameter has no concrete Paths entry |
+| Delete task conversation cards | Card screen/API returns 404 |
+| Delete the seeded thread message | Expected thread content absent, even though the response is 200 |
+| Replace the installed specialist's template ID with a missing ID | Template diff returns 404 in HTML and 422 in API |
+| Delete the preference source message | Source screen returns 404 |
+| Change the suggestion author from coordinator to person | Suggestion screen returns 404 |
+| Corrupt the rendered artifact bytes | Rendered-change screen and PNG both return 409 |
+| Delete account setup rows | Account setup API returns 404 |
+| Remove the release mount skip record | Opaque mount has no screen inventory or skip reason |
+
+Final verification:
+
+All commands ran from `/home/paulca/amadan.net/oficina/equipo-plan-3` with Go 1.26.10 and `CGO_ENABLED=0`; all final checks exited 0.
+
+- `AMADAN_CI=1 nice -n 10 make -C /home/paulca/amadan.net/oficina/equipo-plan-3 perf`: both required perf tests ran. All 86 GET routes met 150ms; cold boot median 100ms, samples 96.447617ms, 99.533916ms and 102.375011ms, against 500ms.
+- `CGO_ENABLED=0 GOTOOLCHAIN=go1.26.10 AMADAN_CI=1 nice -n 10 go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 -p 1 /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipo/team /home/paulca/amadan.net/oficina/equipo-plan-3/internal/runner/containment`: both full packages passed uncached, 22.031s and 5.750s respectively. Test step 28.314s.
+- `make -C /home/paulca/amadan.net/oficina/equipo-plan-3 budget`: all 35 directories within existing size budgets.
+- `CGO_ENABLED=0 GOTOOLCHAIN=go1.26.10 go vet -tags perf /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipotest /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipo/team /home/paulca/amadan.net/oficina/equipo-plan-3/internal/runner/containment`: passed without output.
+- `gofmt -l /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipotest /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipo/team /home/paulca/amadan.net/oficina/equipo-plan-3/internal/runner/containment`: no output.
+- `CGO_ENABLED=0 GOTOOLCHAIN=go1.26.10 go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipotest /home/paulca/amadan.net/oficina/equipo-plan-3/internal/equipo/team /home/paulca/amadan.net/oficina/equipo-plan-3/internal/runner/containment`: passed without output.
+- `python3 /home/paulca/amadan.net/oficina/equipo-plan-3/scripts/runner-dead-references.py`: 954 text files, 1212 matches, zero failures.
+- `CGO_ENABLED=0 GOTOOLCHAIN=go1.26.10 go run github.com/zricethezav/gitleaks/v8@v8.30.1 git --no-banner --redact --log-opts=HEAD .`: 202 commits scanned before committing, no leaks. A final scan will include both repair commits.
+- `git -C /home/paulca/amadan.net/oficina/equipo-plan-3 diff --check`: passed.
+
+The per-screen median and worst times for all 86 routes are in `.superpowers/sdd/2026-11-04-equipo-plan-3-coordinator/perffix-report.md`. Slowest median and worst were `/conversation`, 19.22ms and 20.982ms.
diff --git a/internal/equipotest/perf_plan3_test.go b/internal/equipotest/perf_plan3_test.go
new file mode 100644
index 00000000..2caf44c2
--- /dev/null
+++ b/internal/equipotest/perf_plan3_test.go
@@ -0,0 +1,134 @@
+//go:build perf
+
+package equipotest
+
+import (
+ "bytes"
+ "crypto/ed25519"
+ "crypto/rand"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "image"
+ "image/png"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/equipo"
+ "amadan.net/oficina/equipo/internal/equipo/team"
+ "amadan.net/oficina/equipo/internal/taskplan"
+)
+
+func perfPlan3Paths(t *testing.T, f runnerFixture, paths, checks map[string]string, renderID, renderHash string) string {
+ t.Helper()
+ ctx := connectionContext
+ add := func(pattern, path, content string) { paths[pattern] = path; checks[path] = content }
+ p := taskplan.BugPlan("", f.project.ID)
+ p.Revision = 0
+ p.Steps[0].Instructions = "Repair the checkout error"
+ p, err := f.s.ProposePlan(ctx, ownerActor, p, equipo.Mutation{RequestID: "perf-plan"})
+ executionMust(t, err)
+ _, err = f.s.SendMessage(ctx, ownerActor, p.TaskID, "Checkout fails after payment", equipo.Mutation{RequestID: "perf-thread"})
+ executionMust(t, err)
+ taskPath := "/tasks/" + p.TaskID
+ for _, suffix := range []string{"/plan", "/thread"} {
+ add("/tasks/{id}"+suffix, taskPath+suffix, p.TaskID)
+ }
+ for _, suffix := range []string{"", "/plan", "/thread"} {
+ add("/api/v1/tasks/{id}"+suffix, "/api/v1"+taskPath+suffix, p.TaskID)
+ }
+ var card string
+ executionMust(t, f.d.Writer().QueryRow("SELECT id FROM conversation_cards WHERE resource_id=? AND kind='task'", p.TaskID).Scan(&card))
+ add("/api/v1/cards/{id}", "/api/v1/cards/"+card, p.TaskID)
+ add("/api/v1/questions/{id}", "/api/v1/questions/perf-question", "perf-question")
+ sp, err := f.s.InstallSpecialistTemplate(ctx, ownerActor, equipo.TemplateRef{ID: "qa", Version: 1}, equipo.Mutation{RequestID: "perf-specialist"})
+ executionMust(t, err)
+ for _, suffix := range []string{"/edit", "/template-diff"} {
+ add("/specialists/{key}"+suffix, "/specialists/"+sp.Key+suffix, sp.Key)
+ }
+ for _, suffix := range []string{"", "/template-diff"} {
+ add("/api/v1/specialists/{id}"+suffix, "/api/v1/specialists/"+sp.Key+suffix, sp.Key)
+ }
+ pb, err := f.s.InstallPlaybookTemplate(ctx, ownerActor, equipo.TemplateRef{ID: "playbook_bug", Version: 1}, equipo.Mutation{RequestID: "perf-playbook"})
+ executionMust(t, err)
+ for _, suffix := range []string{"", "/edit", "/template-diff"} {
+ add("/playbooks/{id}"+suffix, "/playbooks/"+pb.ID+suffix, pb.ID)
+ }
+ for _, suffix := range []string{"", "/template-diff"} {
+ add("/api/v1/playbooks/{id}"+suffix, "/api/v1/playbooks/"+pb.ID+suffix, pb.ID)
+ }
+ add("/api/v1/templates/{id}", "/api/v1/templates/qa", "qa")
+ projectPath := fmt.Sprintf("/api/v1/projects/%d", f.project.ID)
+ add("/api/v1/projects/{id}", projectPath, f.project.Name)
+ add("/api/v1/projects/{id}/settings", projectPath+"/settings", "approval_mode")
+ add("/api/v1/connections/{id}", "/api/v1/connections/"+f.ids["claude"], f.ids["claude"])
+ add("/api/v1/runners/{id}", "/api/v1/runners/"+f.principal.RunnerID, f.principal.RunnerID)
+ setup, err := f.s.RequestAccountSetup(ctx, ownerActor, f.principal.RunnerID, "codex", "Personal", equipo.Mutation{RequestID: "perf-setup"})
+ executionMust(t, err)
+ add("/api/v1/account-setups/{id}", "/api/v1/account-setups/"+setup.ID, setup.ID)
+ invite, err := f.s.CreateInvitation(ctx, ownerActor, ownerAddress, equipo.RoleOwner, equipo.Mutation{RequestID: "perf-invite"})
+ executionMust(t, err)
+ add("/invites/{id}", "/invites/"+invite.ID, invite.ID)
+ add("/api/v1/invites/{id}", "/api/v1/invites/"+invite.ID, invite.ID)
+ pub, _, err := ed25519.GenerateKey(rand.Reader)
+ executionMust(t, err)
+ device, err := f.s.BeginPersonDevice(ctx, base64.RawURLEncoding.EncodeToString(pub), "Perf phone", "perf-device")
+ executionMust(t, err)
+ add("/auth/devices/{id}", "/auth/devices/"+device.ID, "Perf phone")
+ source, err := f.s.SendMessage(ctx, ownerActor, "", "Use sentence case", equipo.Mutation{RequestID: "perf-source"})
+ executionMust(t, err)
+ add("/preferences/sources/{source}", "/preferences/sources/"+source.ID, source.Body)
+ suggestion, err := f.s.SendMessage(ctx, ownerActor, "", `{"draft":{"name":"Checkout checks","instructions":"Check checkout changes"}}`, equipo.Mutation{RequestID: "perf-suggestion"})
+ executionMust(t, err)
+ mustSQL(t, f.d, "UPDATE conversation_messages SET author_kind='coordinator',author_id='perf-coordinator' WHERE id=?", suggestion.ID)
+ mustSQL(t, f.d, "INSERT INTO conversation_cards(id,stream_id,kind,resource_id,sequence,revision) VALUES(?,?,'suggest_playbook',?,?,1)", suggestion.ID, suggestion.ConversationID, suggestion.ID, suggestion.Sequence)
+ add("/playbook-suggestions/{suggestion}", "/playbook-suggestions/"+suggestion.ID, "Checkout checks")
+ renderPath := "/tasks/" + renderID + "/rendered-change"
+ add("/tasks/{id}/rendered-change", renderPath, renderHash)
+ add("/tasks/{id}/rendered-change/{hash}.png", renderPath+"/"+renderHash+".png", "\x89PNG\r\n\x1a\n")
+ checks["/api/v1"+taskPath+"/thread"] = "Checkout fails after payment"
+ checks["/api/v1/specialists/"+sp.Key+"/template-diff"] = "qa"
+ checks["/api/v1/playbooks/"+pb.ID+"/template-diff"] = "playbook_bug"
+ checks["/conversation"] = source.Body
+ return strings.TrimPrefix(invite.ShareURL, testOrigin)
+}
+
+func perfRenderedChange(t *testing.T, f runnerFixture) (string, string) {
+ t.Helper()
+ task, err := f.s.CreateBug(connectionContext, ownerActor, f.project.ID, "Checkout wording", "perf-render")
+ executionMust(t, err)
+ task, err = f.s.PrepareBug(connectionContext, f.principal, task.ID, task.Revision, bugPrepared(f.connectionFixture))
+ executionMust(t, err)
+ task, err = f.s.StartBug(connectionContext, f.principal, task.ID, task.Revision)
+ executionMust(t, err)
+ scope := team.Scope{Account: f.a.Scope.Account, Job: task.JobID}
+ handle, err := f.x.Core.Claim(connectionContext, scope, "reproduce", "perf-runner", "perf-workspace")
+ executionMust(t, err)
+ job, err := f.x.Core.GetJob(connectionContext, scope)
+ executionMust(t, err)
+ encode := func(v any) []byte { b, e := json.Marshal(v); executionMust(t, e); return b }
+ job.Evidence.Predicate = team.PredicateRenderedChange
+ job.Evidence.RequireBugFreeze = false
+ job.Evidence.RequiredDecisions = []string{"copy"}
+ mustSQL(t, f.d, "UPDATE jobs SET evidence=? WHERE id=?", string(encode(job.Evidence)), job.ID)
+ mustSQL(t, f.d, "UPDATE tasks SET kind=? WHERE id=?", taskplan.RenderedChange, task.ID)
+ mustSQL(t, f.d, "INSERT INTO decision_owners(project_id,decision,address) VALUES(?,'copy',?)", f.project.ID, ownerAddress)
+ mustSQL(t, f.d, "UPDATE attempts SET state='succeeded',containment='contained' WHERE id=?", handle.Attempt)
+ cand := team.GitCandidate{Repository: job.Target.Repository, BaseCommit: job.Target.BaseRevision, Commit: strings.Repeat("d", 40), Tree: strings.Repeat("e", 40)}
+ raw, hash, err := team.CanonicalJSON(encode(cand))
+ executionMust(t, err)
+ diff := encode([]taskplan.RenderDiffFile{{Path: "checkout.html", Before: []byte("Pay"), After: []byte("Pay securely")}})
+ var pixels bytes.Buffer
+ executionMust(t, png.Encode(&pixels, image.NewRGBA(image.Rect(0, 0, 640, 480))))
+ render := team.RenderResult{Repository: cand.Repository, BaseCommit: cand.BaseCommit, CandidateHash: hash, DiffHash: team.ContentDigest(diff), RenderHash: team.ContentDigest(pixels.Bytes()), RecipeHash: strings.Repeat("b", 64), EnvironmentHash: strings.Repeat("c", 64)}
+ for _, blob := range [][]byte{diff, pixels.Bytes()} {
+ mustSQL(t, f.d, "INSERT INTO artifact_blobs(team_id,job_id,digest,bytes) VALUES(?,?,?,?)", scope.Account, job.ID, team.ContentDigest(blob), blob)
+ }
+ for _, art := range []struct {
+ role team.Role
+ body []byte
+ }{{team.RoleCandidate, raw}, {team.RoleRender, encode(render)}} {
+ mustSQL(t, f.d, "INSERT INTO artifacts(job_id,step_id,attempt_id,fence,role,hash,media_type,size,provenance,payload,created_at) VALUES(?,(SELECT step_id FROM attempts WHERE id=?),?,?,?,?,?,?,?,?,'2026-11-03T00:00:00Z')", job.ID, handle.Attempt, handle.Attempt, handle.Fence, art.role, team.ContentDigest(art.body), team.GitCandidateMediaType, len(art.body), `{"producer":"fixture","provider":"fixture","context":"fixture"}`, art.body)
+ }
+ return task.ID, render.RenderHash
+}
diff --git a/internal/equipotest/perf_test.go b/internal/equipotest/perf_test.go
index d2592d90..fc768c71 100644
--- a/internal/equipotest/perf_test.go
+++ b/internal/equipotest/perf_test.go
@@ -38,6 +38,7 @@ func TestPerfScreens(t *testing.T) {
executionMust(t, err)
mergeTask, err = f.s.StartBug(connectionContext, f.principal, mergeTask.ID, mergeTask.Revision)
executionMust(t, err)
+ renderID, renderHash := perfRenderedChange(t, f)
f.claim, err = f.x.Claim(connectionContext, f.principal, equipo.ClaimRequest{Version: 2, AssignmentID: f.a.ID, Revision: f.a.Revision, RequestID: "perf-claim"})
executionMust(t, err)
f.x.SetRunnerValidators(equipo.RunnerValidators{Question: func(context.Context, equipo.Assignment, equipo.RunnerRequest) error { return nil }})
@@ -66,13 +67,20 @@ func TestPerfScreens(t *testing.T) {
project := f.project
projectPath := fmt.Sprintf("/projects/%d", project.ID)
paths := map[string]string{"/projects/{id}": projectPath, "/projects/{id}/edit": projectPath + "/edit", "/specialists/{key}": "/specialists/engineering", "/tasks/{id}": "/tasks/" + f.a.TaskID, "/tasks/{id}/questions/{question}": "/tasks/" + f.a.TaskID + "/questions/perf-question", "/tasks/{id}/merge": "/tasks/" + mergeTask.ID + "/merge"}
+ planChecks := map[string]string{}
+ inviteURL := perfPlan3Paths(t, f, paths, planChecks, renderID, renderHash)
perftest.Screens(t, perftest.ScreenConfig{
Routes: r, Handler: h, Paths: paths,
Signin: func(c *http.Client, base string) {
signinEmail(t, c, base, testOrigin, mailer, ownerAddress)
+ res, err := c.Get(base + inviteURL)
+ executionMust(t, err)
+ res.Body.Close()
+ if res.StatusCode != http.StatusSeeOther {
+ t.Fatalf("invite bootstrap status %d", res.StatusCode)
+ }
checks := map[string]string{
"/work": `rst-shell-sidebar="index"`,
- "/conversation": `href="/tasks/new"`,
"/needs-you": `id="activity"`,
"/journey": `equipo-steps`,
"/projects": `data-project-count="1"`,
@@ -86,6 +94,9 @@ func TestPerfScreens(t *testing.T) {
for _, key := range []string{"product", "design", "copy", "engineering", "review"} {
checks["/specialists/"+key] = `action="/specialists/` + key + `"`
}
+ for path, want := range planChecks {
+ checks[path] = want
+ }
for path, want := range checks {
body := pageBody(t, c, base, path)
if !strings.Contains(body, want) {