oficina / equipo Public

chat: building or asking for more of an option teaches taste

Task 7 (spec 8.6, Choices). Build this one and More like this on an
option (an answer with wire.OptionRef) now also write a choice note to
the person's design notebook, in the answer's transaction, after the
build or the new round succeeds: source choice, scope the task's
project, Question empty, on the task and card. A refused, retried or
conflicting answer writes nothing (the card conflict returns before),
and More options, Try again, Drop it and an older client's note-only
Build write none.

The body is Equipo's words from copy.go (work.explore.choice_build,
choice_like, and _name variants for an option with no direction, from
before protocol 39), with the option's name and direction each quoted
by wire.QuotedData as Design's words. The direction is folded onto one
line and clipped with an ellipsis to keep the body within 300
characters; the name never is. With no words in copy.go the answer is
refused (ErrInvalid), as Build's option line already is.

New file internal/equipo/chat/taste_choices.go (writeChoice,
choiceBody) rather than taste.go, which Task 8's review round is
editing; it uses Task 8's writeTaste unchanged. Four copy keys marked
pending with scripts/copy-status.py; its inventory rows land in the
controller's uncommitted CONTROLLER-REPORT-plan-3.md, not committed here.

TDD evidence
Command: go test ./internal/equipo/chat/ -run 'TestBuildWritesChoiceNote|TestLikeWritesChoiceNote|TestOtherAnswersWriteNoChoice|TestChoiceNeedsItsWords|TestChoiceBodyFits'
Failure seen (stub choiceBody returning no words, no call):
TestBuildWritesChoiceNote "0 notes", TestLikeWritesChoiceNote "notes []",
TestChoiceNeedsItsWords "Build with no words for the choice: <nil>",
TestChoiceBodyFits "body 0 characters, false".
After: all pass; chat package and internal/equipo -run
'Copy|Taste|Direction|Explore|Option' pass on a clean export of HEAD
plus these files; go vet clean.

Mutations (each broken, test failed, restored):
- no write call in answerDirection: Build, Like, NeedsItsWords fail
- note scoped team-wide: Build, Like fail
- Question set: Build, Like fail
- card id dropped: Build, Like fail
- name not quoted: Build, Like, BodyFits fail
- direction not folded onto one line: BodyFits fails
- no clipping: BodyFits fails
- no ellipsis on a clipped direction: BodyFits fails
- no name-only form for a direction-less option: BodyFits fails
- any answer gets words: BodyFits fails
- missing words skip the note instead of refusing: NeedsItsWords fails
- empty-words guard removed: survived at first (addTaste refuses an
  empty body downstream); BodyFits now pins it, fails
- copy.go text changed: TestChoiceNoteCopy (internal/equipo) fails
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev ecae1ecd828326c966b55e876ef4768669ba3717 parent c6cc2a0
5 files changed, +313 −0
  • internal/equipo/chat/explore.go +8 −0
  • internal/equipo/chat/taste_choices.go +70 −0
  • internal/equipo/chat/taste_choices_test.go +193 −0
  • internal/equipo/copy.go +8 −0
  • internal/equipo/taste_choice_copy_test.go +34 −0
