oficina / equipo Public

chat: a Design exploration needs 3 or 4 options before Review

Task 4 of the Design feedback 1 plan (spec 8.2, 8.3, 8.7, 8.8).

- Migration 0125_design_feedback.sql (additive; schema.sql updated):
  chat_steps.dispatch_protocol integer NOT NULL DEFAULT 0 and
  chat_steps.pack_digest text NOT NULL DEFAULT "". Later tasks append
  to this file.
- dispatchTo (tasks.go) writes every step dispatch (dispatchStep and
  the Research dispatch) and records on the step the protocol its
  runner's connection speaks then; a reconnect never touches it.
  Legacy rows read 0 and keep the old rules.
- stepReport keeps a specialist attempt's PackDigest on its accepted
  terminal report (a SHA-256, else ""); no UI.
- keepCaptures checks under designRules = min(report connection,
  DispatchProtocol): below 39 wire.ValidOptions as before (and keeps
  none of the unchecked new fields); from 39 an exploration with
  wire.ValidExploreOptions, a change with wire.ValidOptions39. The
  kept JSON gains each option's direction and page, each capture's
  label, viewport, path and full page (Facts), and Explore; designView
  puts them on StepDesignOption and StepCapture.
- designOptionsShort / progress.optionsShort: a Design exploration
  attempt dispatched at 39 or later, done and pushed, that kept no set
  passing ValidExploreOptions. advanceExplore checks it before Review
  and calls fixRound (so MaxFixRounds and DesignRunLimit count it);
  fixNote puts the fixed model-facing designFeedbackOptions first in
  the round's feedback; needsExplore says fix_rounds once the rounds
  are used up.
- progressOfKind now sets explore from its kind (progressFor did).
- thintest TestContractDesignFinishLine moves to the 39 exploration
  shape: the hand's Attempt takes Explore and WorkPages as thin does,
  and Design submits three options with directions, pages and labels.

TDD evidence:
- go test ./internal/equipo/chat/ -run 'TestExplore|TestOldReportStillShown|TestKeptCaptureFacts|TestChangeReportLabels39|TestDispatchProtocolPersists|TestPackDigestKept'
  first failed to build (no designFeedbackOptions, DispatchProtocol,
  PackDigest). With the fields, migration and constant only: every
  test failed for its reason (dispatched at 0; a short set reached
  Review; directions and labels not kept; unlabelled and 41-byte
  labels kept; pack digest "").
- go test ./internal/thintest/ -run 'Design|Explore' then failed:
  TestContractDesignFinishLine "kept <nil>" (two options, no
  directions, at 39); passes after its update.
- After: the chat package, the equipo package, thintest -run
  'Design|Explore', TestDesignFeedbackMigrationLegacySteps,
  TestMigrationModels and the snapshot all ok; vet, gofmt, staticcheck
  (chat, thintest) and runner-dead-references clean.

Mutations (each alone, restored after), all FAILED their tests:
- M1 dispatch protocol not recorded: TestExplore*, TestDispatchProtocolPersists
- M2 dispatch_protocol not in writeStep: TestDispatchProtocolPersists
- M3 rules ignore DispatchProtocol: TestOldReportStillShown/legacy_row
- M4 exploration checked as a change: TestExploreTwoOptionsFixRound
- M5 change checked with ValidOptions: TestChangeReportLabels39
- M6 short ignores DispatchProtocol: TestOldReportStillShown
- M7 no short check in advanceExplore: TestExplore* (3)
- M8 fix round without designFeedbackOptions: TestExploreTwoOptionsFixRound, TestExploreNoSubmitFixRound
- M9 needsExplore says nothing at max rounds: TestExploreShortAtMaxFixRounds
- M10 facts not put on StepCapture: TestKeptCaptureFacts, TestChangeReportLabels39
- M11 direction not kept: TestKeptCaptureFacts
- M12 pack digest unchecked: TestPackDigestKept/not_a_digest
- M13 pack digest not kept: TestPackDigestKept/valid
- M14 migration default 1: TestDesignFeedbackMigrationLegacySteps
- M15 old rules keep unchecked fields: TestOldReportStillShown
- M16 a kept explore set counted short: TestKeptCaptureFacts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 92ad5bbd57f86ced8b0ddf79d790934269ab4b27 parent e5a7579
10 files changed, +566 −29
  • internal/equipo/chat/design_captures.go +68 −14
  • internal/equipo/chat/design_feedback_options_test.go +304 −0
  • internal/equipo/chat/explore.go +20 −0
  • internal/equipo/chat/research.go +1 −1
  • internal/equipo/chat/review.go +45 −3
  • internal/equipo/chat/tasks.go +34 −2
  • internal/equipo/design_feedback_migration_test.go +46 −0
  • internal/equipo/migrations/0125_design_feedback.sql +8 −0
  • internal/equipo/migrations/schema.sql +9 −0
  • internal/thintest/design_contract_test.go +31 −9
