oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "io/fs"
5 "regexp"
6 "strings"
7 "testing"
8
9 "amadan.net/oficina/equipo/internal/wire"
10)
11
12func TestTemplateCopyKeys(t *testing.T) {
13 keys := regexp.MustCompile(`\bcopy "([^"]+)"`)
14 err := fs.WalkDir(appFS, "templates", func(path string, entry fs.DirEntry, err error) error {
15 if err != nil {
16 return err
17 }
18 if entry.IsDir() {
19 return nil
20 }
21 raw, err := appFS.ReadFile(path)
22 if err != nil {
23 return err
24 }
25 for _, match := range keys.FindAllStringSubmatch(string(raw), -1) {
26 if copyText(match[1]) == "" {
27 t.Errorf("%s: missing copy key %s", path, match[1])
28 }
29 }
30 return nil
31 })
32 if err != nil {
33 t.Fatal(err)
34 }
35 for _, item := range Navigation() {
36 if copyText(item.CopyKey) == "" {
37 t.Errorf("missing navigation copy %s", item.CopyKey)
38 }
39 }
40}
41
42func TestRunnerCopyInventory(t *testing.T) {
43 for _, key := range PendingRunnerCopy() {
44 text := RunnerText(key)
45 if text == "" || regexp.MustCompile(`[—!]`).MatchString(text) {
46 t.Errorf("invalid draft %s: %q", key, text)
47 }
48 }
49 for _, key := range []string{"step.pending", "step.running", "step.waiting", "step.succeeded", "step.failed", "step.cancelled", "task.state.waiting", "task.cancel.requested", "task.cancel.stopped"} {
50 if copyText(key) == "" {
51 t.Error("missing state", key)
52 }
53 }
54}
55
56// A stopped step says what stopped it: every reason a runner may report
57// has its words, so none falls through to "something went wrong" (a
58// fix round's Checks said only that when the runner could not fetch the
59// repository, 2026-11-07).
60func TestStepReasonsHaveWords(t *testing.T) {
61 for reason := range wire.StepReasons {
62 if reason == "" || reason == "cancelled" || wire.DoneOnlyReasons[reason] {
63 continue
64 }
65 if copyText("work.reason."+reason) == "" {
66 t.Errorf("work.reason.%s has no words", reason)
67 }
68 }
69}
70
71// The Assistant's cards and notes reach a person who never has to go into
72// Equipo, so none of their words names it. assistant.team.own_work is the
73// model's own note and is not shown as copy.
74func TestAssistantCardCopyNamesNoEquipo(t *testing.T) {
75 all := map[string]string{}
76 for key, text := range pageCopy {
77 all[key] = text
78 }
79 for key, text := range runnerDraftCopy {
80 all[key] = text
81 }
82 for key, text := range all {
83 if !strings.HasPrefix(key, "assistant.outcome.") && !strings.HasPrefix(key, "assistant.team.") {
84 continue
85 }
86 if key == "assistant.team.own_work" {
87 continue
88 }
89 if strings.Contains(strings.ToLower(text), "equipo") {
90 t.Errorf("%s names Equipo: %q", key, text)
91 }
92 }
93}
94