diff --git a/internal/equipo/chat/explore.go b/internal/equipo/chat/explore.go
index b0d010f5..e1559400 100644
--- a/internal/equipo/chat/explore.go
+++ b/internal/equipo/chat/explore.go
@@ -345,6 +345,14 @@ func (t *txn) answerDirection(person string, c cardRecord, in wire.AnswerCard) (
return wire.Card{}, wire.Card{}, err
}
}
+ if chosen != nil {
+ // Build this one or More like this on an option teaches taste
+ // (spec 8.6, Choices): a choice note, in this transaction, so a
+ // refused or retried answer writes none.
+ if err := t.writeChoice(person, k, c.ID, in.Choice, chosen.Option); err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ }
out, err := t.cardView(c)
return out, wire.Card{}, err
}
diff --git a/internal/equipo/chat/taste_choices.go b/internal/equipo/chat/taste_choices.go
new file mode 100644
index 00000000..8f307b78
--- /dev/null
+++ b/internal/equipo/chat/taste_choices.go
@@ -0,0 +1,70 @@
+package chat
+
+import (
+ "strings"
+ "unicode/utf8"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Choice notes (spec 2026-11-28-dynamic-specialists.md, section 8.6,
+// Choices): Build this one and More like this on an option also teach
+// Design the person's taste, as a choice note in their notebook.
+
+// choiceKeys are the choice note's words in copy.go, per answer that
+// writes one: Build this one and More like this on an option.
+var choiceKeys = map[string]string{
+ wire.ChoiceBuild: "work.explore.choice_build",
+ wire.ChoiceLike: "work.explore.choice_like",
+}
+
+// writeChoice keeps the person's Build this one or More like this on
+// option o, in the answer's transaction, as a choice note for the task's
+// project with no question (spec 8.6, Choices). Its body is choiceBody's;
+// with no words for it the answer is refused (ErrInvalid), never written
+// in words of the instance's own.
+func (t *txn) writeChoice(person string, k taskRecord, card, choice string, o wire.StepDesignOption) error {
+ body, ok := t.choiceBody(choice, o)
+ if !ok {
+ return ErrInvalid
+ }
+ return t.writeTaste(person, k.ProjectID, wire.TasteSourceChoice, body, "", k.ID, card)
+}
+
+// choiceBody is a choice note's body: Equipo's words from copy.go naming
+// what the person did, with the option's name and its direction quoted
+// as Design's words (wire.QuotedData), so nothing reads them as the
+// person's. The direction is folded onto one line and, when the body
+// would pass wire.MaxTasteBox characters, clipped and ended with an
+// ellipsis; the name never is. An option with no direction (before
+// protocol 39) is named alone. ok is false for any other answer, with no
+// words for it, or when nothing fits.
+func (t *txn) choiceBody(choice string, o wire.StepDesignOption) (string, bool) {
+ key, ok := choiceKeys[choice]
+ if !ok {
+ return "", false
+ }
+ name := wire.QuotedData(o.Name)
+ fits := func(body string) bool { return utf8.RuneCountInString(strings.TrimSpace(body)) <= wire.MaxTasteBox }
+ dir := []rune(strings.Join(strings.Fields(o.Direction), " "))
+ if len(dir) == 0 {
+ body := t.words(key+"_name", name)
+ return body, body != "" && fits(body)
+ }
+ for n := len(dir); n > 0; {
+ d := string(dir[:n])
+ if n < len(dir) {
+ d = strings.TrimSpace(d) + "…"
+ }
+ body := t.words(key, name, wire.QuotedData(d))
+ if body == "" {
+ return "", false
+ }
+ over := utf8.RuneCountInString(strings.TrimSpace(body)) - wire.MaxTasteBox
+ if over <= 0 {
+ return body, true
+ }
+ n -= over
+ }
+ return "", false
+}
diff --git a/internal/equipo/chat/taste_choices_test.go b/internal/equipo/chat/taste_choices_test.go
new file mode 100644
index 00000000..5b2650d3
--- /dev/null
+++ b/internal/equipo/chat/taste_choices_test.go
@@ -0,0 +1,193 @@
+package chat
+
+import (
+ "errors"
+ "fmt"
+ "strings"
+ "testing"
+ "unicode/utf8"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Design feedback 1, Task 7 (spec 2026-11-28-dynamic-specialists.md,
+// section 8.6, Choices): Build this one and More like this on an option
+// also write a choice note for the person, in the answer's transaction:
+// Equipo's words naming what they did, with the option's name and its
+// direction quoted as Design's words (never as the person's). A refused,
+// retried or conflicting answer writes nothing, and so does every other
+// answer.
+
+// The choice note's words, as copy.go has them.
+var choiceWordsText = map[string]string{
+ "work.explore.choice_build": "Chose to build Design's option %s. Design's direction for it: %s",
+ "work.explore.choice_like": "Asked for more like Design's option %s. Design's direction for it: %s",
+ "work.explore.choice_build_name": "Chose to build Design's option %s.",
+ "work.explore.choice_like_name": "Asked for more like Design's option %s.",
+}
+
+// choiceWords gives the rig the choice note's words as copy.go has them.
+func (r *hkRig) choiceWords() {
+ words := r.s.authority.Copy
+ r.s.authority.Copy = func(key string) string {
+ if w, ok := choiceWordsText[key]; ok {
+ return w
+ }
+ return words(key)
+ }
+}
+
+// choiceRound is roundOfThree with the choice note's words.
+func choiceRound(t *testing.T) (*hkRig, string, stepRecord, cardRecord) {
+ r, _, task, s, c := roundOfThree(t)
+ r.choiceWords()
+ return r, task, s, c
+}
+
+// TestBuildWritesChoiceNote: Build this one on option 2 writes one choice
+// note for the creator, scoped to the task's project, with no question,
+// on the task and card: its name and direction quoted as Design's words,
+// never the person's note. Retrying the answer is the card conflict and
+// writes nothing more.
+func TestBuildWritesChoiceNote(t *testing.T) {
+ r, task, s, c := choiceRound(t)
+ in := wire.AnswerCard{Choice: wire.ChoiceBuild, Note: "With the yellow button.", Option: &wire.OptionRef{Step: s.ID, Index: 1}}
+ if err := r.answerCard(c, in); err != nil {
+ t.Fatal(err)
+ }
+ k := r.load(task)
+ if k.BuiltAs == "" || k.ProjectID == "" {
+ t.Fatalf("built %q in project %q", k.BuiltAs, k.ProjectID)
+ }
+ want := fmt.Sprintf(choiceWordsText["work.explore.choice_build"], wire.QuotedData("Writing desk"), wire.QuotedData("Writing desk direction: calm type, warm colour."))
+ rows := r.tasteRows(paul)
+ if len(rows) != 1 {
+ t.Fatalf("%d notes: %+v", len(rows), rows)
+ }
+ n := rows[0]
+ if n.Source != wire.TasteSourceChoice || n.Discipline != TasteDesign || n.ProjectID != k.ProjectID || n.Question != "" || n.TaskID != task || n.CardID != c.ID || n.Body != want {
+ t.Fatalf("note %+v\nwant body %q", n, want)
+ }
+ if strings.Contains(n.Body, "yellow") {
+ t.Fatalf("the person's note is in the choice: %q", n.Body)
+ }
+ if rev, _ := r.book(paul); rev != 1 {
+ t.Fatalf("revision %d", rev)
+ }
+ if err := r.answerCard(c, in); !errors.Is(err, ErrCardConflict) {
+ t.Fatalf("retry: %v", err)
+ }
+ if rows := r.tasteRows(paul); len(rows) != 1 {
+ t.Fatalf("a retry wrote: %+v", rows)
+ }
+ if rev, _ := r.book(paul); rev != 1 {
+ t.Fatalf("revision %d after a retry", rev)
+ }
+}
+
+// TestLikeWritesChoiceNote: More like this on option 3 writes one choice
+// note naming it, as Design's words; a refused Like (an option past the
+// round's) writes nothing.
+func TestLikeWritesChoiceNote(t *testing.T) {
+ r, task, s, c := choiceRound(t)
+ if err := r.answerCard(c, wire.AnswerCard{Choice: wire.ChoiceLike, Option: &wire.OptionRef{Step: s.ID, Index: 3}}); !errors.Is(err, ErrCardConflict) {
+ t.Fatalf("like past the options: %v", err)
+ }
+ if rows := r.tasteRows(paul); len(rows) != 0 {
+ t.Fatalf("a refused Like wrote: %+v", rows)
+ }
+ if err := r.answerCard(c, wire.AnswerCard{Choice: wire.ChoiceLike, Option: &wire.OptionRef{Step: s.ID, Index: 2}}); err != nil {
+ t.Fatal(err)
+ }
+ want := fmt.Sprintf(choiceWordsText["work.explore.choice_like"], wire.QuotedData("Bold"), wire.QuotedData("Bold direction: calm type, warm colour."))
+ rows := r.tasteRows(paul)
+ if len(rows) != 1 || rows[0].Source != wire.TasteSourceChoice || rows[0].Body != want || rows[0].Question != "" || rows[0].ProjectID != r.load(task).ProjectID || rows[0].CardID != c.ID {
+ t.Fatalf("notes %+v\nwant body %q", rows, want)
+ }
+}
+
+// TestOtherAnswersWriteNoChoice: More options, Try again, Drop it and an
+// older client's note-only Build name no option and write no note.
+func TestOtherAnswersWriteNoChoice(t *testing.T) {
+ for name, in := range map[string]wire.AnswerCard{
+ "more": {Choice: wire.ChoiceMore, Note: "Bolder."},
+ "again": {Choice: wire.ChoiceAgain, Note: "Bolder."},
+ "drop": {Choice: wire.ChoiceDrop},
+ "note only": {Choice: wire.ChoiceBuild, Note: "The calm one."},
+ } {
+ r, _, _, c := choiceRound(t)
+ if err := r.answerCard(c, in); err != nil {
+ t.Fatalf("%s: %v", name, err)
+ }
+ if rows := r.tasteRows(paul); len(rows) != 0 {
+ t.Fatalf("%s wrote: %+v", name, rows)
+ }
+ if rev, _ := r.book(paul); rev != -1 {
+ t.Fatalf("%s moved the revision to %d", name, rev)
+ }
+ }
+}
+
+// TestChoiceNeedsItsWords: the note's words live only in copy.go; with
+// none, Build this one on an option is refused (never words of its own),
+// nothing is built or written and the card stays open.
+func TestChoiceNeedsItsWords(t *testing.T) {
+ r, task, s, c := choiceRound(t)
+ words := r.s.authority.Copy
+ r.s.authority.Copy = func(key string) string {
+ if key == "work.explore.choice_build" {
+ 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 choice: %v", err)
+ }
+ if k := r.load(task); k.BuiltAs != "" || r.openDirection(task).ID != c.ID || len(r.tasteRows(paul)) != 0 {
+ t.Fatalf("built %q", k.BuiltAs)
+ }
+}
+
+// TestChoiceBodyFits: the body stays within wire.MaxTasteBox characters:
+// a long direction (folded onto one line) is clipped, marked with an
+// ellipsis, never the name; an option with no direction (before protocol
+// 39) is named alone; any other answer, or one with no words in copy.go,
+// has no body.
+func TestChoiceBodyFits(t *testing.T) {
+ r, _, _, _ := choiceRound(t)
+ name := strings.Repeat("Desk ", 10) + "Writing"
+ long := "Warm paper,\n\tquiet type. " + strings.Repeat("é", 400)
+ r.must(r.tx(func(t *txn) error {
+ body, ok := t.choiceBody(wire.ChoiceBuild, wire.StepDesignOption{Name: name, Direction: long})
+ if !ok || utf8.RuneCountInString(body) > wire.MaxTasteBox || utf8.RuneCountInString(body) < wire.MaxTasteBox-2 {
+ r.t.Fatalf("body %d characters, %v: %q", utf8.RuneCountInString(body), ok, body)
+ }
+ head := fmt.Sprintf(choiceWordsText["work.explore.choice_build"], wire.QuotedData(name), `"Warm paper, quiet type. éé`)
+ if !strings.HasPrefix(body, head) || !strings.HasSuffix(body, `é…"`) || strings.ContainsAny(body, "\n\t") {
+ r.t.Fatalf("body %q", body)
+ }
+ short := "Calm type.\nWarm colour."
+ if body, ok := t.choiceBody(wire.ChoiceLike, wire.StepDesignOption{Name: "Calm", Direction: short}); !ok || body != fmt.Sprintf(choiceWordsText["work.explore.choice_like"], wire.QuotedData("Calm"), wire.QuotedData("Calm type. Warm colour.")) {
+ r.t.Fatalf("short body %q", body)
+ }
+ for choice, key := range map[string]string{wire.ChoiceBuild: "work.explore.choice_build_name", wire.ChoiceLike: "work.explore.choice_like_name"} {
+ if body, ok := t.choiceBody(choice, wire.StepDesignOption{Name: "Calm"}); !ok || body != fmt.Sprintf(choiceWordsText[key], wire.QuotedData("Calm")) {
+ r.t.Fatalf("%s with no direction: %q", choice, body)
+ }
+ }
+ for _, choice := range []string{wire.ChoiceMore, wire.ChoiceAgain, wire.ChoiceDrop, ""} {
+ if body, ok := t.choiceBody(choice, wire.StepDesignOption{Name: "Calm", Direction: short}); ok || body != "" {
+ r.t.Fatalf("%q has words: %q", choice, body)
+ }
+ }
+ words := r.s.authority.Copy
+ r.s.authority.Copy = func(string) string { return "" }
+ defer func() { r.s.authority.Copy = words }()
+ for _, o := range []wire.StepDesignOption{{Name: "Calm", Direction: short}, {Name: "Calm"}} {
+ if body, ok := t.choiceBody(wire.ChoiceLike, o); ok || body != "" {
+ r.t.Fatalf("no words for %+v, yet %q", o, body)
+ }
+ }
+ return nil
+ }))
+}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 116f5486..0ab88ece 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -2065,6 +2065,14 @@ var pageCopy = map[string]string{
"work.explore.build_note": "%s said which option to build in their own words: %s", // COPY ACCEPTED BY DELEGATION (Luna, 2026-11-29)
"work.explore.build_option": "Build option %d (Design's name for it: %s), from branch %s at commit %s, folder %s.", // COPY REVIEW PENDING
+ // Design feedback 1, task 7: the choice note Build this one and More
+ // like this on an option write to the person's design notebook. Each
+ // %s is Design's words, quoted: the option's name, then its direction.
+ "work.explore.choice_build": "Chose to build Design's option %s. Design's direction for it: %s", // COPY REVIEW PENDING
+ "work.explore.choice_like": "Asked for more like Design's option %s. Design's direction for it: %s", // COPY REVIEW PENDING
+ "work.explore.choice_build_name": "Chose to build Design's option %s.", // COPY REVIEW PENDING
+ "work.explore.choice_like_name": "Asked for more like Design's option %s.", // COPY REVIEW PENDING
+
// Design feedback 1, task 5: capture captions, a link to earlier
// rounds, and More options and More like this on the direction card.
"work.captures.caption": "%s, %s", // COPY REVIEW PENDING
diff --git a/internal/equipo/taste_choice_copy_test.go b/internal/equipo/taste_choice_copy_test.go
new file mode 100644
index 00000000..cabb36e7
--- /dev/null
+++ b/internal/equipo/taste_choice_copy_test.go
@@ -0,0 +1,34 @@
+package equipo
+
+import (
+ "fmt"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// TestChoiceNoteCopy: copy.go holds the choice note's words with the
+// exact text the chat tests use (chat.choiceWordsText), each formatting
+// with Design's quoted name (and direction) and naming them as Design's.
+func TestChoiceNoteCopy(t *testing.T) {
+ name, dir := wire.QuotedData("Writing desk"), wire.QuotedData("Calm type, warm colour.")
+ for key, want := range map[string]string{
+ "work.explore.choice_build": "Chose to build Design's option %s. Design's direction for it: %s",
+ "work.explore.choice_like": "Asked for more like Design's option %s. Design's direction for it: %s",
+ "work.explore.choice_build_name": "Chose to build Design's option %s.",
+ "work.explore.choice_like_name": "Asked for more like Design's option %s.",
+ } {
+ text := copyText(key)
+ if text != want {
+ t.Fatalf("%s is %q", key, text)
+ }
+ args := []any{name, dir}
+ if strings.HasSuffix(key, "_name") {
+ args = args[:1]
+ }
+ if got := fmt.Sprintf(text, args...); strings.Contains(got, "%!") || !strings.Contains(got, "Design's option "+name) {
+ t.Fatalf("%s formatted %q", key, got)
+ }
+ }
+}