diff --git a/internal/equipo/chat/design_captures.go b/internal/equipo/chat/design_captures.go
index 458cd513..26725bd8 100644
--- a/internal/equipo/chat/design_captures.go
+++ b/internal/equipo/chat/design_captures.go
@@ -36,15 +36,54 @@ import (
var ErrDirectionNote = fmt.Errorf("%w: build needs a note", ErrCardConflict)
// designKept is a step's DesignOptions: the done attempt and its
-// options, each with its capture ids in the report's order.
+// options, each with its capture ids in the report's order. Explore:
+// the set passed wire.ValidExploreOptions (an exploration under the
+// protocol-39 rules), so it may go to Review (designOptionsShort).
type designKept struct {
Attempt int64 `json:"attempt"`
+ Explore bool `json:"explore,omitempty"`
Options []keptOption `json:"options"`
}
+// keptOption is one kept option. Under the protocol-39 rules it keeps
+// the report's direction and page, and Facts holds each capture's
+// label and render facts in Captures' order; under the old rules none
+// of them (they were never checked).
type keptOption struct {
- Name string `json:"name"`
- Captures []string `json:"captures"`
+ Name string `json:"name"`
+ Direction string `json:"direction,omitempty"`
+ Page string `json:"page,omitempty"`
+ Captures []string `json:"captures"`
+ Facts []keptFacts `json:"facts,omitempty"`
+}
+
+// keptFacts is a kept capture's label (Design's words) and the render
+// call's page as the runner recorded it.
+type keptFacts struct {
+ Label string `json:"label"`
+ Viewport string `json:"viewport"`
+ Path string `json:"path,omitempty"`
+ FullPage bool `json:"full_page,omitempty"`
+}
+
+// designRules is the protocol whose rules a Design report is checked
+// under: the lower of the connection's that carried it and the one its
+// attempt was dispatched at, so a step from before protocol 39
+// (DispatchProtocol 0) keeps the old rules.
+func designRules(s stepRecord, protocol int) int { return min(protocol, s.DispatchProtocol) }
+
+// validDesign checks a done Design attempt's options under rules: below
+// protocol 39 wire.ValidOptions as before; from it, an exploration's
+// with wire.ValidExploreOptions and a change's with wire.ValidOptions39
+// (no minimum, every capture labelled).
+func validDesign(opts []wire.DesignOption, rules int, explore bool) error {
+ switch {
+ case rules < wire.ProtocolDesignFeedback:
+ return wire.ValidOptions(opts)
+ case explore:
+ return wire.ValidExploreOptions(opts)
+ }
+ return wire.ValidOptions39(opts)
}
// refuseRender refuses a render_file chunk: acked and dropped, logged.
@@ -147,22 +186,32 @@ type keptCapture struct {
}
// keepCaptures applies a done Design attempt's options (stepReport has
-// accepted the done report, before the step is saved): kept whole when
-// checkCaptures finds them sound, stored on the step for its read shape;
+// accepted the done report, before the step is saved; protocol is the
+// connection's that carried it): kept whole when checkCaptures finds
+// them sound under designRules, stored on the step for its read shape;
// otherwise nothing. Saving the ended step then deletes every file it
// sent and did not keep (saveStep).
-func (t *txn) keepCaptures(k *taskRecord, s *stepRecord, opts []wire.DesignOption) error {
- keep, ok, err := t.checkCaptures(k, s, opts)
+func (t *txn) keepCaptures(k *taskRecord, s *stepRecord, opts []wire.DesignOption, protocol int) error {
+ rules := designRules(*s, protocol)
+ explore := wire.NormalKind(k.Kind) == wire.KindExplore
+ keep, ok, err := t.checkCaptures(k, s, opts, rules, explore)
if err != nil {
return err
}
s.DesignOptions = ""
if ok {
- kept := designKept{Attempt: s.Attempt, Options: []keptOption{}}
+ labelled := rules >= wire.ProtocolDesignFeedback
+ kept := designKept{Attempt: s.Attempt, Explore: labelled && explore, Options: []keptOption{}}
for _, o := range opts {
ko := keptOption{Name: o.Name, Captures: []string{}}
+ if labelled {
+ ko.Direction, ko.Page = o.Direction, o.Page
+ }
for _, c := range o.Captures {
ko.Captures = append(ko.Captures, c.ID)
+ if labelled {
+ ko.Facts = append(ko.Facts, keptFacts{Label: c.Label, Viewport: c.Viewport, Path: c.Path, FullPage: c.FullPage})
+ }
}
kept.Options = append(kept.Options, ko)
}
@@ -184,14 +233,14 @@ func (t *txn) keepCaptures(k *taskRecord, s *stepRecord, opts []wire.DesignOptio
// checkCaptures reports whether a done Design attempt's options can be
// kept, and the captures to keep: no options keeps nothing; otherwise
-// the options must be valid (wire.ValidOptions); the step bound to the
+// the options must be valid under rules (validDesign); the step bound to the
// task's maker, its binding still exactly what grantFor finds for the
// task's project and holding page.render; every capture a complete file
// this attempt staged with the report's hash, a PNG within the capture
// bounds (checkCapture); and the captures of one render agreeing on each
// tree's digest (a diff is of work's tree).
-func (t *txn) checkCaptures(k *taskRecord, s *stepRecord, opts []wire.DesignOption) ([]keptCapture, bool, error) {
- if len(opts) == 0 || wire.ValidOptions(opts) != nil {
+func (t *txn) checkCaptures(k *taskRecord, s *stepRecord, opts []wire.DesignOption, rules int, explore bool) ([]keptCapture, bool, error) {
+ if len(opts) == 0 || validDesign(opts, rules, explore) != nil {
return nil, false, nil
}
if s.SpecialistID == "" || s.SpecialistID != k.MakerSpecialistID || !slices.Contains(boundCaps(*s), specialist.CapabilityPageRender) {
@@ -281,10 +330,15 @@ func (t *txn) designView(s stepRecord) (*wire.StepDesign, error) {
}
v := &wire.StepDesign{Attempt: kept.Attempt, Options: []wire.StepDesignOption{}}
for _, o := range kept.Options {
- vo := wire.StepDesignOption{Name: o.Name, Captures: []wire.StepCapture{}}
- for _, id := range o.Captures {
+ vo := wire.StepDesignOption{Name: o.Name, Direction: o.Direction, Page: o.Page, Captures: []wire.StepCapture{}}
+ for i, id := range o.Captures {
if f, ok := byID[id]; ok {
- vo.Captures = append(vo.Captures, wire.StepCapture{ID: f.ID, CaptureID: f.ImageID, Size: f.Size, Width: f.Width, Height: f.Height})
+ c := wire.StepCapture{ID: f.ID, CaptureID: f.ImageID, Size: f.Size, Width: f.Width, Height: f.Height}
+ if len(o.Facts) == len(o.Captures) {
+ fact := o.Facts[i]
+ c.Label, c.Viewport, c.Path, c.FullPage = fact.Label, fact.Viewport, fact.Path, fact.FullPage
+ }
+ vo.Captures = append(vo.Captures, c)
}
}
v.Options = append(v.Options, vo)
diff --git a/internal/equipo/chat/design_feedback_options_test.go b/internal/equipo/chat/design_feedback_options_test.go
new file mode 100644
index 00000000..ea210cc7
--- /dev/null
+++ b/internal/equipo/chat/design_feedback_options_test.go
@@ -0,0 +1,304 @@
+package chat
+
+import (
+ "io"
+ "log/slog"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+ "amadan.net/rastrillo/rastrillo/db"
+)
+
+// Design feedback 1, Task 4 (spec 2026-11-28-dynamic-specialists.md,
+// sections 8.2, 8.3 and 8.7): the instance keeps a Design report's
+// directions, pages, labels and render facts, checks a protocol-39
+// report strictly (an exploration with ValidExploreOptions, a change
+// with ValidOptions39), and sends a protocol-39 exploration attempt that
+// ends without a valid set of options back for a fix round with
+// Equipo's fixed feedback instead of to Review. Each step records the
+// protocol it was dispatched at; a step from before this round (0) keeps
+// the old rules.
+
+// designAt is a Patrix task of kind made by Design whose attempt was
+// dispatched to RUNNER1 speaking protocol, has started and reported its
+// candidate; the lease speaks protocol too.
+func designAt(t *testing.T, protocol int, kind string) (*hkRig, Lease, string, stepRecord) {
+ r, l, _ := grantRig(t)
+ r.exec("CREATE TABLE IF NOT EXISTS runners (id text PRIMARY KEY, person text, role text, label text, removing_at datetime, tainted_at datetime, revoked_at datetime)")
+ r.exec("INSERT INTO runners(id, person, role) VALUES ('RUNNER1', ?, ?)", paul, wire.RolePrimary)
+ r.exec("UPDATE runner_sessions SET protocol = ? WHERE runner_id = ?", protocol, "RUNNER1")
+ l.Protocol = protocol
+ sp := r.active(l, "Patrix", "p_patrix")
+ task, s := r.runningDesign(l, sp, kind)
+ r.report(l, s, wire.StepReport{State: wire.StepRunning, BaseSHA: strings.Repeat("b", 40), CandidateSHA: candidateSHA})
+ return r, l, task, r.stepNow(s.ID)
+}
+
+// option39 is an exploration option with a direction, a page and n
+// labelled desktop captures, each uploaded for s's attempt.
+func (r *hkRig) option39(l Lease, s stepRecord, call int, name string, n int) wire.DesignOption {
+ r.t.Helper()
+ o := wire.DesignOption{Name: name, Direction: name + " direction: calm type, warm colour.", Page: strings.ToLower(strings.ReplaceAll(name, " ", "-"))}
+ for i := 1; i <= n; i++ {
+ data := capturePNG(r.t, 20, 20, uint8(call*10+i))
+ id := itoa64(int64(call)) + "-work-" + itoa64(int64(i)) + ".png"
+ r.uploadCapture(l, s, id, data)
+ c := capture(id, data, digestWork)
+ c.Label, c.Viewport, c.Path = "Screen "+itoa64(int64(i)), "desktop", "/"+o.Page+"/"
+ o.Captures = append(o.Captures, c)
+ }
+ return o
+}
+
+// doneWith reports s's attempt done and pushed at sha with opts.
+func (r *hkRig) doneWith(l Lease, s stepRecord, sha string, opts []wire.DesignOption) {
+ r.t.Helper()
+ r.report(l, s, wire.StepReport{State: wire.StepDone, BaseSHA: strings.Repeat("b", 40), CandidateSHA: sha, Pushed: true, Termination: true, Options: opts})
+}
+
+// reviews counts the task's Review steps.
+func (r *hkRig) reviews(task string) int64 {
+ return r.count("SELECT count(*) FROM chat_steps WHERE task_id = ? AND specialist = ?", task, wire.SpecialistReview)
+}
+
+// shortFixRound: after the short attempt s, the task has no Review and a
+// new Design round (round) whose dispatch carries designFeedbackOptions.
+func (r *hkRig) shortFixRound(task string, s stepRecord, round int) stepRecord {
+ r.t.Helper()
+ if n := r.reviews(task); n != 0 {
+ r.t.Fatalf("a short set reached Review: %d Review steps", n)
+ }
+ next := r.makerStep(task)
+ if next.ID == s.ID || next.Round != round || next.SpecialistID == "" {
+ r.t.Fatalf("no fix round %d after %s: newest maker step %s round %d", round, s.ID, next.ID, next.Round)
+ }
+ if _, cmd := r.dispatched(next.ID); !strings.Contains(cmd.Feedback, designFeedbackOptions) {
+ r.t.Fatalf("fix round feedback %q", cmd.Feedback)
+ }
+ return next
+}
+
+// TestExploreTwoOptionsFixRound: an exploration attempt dispatched at 39
+// that keeps two options, otherwise well formed, gets a fix round with
+// Equipo's fixed feedback, and no Review step; the options are not kept.
+func TestExploreTwoOptionsFixRound(t *testing.T) {
+ r, l, task, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindExplore)
+ if s.DispatchProtocol != wire.ProtocolDesignFeedback {
+ t.Fatalf("dispatched at %d", s.DispatchProtocol)
+ }
+ r.doneWith(l, s, candidateSHA, []wire.DesignOption{r.option39(l, s, 1, "Calm", 1), r.option39(l, s, 2, "Bold", 2)})
+ if d := r.stepDesign(task, s.ID); d != nil {
+ t.Fatalf("a short set was kept: %+v", d)
+ }
+ r.shortFixRound(task, s, 1)
+ if k := r.load(task); k.DesignRuns != 2 || k.RepairRound != 1 {
+ t.Fatalf("the round counts: %d Design runs, repair round %d", k.DesignRuns, k.RepairRound)
+ }
+}
+
+// TestExploreNoSubmitFixRound: an exploration attempt at 39 that ends
+// without submitting any option gets the same fix round.
+func TestExploreNoSubmitFixRound(t *testing.T) {
+ r, l, task, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindExplore)
+ r.doneWith(l, s, candidateSHA, nil)
+ r.shortFixRound(task, s, 1)
+}
+
+// TestExploreShortAtMaxFixRounds: every round short, the rounds run out
+// at MaxFixRounds: no further round, no Review, and the task needs its
+// person (fix_rounds).
+func TestExploreShortAtMaxFixRounds(t *testing.T) {
+ r, l, task, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindExplore)
+ r.doneWith(l, s, candidateSHA, nil)
+ for round := 1; round <= wire.MaxFixRounds; round++ {
+ next := r.shortFixRound(task, s, round)
+ r.ackDispatches(next.ID)
+ if refused := r.authorize(l, next, ""); refused != "" {
+ t.Fatalf("start round %d: %q", round, refused)
+ }
+ sha := strings.Repeat(itoa64(int64(round+1)), 40)
+ r.report(l, next, wire.StepReport{State: wire.StepRunning, BaseSHA: candidateSHA, CandidateSHA: sha})
+ r.doneWith(l, r.stepNow(next.ID), sha, []wire.DesignOption{r.option39(l, next, 1, "Calm", 1)})
+ s = r.stepNow(next.ID)
+ }
+ if last := r.makerStep(task); last.ID != s.ID {
+ t.Fatalf("a round past MaxFixRounds: %s round %d", last.ID, last.Round)
+ }
+ if n := r.reviews(task); n != 0 {
+ t.Fatalf("%d Review steps", n)
+ }
+ v, err := r.s.Task(r.ctx, paul, task)
+ r.must(err)
+ if v.NeedsYou != wire.NeedsFixRounds {
+ t.Fatalf("needs %q", v.NeedsYou)
+ }
+}
+
+// TestOldReportStillShown: a step dispatched before protocol 39 keeps
+// the old rules: two options without directions or labels are kept and
+// shown, and Review runs, with no fix round. A legacy row (0) does too,
+// even when its report arrives over a 39 connection.
+func TestOldReportStillShown(t *testing.T) {
+ for _, legacy := range []bool{false, true} {
+ name := "dispatched at 38"
+ if legacy {
+ name = "legacy row"
+ }
+ t.Run(name, func(t *testing.T) {
+ r, l, task, s := designAt(t, wire.ProtocolDesign, wire.KindExplore)
+ if s.DispatchProtocol != wire.ProtocolDesign {
+ t.Fatalf("dispatched at %d", s.DispatchProtocol)
+ }
+ if legacy {
+ r.exec("UPDATE chat_steps SET dispatch_protocol = 0 WHERE id = ?", s.ID)
+ l.Protocol = wire.ProtocolDesignFeedback
+ s = r.stepNow(s.ID)
+ }
+ var opts []wire.DesignOption
+ for i, n := range []string{"Calm", "Bold"} {
+ data := capturePNG(t, 20, 20, uint8(i))
+ id := itoa64(int64(i+1)) + "-work-1.png"
+ r.uploadCapture(l, s, id, data)
+ opts = append(opts, wire.DesignOption{Name: n, Captures: []wire.DesignCapture{capture(id, data, digestWork)}})
+ }
+ // What the old rules never check is not kept: a direction
+ // and a label beside them are dropped.
+ opts[0].Direction, opts[0].Captures[0].Label, opts[0].Captures[0].Viewport = "Unchecked.", "Unchecked", "desktop"
+ r.doneWith(l, s, candidateSHA, opts)
+ d := r.stepDesign(task, s.ID)
+ if d == nil || len(d.Options) != 2 || len(d.Options[1].Captures) != 1 {
+ t.Fatalf("old report not shown: %+v", d)
+ }
+ if o := d.Options[0]; o.Direction != "" || o.Captures[0].Label != "" || o.Captures[0].Viewport != "" {
+ t.Fatalf("unchecked fields kept: %+v", o)
+ }
+ if n := r.reviews(task); n != 1 {
+ t.Fatalf("%d Review steps", n)
+ }
+ if next := r.makerStep(task); next.ID != s.ID {
+ t.Fatalf("a fix round %s", next.ID)
+ }
+ })
+ }
+}
+
+// TestKeptCaptureFacts: a valid protocol-39 exploration is kept with
+// each option's direction and page and each capture's label, viewport,
+// path and full page, and goes to Review.
+func TestKeptCaptureFacts(t *testing.T) {
+ r, l, task, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindExplore)
+ opts := []wire.DesignOption{r.option39(l, s, 1, "Calm", 2), r.option39(l, s, 2, "Bold", 1), r.option39(l, s, 3, "Writing desk", 3)}
+ opts[1].Captures[0].Viewport, opts[1].Captures[0].Path, opts[1].Captures[0].FullPage = "phone", "", true
+ r.doneWith(l, s, candidateSHA, opts)
+ d := r.stepDesign(task, s.ID)
+ if d == nil || len(d.Options) != 3 {
+ t.Fatalf("not kept: %+v", d)
+ }
+ for i, o := range d.Options {
+ if o.Name != opts[i].Name || o.Direction != opts[i].Direction || o.Page != opts[i].Page || len(o.Captures) != len(opts[i].Captures) {
+ t.Fatalf("option %d: %+v", i, o)
+ }
+ for j, c := range o.Captures {
+ want := opts[i].Captures[j]
+ if c.CaptureID != want.ID || c.Label != want.Label || c.Viewport != want.Viewport || c.Path != want.Path || c.FullPage != want.FullPage {
+ t.Fatalf("option %d capture %d: %+v, want %+v", i, j, c, want)
+ }
+ }
+ }
+ if c := d.Options[1].Captures[0]; c.Label != "Screen 1" || c.Viewport != "phone" || !c.FullPage || c.Path != "" {
+ t.Fatalf("Bold's capture %+v", c)
+ }
+ if n := r.reviews(task); n != 1 {
+ t.Fatalf("%d Review steps", n)
+ }
+ if next := r.makerStep(task); next.ID != s.ID {
+ t.Fatalf("a fix round %s", next.ID)
+ }
+}
+
+// TestChangeReportLabels39: a protocol-39 change task's report needs no
+// minimum (one labelled option is kept, and nothing sends it back), but
+// every capture needs a valid label: unlabelled or 41 bytes keeps
+// nothing.
+func TestChangeReportLabels39(t *testing.T) {
+ for name, label := range map[string]string{"labelled": "Dashboard", "unlabelled": "", "41 bytes": strings.Repeat("a", wire.MaxCaptureLabel+1)} {
+ t.Run(name, func(t *testing.T) {
+ r, l, task, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindChange)
+ data := capturePNG(t, 20, 20, 1)
+ r.uploadCapture(l, s, "1-work-1.png", data)
+ c := capture("1-work-1.png", data, digestWork)
+ c.Label, c.Viewport = label, "desktop"
+ r.doneWith(l, s, candidateSHA, []wire.DesignOption{{Name: "Built", Captures: []wire.DesignCapture{c}}})
+ if label != "Dashboard" {
+ r.nothingKept(task, s.ID, name)
+ return
+ }
+ d := r.stepDesign(task, s.ID)
+ if d == nil || len(d.Options) != 1 || len(d.Options[0].Captures) != 1 || d.Options[0].Captures[0].Label != "Dashboard" || d.Options[0].Captures[0].Viewport != "desktop" {
+ t.Fatalf("not kept: %+v", d)
+ }
+ if next := r.makerStep(task); next.ID != s.ID {
+ t.Fatalf("a change task got a fix round %s", next.ID)
+ }
+ })
+ }
+}
+
+// TestDispatchProtocolPersists: the protocol is written with the
+// dispatch, survives a store reopen and the runner reconnecting at
+// another protocol, and a row written before the column reads 0.
+func TestDispatchProtocolPersists(t *testing.T) {
+ r, l, task, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindExplore)
+ if s.DispatchProtocol != wire.ProtocolDesignFeedback {
+ t.Fatalf("dispatched at %d", s.DispatchProtocol)
+ }
+ // The runner reconnects speaking 38: what the attempt was sent at stays.
+ hello := designHello(wire.ToolHealthy, claudeSub)
+ hello.Protocol = wire.ProtocolDesign
+ if _, err := r.s.Connect(r.ctx, l.Runner, "p2", hello, ""); err != nil {
+ t.Fatal(err)
+ }
+ if got := r.count("SELECT protocol FROM runner_sessions WHERE runner_id = ?", "RUNNER1"); got != int64(wire.ProtocolDesign) {
+ t.Fatalf("reconnected at %d", got)
+ }
+ if got := r.stepNow(s.ID).DispatchProtocol; got != wire.ProtocolDesignFeedback {
+ t.Fatalf("after a reconnect: %d", got)
+ }
+ // A store opened afresh on the same file reads it.
+ var path string
+ r.must(r.s.db.G.Raw("SELECT file FROM pragma_database_list WHERE name = 'main'").Scan(&path).Error)
+ d, err := db.Open(path, slog.New(slog.NewTextHandler(io.Discard, nil)))
+ r.must(err)
+ t.Cleanup(func() { _ = d.Close() })
+ again := NewStore(d, r.s.authority, nil)
+ var got stepRecord
+ r.must(again.db.G.Where("id = ?", s.ID).First(&got).Error)
+ if got.DispatchProtocol != wire.ProtocolDesignFeedback {
+ t.Fatalf("after a reopen: %d", got.DispatchProtocol)
+ }
+ // A row written without the column (before this round) reads 0.
+ r.exec("INSERT INTO chat_steps(id, task_id, idx, specialist, person, state, attempt, revision) VALUES ('s_legacy', ?, 99, ?, ?, ?, 1, 1)", task, wire.SpecialistEngineering, paul, wire.StepDone)
+ if got := r.stepNow("s_legacy"); got.DispatchProtocol != 0 || got.PackDigest != "" {
+ t.Fatalf("legacy row: %d %q", got.DispatchProtocol, got.PackDigest)
+ }
+}
+
+// TestPackDigestKept: a Design attempt's final report's pack digest is
+// recorded on its step when the report is accepted; one that is not a
+// SHA-256 is not.
+func TestPackDigestKept(t *testing.T) {
+ for name, digest := range map[string]string{"valid": strings.Repeat("ab", 32), "not a digest": "design-v1"} {
+ t.Run(name, func(t *testing.T) {
+ r, l, _, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindExplore)
+ r.report(l, s, wire.StepReport{State: wire.StepDone, BaseSHA: strings.Repeat("b", 40), CandidateSHA: candidateSHA, Pushed: true, Termination: true, PackDigest: digest})
+ want := digest
+ if name != "valid" {
+ want = ""
+ }
+ if got := r.stepNow(s.ID).PackDigest; got != want {
+ t.Fatalf("pack digest %q, want %q", got, want)
+ }
+ })
+ }
+}
diff --git a/internal/equipo/chat/explore.go b/internal/equipo/chat/explore.go
index f766621a..c6167647 100644
--- a/internal/equipo/chat/explore.go
+++ b/internal/equipo/chat/explore.go
@@ -58,6 +58,15 @@ func (p progress) needsExplore(k taskRecord) string {
case w.State != wire.StepDone || p.candidate == "":
return ""
}
+ if p.optionsShort() {
+ // A Design attempt with no valid set of options never reaches
+ // Review: once its fix rounds are used up (fixRound), the person
+ // decides.
+ if max(k.RepairRound, p.eng.Round)-p.free >= wire.MaxFixRounds || p.repeated {
+ return wire.NeedsFixRounds
+ }
+ return ""
+ }
_, _, verdict, _ := p.judged()
switch {
case verdict == wire.VerdictApprove:
@@ -109,6 +118,17 @@ func (t *txn) advanceExplore(k *taskRecord) error {
if w == nil || w.State != wire.StepDone || p.candidate == "" || p.eng == nil || awaitingPublication(w) {
return nil
}
+ short, err := t.designOptionsShort(p)
+ if err != nil {
+ return err
+ }
+ if short {
+ // A protocol-39 Design exploration attempt that ended without 3
+ // or 4 valid options goes back to Design with Equipo's fixed
+ // feedback (fixNote), never to Review; the round counts against
+ // MaxFixRounds and DesignRunLimit like any other.
+ return t.fixRound(k, p, steps)
+ }
_, _, verdict, _ := p.judged()
switch {
case p.review == nil:
diff --git a/internal/equipo/chat/research.go b/internal/equipo/chat/research.go
index 40b2b415..3ce4a73e 100644
--- a/internal/equipo/chat/research.go
+++ b/internal/equipo/chat/research.go
@@ -647,7 +647,7 @@ func (t *txn) dispatchResearch(k *taskRecord, s *stepRecord) error {
if err := t.specialistUsed(sp, *k, *s); err != nil {
return err
}
- return t.commandTo(s.RunnerID, s.Person, wire.FrameDispatch, cmd)
+ return t.dispatchTo(s, cmd)
}
// researchReport applies a runner's report of a Research step attempt
diff --git a/internal/equipo/chat/review.go b/internal/equipo/chat/review.go
index c8926c77..76933a3b 100644
--- a/internal/equipo/chat/review.go
+++ b/internal/equipo/chat/review.go
@@ -60,7 +60,6 @@ func freeRound(s *stepRecord) bool {
func progressFor(k taskRecord, steps []stepRecord) progress {
p := progressOfKind(steps, k.Kind)
p.moved = p.candidate != "" && k.MovedFrom == p.candidate
- p.explore = wire.NormalKind(k.Kind) == wire.KindExplore
p.taskID = k.ID
p.repeated = repeatedChecks(p, steps)
return p
@@ -77,7 +76,7 @@ func counts(s *stepRecord, kind string) bool {
}
func progressOfKind(steps []stepRecord, kind string) progress {
- var p progress
+ p := progress{explore: wire.NormalKind(kind) == wire.KindExplore}
for i := range steps {
s := &steps[i]
if s.Specialist == wire.SpecialistPreview || s.Specialist == wire.SpecialistResearch || s.Specialist == wire.SpecialistPublish {
@@ -548,6 +547,43 @@ const (
exploreReview = "This task is an exploration, never merged: judge whether it does what was asked, whether release/preview.json names its committed static output, and whether that output is safe to publish as a public static preview (no secrets, no personal data, nothing that calls a live service). Do not ask for production readiness, tests or polish."
)
+// designFeedbackOptions is Equipo's fixed feedback for a Design
+// exploration attempt that ended without a valid set of options
+// (designOptionsShort): its fix round's feedback, model text, not copy.
+const designFeedbackOptions = "Your last attempt ended without a valid set of options, so it was not sent to Review. An exploration needs 3 or 4 options. Each option needs a direction (what it commits to, in plain text), its page folder holding an index.html, and 1 to 3 captures, each with a label saying what it shows. Keep the work already on the branch, add or fix options until the set meets this, and submit the whole set with submit_candidate before you finish."
+
+// optionsShort: the newest Engineering step is a Design exploration
+// attempt dispatched at protocol 39 or later, done with its candidate
+// pushed (the candidate p judges), whose report kept no set of options
+// that passed wire.ValidExploreOptions (designKept.Explore). A step
+// dispatched before 39 (0 for rows from before it) keeps the old rules
+// and is never short; so are a rebase and a republish, which make no
+// options. A kept record that does not decode kept nothing readable, so
+// it is short too (designOptionsShort reports it as an error instead).
+func (p progress) optionsShort() bool {
+ short, _ := p.designShort()
+ return short
+}
+
+func (p progress) designShort() (bool, error) {
+ e := p.eng
+ if !p.explore || e == nil || e.SpecialistID == "" || e.DispatchProtocol < wire.ProtocolDesignFeedback || e.State != wire.StepDone || !e.Pushed || e.Rebase || e.Republish || e.CandidateSHA == "" || e.CandidateSHA != p.candidate {
+ return false, nil
+ }
+ if e.DesignOptions == "" {
+ return true, nil
+ }
+ var kept designKept
+ if err := json.Unmarshal([]byte(e.DesignOptions), &kept); err != nil {
+ return true, err
+ }
+ return !kept.Explore || kept.Attempt != e.Attempt, nil
+}
+
+// designOptionsShort is optionsShort for advanceExplore, where a kept
+// record that does not decode is an error, not a silent fix round.
+func (t *txn) designOptionsShort(p progress) (bool, error) { return p.designShort() }
+
// fixNote is an Engineering fix round's part of its brief: what the
// checks and review of the commit before it said ("" for other steps).
func fixNote(steps []stepRecord, s stepRecord) string {
@@ -569,7 +605,13 @@ func fixNoteKind(steps []stepRecord, s stepRecord, kind string) string {
if s.Note != "" {
note = "Person's note for this round: " + wire.QuotedData(clipText(s.Note, wire.MaxTaskBrief)) + "\n"
}
- f := strings.TrimSpace(note + feedbackBudget(progressOfKind(before, kind), min(4500, 7600-len(note))))
+ prior := progressOfKind(before, kind)
+ if prior.optionsShort() {
+ // The Design attempt before it ended without a valid set of
+ // options (designOptionsShort): Equipo's own words say so.
+ note += designFeedbackOptions + "\n"
+ }
+ f := strings.TrimSpace(note + feedbackBudget(prior, min(4500, 7600-len(note))))
if f == "" {
return ""
}
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go
index 85d20d8f..6c417caa 100644
--- a/internal/equipo/chat/tasks.go
+++ b/internal/equipo/chat/tasks.go
@@ -327,6 +327,15 @@ type stepRecord struct {
// DesignOptions are the options a done Design attempt's report named,
// kept with its captures (designKept JSON); "" is none.
DesignOptions string `gorm:"not null;default:''"`
+ // DispatchProtocol is the protocol the runner's connection spoke
+ // when this attempt's dispatch was written for it (dispatchTo);
+ // 0 for a step from before protocol 39, which keeps the old rules
+ // (spec 2026-11-28-dynamic-specialists.md, section 8.3).
+ DispatchProtocol int `gorm:"not null;default:0"`
+ // PackDigest is the SHA-256 (hex) of the prompt pack a specialist's
+ // attempt said, on its accepted final report, that it ran with
+ // (section 8.8); "" when none was said.
+ PackDigest string `gorm:"not null;default:''"`
}
func (stepRecord) TableName() string { return "chat_steps" }
@@ -860,7 +869,7 @@ func (t *txn) writeStep(s *stepRecord) error {
}
s.Revision++
s.UpdatedAt = t.now()
- if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("base_checks", "base_checks_sha", "copy_owner", "copy_revision", "copy_result", "failure_signature", "state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "headline", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks", "switched", "activity", "runner_id", "needs", "placement", "waiting_since", "refused_by", "withdrawn", "termination_kind", "publication", "publication_id", "apple", "checks_sandbox", "change_files", "change_facts", "decided_by", "merge_source", "merge_parents", "hosted_ci", "kind", "note", "sandbox_runner", "unsandboxed_by", "unsandboxed_at", "unsandboxed_attempt", "unsandboxed_runner", "has_preview", "preview", "boundary", "question", "request_turn", "sources_card", "sources_hash", "research_grant", "research_grant_revision", "specialist_id", "specialist_revision", "specialist_project", "specialist_caps", "design_options", "hold", "housekeeping_attempt", "coordinator_attempt", "held_at", "publish", "model", "xcode_access", "outcome_phase", "session_id", "publication_runner", "on_worker", "ability_held").Updates(s).Error; err != nil {
+ if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("base_checks", "base_checks_sha", "copy_owner", "copy_revision", "copy_result", "failure_signature", "state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "headline", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks", "switched", "activity", "runner_id", "needs", "placement", "waiting_since", "refused_by", "withdrawn", "termination_kind", "publication", "publication_id", "apple", "checks_sandbox", "change_files", "change_facts", "decided_by", "merge_source", "merge_parents", "hosted_ci", "kind", "note", "sandbox_runner", "unsandboxed_by", "unsandboxed_at", "unsandboxed_attempt", "unsandboxed_runner", "has_preview", "preview", "boundary", "question", "request_turn", "sources_card", "sources_hash", "research_grant", "research_grant_revision", "specialist_id", "specialist_revision", "specialist_project", "specialist_caps", "design_options", "hold", "housekeeping_attempt", "coordinator_attempt", "held_at", "publish", "model", "xcode_access", "outcome_phase", "session_id", "publication_runner", "on_worker", "ability_held", "dispatch_protocol", "pack_digest").Updates(s).Error; err != nil {
return err
}
if s.Retired {
@@ -1402,6 +1411,21 @@ func (t *txn) dispatchStep(k *taskRecord, s *stepRecord) error {
return err
}
}
+ return t.dispatchTo(s, cmd)
+}
+
+// dispatchTo writes the dispatch of s's attempt to the runner it is
+// placed on, and records on s (the caller saves it) the protocol that
+// runner's connection speaks now: what the dispatch is encoded for
+// (spec 2026-11-28-dynamic-specialists.md, section 8.7). Written once
+// per dispatch, never by a reconnect; 0 when the runner has no
+// connection on record.
+func (t *txn) dispatchTo(s *stepRecord, cmd wire.DispatchCommand) error {
+ var sess runnerSessionRecord
+ if err := t.db.Where("runner_id = ?", s.RunnerID).Limit(1).Find(&sess).Error; err != nil {
+ return err
+ }
+ s.DispatchProtocol = sess.Protocol
return t.commandTo(s.RunnerID, s.Person, wire.FrameDispatch, cmd)
}
@@ -1693,6 +1717,14 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error {
if err := t.recordUsage(l, s.Person, s.Specialist, s.TaskID, s.ID, "", s.Round, v.Usage); err != nil {
return err
}
+ if s.SpecialistID != "" {
+ // The pack this attempt ran with, as its final report says
+ // (spec section 8.8); kept only with the report.
+ s.PackDigest = ""
+ if wire.ValidSHA256(v.PackDigest) {
+ s.PackDigest = v.PackDigest
+ }
+ }
}
if v.Switched != nil {
// The first refusal says what the step moved from; a later
@@ -1819,7 +1851,7 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error {
if s.SpecialistID != "" {
// A maker's attempt: its captures are kept only now,
// if its options check, and never otherwise.
- if err := t.keepCaptures(&k, &s, v.Options); err != nil {
+ if err := t.keepCaptures(&k, &s, v.Options, l.Protocol); err != nil {
return err
}
}
diff --git a/internal/equipo/design_feedback_migration_test.go b/internal/equipo/design_feedback_migration_test.go
new file mode 100644
index 00000000..ea36e025
--- /dev/null
+++ b/internal/equipo/design_feedback_migration_test.go
@@ -0,0 +1,46 @@
+package equipo
+
+import (
+ "context"
+ "testing"
+
+ "amadan.net/rastrillo/rastrillo/migrate"
+)
+
+// TestDesignFeedbackMigrationLegacySteps: a step written before 0125
+// reads dispatch protocol 0 (the old rules) and no pack digest once it
+// applies; the migration changes no existing value.
+func TestDesignFeedbackMigrationLegacySteps(t *testing.T) {
+ ctx := context.Background()
+ all := Schema.All()
+ at := -1
+ for i, m := range all {
+ if m.ID == "equipo/0125_design_feedback" {
+ at = i
+ }
+ }
+ if at < 0 {
+ t.Fatal("no 0125_design_feedback")
+ }
+ d, err := migrate.Replay(ctx, all[:at])
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer d.Close()
+ if _, err = d.ExecContext(ctx, "INSERT INTO chat_steps(id, task_id, idx, specialist, state, attempt, design_options) VALUES ('s_old', 'tk_old', 1, 'engineering', 'done', 2, '{\"attempt\":2,\"options\":[]}')"); err != nil {
+ t.Fatal(err)
+ }
+ for _, m := range all[at:] {
+ if _, err = d.ExecContext(ctx, m.SQL); err != nil {
+ t.Fatalf("%s: %v", m.ID, err)
+ }
+ }
+ var protocol, attempt int
+ var digest, options string
+ if err = d.QueryRowContext(ctx, "SELECT dispatch_protocol, pack_digest, attempt, design_options FROM chat_steps WHERE id = 's_old'").Scan(&protocol, &digest, &attempt, &options); err != nil {
+ t.Fatal(err)
+ }
+ if protocol != 0 || digest != "" || attempt != 2 || options != `{"attempt":2,"options":[]}` {
+ t.Fatalf("legacy step: protocol %d, digest %q, attempt %d, options %q", protocol, digest, attempt, options)
+ }
+}
diff --git a/internal/equipo/migrations/0125_design_feedback.sql b/internal/equipo/migrations/0125_design_feedback.sql
new file mode 100644
index 00000000..eab7868e
--- /dev/null
+++ b/internal/equipo/migrations/0125_design_feedback.sql
@@ -0,0 +1,8 @@
+-- Design feedback 1 (protocol 39; spec 2026-11-28-dynamic-specialists.md,
+-- sections 8.3, 8.7 and 8.8): the protocol each step attempt's dispatch
+-- was written for (the runner connection's then; 0 for a step from before
+-- this round, which keeps the old rules), and the SHA-256 of the prompt
+-- pack a specialist's attempt said on its final report that it ran with
+-- ("" none). A team record, as its step; no existing row changes.
+ALTER TABLE chat_steps ADD COLUMN dispatch_protocol integer NOT NULL DEFAULT 0;
+ALTER TABLE chat_steps ADD COLUMN pack_digest text NOT NULL DEFAULT "";
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql
index b295b2da..91ed47bb 100644
--- a/internal/equipo/migrations/schema.sql
+++ b/internal/equipo/migrations/schema.sql
@@ -915,3 +915,12 @@ ALTER TABLE chat_steps ADD COLUMN design_options text NOT NULL DEFAULT "";
-- records as JSON (wire.RenderAudit), plain data. A team record, as its
-- step; no existing row changes.
CREATE TABLE chat_step_renders (step_id text, attempt integer, renders text NOT NULL DEFAULT "", updated_at datetime, PRIMARY KEY (step_id, attempt));
+
+-- Design feedback 1 (protocol 39; spec 2026-11-28-dynamic-specialists.md,
+-- sections 8.3, 8.7 and 8.8): the protocol each step attempt's dispatch
+-- was written for (the runner connection's then; 0 for a step from before
+-- this round, which keeps the old rules), and the SHA-256 of the prompt
+-- pack a specialist's attempt said on its final report that it ran with
+-- ("" none). A team record, as its step; no existing row changes.
+ALTER TABLE chat_steps ADD COLUMN dispatch_protocol integer NOT NULL DEFAULT 0;
+ALTER TABLE chat_steps ADD COLUMN pack_digest text NOT NULL DEFAULT "";
diff --git a/internal/thintest/design_contract_test.go b/internal/thintest/design_contract_test.go
index bed7f8f2..08f2a37a 100644
--- a/internal/thintest/design_contract_test.go
+++ b/internal/thintest/design_contract_test.go
@@ -254,9 +254,10 @@ func (x *designHand) browser(_ context.Context, cfg render.LaunchConfig, out str
func (x *designHand) mockups() {
x.r.t.Helper()
files := map[string]string{
- "release/preview.json": `{"output": "mockups/` + x.d.TaskID + `"}`,
- "mockups/" + x.d.TaskID + "/calm/index.html": "<h1>Patrix</h1><p>Calm: soft blue, larger type.</p>",
- "mockups/" + x.d.TaskID + "/bold/index.html": "<h1>Patrix</h1><p>Bold: black and yellow.</p>",
+ "release/preview.json": `{"output": "mockups/` + x.d.TaskID + `"}`,
+ "mockups/" + x.d.TaskID + "/calm/index.html": "<h1>Patrix</h1><p>Calm: soft blue, larger type.</p>",
+ "mockups/" + x.d.TaskID + "/bold/index.html": "<h1>Patrix</h1><p>Bold: black and yellow.</p>",
+ "mockups/" + x.d.TaskID + "/plain/index.html": "<h1>Patrix</h1><p>Plain: system type, no colour.</p>",
}
for name, body := range files {
p := filepath.Join(x.work, name)
@@ -266,6 +267,18 @@ func (x *designHand) mockups() {
}
}
+// workPages is the runner's page check on the work tree (WorkPages):
+// the pages without an index.html under mockups/<task>/.
+func (x *designHand) workPages(_ context.Context, pages []string) ([]string, error) {
+ var missing []string
+ for _, p := range pages {
+ if fi, err := os.Lstat(filepath.Join(x.work, "mockups", x.d.TaskID, p, "index.html")); err != nil || !fi.Mode().IsRegular() {
+ missing = append(missing, p)
+ }
+ }
+ return missing, nil
+}
+
// tool is the fake model calling one of the step's tools.
func (x *designHand) tool(name, args string) (string, bool) {
return x.at.Call(x.r.ctx, name, "", json.RawMessage(args))
@@ -339,8 +352,9 @@ func (r *toolRig) makerOf(id string) string {
// continuation, which records an exploration and starts it with Design;
// the dispatch carries the binding; the model renders through the
// instance's render check, writes its options under mockups/<task>/ and
-// submits; the captures go up as render_file chunks and the final
-// report keeps them; the task page and the direction card show them;
+// submits three (protocol 39: each with its direction, page and
+// labelled captures); the captures go up as render_file chunks and the
+// final report keeps them, with those fields; the task page and the direction card show them;
// Build needs a note and, with one, makes the change task with Design
// as its maker and the note quoted as the person's own words.
func TestContractDesignFinishLine(t *testing.T) {
@@ -361,6 +375,8 @@ func TestContractDesignFinishLine(t *testing.T) {
d := r.designStarted(sp, id)
x := r.designHand(d, health)
+ // An exploration's options are checked as the runner does (thin).
+ x.at.Explore, x.at.WorkPages = d.Explore, x.workPages
x.mockups()
if text, failed := x.tool(designstep.ToolRenderPage, renderBoth); failed || !strings.Contains(text, "/render/1-work-3.png") {
t.Fatalf("render_page %v %s", failed, text)
@@ -368,14 +384,17 @@ func TestContractDesignFinishLine(t *testing.T) {
if x.checks != 1 || x.browserRuns != 1 {
t.Fatalf("%d render checks, %d browser runs", x.checks, x.browserRuns)
}
+ if text, failed := x.tool(designstep.ToolRenderPage, `{"tree": "work", "pages": [{"path": "/plain/", "viewport": "desktop"}]}`); failed || !strings.Contains(text, "/render/2-work-1.png") {
+ t.Fatalf("render_page plain %v %s", failed, text)
+ }
if text, failed := x.tool(designstep.ToolAskPerson, `{"question": "Blue or yellow?"}`); failed || text != designstep.AskText {
t.Fatalf("ask_person %s", text)
}
- if text, failed := x.tool(designstep.ToolSubmitCandidate, `{"options": [{"name": "Calm", "captures": [{"file": "1-work-1.png", "label": "Home"}, {"file": "1-work-2.png", "label": "Menu"}]}, {"name": "Bold", "captures": [{"file": "1-work-3.png", "label": "Home"}]}]}`); failed {
+ if text, failed := x.tool(designstep.ToolSubmitCandidate, `{"options": [{"name": "Calm", "direction": "Soft blue, larger type.", "page": "calm", "captures": [{"file": "1-work-1.png", "label": "Home"}, {"file": "1-work-2.png", "label": "Menu"}]}, {"name": "Bold", "direction": "Black and yellow.", "page": "bold", "captures": [{"file": "1-work-3.png", "label": "Home"}]}, {"name": "Plain", "direction": "System type, no colour.", "page": "plain", "captures": [{"file": "2-work-1.png", "label": "Home"}]}]}`); failed {
t.Fatalf("submit %s", text)
}
x.uploads("ds-file")
- if r.rows("SELECT count(*) FROM chat_task_files WHERE step_id = ? AND complete = 1 AND kept = 0", d.StepID) != 3 {
+ if r.rows("SELECT count(*) FROM chat_task_files WHERE step_id = ? AND complete = 1 AND kept = 0", d.StepID) != 4 {
t.Fatal("the captures are not staged")
}
if why := r.lease(r.runner, "ds-push", wire.LeaseCheck{StepID: d.StepID, Attempt: d.Attempt}); why != "" {
@@ -386,9 +405,12 @@ func TestContractDesignFinishLine(t *testing.T) {
// Kept, byte for byte, in the report's order.
k := r.task(id)
eng := stepsOf(k, wire.SpecialistEngineering)[0]
- if eng.Design == nil || len(eng.Design.Options) != 2 || eng.Design.Options[0].Name != "Calm" || len(eng.Design.Options[0].Captures) != 2 || eng.Design.Options[1].Name != "Bold" || len(eng.Design.Options[1].Captures) != 1 {
+ if eng.Design == nil || len(eng.Design.Options) != 3 || eng.Design.Options[0].Name != "Calm" || len(eng.Design.Options[0].Captures) != 2 || eng.Design.Options[1].Name != "Bold" || len(eng.Design.Options[1].Captures) != 1 || eng.Design.Options[2].Name != "Plain" {
t.Fatalf("kept %+v", eng.Design)
}
+ if o := eng.Design.Options[0]; o.Direction != "Soft blue, larger type." || o.Page != "calm" || o.Captures[1].Label != "Menu" || o.Captures[1].Viewport != "phone" || o.Captures[1].Path != "/calm/" {
+ t.Fatalf("Calm kept %+v", o)
+ }
for _, o := range eng.Design.Options {
for _, c := range o.Captures {
want, err := os.ReadFile(filepath.Join(x.dir, c.CaptureID))
@@ -401,7 +423,7 @@ func TestContractDesignFinishLine(t *testing.T) {
r.expect(wire.FrameWatchMerge)
r.approved("ds", candX, true)
dir := r.directionCard(id)
- if k := r.task(id); k.Direction == nil || len(k.Direction.Options) != 2 || !k.Direction.NoteNeeded {
+ if k := r.task(id); k.Direction == nil || len(k.Direction.Options) != 3 || !k.Direction.NoteNeeded {
t.Fatalf("direction %+v", k.Direction)
}
calm := eng.Design.Options[0].Captures[0].ID