oficina / equipo Public

design: discovery answers reach Design with Equipo's question

Final review F3 (Astra 3, Fable 1). writeDiscovery stored each typed
box with its question, but wire.TasteLine dropped the question for a
words note, so "Gradients" typed under "Anything to avoid" reached
Design as the person's words alone, like a wish.

A words note with a question now renders as "<person>'s own words,
typed on <date>, <scope>, answering Equipo's question <quoted
question>: <quoted answer>": the question attributed to Equipo, the
answer to the person (AGENTS.md rules 1 and 3). TasteFit counts the
same line, so the 6 KiB budget includes the question. A note typed on
Design's page (no question) renders as before.

Tests (RED first):
  go test ./internal/wire/ -run 'TestTasteLine|TestTasteFit'
    RED: the Avoid line lacked "answering Equipo's question ..."
  go test ./internal/equipo/chat/ -run TestDiscoveryBoxesReachDesignWithTheirQuestion
    (discovery card Avoid + Keep -> Design dispatch -> TasteLine; at
    the cap with 300-character questions)
    RED: line "- paul.c@tito.io's own words, ...: \"The logo\""
  go test ./internal/runner/thin/ -run TestTastePromptQuotesDiscoveryQuestions
    (first prompt via tastePrompt and resumed via designFixPrompt; cap)
    RED: the question line missing from both
  GREEN: all, plus wire; chat -run Taste; thin -run
  'TastePrompt|Taste|DesignPrompt|FixPrompt'.

Mutation (restored): TasteFit measuring each line without its
question -> wire "a block with a question of 6145 bytes fit", chat
"15 notes, 10809 bytes", thin "8 notes, 8199 bytes": all FAIL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 9f65b18865da53e5d3fd3687d7cb9693bf3664fd parent fe9ffa3
4 files changed, +92 −1
  • internal/equipo/chat/taste_ask_test.go +46 −0
  • internal/runner/thin/design_prompt_test.go +27 −0
  • internal/wire/taste_prompt.go +6 −1
  • internal/wire/taste_prompt_test.go +13 −0
