oficina / equipo Public

chat: the Build option line comes only from copy.go

Task 6 review, fix round 1. buildThisOne had an inline English fallback
for work.explore.build_option, runtime copy outside copy.go. It is gone:
with no copy for the key, Build this one on an option is refused
(ErrInvalid, the transaction rolls back, the card stays open) instead of
inventing words. The older build_title and build_brief fallbacks are
unchanged.

Tests: TestBuildOptionNeedsItsWords (chat: no copy for the key, the
answer is ErrInvalid, nothing built, card open) and TestBuildOptionCopy
(equipo: copy.go holds the key with its exact text, and it formats with
the five arguments). TestContractDesignFinishLine already checks the
line, as copy.go has it, in a built brief.

TDD evidence:
- go test ./internal/equipo/chat/ -run TestBuildOptionNeedsItsWords:
  with the fallback in place it failed (the build succeeded, err nil).
- After: chat package, thintest -run 'Design|Explore', equipo -run
  'TestBuildOptionCopy|TestFormOption' ok; vet, gofmt, staticcheck clean.

Mutations (each alone, restored after), both FAILED their tests:
- F1 inline wording instead of refusing: TestBuildOptionNeedsItsWords
- F2 key missing from copy.go: TestBuildOptionCopy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev eb34b426f97852857c81211df1176eae7bb187d1 parent fddfda5
3 files changed, +38 −2
  • internal/equipo/card_option_test.go +14 −0
  • internal/equipo/chat/direction_options_test.go +21 −0
  • internal/equipo/chat/explore.go +3 −2
diff --git a/internal/equipo/card_option_test.go b/internal/equipo/card_option_test.go
index 7a87553e..cdbd7bed 100644
--- a/internal/equipo/card_option_test.go
+++ b/internal/equipo/card_option_test.go
@@ -1,6 +1,7 @@
package equipo
import (
+ "fmt"
"net/http"
"net/http/httptest"
"net/url"
@@ -38,3 +39,16 @@ func TestFormOption(t *testing.T) {
t.Fatalf("no step: %+v", got)
}
}
+
+// TestBuildOptionCopy: the brief's option line is copy.go's
+// work.explore.build_option, taking the option's number, Design's name
+// for it (quoted), the branch, the commit and the folder.
+func TestBuildOptionCopy(t *testing.T) {
+ text := copyText("work.explore.build_option")
+ if text != "Build option %d (Design's name for it: %s), from branch %s at commit %s, folder %s." {
+ t.Fatalf("work.explore.build_option is %q", text)
+ }
+ if got := fmt.Sprintf(text, 2, wire.QuotedData("Writing desk"), "equipo/tk1-x", "c0ffee0", "mockups/tk1/writing-desk/"); strings.Contains(got, "%!") {
+ t.Fatalf("formatted %q", got)
+ }
+}
diff --git a/internal/equipo/chat/direction_options_test.go b/internal/equipo/chat/direction_options_test.go
index a745ebc2..347c67e2 100644
--- a/internal/equipo/chat/direction_options_test.go
+++ b/internal/equipo/chat/direction_options_test.go
@@ -398,3 +398,24 @@ func TestFixRoundInheritsAsk(t *testing.T) {
}
})
}
+
+// TestBuildOptionNeedsItsWords: the option line's words live only in
+// copy.go; with no copy for work.explore.build_option, Build this one
+// on an option builds nothing (never words of its own) and the card
+// stays open.
+func TestBuildOptionNeedsItsWords(t *testing.T) {
+ r, _, task, s, c := roundOfThree(t)
+ words := r.s.authority.Copy
+ r.s.authority.Copy = func(key string) string {
+ if key == "work.explore.build_option" {
+ return ""
+ }
+ return words(key)
+ }
+ if err := r.answerCard(c, wire.AnswerCard{Choice: wire.ChoiceBuild, Option: &wire.OptionRef{Step: s.ID, Index: 1}}); !errors.Is(err, ErrInvalid) {
+ t.Fatalf("Build with no words for the option: %v", err)
+ }
+ if k := r.load(task); k.BuiltAs != "" || r.openDirection(task).ID != c.ID {
+ t.Fatalf("built %q", k.BuiltAs)
+ }
+}
diff --git a/internal/equipo/chat/explore.go b/internal/equipo/chat/explore.go
index d72e2ccc..b0d010f5 100644
--- a/internal/equipo/chat/explore.go
+++ b/internal/equipo/chat/explore.go
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"slices"
"strings"
@@ -391,9 +390,11 @@ func (t *txn) buildThisOne(k *taskRecord, p progress, note string, chosen *chose
folder += chosen.Option.Page + "/"
}
name := wire.QuotedData(chosen.Option.Name)
+ // Its words live only in copy.go: without them nothing names the
+ // option, so nothing is built.
line := t.words("work.explore.build_option", chosen.Index+1, name, k.Branch, short(ref), folder)
if line == "" {
- line = fmt.Sprintf("Build option %d (Design's name for it: %s), from branch %s at commit %s, folder %s.", chosen.Index+1, name, k.Branch, short(ref), folder)
+ return ErrInvalid
}
more += "\n\n" + line
}