| 1 | package plan3test |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/copydesk" |
| 5 | "html" |
| 6 | "os" |
| 7 | "os/exec" |
| 8 | "path/filepath" |
| 9 | "regexp" |
| 10 | "slices" |
| 11 | "strconv" |
| 12 | "strings" |
| 13 | "testing" |
| 14 | |
| 15 | "amadan.net/oficina/equipo/internal/release" |
| 16 | "amadan.net/oficina/equipo/internal/runner/provider" |
| 17 | "amadan.net/oficina/equipo/internal/taskplan" |
| 18 | "amadan.net/oficina/equipo/internal/testci" |
| 19 | ) |
| 20 | |
| 21 | func TestPlan3ReleaseBoundaries(t *testing.T) { |
| 22 | t.Run("inventory", plan3CopyInventory) |
| 23 | t.Run("copy", func(t *testing.T) { |
| 24 | // Test the production release check with otherwise reviewed inputs, one |
| 25 | // pending surface at a time. A pending runtime entry cannot hide a doc gap. |
| 26 | files := []string{"internal/equipo/copy.go", "docs/api/equipo-v1.md", "docs/plan-3-acceptance.md", "docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md"} |
| 27 | root := t.TempDir() |
| 28 | write := func(t *testing.T, path, value string) { |
| 29 | t.Helper() |
| 30 | path = filepath.Join(root, path) |
| 31 | must(t, os.MkdirAll(filepath.Dir(path), 0700)) |
| 32 | must(t, os.WriteFile(path, []byte(value), 0600)) |
| 33 | } |
| 34 | for _, path := range files { |
| 35 | write(t, path, "reviewed fixture\n") |
| 36 | } |
| 37 | run := func(t *testing.T, want bool) { |
| 38 | t.Helper() |
| 39 | testci.Files(t, "../../scripts/plan3-copy-check.py") |
| 40 | cmd := exec.Command("python3", "-c", `import runpy,sys; m=runpy.run_path('../../scripts/plan3-copy-check.py'); sys.exit(0 if m['copy_reviewed'](m['Path'](sys.argv[1])) else 1)`, root) |
| 41 | out, err := cmd.CombinedOutput() |
| 42 | if (err == nil) != want { |
| 43 | t.Fatalf("copy gate accepted=%v want=%v: %s", err == nil, want, out) |
| 44 | } |
| 45 | } |
| 46 | // A document outside the reviewed surfaces does not hold a release. |
| 47 | write(t, "docs/superpowers/plans/another-plan.md", "COPY REVIEW REQUIRED\n") |
| 48 | run(t, true) |
| 49 | for _, path := range files { |
| 50 | t.Run(filepath.Base(path), func(t *testing.T) { |
| 51 | write(t, path, "COPY REVIEW REQUIRED\n") |
| 52 | run(t, false) |
| 53 | write(t, path, "reviewed fixture\n") |
| 54 | }) |
| 55 | } |
| 56 | write(t, files[2], "# Draft: pending copy review\n") |
| 57 | run(t, false) |
| 58 | write(t, files[2], "reviewed fixture\n") |
| 59 | must(t, os.Remove(filepath.Join(root, files[1]))) |
| 60 | run(t, false) |
| 61 | raw, err := os.ReadFile("../../scripts/runner-release-check.py") |
| 62 | must(t, err) |
| 63 | if !strings.Contains(string(raw), "plan3-copy-check.py") { |
| 64 | t.Fatal("versioned release does not invoke Plan 3 copy gate") |
| 65 | } |
| 66 | }) |
| 67 | t.Run("install", func(t *testing.T) { |
| 68 | // A build that recorded no tool proxy installs nothing. |
| 69 | m := release.BuildManifest() |
| 70 | if m.Installable() { |
| 71 | t.Fatal("a build with no recorded tool proxy is installable") |
| 72 | } |
| 73 | for _, name := range []string{"claude", "codex"} { |
| 74 | if provider.LoginVersion(name) != map[string]string{"claude": m.Claude, "codex": m.Codex}[name] { |
| 75 | t.Fatal("login and execution pins differ") |
| 76 | } |
| 77 | d := provider.NewLoginDriver() |
| 78 | if d.(interface{ Supported(string) bool }).Supported(name) { |
| 79 | t.Fatal("missing official login accepted") |
| 80 | } |
| 81 | } |
| 82 | m.Binaries = append(m.Binaries, release.BinaryDigest{Name: "equipo-tool-proxy", Version: m.LauncherVersion, SHA256: strings.Repeat("a", 64)}) |
| 83 | if !m.Installable() { |
| 84 | t.Fatal("a release that recorded its tool proxy is not installable") |
| 85 | } |
| 86 | for _, platform := range []string{"darwin/arm64", "linux/arm64", "hosted"} { |
| 87 | m.RunnerTarget = platform |
| 88 | if m.Installable() { |
| 89 | t.Fatal("unsupported runner installable", platform) |
| 90 | } |
| 91 | } |
| 92 | }) |
| 93 | t.Run("login_capability", func(t *testing.T) { |
| 94 | for _, name := range []string{"claude", "codex"} { |
| 95 | for _, mode := range []string{"version", "command"} { |
| 96 | t.Run(name+"/"+mode, func(t *testing.T) { |
| 97 | binary := acceptanceLoginCLI(t, name, "fixture@example.test") |
| 98 | raw, err := os.ReadFile(binary) |
| 99 | must(t, err) |
| 100 | script := string(raw) |
| 101 | if mode == "version" { |
| 102 | script = strings.ReplaceAll(script, provider.LoginVersion(name), "0.0.0") |
| 103 | } else { |
| 104 | script = strings.ReplaceAll(script, "'auth login --help'|'login --device-auth --help') exit 0", "'auth login --help'|'login --device-auth --help') exit 9") |
| 105 | } |
| 106 | must(t, os.WriteFile(binary, []byte(script), 0700)) |
| 107 | driver := provider.NewLoginDriver(provider.LoginOptions{ClaudePath: binary, CodexPath: binary}) |
| 108 | if driver.(interface{ Supported(string) bool }).Supported(name) { |
| 109 | t.Fatal("unsupported login capability accepted", mode) |
| 110 | } |
| 111 | }) |
| 112 | } |
| 113 | } |
| 114 | }) |
| 115 | t.Run("publication", func(t *testing.T) { |
| 116 | p := taskplan.BugPlan("feature", 1) |
| 117 | p.Kind = taskplan.Feature |
| 118 | p.Steps[0].Action = "scope" |
| 119 | p.Steps[0].Specialist = "product" |
| 120 | must(t, taskplan.Validate(p)) |
| 121 | for _, action := range []string{"review", "checks", "person"} { |
| 122 | bad := p |
| 123 | bad.Steps = nil |
| 124 | for _, step := range p.Steps { |
| 125 | if step.Action != action { |
| 126 | bad.Steps = append(bad.Steps, step) |
| 127 | } |
| 128 | } |
| 129 | if taskplan.Validate(bad) == nil { |
| 130 | t.Fatal("publishing guard removed", action) |
| 131 | } |
| 132 | } |
| 133 | for _, action := range []string{"merge", "deploy"} { |
| 134 | bad := p |
| 135 | bad.Steps = append([]taskplan.Step(nil), p.Steps...) |
| 136 | bad.Steps[len(bad.Steps)-1].Action = action |
| 137 | if taskplan.Validate(bad) == nil { |
| 138 | t.Fatal("automatic publication accepted", action) |
| 139 | } |
| 140 | } |
| 141 | }) |
| 142 | t.Run("API", personAPIContractCoverage) |
| 143 | } |
| 144 | |
| 145 | func plan3CopyInventory(t *testing.T) { |
| 146 | t.Helper() |
| 147 | current, err := os.ReadFile("../equipo/copy.go") |
| 148 | must(t, err) |
| 149 | base, err := exec.Command("git", "show", "ff73f89:internal/equipo/copy.go").Output() |
| 150 | must(t, err) |
| 151 | report, err := os.ReadFile("../../docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md") |
| 152 | must(t, err) |
| 153 | _, inventory, ok := strings.Cut(string(report), "## Plan 3 copy inventory (for Paul's review)") |
| 154 | if !ok { |
| 155 | t.Fatal("complete Plan 3 copy inventory missing") |
| 156 | } |
| 157 | inventory, _, _ = strings.Cut(inventory, "\n## ") |
| 158 | rows := map[string]string{} |
| 159 | for _, line := range strings.Split(inventory, "\n") { |
| 160 | if strings.HasPrefix(line, "| `") { |
| 161 | cells := strings.Split(line, " | ") |
| 162 | if len(cells) != 4 { |
| 163 | t.Fatal("malformed copy row") |
| 164 | } |
| 165 | key := strings.TrimPrefix(strings.TrimSuffix(cells[0], "`"), "| `") |
| 166 | rows[key] = html.UnescapeString(strings.ReplaceAll(cells[1], "<br>", "\n")) |
| 167 | acceptedAll := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)") |
| 168 | acceptedGuide := strings.HasPrefix(cells[2], "Guided live gate") && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)" |
| 169 | acceptedStarter := key == "scope" && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-05; starter-set brief)" |
| 170 | acceptedRound2 := slices.Contains([]string{"CopyCalibrationFunding"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context)" |
| 171 | // Paul delegated copy review on 2026-10-25; a row Astra's |
| 172 | // delegated pass accepted carries that marker. |
| 173 | acceptedDelegation := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)") || slices.Contains([]string{"docs/api/equipo-v1.md / COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)", "docs/api/equipo-v1.md / Retry writes and handle revisions", "docs/api/equipo-v1.md / Reconnect and answer questions", "docs/api/equipo-v1.md / Talk to your Coordinator from a device"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-19)") || slices.Contains([]string{"conversation.empty", "conversation.start.label", "conversation.start.bug", "conversation.start.bug_draft", "conversation.start.feature", "conversation.start.feature_draft", "conversation.start.project", "conversation.start.project_draft", "work.track.working"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20)") |
| 174 | // Paul's own review of the publish strings (base-publish). |
| 175 | approvedPublish := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-12, copy-review jadya3tfrmkf7t3ym2nqhpgira, unchanged)") |
| 176 | // Paul's own review of the Assistant lane's strings and API section. |
| 177 | approvedAssistant := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-13, copy-review 64nswfjbrpsw2pezhyi7y3nenq, unchanged)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-13, copy-review c3ipwcupsvwv7rpbj2kdbgrsyy, unchanged)") |
| 178 | // Paul's own review of the jobs strings and the API section's job prose. |
| 179 | approvedJobs := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-14, copy-review cvaxhn3pwgpxhpssj5cgizqtrq, unchanged)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-14, copy-review cvaxhn3pwgpxhpssj5cgizqtrq)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-14, copy-review mbvzxmewxxgud4ksakdb2m7pye)") |
| 180 | // Paul's own review of the Oficina connection's strings and API sentence. |
| 181 | approvedOficina := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-16, copy-review arfnqquz6wks4vdyxptv6ditju, unchanged)") |
| 182 | // Paul's own review of the failed-reply lines and Try again, and of the sign-in door's refusal. |
| 183 | approvedFailedReplies := strings.HasPrefix(key, "chat.failed.") && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-22, copy-review ipgtz3lqoo3rj6rpiodpekh6vu, unchanged)") || key == "signin.refused" && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-22, copy-review smart-door-copy-5, unchanged)") |
| 184 | // Paul's own review of the Engineering stop reasons. |
| 185 | approvedStopReasons := slices.Contains([]string{"work.reason.no_further_changes", "work.reason.tools_refused"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-23, copy-review eavqvil43jg2zs3wxx3kxp3bpm, unchanged)") |
| 186 | // Paul's approval of the no-access going-live strings, given in the |
| 187 | // coordinator's session (2026-11-26). |
| 188 | approvedNoAccess := slices.Contains([]string{"assistant.team.no_access", "assistant.job.detail.no_access"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-26, coordinator session, unchanged)") |
| 189 | // Paul's own review of the merge step's credential and hub reasons. |
| 190 | approvedMergeCredential := slices.Contains([]string{"work.reason.merge_credential", "work.reason.amadan_unreachable"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-25, copy-review 6wxwi7zo3fph5nu4nm6eipptfq, unchanged)") |
| 191 | // Paul's own review of the coordinator's stuck-task strings. |
| 192 | approvedStuckTasks := slices.Contains([]string{"chat.merge.retry_offer", "chat.activity.offer_retry", "chat.activity.retry_step", "work.tl.coordinator_retried"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-25, copy-review 6haczxo74hoyyuf7xkojgqd27e, unchanged)") |
| 193 | acceptedRoster := strings.HasPrefix(key, "roster.") && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)") |
| 194 | acceptedPlacement := strings.HasPrefix(key, "placement.") && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)") |
| 195 | acceptedAccess := slices.Contains([]string{"access.waiting", "access.reopen", "access.not_owned", "access.already", "access.unconfirmed", "access.missing", "access.uncheckable", "access.authority", "access.confirm_namespace", "access.namespace", "access.granted_note", "access.title", "access.confirm", "access.ask", "access.approve", "access.aside", "access.reason", "access.role", "access.confirmation", "access.filing", "access.pending", "access.approved", "access.declined", "access.expired", "access.limited", "access.failed", "access.operator", "access.continue"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-17)") |
| 196 | acceptedPlacementEdges := slices.Contains([]string{"placement.late_push", "placement.late_report"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-17)") |
| 197 | acceptedReportActions := slices.Contains([]string{"roster.talk", "roster.round_busy", "roster.round_done", "roster.merge_busy", "roster.merge_done"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)") |
| 198 | // Luna's delegated pass on the boot refusal for CARLOS mail submission. |
| 199 | acceptedInjection := slices.Contains([]string{"autonomy.title", "autonomy.lede", "autonomy.auto_merge_ci", "autonomy.auto_merge_ci_help", "autonomy.public_previews", "autonomy.public_previews_help", "autonomy.empty", "work.reason.base_checks_failed", "chat.merge.not.base_failed", "chat.merge.not.base_checks", "chat.merge.not.gates", "chat.merge.not.review_truncated", "work.reason.base_gate_unavailable", "work.reason.preview_secrets", "work.reason.preview_scanner", "work.reason.preview_public_disabled", "work.reason.preview_host", "work.reason.preview_headers", "autonomy.auto_merge_sensitive", "autonomy.auto_merge_sensitive_help", "work.reason.preview_header_missing", "preview.unsafe_question", "preview.unsafe_help", "preview.unsafe_open", "preview.wrapper_title"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-19)") |
| 200 | acceptedMail := key == "copyMissingSMTP" && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-17)") |
| 201 | // Luna's delegated pass on native slice 2's push strings and API |
| 202 | // prose (Paul, 2026-11-20: Luna's verdicts are the review). |
| 203 | acceptedPush := slices.Contains([]string{"copyLoggedPushPublic", "copyCarlosPushUnavailable", "copyPushBoth", "push.card.title", "push.card.body", "push.reply.title", "push.task.done", "push.task.cancelled", "push.task.failed", "push.activity.started", "docs/api/equipo-v1.md / Talk to your Coordinator from a device: set aside", "docs/api/equipo-v1.md / Receive pushes on a device"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-20)") |
| 204 | // Paul, 2026-11-20: Luna's verdicts are the agent-access copy review. |
| 205 | // Paul, 2026-11-22: Luna verdicts and the controller clarification are this slice's review. |
| 206 | acceptedAPIErrors := slices.Contains([]string{"api.repo_not_allowed", "api.card_answered", "api.card_stale", "api.confirmation_required", "api.coordinator_busy", "api.hold_bar", "api.idempotency_conflict", "api.models_not_allowed", "api.not_active", "api.not_askable", "api.not_mergeable", "api.not_retryable", "api.question_ended", "api.runner_offline", "api.task_busy", "api.task_ended", "api.task_merging", "api.turn_ended"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| 207 | acceptedNativeProjects := slices.Contains([]string{"projects.new_request", "projects.remove_selection"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| 208 | acceptedGitHubApp := slices.Contains([]string{"github.title", "github.connect", "github.account", "github.account_type", "github.organization", "github.personal_account", "github.create_app", "github.create_hint", "github.confirm_account", "github.repository_count", "github.confirm", "github.connected", "github.already_connected", "github.disconnect", "github.disconnect_hint", "github.pending", "github.pending_hint", "github.pending_approval", "github.check_again", "github.redirect_expired", "github.pending_expired", "github.setup_failed", "github.app_remains", "github.app_settings", "github.reconnect", "github.reconnect_hint", "github.check_failed", "github.not_connected", "github.suspended", "github.too_many", "github.choose_repositories"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| 209 | // Luna's verdict on the GitHub sweep log line, 2026-11-25. |
| 210 | acceptedGitHubSweep := key == "copyGitHubSweep" && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-25)") |
| 211 | acceptedGitHubEgress := key == "CopyGitHubEgress" && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| 212 | acceptedForgeSeam := key == "work.reason.proposal_failed" && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| 213 | // Luna's reviews of the paused-work strings and API prose (2026-11-24). |
| 214 | // Luna's two native preview API error verdicts, controller 2026-11-26. |
| 215 | // Luna's seven operator check-db verdicts, controller 2026-11-26. |
| 216 | acceptedDBCheck := slices.Contains([]string{"CopyDBPathMissing", "CopyDBPathInvalid", "CopyDBOpenFailed", "CopyDBCheckFailed", "CopyDBTimeout", "CopyDBMetadataFailed", "CopyDBArguments"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26)" |
| 217 | acceptedPreview := slices.Contains([]string{"api.preview_changed", "api.preview_expired"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26)" |
| 218 | // Luna's review of the Assistant's file strings, controller 2026-11-26. |
| 219 | acceptedAskFiles := slices.Contains([]string{"api.attachments_unavailable", "api.attachment_sent", "chat.activity.read_attachment"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26)" |
| 220 | acceptedPaused := slices.Contains(pausedCopyKeys, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-24)") |
| 221 | // Luna's review of the new team's grant card line (hub #48). |
| 222 | acceptedNewTeamCard := key == "chat.card.access_first" && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-24)") |
| 223 | acceptedCardNames := slices.Contains([]string{"projects.carried_selection", "projects.remember_name", "projects.name_to_remember", "projects.use_title", "docs/api/equipo-v1.md / Projects and starting a request"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| 224 | acceptedProjects := slices.Contains([]string{"projects.amadan", "projects.yours", "projects.can_add", "projects.add_reachable", "projects.names", "projects.names_hint", "projects.details", "projects.title", "projects.description", "projects.save", "projects.context", "projects.found", "projects.selected", "projects.owner_add", "projects.selection_lost", "projects.other", "projects.name_question", "projects.personal_names", "projects.forget_name", "docs/api/equipo-v1.md / Projects and starting a request"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-22)") |
| 225 | acceptedAgentAccess := slices.Contains([]string{"copyAgentConfig", "copyAgentForbidden", "copyAgentNotFound", "copyAgentUnavailable", "copyAgentTooLarge", "copyAgentInvalid", "copyAgentMedia", "copyAgentUnauthenticated", "agent.equipo_projects_list", "agent.equipo_tasks_list", "agent.equipo_task_get", "agent.equipo_needs_you", "docs/api/equipo-v1.md / Delegated read-only operations"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-20)") |
| 226 | // Luna's review of the places slice 1 strings (Paul, 2026-11-26: Luna reviews all but the place and publish cards, which stay his). |
| 227 | acceptedPlaces := slices.Contains([]string{"chat.publish_blocked", "chat.publish_unproven", "places.missing.no_place", "places.missing.no_runner", "places.missing.runner_outdated", "places.missing.carlos_outdated", "places.missing.no_login", "places.missing.no_deploy", "places.missing.not_owner", "work.reason.carlos_outdated", "work.reason.publish_secrets", "work.reason.publish_scanner", "work.reason.publish_key_missing", "work.reason.publish_mint_failed", "work.reason.publish_app_missing", "work.reason.publish_app_unproven", "chat.activity.places", "chat.activity.propose_place", "chat.activity.publish_site", "chat.activity.site_status", "settings.places", "settings.places_about", "places.title", "places.empty", "places.site_line", "places.site_live", "places.site_unconfirmed", "places.site_not_yet", "places.unplaced", "places.pending", "places.deploy_held", "places.deploy_lost", "places.deploy_none"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26)") |
| 228 | // Paul's own review of the place and publish cards (places slice 1). |
| 229 | approvedPlaces := slices.Contains([]string{"chat.card.place_question", "chat.card.place_option", "chat.card.place_chose", "chat.card.place_chose_not_now", "chat.card.publish_place_question", "chat.card.publish_setup_note", "chat.card.publish_mint_note", "chat.card.publish_stale"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-26, copy-review iic5rwpyavu7rnhiuvx7cnedzm, unchanged)") |
| 230 | // Luna's review of the Mac fixes' installer and task lines (Paul, 2026-11-28: Luna reviews all but the four Needs you card lines, which stay his). |
| 231 | acceptedMacFixes := slices.Contains([]string{"runner.mac.other_instance", "runner.install.other_instance", "runner.enrol.identity", "runner.mac.restored", "runner.mac.not_restored", "work.needs.mac_runner", "work.needs.mac_engineering", "work.waits.mac_runner", "work.waits.mac_engineering"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-28)" |
| 232 | // Paul's own review of Mac slice F's six lines, and Luna's of the rest (Paul delegated 2026-10-25), controller 2026-11-29. |
| 233 | approvedMacSliceF := slices.Contains(macSliceFPaulKeys, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-29, copy-review d62qn3bsdsvg6g2c42p2t3ptqm, unchanged)") |
| 234 | acceptedMacSliceF := slices.Contains(macSliceFLunaKeys, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-29)" |
| 235 | // Paul's own review of the four Mac Needs you card lines (2026-11-29). |
| 236 | approvedMacCards := slices.Contains([]string{"work.decide.mac_runner_why", "work.decide.mac_runner_ask", "work.decide.mac_engineering_why", "work.decide.mac_engineering_ask"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged)") |
| 237 | // Paul's own review of the Design card, recovery card, held card and |
| 238 | // direction card strings (dynamic specialists slice 1). |
| 239 | approvedDesign := slices.Contains([]string{"chat.specialist.capability.branch.edit", "chat.specialist.capability.page.render", "chat.card.specialist_project", "chat.specialist.added_record", "chat.specialist.added_ask", "chat.specialist.profile.design-v1", "chat.specialist.profile.research-v1", "chat.card.maker_removed", "chat.card.to_engineering", "chat.card.maker_removed_chose_to_engineering", "chat.held.design_limit", "work.decide.direction_ask_options", "chat.card.direction_note_options", "chat.card.build_note", "api.direction_note"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY APPROVED (Paul, 2026-11-29, copy-review v4fsltihakfhehduzju7dgu47m, unchanged)" |
| 240 | // Luna's review of the rest of dynamic specialists slice 1's strings. |
| 241 | acceptedDesign := slices.Contains([]string{"work.reason.specialist_no_grant", "work.design.design_limit", "work.design.design_runner_old", "work.design.design_renderer", "work.design.design_no_claude", "work.captures.option", "work.captures.alt", "work.captures.none", "work.captures.tree.work", "work.captures.tree.base", "work.captures.tree.diff", "work.explore.build_note"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-29)" |
| 242 | acceptedCopy := strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Copy, record-bound) sha256:"+copydesk.Hash(rows[key]) |
| 243 | // Paul's own review of the Assistant abilities strings (2026-11-28). |
| 244 | approvedAbilities := slices.Contains([]string{"assistant.ability.web.name", "assistant.ability.apps_read.name", "assistant.ability.apps_write.name", "assistant.ability.build.name", "assistant.ability.go_live.name", "assistant.ability.services.name", "assistant.ability.services_add.name", "assistant.job.detail.ability_off", "assistant.job.detail.ability_back", "assistant.job.detail.go_live_off", "chat.card.ability_off", "oficina.connect.ability_off", "services.inventory.question", "services.inventory.confirm", "assistant.activity.lookup", "assistant.lookup.fallback_sources"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)") |
| 245 | if !approvedDesign && !acceptedDesign && !approvedMacSliceF && !acceptedMacSliceF && !approvedMacCards && !approvedAbilities && !acceptedMacFixes && !acceptedGitHubApp && !acceptedGitHubSweep && !approvedPlaces && !acceptedPlaces && !acceptedAskFiles && !acceptedDBCheck && !acceptedPreview && !approvedNoAccess && !approvedMergeCredential && !approvedStuckTasks && !acceptedPaused && !acceptedNewTeamCard && !acceptedGitHubEgress && !acceptedForgeSeam && !acceptedAPIErrors && !acceptedNativeProjects && !acceptedInjection && !acceptedMail && !acceptedPush && !acceptedAgentAccess && !acceptedProjects && !acceptedCardNames && !acceptedAccess && !acceptedPlacementEdges && !acceptedPlacement && !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs && !approvedOficina && !approvedFailedReplies && !approvedStopReasons { |
| 246 | t.Fatal("entry has no copy review status or applicable acceptance", key) |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | patterns := []*regexp.Regexp{ |
| 251 | regexp.MustCompile(`(?m)^\s*"([^"]+)":\s*("(?:[^"\\]|\\.)*")`), |
| 252 | regexp.MustCompile(`(?m)^(?:const )?\s*([A-Za-z][A-Za-z0-9_]*)\s*=\s*("(?:[^"\\]|\\.)*")`), |
| 253 | } |
| 254 | for _, pattern := range patterns { |
| 255 | old := map[string]bool{} |
| 256 | for _, m := range pattern.FindAllStringSubmatch(string(base), -1) { |
| 257 | old[m[1]+"\x00"+m[2]] = true |
| 258 | } |
| 259 | for _, m := range pattern.FindAllStringSubmatch(string(current), -1) { |
| 260 | if old[m[1]+"\x00"+m[2]] { |
| 261 | continue |
| 262 | } |
| 263 | text, err := strconv.Unquote(m[2]) |
| 264 | must(t, err) |
| 265 | if rows[m[1]] != text && rows["runnerDraftCopy."+m[1]] != text { |
| 266 | t.Fatal("pending copy omitted or changed in review inventory", m[1]) |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | // Full API sections must be present, including the newest notification prose. |
| 271 | raw, err := os.ReadFile("../../docs/api/equipo-v1.md") |
| 272 | must(t, err) |
| 273 | for _, heading := range regexp.MustCompile(`(?m)^## (.+)$`).FindAllStringSubmatch(string(raw), -1) { |
| 274 | if rows["docs/api/equipo-v1.md / "+heading[1]] == "" { |
| 275 | t.Fatal("API section omitted", heading[1]) |
| 276 | } |
| 277 | } |
| 278 | if rows["docs/mockups/onboarding.html / Mac app enrolment note"] == "" || rows["runner.install.lingering"] == "" { |
| 279 | t.Fatal("setup proposals or diagnostics omitted") |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | // macSliceFPaulKeys are the six Mac slice F lines Paul approved unchanged |
| 284 | // (copy review d62qn3bsdsvg6g2c42p2t3ptqm, 2026-11-29). |
| 285 | var macSliceFPaulKeys = []string{"work.needs.mac_connection", "work.needs.mac_update", "chat.connections.add_to", "work.needs.mac_runner", "work.needs.mac_engineering", "work.step.made_on"} |
| 286 | |
| 287 | // macSliceFLunaKeys are the Mac slice F strings shipped exactly as Luna |
| 288 | // reviewed them (2026-11-29). |
| 289 | var macSliceFLunaKeys = []string{"runner.mac.home_open", "work.decide.mac_connection_why.no_connection", "work.decide.mac_connection_why.signed_out", "work.decide.mac_connection_why.limited", "work.decide.mac_connection_why.probes_pending", "work.decide.mac_connection_why.probes_failed", "work.decide.mac_connection_why.cli_unpinned", "work.decide.mac_connection_why.home_open", "work.decide.mac_connection_why.tainted", "work.decide.mac_update_why", "work.decide.mac_wait_ask", "work.reason.base_unavailable", "chat.merge.not.mac_made", "work.reason.workspace_too_large", "runner.probe_detail.turn_busy", "runner.unproven.record_incomplete", "runner.mac.home_open_folder", "runner.mac.keychain_item", "runner.unproven.credential_unproven", "chat.connections.reason.mac_claude_only", "work.reason.secret_in_candidate", "work.reason.engineering_unavailable", "work.ask.mac_offline", "runner.probe.F1", "runner.probe.F2", "runner.probe.F3", "runner.probe.F4", "runner.probe.F5", "runner.probe.F6", "runner.probe.F7", "work.step.no_xcode", "work.step.waiting_base", "work.decide.sandbox_held", "work.decide.unsandboxed_withdrawn", "runner.engineering", "runner.engineering.ready", "runner.engineering.no_connection", "runner.engineering.signed_out", "runner.engineering.limited", "runner.engineering.probes_pending", "runner.engineering.probes_failed", "runner.engineering.cli_unpinned", "runner.engineering.home_open", "runner.engineering.tainted", "runner.mac.holds_claude", "runner.tainted_held", "runner.unproven.processes_left", "runner.probe_detail.probe_limit", "runner.probe_detail.not_run", "runner.probe_detail.f5_skipped", "runner.probe_detail.inputs_changed", "runner.probe_detail.stale_runner", "runner.probe_detail.stale_settings", "runner.probe_detail.stale_cli", "runner.probe_detail.stale_xcode", "runner.probe_detail.stale_runtimes", "runner.probe_detail.future", "runner.probe_detail.expired", "runner.probe_detail.launch_not_started", "runner.probe_detail.launch_unproven", "runner.probe_detail.script_not_run", "runner.probe_detail.other_command", "runner.probe_detail.records_foreign", "runner.probe_detail.tree_unmade", "runner.probe_detail.not_prepared", "runner.probe_detail.no_loopback", "runner.probe_detail.script_unwritten", "runner.probe_detail.no_xcode", "runner.probe_detail.no_simulator", "runner.probe_detail.xcode_unavailable", "runner.probe_detail.simulator_unavailable", "runner.probe_detail.fixture_uncopied", "runner.probe_detail.fixture_unprepared", "runner.probe_detail.no_sentinel", "runner.probe_detail.allowed", "runner.probe_detail.not_shown_denied", "runner.probe_detail.not_collected", "runner.probe_detail.unix_only", "runner.probe_detail.reached_scratch", "runner.probe_detail.reached_tree", "runner.probe_detail.not_set_up", "runner.probe_detail.incomplete", "runner.probe_detail.tree_unsearched", "runner.probe_detail.secrets_unreadable", "runner.probe_detail.not_all_denied", "runner.probe_detail.loopback_hits", "runner.probe_detail.dns_control_failed", "runner.probe_detail.control_failed", "runner.probe_detail.no_token_file", "runner.probe_detail.no_procargs_reader", "runner.probe_detail.ps_control_failed", "runner.probe_detail.procargs_not_sandboxed", "runner.probe_detail.procargs_incomplete", "runner.probe_detail.process_list_unreadable", "runner.probe_detail.pipe_open", "runner.probe_detail.token_reached_scratch", "runner.probe_detail.token_reached_tree", "runner.probe_detail.token_reached", "runner.probe_detail.not_shown_tried", "runner.probe_detail.env_unreadable", "runner.probe_detail.token_in_env", "runner.probe_detail.control_read_missing", "runner.probe_detail.reached_model", "runner.probe_detail.not_shown_made", "runner.probe_detail.not_prescribed", "runner.probe_detail.unobserved", "runner.probe_detail.write_denied_place", "runner.probe_detail.write_through_link", "runner.probe_detail.hard_linked", "runner.probe_detail.link_not_refused", "runner.probe_detail.child_not_started", "runner.probe_detail.child_not_own_session", "runner.probe_detail.child_outlived", "runner.probe_detail.child_not_gone", "runner.probe_detail.f1_denied", "runner.probe_detail.f2_denied", "runner.probe_detail.other_home_os", "runner.probe_detail.f3_denied", "runner.probe_detail.f4_passed", "runner.probe_detail.f5_denied", "runner.probe_detail.unix_home", "runner.probe_detail.f6_denied", "runner.probe_detail.f7_denied", "runner.probe_detail.xcode", "runner.probe_detail.ios_simulators", "runner.probe_detail.computer", "runner.probe_detail.srt_missing", "runner.probe_detail.user_temp_refused", "runner.probe_detail.all_denied", "runner.probe_detail.end_unproven", "runner.probe_detail.srt_ran_xcode", "runner.probe_detail.srt_failed", "runner.probe_detail.srt_not_run", "runner.probe_detail.p3_keychain_denied", "runner.probe_detail.p3_keychain_unshown", "runner.probe_detail.p3_keychain_unprobed", "runner.probe_detail.p5_parked", "runner.probe_detail.homes_unchecked", "runner.probe_detail.homes_readable", "runner.probe_detail.homes_closed", "runner.probe_detail.agent_loaded", "runner.probe_detail.agent_not_loaded", "runner.probe_detail.sleep_unknown", "runner.probe_detail.sleep_off", "runner.probe_detail.sleep_after", "runner.probe_detail.test_not_started", "runner.probe_detail.group_gone", "runner.probe_detail.group_unproven", "runner.probe_detail.marked_left", "runner.probe_detail.still_running", "runner.probe_detail.simulators_shut", "runner.probe_detail.tree_removed", "runner.probe_detail.tree_not_removable", "runner.probe_detail.tool_missing", "runner.probe_detail.tool_version", "runner.probe_detail.node_old", "runner.probe_detail.srt_cannot_run", "work.step.waiting_publish", "runner.engineering.needs_p2"} |
| 290 | |
| 291 | // pausedCopyKeys are the paused-work strings and API prose Luna reviewed |
| 292 | // (2026-11-24). |
| 293 | var pausedCopyKeys = []string{"work.stage.paused", "work.stage.stopped", "work.stage.needs_you", "work.pause.until", "work.pause.since", "work.pause.moment", "time.tonight", "time.today_at", "time.tomorrow_at", "time.midnight", "time.in_hours", "work.pause.reason.headroom_out", "work.pause.reason.headroom_saving", "work.pause.reason.budget", "work.pause.reason.busy", "work.pause.reason.offline", "work.pause.next.by_itself", "work.pause.next.budget", "work.pause.next.busy", "work.pause.next.online", "work.pause.next.choose", "work.pause.next.try_again", "work.pause.next.update", "work.pause.next.spend_unknown", "work.pause.run_now_with", "work.pause.run_now_on", "work.pause.run_now_room", "work.pause.run_now_last", "work.pause.run_now_metered", "work.pause.check_machine", "work.pause.update_runner", "work.pause.connect", "work.pause.try_again", "work.pause.lead.spend_unknown", "work.pause.lead.no_connection", "work.pause.lead.too_old", "work.pause.lead.stopped", "assistant.job.paused", "assistant.job.paused_view", "assistant.job.detail.paused_allowance", "assistant.job.detail.paused_limit", "assistant.job.detail.paused_offline", "assistant.job.carry_on", "assistant.job.carry_on_note", "assistant.job.change_limit", "time.in_hours.one", "time.in_days.one", "api.carry_on_unavailable", "time.in_minutes", "time.in_minutes.one", "time.in_days", "time.when_in", "api.not_paused", "docs/api/equipo-v1.md / Talk to the Assistant: paused jobs", "docs/api/equipo-v1.md / Talk to the Assistant: only_if_unset", "api.already_running", "api.offer_changed", "work.pause.run_now_may_bill"} |
| 294 | |