diff --git a/internal/equipo/chat/taste_ask_test.go b/internal/equipo/chat/taste_ask_test.go
index 4b29065a..db7fc92f 100644
--- a/internal/equipo/chat/taste_ask_test.go
+++ b/internal/equipo/chat/taste_ask_test.go
@@ -743,3 +743,49 @@ func TestWriteDiscoveryOwnAsk(t *testing.T) {
t.Fatal("written")
}
}
+
+// TestDiscoveryBoxesReachDesignWithTheirQuestion (final review, F3):
+// Avoid and Keep answered on the discovery card reach a Design step's
+// dispatch with Equipo's question each answered, and each line the
+// prompt gets quotes that question as Equipo's and the answer as the
+// person's own words, so "Anything to avoid" never reads as a wish. At
+// the byte cap the questions are counted: the fitted block is within
+// wire.MaxTasteBytes and one more such note would not fit.
+func TestDiscoveryBoxesReachDesignWithTheirQuestion(t *testing.T) {
+ r, l, sp := tasteAskRig(t)
+ _, c := r.askTaste(l, "Make Patrix calmer.")
+ if _, err := r.answerTaste(c, wire.ChoiceUseThese, &wire.TasteAnswer{Avoid: "Gradients", Keep: "The logo"}); err != nil {
+ t.Fatal(err)
+ }
+ task := r.designTask(l, sp, wire.KindExplore)
+ _, d := r.dispatched(r.makerStep(task).ID)
+ if len(d.Taste) != 2 {
+ t.Fatalf("taste %+v", d.Taste)
+ }
+ want := map[string]string{"Gradients": tasteWords[tasteAvoidKey], "The logo": tasteWords[tasteKeepKey]}
+ for _, n := range d.Taste {
+ q, ok := want[n.Body]
+ if !ok || n.Question != q || n.Source != wire.TasteSourceWords {
+ t.Fatalf("note %+v", n)
+ }
+ line := wire.TasteLine(paul, n)
+ if !strings.Contains(line, paul+"'s own words") || !strings.Contains(line, "answering Equipo's question "+wire.QuotedData(q)+": "+wire.QuotedData(n.Body)) {
+ t.Fatalf("line %q", line)
+ }
+ }
+ // At the cap: long answers under long questions.
+ r2, _ := designRig(t)
+ for i := 0; i < 40; i++ {
+ r2.note(paul, "p_patrix", wire.TasteSourceWords, strings.Repeat("a", 300), strings.Repeat("q", 300), 100-i)
+ }
+ notes, _, _, _ := r2.tasteOf(paul, "p_patrix")
+ next := wire.TasteNote{Source: wire.TasteSourceWords, Scope: wire.TasteScopeProject, Body: strings.Repeat("a", 300), Question: strings.Repeat("q", 300), Date: "2026-11-08"}
+ if size := promptBytes(notes); len(notes) == 0 || size > wire.MaxTasteBytes || size+len(wire.TasteLine(paul, next)) <= wire.MaxTasteBytes {
+ t.Fatalf("%d notes, %d bytes", len(notes), size)
+ }
+ for _, n := range notes {
+ if n.Question != strings.Repeat("q", 300) {
+ t.Fatalf("a note lost its question: %+v", n)
+ }
+ }
+}
diff --git a/internal/runner/thin/design_prompt_test.go b/internal/runner/thin/design_prompt_test.go
index 0ea2f8e3..77132cf4 100644
--- a/internal/runner/thin/design_prompt_test.go
+++ b/internal/runner/thin/design_prompt_test.go
@@ -207,3 +207,30 @@ func TestTastePromptAtTheCap(t *testing.T) {
}
}
}
+
+// TestTastePromptQuotesDiscoveryQuestions (final review, F3): a
+// discovery box's note renders with Equipo's question it answered, in a
+// resumed round's message as in a first prompt (tastePrompt), and at
+// the cap the questions are within the budget.
+func TestTastePromptQuotesDiscoveryQuestions(t *testing.T) {
+ avoid := wire.TasteNote{ID: "tn_1", Source: wire.TasteSourceWords, Scope: wire.TasteScopeProject, Body: "Gradients", Question: "Anything to avoid", Date: "2026-11-30"}
+ keep := wire.TasteNote{ID: "tn_2", Source: wire.TasteSourceWords, Scope: wire.TasteScopeProject, Body: "The logo", Question: "Anything that has to stay", Date: "2026-11-30"}
+ row := stepRow{DispatchCommand: wire.DispatchCommand{Person: "Paul", TaskID: "tk1", Branch: "equipo/tk1-design", Feedback: "f", Taste: []wire.TasteNote{avoid, keep}}}
+ first, fix := tastePrompt("Paul", row.Taste, false), (&Engineer{}).designFixPrompt(row)
+ for _, n := range row.Taste {
+ want := "Paul's own words, typed on 30 Nov 2026, for this project, answering Equipo's question " + wire.QuotedData(n.Question) + ": " + wire.QuotedData(n.Body)
+ if !strings.Contains(first, want) || !strings.Contains(fix, want) {
+ t.Fatalf("%q missing:\nfirst:\n%s\nresumed:\n%s", want, first, fix)
+ }
+ }
+ long := wire.TasteNote{ID: "tn", Source: wire.TasteSourceWords, Scope: wire.TasteScopeProject, Body: strings.Repeat("é", 300), Question: strings.Repeat("q", 300), Date: "2026-11-30"}
+ var notes []wire.TasteNote
+ for i := 0; i < 40; i++ {
+ notes = append(notes, long)
+ }
+ fit := wire.TasteFit("Paul", notes)
+ block := tastePrompt("Paul", fit, false) + wire.TasteResumedNote
+ if len(fit) == 0 || len(block) > wire.MaxTasteBytes || len(block)+len(wire.TasteLine("Paul", long)) <= wire.MaxTasteBytes || !strings.Contains(block, strings.Repeat("q", 300)) {
+ t.Fatalf("%d notes, %d bytes", len(fit), len(block))
+ }
+}
diff --git a/internal/wire/taste_prompt.go b/internal/wire/taste_prompt.go
index 4114010f..b71069e2 100644
--- a/internal/wire/taste_prompt.go
+++ b/internal/wire/taste_prompt.go
@@ -20,12 +20,17 @@ const tasteDate = "2006-01-02"
// TasteLine is one note's line in a Design prompt for person (the
// dispatch's): its body quoted with QuotedData under a label naming its
// source (AGENTS.md rules 1 and 3): a typed note is the person's own
-// words; a choice is the person's pick among options someone else
+// words, after Equipo's question it answered for a discovery box; a
+// choice is the person's pick among options someone else
// wrote, the coordinator's feels under Equipo's question, or Design's
// options. A note of any other source has no line ("").
func TasteLine(person string, n TasteNote) string {
when, scope := tasteWhen(n.Date), tasteScope(n.Scope)
switch {
+ case n.Source == TasteSourceWords && n.Question != "":
+ // A discovery box: the question it answered is Equipo's, the
+ // answer the person's ("Anything to avoid" is never a wish).
+ return "- " + person + "'s own words" + tasteOn(", typed on ", when) + scope + ", answering Equipo's question " + QuotedData(n.Question) + ": " + QuotedData(n.Body) + "\n"
case n.Source == TasteSourceWords:
return "- " + person + "'s own words" + tasteOn(", typed on ", when) + scope + ": " + QuotedData(n.Body) + "\n"
case n.Source == TasteSourceChoice && n.Question != "":
diff --git a/internal/wire/taste_prompt_test.go b/internal/wire/taste_prompt_test.go
index a216ae96..f9c2ac45 100644
--- a/internal/wire/taste_prompt_test.go
+++ b/internal/wire/taste_prompt_test.go
@@ -17,6 +17,9 @@ func TestTasteLine(t *testing.T) {
{TasteNote{Source: TasteSourceWords, Scope: TasteScopeProject, Body: "Warm", Date: "2026-11-30"}, []string{"- Paul's own words, typed on 30 Nov 2026, for this project: " + QuotedData("Warm") + "\n"}},
{TasteNote{Source: TasteSourceChoice, Scope: TasteScopeTeam, Body: "Calm", Question: "What feel?", Date: "2026-11-30"}, []string{"choice among options Equipo's coordinator wrote, made on 30 Nov 2026, for all projects", QuotedData("What feel?"), QuotedData("Calm")}},
{TasteNote{Source: TasteSourceChoice, Body: "Build: Calm", Date: "x"}, []string{"- Paul's choice among Design's options (Design's words, not Paul's): " + QuotedData("Build: Calm")}},
+ // A discovery box: the person's words with Equipo's question
+ // they answered, so "Anything to avoid" never reads as a wish.
+ {TasteNote{Source: TasteSourceWords, Scope: TasteScopeProject, Body: "Gradients", Question: "Anything to avoid", Date: "2026-11-30"}, []string{"- Paul's own words, typed on 30 Nov 2026, for this project, answering Equipo's question " + QuotedData("Anything to avoid") + ": " + QuotedData("Gradients") + "\n"}},
} {
got := TasteLine("Paul", c.n)
for _, w := range c.want {
@@ -63,6 +66,16 @@ func TestTasteFit(t *testing.T) {
if got := TasteFit("p", []TasteNote{exact}); len(got) != 0 {
t.Fatalf("a block of %d bytes fit", MaxTasteBytes+1)
}
+ // A discovery box's question counts too, to the byte.
+ asked := TasteNote{Source: TasteSourceWords, Question: strings.Repeat("q", 300)}
+ asked.Body = strings.Repeat("a", room-len(TasteLine("p", asked)))
+ if got := TasteFit("p", []TasteNote{asked}); len(got) != 1 {
+ t.Fatalf("a block with a question of exactly %d bytes did not fit", MaxTasteBytes)
+ }
+ asked.Body += "a"
+ if got := TasteFit("p", []TasteNote{asked}); len(got) != 0 {
+ t.Fatalf("a block with a question of %d bytes fit", MaxTasteBytes+1)
+ }
var many []TasteNote
for i := 0; i < MaxTasteNotes+1; i++ {
many = append(many, short)