oficina / equipo Public

equipo: Design's captures kept by the final report, gallery, Build note

What changed (task 19, dynamic specialists slice 1, half 1b):
- render_file is received (Apply, the stream's frame list): renderFile
  stages a chunk only at protocol 36, wire-valid, from the step's
  runner and person, for a step bound to its task's maker, its current
  attempt while running and not withdrawn, the task not ended, in
  order, at most 12 captures an attempt; complete only at its size and
  hash. Staged files are never served.
- The Engineering done branch of stepReport calls keepCaptures for a
  bound step: options valid (wire.ValidOptions), the step the task's
  maker, its binding still exactly grantFor's (bindingHolds, in the
  report's transaction) with page.render, every named capture a
  complete file of this attempt with the report's hash, one render's
  tree digests agreeing (diff is work's tree), and each PNG checked:
  header within MaxCaptureWidth x MaxCaptureHeight before decoding,
  byte for byte as attach keeps it, then fully decoded. All or
  nothing. saveStep drops every unkept file of an ended maker step.
- Migration 0117: chat_steps.design_options (options in report order).
- Read shape: Step.design (StepDesign/StepDesignOption/StepCapture),
  TaskDirection.options and note_needed; CardConflict code
  direction_note. OpenAPI and wireschema updated.
- Build this with more than one option and no note is ErrDirectionNote
  (a card conflict; the person API answers 409 direction_note,
  api.direction_note). The note ends the new task's brief, quoted under
  the person's name (work.explore.build_note); the exploration's brief
  is cut to make room, never the note; a note that cannot fit is 422.
- Web: kept captures by option on the task page timeline, the task
  page direction card and the conversation direction card (the
  existing /tasks/{id}/files/{file} route). Multi-option: the task
  page's note field is required and Drop is formnovalidate; the
  conversation card's Build is its own scriptless form with a required
  note. Token colours, no left-border accents.
- TaskFile names a capture by its id. wire.CaptureTree;
  MaxCaptureWidth/Height pinned to renderpage's bounds.
- 11 copy keys pending (copy.go, inventory rows).

Tests:
CGO_ENABLED=0 go test ./internal/equipo/chat/ -run 'TestDesignCaptures|TestDesignRenderFile|TestDirectionShowsCaptures|TestBuildNote|TestBuildOneOption'
CGO_ENABLED=0 go test ./internal/equipo/ -run 'TestTaskPageShowsDesignCaptures|TestDirectionDecisionShowsOptions|TestConversationDirectionCardBuildNote'
CGO_ENABLED=0 go test ./internal/wire/ -run TestCaptureTree; ./internal/runner/renderpage/ -run TestCapturesFitTheWire

RED: tests first failed to build (tx.renderFile, ErrDirectionNote
undefined); against stubs: "staged map[]", "below protocol 36: <nil>",
"kept 0 of a consistent render", "a stale attempt's chunk: <nil>",
"direction &{... Options:[] NoteNeeded:false}", "brief 4000 bytes, ends
xxxx". The web view tests were written after the views; their RED is
the mutations W1-W12.

GREEN: internal/equipo/chat, internal/equipo, internal/wire/...,
renderpage; plan3test -run 'Contract|Protocol|Specialist|Lease|Copy|
Explore|Direction'; headless -run 'Research|Specialist|Design|Explore|
Direction'; thintest -run 'Research|Explore|Direction|Design|
Specialist|Card|Build|Native|Fixture|Task|File'; vet, gofmt, darwin
build and vet gates, runner-dead-references 0 failures.

Mutations (scripted: break, run, restore): 70 applied, 63 killed.
- renderFile R1 protocol, R2 ValidRenderFile, R4 no such step, R6
  unbound, R7 person, R8 runner, R9 running, R10 attempt, R11
  withdrawn, R12 maker, R13 task ended, R14 first chunk, R15 count,
  R16 skipped chunk, R18 hash at completion, R19 source render: killed
  (TestDesignRenderFileRefused, TestDesignCapturesKeptByTheReport).
- keep K1 no options, K2 ValidOptions, K3 maker, K5 bindingHolds
  (TestDesignCapturesRevokedDuringUpload), K6 digests agree, K7 diff
  is work's tree, K8 foreign id, K10 attempt, K11 report hash, K12 all
  or nothing: killed.
- PNG P1 header bounds, P2 width, P3 height, P4 byte for byte, P5 full
  decode: killed (TestDesignCapturesChecked).
- S1 keep called, S3 drop at the end, S4 design view, S5 Apply's
  render_file case; F1 kept only served, F2 own task only, F3 current
  member, F4 file name: killed.
- D1 note needed, D2 more than one, D3/D4 direction, D5 note in brief,
  D6 room for the note, D7 note that cannot fit, D8 conflict code:
  killed. W1-W12 (timeline, decision and card gallery, BuildNote,
  ask, required, formnovalidate, card Build hidden, empty option):
  killed. X1/X2 wire bounds, X3 CaptureTree, X4 contract enum: killed.
- Layered or equivalent survivors: R3 base64 error (ValidRenderFile
  decodes strictly), R5 step kind (maker check), R17 size (exact chunk
  shares), K4 page.render (bindingHolds), K9 complete (a partial PNG
  never decodes), S2 bound-only keep (unbound steps stage nothing), D9
  eng done (a direction card needs it).
- Redone to compile: R18, K5, P4, D1. First survivors given tests:
  R16 (a skipped chunk), K10 (old attempt's whole capture), W10 (the
  Build drawer's own field). Removed as redundant: keepCaptures' own
  drop (saveStep's), the decoded-bounds compare (image/png's).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 5eaff5ab14830858242782b4cef0fc6fce0539e4 parent 548e7ac
28 files changed, +1,452 −20
  • .rastrillo/budgets.txt +3 −3
  • docs/api/equipo-v1.openapi.json +93 −1
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +11 −0
  • internal/equipo/chat/design_captures.go +303 −0
  • internal/equipo/chat/design_captures_test.go +639 −0
  • internal/equipo/chat/explore.go +38 −5
  • internal/equipo/chat/http.go +5 −0
  • internal/equipo/chat/research_results.go +4 −0
  • internal/equipo/chat/runner.go +2 −0
  • internal/equipo/chat/stream.go +1 −1
  • internal/equipo/chat/tasks.go +25 −1
  • internal/equipo/chat_page.go +7 −0
  • internal/equipo/copy.go +14 −0
  • internal/equipo/design_views.go +56 −0
  • internal/equipo/design_views_test.go +134 −0
  • internal/equipo/migrations/0117_design_options.sql +6 −0
  • internal/equipo/migrations/schema.sql +7 −0
  • internal/equipo/static/equipo.css +9 −0
  • internal/equipo/templates/chat.html +1 −1
  • internal/equipo/templates/work_parts.html +5 −2
  • internal/equipo/templates/work_task.html +1 −0
  • internal/equipo/work_views.go +13 −0
  • internal/runner/renderpage/wire_test.go +7 −1
  • internal/wire/design.go +42 −0
  • internal/wire/design_test.go +10 −0
  • internal/wire/explore.go +12 −4
  • internal/wire/tasks.go +3 −0
  • internal/wire/wireschema/wireschema.go +1 −1

CI failed — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/specialists-slice-1: Type  Size Avail | ext4   96G   84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 2.8s
ci-box: codex: fetched and verified in 4.5s
ci-box: codex-code-mode-host: fetched and verified in 1.4s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.9s
ci-box: pi: installed and verified in 7.4s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 9.4s
ci-box: clone deepened in 4.8s
ci-box: file times set from content: 3401 files, 222 directories
ci-box: ready in 19.5s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipotest	0.153s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  6.4s
+ go list -export -test -tags testbuild -f  ./...
  6.0s
+ go list -export -test -tags browser,testbuild -f  ./internal/equipo ./internal/equipotest ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  3.7s
rastrillo: budget size: 2 problem(s)
exit status 1
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-24 15:56:00 +0000 UTC

go run github.com/zricethezav/gitleaks/v8@v8.30.1 version
version is set by build process
=== check ===
--- shard 0 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-work: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$' ./internal/headless

receipt: test step 1m24.193s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m21.976s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m21.98s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 86.13, cpu waiting 47.95%, memory waiting 0.00%, io waiting 0.35%
--- shard 1 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-review: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$' ./internal/headless

receipt: test step 1m27.088s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m24.157s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m24.16s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 86.13, cpu waiting 48.21%, memory waiting 0.00%, io waiting 0.34%
--- shard 2 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-connections: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$' ./internal/headless

receipt: test step 1m26.69s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m24.465s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m13.84s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.62s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 5s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 86.13, cpu waiting 48.34%, memory waiting 0.00%, io waiting 0.33%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless

receipt: test step 1m23.66s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m21.424s amadan.net/oficina/equipo/internal/headless
receipt: slow test 41.06s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 21.64s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.45s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.27s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 86.13, cpu waiting 47.95%, memory waiting 0.00%, io waiting 0.35%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless

receipt: test step 1m42.833s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m40.081s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m8.74s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.94s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 8.78s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 7.73s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 4.89s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 77.88, cpu waiting 44.27%, memory waiting 0.00%, io waiting 0.26%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless

receipt: test step 3m4.425s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3m1.583s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m45.05s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 20.33s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.25s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 7.2s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistantAttachments
receipt: slow test 6.77s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 28.16, cpu waiting 12.30%, memory waiting 0.00%, io waiting 0.06%
--- shard 6 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 2m20.549s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m17.5s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 10.34s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.82s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 5.29s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 3.95s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 2.85s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
machine: 32 CPUs, load 50.75, cpu waiting 25.24%, memory waiting 0.00%, io waiting 0.13%
--- shard 7 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest-contract: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 2m0.598s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m58.51s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.66s amadan.net/oficina/equipo/internal/thintest TestContractRetryPreviewUnverifiedMerge
receipt: slow test 9.14s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.01s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.63s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 3.05s amadan.net/oficina/equipo/internal/thintest TestContractPausedJob
machine: 32 CPUs, load 60.33, cpu waiting 33.41%, memory waiting 0.00%, io waiting 0.18%
--- shard 8 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-thin: ./internal/runner/thin
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/runner/thin
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/runner/thin TestSnapshotRefusesASelfResumingWriter
=== RUN   TestSnapshotRefusesASelfResumingWriter
    worksnap_adversary_linux_test.go:232: 0 of 5 copies saw the page change; 0 refused busy
    worksnap_adversary_linux_test.go:234: the self-resuming writer never wrote during a copy: the test proves nothing
--- FAIL: TestSnapshotRefusesASelfResumingWriter (0.77s)

--- FAIL amadan.net/oficina/equipo/internal/runner/thin (package output)
FAIL
rastrillo-budget/v1 ran 5m31.147s
FAIL	amadan.net/oficina/equipo/internal/runner/thin	331.241s


receipt: test step 5m32.818s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 5m31.147s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 37.06s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.9s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.86s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.52s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 9.96s amadan.net/oficina/equipo/internal/runner/thin TestTimeoutKeepsNothingForAnOlderInstance
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestSnapshotRefusesASelfResumingWriter$' -count=1 ./internal/runner/thin   (retry, once)
FAILED TWICE ./internal/runner/thin:TestSnapshotRefusesASelfResumingWriter runner-thin
=== RUN   TestSnapshotRefusesASelfResumingWriter
    worksnap_adversary_linux_test.go:232: 0 of 5 copies saw the page change; 0 refused busy
    worksnap_adversary_linux_test.go:234: the self-resuming writer never wrote during a copy: the test proves nothing
--- FAIL: TestSnapshotRefusesASelfResumingWriter (0.78s)
FAIL
rastrillo-budget/v1 ran 777ms
FAIL	amadan.net/oficina/equipo/internal/runner/thin	0.789s
FAIL
machine: 32 CPUs, load 3.84, cpu waiting 0.97%, memory waiting 0.00%, io waiting 0.00%
make: *** [Makefile:113: ci-shard] Error 1

amadan: step check shard 8 of 29 failed: exit status 2
--- shard 9 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-bug: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$' ./internal/runner

receipt: test step 53.792s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 52.832s amadan.net/oficina/equipo/internal/runner
receipt: slow test 32.8s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 66.95, cpu waiting 37.64%, memory waiting 0.00%, io waiting 0.59%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner

receipt: test step 1m6.326s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m5.062s amadan.net/oficina/equipo/internal/runner
receipt: slow test 55.01s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 52.04s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.44s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.6s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 84.95, cpu waiting 44.68%, memory waiting 0.00%, io waiting 0.48%
--- shard 11 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-rest: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$|^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner

receipt: test step 37.297s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 36.228s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.13s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.41s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 3.28s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.14s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestCoordinatorTransientRefusalKeepsServing
machine: 32 CPUs, load 39.10, cpu waiting 22.92%, memory waiting 0.00%, io waiting 0.80%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 41.1%, load 28.40
test lane equipotest-a: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' ./internal/equipotest

receipt: test step 1m13.437s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m11.12s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 31.11s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 30.97s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 28.66s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 25.77s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 25.51s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfiguration
machine: 32 CPUs, load 77.88, cpu waiting 43.38%, memory waiting 0.00%, io waiting 0.25%
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 41.1%, load 28.40
test lane equipotest-e: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[E-P]' ./internal/equipotest

receipt: test step 2m20.055s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m17.774s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 22.6s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 22.58s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 22.56s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 22.54s amadan.net/oficina/equipo/internal/equipotest TestProjectsSharedAndGrouped
receipt: slow test 22.53s amadan.net/oficina/equipo/internal/equipotest TestProjectsAccountRevisionAndValidation
machine: 32 CPUs, load 34.32, cpu waiting 15.53%, memory waiting 0.00%, io waiting 0.08%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 41.1%, load 28.40
test lane equipotest-r: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestR' ./internal/equipotest
budget note: internal/equipotest took 5m34.904s, over the 5m0s its record on line 15 allows; reported only, timing fails on CI

receipt: test step 5m40.851s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 5m34.904s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 4m42.43s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.99s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.96s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 9.88s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 6.85s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 2.51, cpu waiting 0.53%, memory waiting 0.00%, io waiting 0.00%
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 41.1%, load 28.40
test lane equipotest-rest: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test[A-D]|^TestQ|^Test[E-P]|^TestR' ./internal/equipotest

receipt: test step 1m12.613s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m10.165s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 28.49s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 28.48s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 28.43s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 26.33s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsUpgrade
receipt: slow test 26.29s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettings
machine: 32 CPUs, load 77.88, cpu waiting 43.38%, memory waiting 0.00%, io waiting 0.25%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 41.1%, load 28.40
test lane plan3test: ./internal/plan3test
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/plan3test
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/plan3test TestPlan3ReleaseBoundaries
=== RUN   TestPlan3ReleaseBoundaries
--- FAIL: TestPlan3ReleaseBoundaries (0.34s)

--- FAIL amadan.net/oficina/equipo/internal/plan3test TestPlan3ReleaseBoundaries/inventory
=== RUN   TestPlan3ReleaseBoundaries/inventory
    plan3_release_test.go:22: entry has no copy review status or applicable acceptance chat.specialist.capability.branch.edit
--- FAIL: TestPlan3ReleaseBoundaries/inventory (0.02s)

--- FAIL amadan.net/oficina/equipo/internal/plan3test (package output)
FAIL
rastrillo-budget/v1 ran 56.382s
FAIL	amadan.net/oficina/equipo/internal/plan3test	56.681s


receipt: test step 58.585s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 56.382s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 4.12s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.58s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.69s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.69s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.42s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestPlan3ReleaseBoundaries$/^inventory$' -count=1 ./internal/plan3test   (retry, once)
FAILED TWICE ./internal/plan3test:TestPlan3ReleaseBoundaries/inventory plan3test
=== RUN   TestPlan3ReleaseBoundaries
=== RUN   TestPlan3ReleaseBoundaries/inventory
    plan3_release_test.go:22: entry has no copy review status or applicable acceptance chat.specialist.capability.branch.edit
--- FAIL: TestPlan3ReleaseBoundaries (0.02s)
    --- FAIL: TestPlan3ReleaseBoundaries/inventory (0.02s)
FAIL
rastrillo-budget/v1 ran 17ms
FAIL	amadan.net/oficina/equipo/internal/plan3test	0.222s
FAIL
machine: 32 CPUs, load 81.96, cpu waiting 47.64%, memory waiting 0.00%, io waiting 0.32%
make: *** [Makefile:113: ci-shard] Error 1

amadan: step check shard 16 of 29 failed: exit status 2
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 41.1%, load 28.40
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/release/renderertest ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/designstep ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/pause ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/render ./internal/runner/renderpage ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/release/renderertest ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/designstep ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/pause ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/render ./internal/runner/renderpage ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/chatmarkdown: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
--- FAIL amadan.net/oficina/equipo/internal/runner/metered TestMeteredRaceAdmitsExactlyOne
=== RUN   TestMeteredRaceAdmitsExactlyOne
    meter_test.go:205: round 0: ran map[], held map[ask:busy review:busy]
--- FAIL: TestMeteredRaceAdmitsExactlyOne (0.03s)

--- FAIL amadan.net/oficina/equipo/internal/runner/metered (package output)
FAIL
rastrillo-budget/v1 ran 3.184s
FAIL	amadan.net/oficina/equipo/internal/runner/metered	3.206s

--- FAIL amadan.net/oficina/equipo/internal/runner/pause TestHoldStopsEveryWriter
=== RUN   TestHoldStopsEveryWriter
    pause_linux_test.go:238: Hold: sandbox could not be paused in time (called false)
    pause_linux_test.go:69: sandbox stderr: 
--- FAIL: TestHoldStopsEveryWriter (0.08s)

--- FAIL amadan.net/oficina/equipo/internal/runner/pause TestHoldStopsAReparentedDaemon
=== RUN   TestHoldStopsAReparentedDaemon
    pause_linux_test.go:598: sandbox could not be paused in time
    pause_linux_test.go:69: sandbox stderr: 
--- FAIL: TestHoldStopsAReparentedDaemon (6.77s)

--- FAIL amadan.net/oficina/equipo/internal/runner/pause (package output)
FAIL
FAIL	amadan.net/oficina/equipo/internal/runner/pause	9.959s

--- FAIL amadan.net/oficina/equipo/internal/testci TestBudgetRecordsAreShort
=== RUN   TestBudgetRecordsAreShort
    budgets_file_test.go:37: .rastrillo/budgets.txt:17: reason is 302 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:18: reason is 283 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:41: reason is 461 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:59: reason is 445 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:74: reason is 249 bytes, over 200
--- FAIL: TestBudgetRecordsAreShort (0.00s)

--- FAIL amadan.net/oficina/equipo/internal/testci (package output)
FAIL
rastrillo-budget/v1 ran 1.588s
FAIL	amadan.net/oficina/equipo/internal/testci	1.594s

budget: amadan.net/oficina/equipo/internal/runner/designstep ran tests but printed no time: add func TestMain(m *testing.M) { os.Exit(budget.Main(m)) }
budget note: internal/equipo took 2m39.966s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 41.197s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/github took 40.651s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/setup took 11.237s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 2m2.631s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 50.084s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/containment took 1m7.346s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/forge took 28.614s, over the 20s its record on line 35 allows; reported only, timing fails on CI
budget note: internal/runner/provider/claude/realcli took 14.155s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/provider/pi took 1m22.773s, over the 1m0s its record on line 27 allows; reported only, timing fails on CI
budget note: internal/runner/render took 1m29.861s, over the 10s the default allows; reported only, timing fails on CI

receipt: test step 2m46.473s against a 60s target (the gate's other steps are not in this figure)
receipt: 53 packages ran, 17 cached, 17 without tests, 3 failed
receipt: slow package 2m39.966s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 2m2.631s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 1m29.861s amadan.net/oficina/equipo/internal/runner/render
receipt: slow package 1m22.773s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 1m9.17s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow test 58.73s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
receipt: slow test 50.31s amadan.net/oficina/equipo/internal/runner/render TestLaunchNeverClaimsAnUnprovenEnd
receipt: slow test 49.67s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 49.51s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
receipt: slow test 49.36s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
rastrillo: budget test: go test failed
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestMeteredRaceAdmitsExactlyOne$' -count=1 ./internal/runner/metered   (retry, once)
##############################################################################
FLAKE ./internal/runner/metered:TestMeteredRaceAdmitsExactlyOne rest 5eaff5ab14830858242782b4cef0fc6fce0539e4 0.03s 24.29
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
+ go test -tags testbuild -timeout 15m -v -run '^TestHoldStopsAReparentedDaemon$|^TestHoldStopsEveryWriter$' -count=1 ./internal/runner/pause   (retry, once)
FAILED TWICE ./internal/runner/pause:TestHoldStopsAReparentedDaemon rest
FAILED TWICE ./internal/runner/pause:TestHoldStopsEveryWriter rest
=== RUN   TestHoldStopsEveryWriter
--- PASS: TestHoldStopsEveryWriter (0.32s)
=== RUN   TestHoldStopsAReparentedDaemon
    pause_linux_test.go:603: daemon made no progress in 2s
    pause_linux_test.go:69: sandbox stderr: 
--- FAIL: TestHoldStopsAReparentedDaemon (2.31s)
FAIL
FAIL	amadan.net/oficina/equipo/internal/runner/pause	2.629s
FAIL
+ go test -tags testbuild -timeout 15m -v -run '^TestBudgetRecordsAreShort$' -count=1 ./internal/testci   (retry, once)
FAILED TWICE ./internal/testci:TestBudgetRecordsAreShort rest
=== RUN   TestBudgetRecordsAreShort
    budgets_file_test.go:37: .rastrillo/budgets.txt:17: reason is 302 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:18: reason is 283 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:41: reason is 461 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:59: reason is 445 bytes, over 200
    budgets_file_test.go:37: .rastrillo/budgets.txt:74: reason is 249 bytes, over 200
--- FAIL: TestBudgetRecordsAreShort (0.00s)
FAIL
rastrillo-budget/v1 ran 0s
FAIL	amadan.net/oficina/equipo/internal/testci	0.004s
FAIL
machine: 32 CPUs, load 22.43, cpu waiting 9.42%, memory waiting 0.00%, io waiting 0.04%
make: *** [Makefile:113: ci-shard] Error 1

amadan: step check shard 17 of 29 failed: exit status 2
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless

receipt: test step 1m28.386s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m26.481s amadan.net/oficina/equipo/internal/headless
receipt: slow test 39.36s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.86s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 11.23s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.68s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 7.14s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 81.96, cpu waiting 47.64%, memory waiting 0.00%, io waiting 0.32%
--- shard 19 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-work: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' ./internal/headless
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
=== RUN   TestBrowserRailFollowsWork
time=2026-11-29T02:20:05.548Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-29T02:20:05.549Z level=INFO msg="startup phase done" phase=state_lock took=221µs
time=2026-11-29T02:20:05.549Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-29T02:20:05.549Z level=INFO msg="startup phase done" phase=claim_roots took=194µs
time=2026-11-29T02:20:05.549Z level=INFO msg="startup phase" phase=sweep
time=2026-11-29T02:20:05.602Z level=INFO msg="startup phase done" phase=sweep took=52.737ms
time=2026-11-29T02:20:05.602Z level=INFO msg="startup phase" phase=credentials
time=2026-11-29T02:20:05.602Z level=INFO msg="startup phase done" phase=credentials took=114µs
time=2026-11-29T02:20:05.602Z level=INFO msg="startup phase" phase=open_state
time=2026-11-29T02:20:05.662Z level=INFO msg="startup phase done" phase=open_state took=60.154ms
time=2026-11-29T02:20:05.663Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-29T02:20:05.665Z level=INFO msg=connecting host=127.0.0.1:41289 protocol=36
time=2026-11-29T02:20:05.667Z level=INFO msg=connected host=127.0.0.1:41289 took=1.052ms
time=2026-11-29T02:20:05.667Z level=INFO msg="capabilities gathering"
time=2026-11-29T02:20:05.669Z level=INFO msg="capabilities gathered" took=1.143ms tags=linux,claude,go
time=2026-11-29T02:20:05.672Z level=INFO msg="hello sent" protocol=36
time=2026-11-29T02:20:05.674Z level=INFO msg=welcome protocol=36 role=primary generation=1
time=2026-11-29T02:20:06.871Z level=INFO msg="connection checked" connection=claude-1 state=healthy
time=2026-11-29T02:20:14.567Z level=INFO msg="kept sessions" kept=1 bytes=2885 expired=0
time=2026-11-29T02:20:19.722Z level=INFO msg="kept sessions" kept=2 bytes=5037 expired=0
time=2026-11-29T02:20:20.738Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-29T02:20:20.738Z level=INFO msg="startup phase done" phase=state_lock took=177µs
time=2026-11-29T02:20:20.738Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-29T02:20:20.738Z level=INFO msg="startup phase done" phase=claim_roots took=166µs
time=2026-11-29T02:20:20.738Z level=INFO msg="startup phase" phase=sweep
time=2026-11-29T02:20:20.803Z level=INFO msg="startup phase done" phase=sweep took=64.767ms
time=2026-11-29T02:20:20.803Z level=INFO msg="startup phase" phase=credentials
time=2026-11-29T02:20:20.803Z level=INFO msg="startup phase done" phase=credentials took=182µs
time=2026-11-29T02:20:20.803Z level=INFO msg="startup phase" phase=open_state
time=2026-11-29T02:20:20.889Z level=INFO msg="startup phase done" phase=open_state took=85.751ms
time=2026-11-29T02:20:20.890Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-29T02:20:20.893Z level=INFO msg=connecting host=127.0.0.1:46393 protocol=36
time=2026-11-29T02:20:20.895Z level=INFO msg=connected host=127.0.0.1:46393 took=2.387ms
time=2026-11-29T02:20:20.895Z level=INFO msg="capabilities gathering"
time=2026-11-29T02:20:20.896Z level=INFO msg="capabilities gathered" took=725µs tags=linux,claude,go
time=2026-11-29T02:20:20.897Z level=INFO msg="hello sent" protocol=36
time=2026-11-29T02:20:20.911Z level=INFO msg=welcome protocol=36 role=primary generation=1
time=2026-11-29T02:20:22.775Z level=INFO msg="connection checked" connection=claude-1 state=healthy
    browser_review_test.go:57: waiting for document.querySelector('#rail [data-specialist="engineering"]')?.dataset.state==='working' && document.querySelector('#rail [data-specialist="engineering"]').querySelector('[equipo-nav-task]')?.textContent==='Slow sidebar change' && document.querySelector('#nav-tasks [data-count]')?.textContent==='1': context deadline exceeded (last evaluation: context deadline exceeded)
time=2026-11-29T02:20:27.378Z level=WARN msg="step account" err=cancelled
--- FAIL: TestBrowserRailFollowsWork (22.55s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m34.839s
FAIL	amadan.net/oficina/equipo/internal/headless	95.088s


receipt: test step 1m36.972s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m34.839s amadan.net/oficina/equipo/internal/headless
receipt: slow test 27.15s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 22.55s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 13.77s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 12.67s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
receipt: slow test 9.61s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' -v -run '^TestBrowserRailFollowsWork$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserRailFollowsWork browser-headless-work 5eaff5ab14830858242782b4cef0fc6fce0539e4 22.55s 81.96
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 60.33, cpu waiting 34.48%, memory waiting 0.00%, io waiting 0.19%
--- shard 20 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-connections: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless

receipt: test step 1m58.302s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m56.06s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.17s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.73s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 13.32s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 11.47s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 11.32s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsSignInEmail
machine: 32 CPUs, load 60.33, cpu waiting 34.48%, memory waiting 0.00%, io waiting 0.19%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserCardAnswerSettlesAtBottom|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN   TestBrowserCopyContinue
time=2026-11-29T02:20:30.534Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-29T02:20:30.535Z level=INFO msg="startup phase done" phase=state_lock took=271µs
time=2026-11-29T02:20:30.535Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-29T02:20:30.535Z level=INFO msg="startup phase done" phase=claim_roots took=187µs
time=2026-11-29T02:20:30.535Z level=INFO msg="startup phase" phase=sweep
time=2026-11-29T02:20:30.579Z level=INFO msg="startup phase done" phase=sweep took=43.805ms
time=2026-11-29T02:20:30.579Z level=INFO msg="startup phase" phase=credentials
time=2026-11-29T02:20:30.579Z level=INFO msg="startup phase done" phase=credentials took=137µs
time=2026-11-29T02:20:30.579Z level=INFO msg="startup phase" phase=open_state
time=2026-11-29T02:20:30.626Z level=INFO msg="startup phase done" phase=open_state took=47.168ms
time=2026-11-29T02:20:30.627Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-29T02:20:30.628Z level=INFO msg=connecting host=127.0.0.1:40393 protocol=36
time=2026-11-29T02:20:30.630Z level=INFO msg=connected host=127.0.0.1:40393 took=1.776ms
rastrillo: budget test: go test failed
time=2026-11-29T02:20:30.638Z level=INFO msg="capabilities gathering"
time=2026-11-29T02:20:30.641Z level=INFO msg="capabilities gathered" took=3.594ms tags=linux,claude,go
time=2026-11-29T02:20:30.642Z level=INFO msg="hello sent" protocol=36
time=2026-11-29T02:20:30.647Z level=INFO msg=welcome protocol=36 role=primary generation=1
    browser_copy_test.go:90: waiting for !document.querySelector('[data-copy-continue]'): context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserCopyContinue (6.45s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m45.12s
FAIL	amadan.net/oficina/equipo/internal/headless	105.347s


receipt: test step 1m47.086s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m45.12s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.2s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 13.87s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 11.06s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 9.56s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.71s amadan.net/oficina/equipo/internal/headless TestBrowserNotebookLook
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserCardAnswerSettlesAtBottom|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' -v -run '^TestBrowserCopyContinue$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest 5eaff5ab14830858242782b4cef0fc6fce0539e4 6.45s 73.48
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 68.56, cpu waiting 38.96%, memory waiting 0.00%, io waiting 0.22%
--- shard 22 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-rest: ./internal/equipo
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserPreviewBlocksNavigation|TestBrowserPreviewPassExchange)$' ./internal/equipo

receipt: test step 4.716s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.69s amadan.net/oficina/equipo/internal/equipo
receipt: slow test 1.96s amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewPassExchange
receipt: slow test 720ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
browser lane browser-rest: ./internal/equipotest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserGitHubManifestCSP)$' ./internal/equipotest

receipt: test step 8.162s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 6.456s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 6.46s amadan.net/oficina/equipo/internal/equipotest TestBrowserGitHubManifestCSP
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor|TestBrowserSmartDoor)$' ./internal/idtest
budget note: internal/idtest took 11.787s, over the 10s the default allows; reported only, timing fails on CI

receipt: test step 13.585s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 11.787s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 9.56s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.23s amadan.net/oficina/equipo/internal/idtest TestBrowserOficinaIDDoor
browser lane browser-rest: ./internal/plan3test
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestTeamsHierarchyBrowser)$' ./internal/plan3test

receipt: test step 4.736s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.714s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.71s amadan.net/oficina/equipo/internal/plan3test TestTeamsHierarchyBrowser
browser lane browser-rest: ./internal/thintest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAccessEmojiByline|TestBrowserAccessFinalOutcomes|TestBrowserAccessRequest|TestBrowserAccessReview|TestBrowserActivitySubjects|TestBrowserAutonomySettings|TestBrowserCoordinatorQueue|TestBrowserEmptyConversation|TestBrowserEndedNoteStaysGone|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPausedWork|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRhythm|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre|TestBrowserTryAgain)$' ./internal/thintest

receipt: test step 3m41.213s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3m38.251s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 27.98s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.41s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.09s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.72s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 9.11s amadan.net/oficina/equipo/internal/thintest TestBrowserRhythm
machine: 32 CPUs, load 10.17, cpu waiting 3.83%, memory waiting 0.00%, io waiting 0.01%
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless   (57s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.94s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.27s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 10.16s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.51s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 27.65s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless   (64s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 16.59s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 12.76s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 10.46s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 21.10s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (23s)
ok ./internal/headless TestMixedVersions 19.77s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (3s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.88s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (3s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.06s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 84.95, cpu waiting 43.82%, memory waiting 0.00%, io waiting 0.50%
--- shard 24 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 24: make runner-host
python3 scripts/runner-prerequisites.py
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks

receipt: test step 14.987s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 4 without tests, 0 failed
receipt: slow package 8.22s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 187ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 114ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 6ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow test 6.05s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.7s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 340ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 190ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/provider/codex TestDirectJournalAdapterBarrier
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment

receipt: test step 4.463s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3.232s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 300ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 190ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryMalformedRecord
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceExitStatus
machine: 32 CPUs, load 20.62, cpu waiting 13.07%, memory waiting 0.00%, io waiting 1.04%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 41.1%, load 28.40
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 3113 text files, 3332 matches, 0 failures
python3 native/scripts/check-share.py
Share packaging, keychain-only boundary and reviewed copy verified
python3 scripts/ci-test.py check
lanes: 18 lanes and 5 browser lanes run every test once; 20-check@29
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /dev/null ./cmd/equipo-runner
go vet ./...
go vet -tags testbuild ./internal/runner/thin ./internal/headless
GOOS=darwin GOARCH=arm64 go vet ./cmd/equipo-runner/... ./internal/runner/... ./internal/wire/... ./internal/release/...
go tool fiesta spacing -skip tokens.css internal/equipo/static
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
internal/runner/provider: 5792 source lines, over the 5731 its exemption (line 29) allows
rastrillo: budget size: 2 problem(s)
internal/thintest: 37005 test lines, over the 37004 its exemption (line 74) allows
exit status 1
make[1]: *** [Makefile:75: budget] Error 1
machine: 32 CPUs, load 83.01, cpu waiting 47.92%, memory waiting 0.00%, io waiting 0.36%
make: *** [Makefile:113: ci-shard] Error 2

amadan: step check shard 25 of 29 failed: exit status 2
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 41.1%, load 28.40
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
internal/runner/thin/render_page_test.go:210:48: error should be returned as the last argument (ST1008)
internal/wire/design_test.go:244:76: string literal contains the Unicode format character U+202E, consider using the '\u202e' escape sequence instead (ST1018)
exit status 1
make[1]: *** [Makefile:195: staticcheck] Error 1
machine: 32 CPUs, load 77.20, cpu waiting 42.53%, memory waiting 0.00%, io waiting 0.51%
make: *** [Makefile:113: ci-shard] Error 2

amadan: step check shard 26 of 29 failed: exit status 2
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 41.1%, load 28.40
shard 27: make govulncheck
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
=== Symbol Results ===

No vulnerabilities found.

Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 10
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
machine: 32 CPUs, load 66.95, cpu waiting 38.83%, memory waiting 0.00%, io waiting 0.57%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 41.1%, load 28.40
shard 28: make gitleaks
2:20AM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
2:20AM INF 1298 commits scanned.
2:20AM INF scanned ~70044146 bytes (70.04 MB) in 29.1s
2:20AM INF no leaks found
machine: 32 CPUs, load 66.95, cpu waiting 40.02%, memory waiting 0.00%, io waiting 0.55%

amadan: job failed at step check shards 8, 16, 17, 25, 26 of 29 — its output is above, not at the tail of this log
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index f9d8d2cd..065fde1b 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -14,8 +14,8 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr
time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI.
time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage.
-size internal/equipo 23960 - Preview grants, retry/timeline, no-access merges, kept work, check-db copy, notification actions, places page and its superseded card, GitHub owner routes, specialist copy, the recovery card and Design's waiting lines; measured 23960 source lines.
-size internal/wire 8530 - Protocol 31 facts, 32 unfinished work, task evidence, CI units, notification inputs, 33 Assistant files, 34 places, 35 diffs, 36 Design (binding, options, render_file), its exploration flag, brief, waits and recovery card; measured 8530 source lines.
+size internal/equipo 24050 - Preview grants, retry/timeline, no-access merges, kept work, check-db copy, notification actions, places page and its superseded card, GitHub owner routes, specialist copy, the recovery card and Design's waiting lines, Design's captures on the task page and direction card; measured 24050 source lines.
+size internal/wire 8583 - Protocol 31 facts, 32 unfinished work, task evidence, CI units, notification inputs, 33 Assistant files, 34 places, 35 diffs, 36 Design (binding, options, render_file), its exploration flag, brief, waits and recovery card, kept captures on the read shape; measured 8583 source lines.
size internal/equipotest - 12684 GitHub connect value search, lifecycle and sweep-log contracts; Task 21 migration fixtures, Rastrillo asset contract, renderer pin link; measured 0/12684 source/test lines.
time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded);
time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s).
@@ -56,7 +56,7 @@ perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for device
perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen.
perf GET /api/v1/assistant/messages skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen.
perf GET /api/v1/assistant/events skip Assistant event stream (Server-Sent Events), bearer-only and long-lived; not a screen.
-size internal/equipo/chat 39491 14857 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places and where their cards land, waiting cards, 36 proposal project and Build's note, scoped specialists and their continuation, grants and step bindings, Design routing, the autonomy limit and the recovery card (any maker that stops resolving); measured 39491/14857.
+size internal/equipo/chat 39862 15496 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places and where their cards land, waiting cards, 36 proposal project and Build's note, scoped specialists and their continuation, grants and step bindings, Design routing, the autonomy limit and the recovery card (any maker that stops resolving), Design's captures kept by the final report and Build's note; measured 39862/15496.
perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}.
perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}.
perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections.
diff --git a/docs/api/equipo-v1.openapi.json b/docs/api/equipo-v1.openapi.json
index c5f85564..afa867ab 100644
--- a/docs/api/equipo-v1.openapi.json
+++ b/docs/api/equipo-v1.openapi.json
@@ -19285,7 +19285,8 @@
"type": "string",
"enum": [
"card_stale",
- "card_answered"
+ "card_answered",
+ "direction_note"
]
},
"copy_key": {
@@ -22691,6 +22692,9 @@
"research": {
"$ref": "#/components/schemas/StepResearch"
},
+ "design": {
+ "$ref": "#/components/schemas/StepDesign"
+ },
"hold": {
"$ref": "#/components/schemas/StepHold"
},
@@ -22944,6 +22948,85 @@
"additionalProperties": false,
"x-go-type": "wire.StepResearchImage"
},
+ "StepDesign": {
+ "type": "object",
+ "properties": {
+ "attempt": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "options": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/components/schemas/StepDesignOption"
+ }
+ }
+ },
+ "required": [
+ "attempt",
+ "options"
+ ],
+ "additionalProperties": false,
+ "x-go-type": "wire.StepDesign"
+ },
+ "StepDesignOption": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "captures": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/components/schemas/StepCapture"
+ }
+ }
+ },
+ "required": [
+ "name",
+ "captures"
+ ],
+ "additionalProperties": false,
+ "x-go-type": "wire.StepDesignOption"
+ },
+ "StepCapture": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "capture_id": {
+ "type": "string"
+ },
+ "size": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "width": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "height": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ "required": [
+ "id",
+ "capture_id",
+ "size",
+ "width",
+ "height"
+ ],
+ "additionalProperties": false,
+ "x-go-type": "wire.StepCapture"
+ },
"StreamEvent": {
"oneOf": [
{
@@ -23402,6 +23485,15 @@
},
"previews_off": {
"type": "boolean"
+ },
+ "options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/StepDesignOption"
+ }
+ },
+ "note_needed": {
+ "type": "boolean"
}
},
"required": [
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index bfdbb7c7..2700fd97 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -7013,6 +7013,17 @@ records remain unchanged.
| `work.design.design_runner_old` | Waiting for the runner to be updated so it can run Design. | Copy specialist | COPY REVIEW PENDING |
| `work.design.design_renderer` | Waiting for the runner’s page renderer. Updating the runner fixes it. | Copy specialist | COPY REVIEW PENDING |
| `work.design.design_no_claude` | Waiting for a Claude connection on the runner. Design works only with Claude. | Copy specialist | COPY REVIEW PENDING |
+| `work.captures.option` | Option %d: %s | Copy specialist | COPY REVIEW PENDING |
+| `work.captures.alt` | %s, screenshot %d | Copy specialist | COPY REVIEW PENDING |
+| `work.captures.none` | No screenshots of this option. | Copy specialist | COPY REVIEW PENDING |
+| `work.captures.tree.work` | Mockup | Copy specialist | COPY REVIEW PENDING |
+| `work.captures.tree.base` | Before | Copy specialist | COPY REVIEW PENDING |
+| `work.captures.tree.diff` | What changed | Copy specialist | COPY REVIEW PENDING |
+| `work.decide.direction_ask_options` | Say which option to build, try again with a note, or drop it. | Copy specialist | COPY REVIEW PENDING |
+| `chat.card.direction_note_options` | Which option should Equipo build, or what should change? A note is required to build or try again. | Copy specialist | COPY REVIEW PENDING |
+| `chat.card.build_note` | Which option should Equipo build? Say it in your own words. | Copy specialist | COPY REVIEW PENDING |
+| `api.direction_note` | Say which option to build. Open this card on the web to add your note. | Copy specialist | COPY REVIEW PENDING |
+| `work.explore.build_note` | %s said which option to build, in their own words: %s | Copy specialist | COPY REVIEW PENDING |
## Task 21
diff --git a/internal/equipo/chat/design_captures.go b/internal/equipo/chat/design_captures.go
new file mode 100644
index 00000000..e2a4a076
--- /dev/null
+++ b/internal/equipo/chat/design_captures.go
@@ -0,0 +1,303 @@
+package chat
+
+import (
+ "bytes"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/hex"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "image/png"
+ "slices"
+ "strings"
+
+ "gorm.io/gorm"
+
+ "amadan.net/oficina/equipo/internal/attach"
+ "amadan.net/oficina/equipo/internal/specialist"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// A Design attempt's captures (spec 2026-11-28-dynamic-specialists.md,
+// sections 3 and 5; protocol 36), kept as Research keeps its images: the
+// runner sends the captures its final report names as render_file chunks
+// before that report; they are staged for the step's current attempt
+// (renderFile) and never served. The final report's options are then
+// checked against them in the report's transaction (keepCaptures): the
+// options valid, every capture complete with the report's hash, the tree
+// digests consistent, each PNG decoded within the capture bounds, and
+// the step's binding still what grantFor finds. Only then are they kept,
+// with the options; anything else keeps nothing. Whatever the attempt
+// sent and did not keep is deleted with its bytes when the step ends.
+
+// ErrDirectionNote: Build this on a direction card with more than one
+// option, without the person's note. A card conflict: the card stands.
+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.
+type designKept struct {
+ Attempt int64 `json:"attempt"`
+ Options []keptOption `json:"options"`
+}
+
+type keptOption struct {
+ Name string `json:"name"`
+ Captures []string `json:"captures"`
+}
+
+// refuseRender refuses a render_file chunk: acked and dropped, logged.
+func refuseRender(why string) error {
+ return fmt.Errorf("%w: render_file: %s", ErrRefused, why)
+}
+
+// renderFile stages one chunk of a Design capture only at protocol 36,
+// valid on the wire, from the runner the step is placed on, for a step
+// bound to its task's maker, for the step's current attempt while it
+// runs and the task has not ended, in order, and at most
+// wire.MaxDesignCaptures captures per attempt. The last chunk completes
+// the file only when the whole is the declared size and hash. A staged
+// file is never served (TaskFile serves kept files only).
+func (t *txn) renderFile(l Lease, v *wire.RenderFile) error {
+ if l.Protocol < wire.ProtocolDesign {
+ return refuseRender("below protocol 36")
+ }
+ if !wire.ValidRenderFile(*v) {
+ return refuseRender("bad chunk")
+ }
+ data, err := base64.StdEncoding.Strict().DecodeString(v.Data)
+ if err != nil {
+ return refuseRender("bad chunk data")
+ }
+ var s stepRecord
+ if err := t.db.Where("id = ? AND task_id = ?", v.StepID, v.TaskID).First(&s).Error; errors.Is(err, gorm.ErrRecordNotFound) {
+ return refuseRender("no such step")
+ } else if err != nil {
+ return err
+ }
+ if s.Specialist != wire.SpecialistEngineering || s.SpecialistID == "" || s.Person != l.Runner.Person || s.RunnerID != l.Runner.RunnerID {
+ return refuseRender("not this runner's Design step")
+ }
+ if s.State != wire.StepRunning || v.Attempt != s.Attempt || s.Withdrawn {
+ return refuseRender("attempt not current")
+ }
+ k, err := t.loadTask(s.TaskID)
+ if err != nil {
+ return err
+ }
+ if k.MakerSpecialistID != s.SpecialistID {
+ return refuseRender("not the task's maker")
+ }
+ if wire.FinalStage(k.Stage) || k.CancelRequested {
+ return refuseRender("task ended")
+ }
+ now := t.now()
+ var f taskFileRecord
+ err = t.db.Where("step_id = ? AND attempt = ? AND image_id = ?", s.ID, s.Attempt, v.CaptureID).First(&f).Error
+ fresh := errors.Is(err, gorm.ErrRecordNotFound)
+ if err != nil && !fresh {
+ return err
+ }
+ if fresh {
+ if v.Index != 0 {
+ return refuseRender("chunk out of order")
+ }
+ var n int64
+ if err := t.db.Model(&taskFileRecord{}).Where("step_id = ? AND attempt = ?", s.ID, s.Attempt).Count(&n).Error; err != nil {
+ return err
+ }
+ if n >= wire.MaxDesignCaptures {
+ return refuseRender("too many captures")
+ }
+ f = taskFileRecord{ID: newID("tf_"), TaskID: k.ID, StepID: s.ID, Attempt: s.Attempt, RunnerID: l.Runner.RunnerID, ImageID: v.CaptureID, Size: v.Size, SHA256: v.SHA256, Total: v.Total, Source: taskFileRender, CreatedAt: now}
+ } else if f.Complete || f.Total != v.Total || f.Size != v.Size || f.SHA256 != v.SHA256 || v.Index != f.Received {
+ return refuseRender("chunk out of order")
+ }
+ f.Received, f.Bytes, f.UpdatedAt = f.Received+1, f.Bytes+int64(len(data)), now
+ if f.Bytes > f.Size || f.Received == f.Total && f.Bytes != f.Size {
+ return refuseRender("size does not match")
+ }
+ if err := t.db.Create(&taskFileDataRecord{FileID: f.ID, Idx: v.Index, Data: data}).Error; err != nil {
+ return err
+ }
+ if f.Received == f.Total {
+ whole, err := t.fileBytes(f.ID)
+ if err != nil {
+ return err
+ }
+ if sum := sha256.Sum256(whole); int64(len(whole)) != f.Size || hex.EncodeToString(sum[:]) != f.SHA256 {
+ return refuseRender("hash does not match")
+ }
+ f.Complete = true
+ }
+ if fresh {
+ return t.db.Create(&f).Error
+ }
+ return t.db.Model(&taskFileRecord{}).Where("id = ?", f.ID).Select("received", "bytes", "complete", "updated_at").Updates(&f).Error
+}
+
+// keptCapture is a capture the report names and the staged file it is,
+// checked, with its option and pixel size.
+type keptCapture struct {
+ file taskFileRecord
+ option string
+ digest string
+ w, h int
+}
+
+// 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;
+// 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)
+ if err != nil {
+ return err
+ }
+ s.DesignOptions = ""
+ if ok {
+ kept := designKept{Attempt: s.Attempt, Options: []keptOption{}}
+ for _, o := range opts {
+ ko := keptOption{Name: o.Name, Captures: []string{}}
+ for _, c := range o.Captures {
+ ko.Captures = append(ko.Captures, c.ID)
+ }
+ kept.Options = append(kept.Options, ko)
+ }
+ raw, err := json.Marshal(kept)
+ if err != nil {
+ return err
+ }
+ s.DesignOptions = string(raw)
+ for _, c := range keep {
+ f := c.file
+ f.Kept, f.Option, f.TreeDigest, f.MediaType, f.Width, f.Height, f.UpdatedAt = true, c.option, c.digest, attach.PNG, c.w, c.h, t.now()
+ if err := t.db.Model(&taskFileRecord{}).Where("id = ?", f.ID).Select("kept", "option", "tree_digest", "media_type", "width", "height", "updated_at").Updates(&f).Error; err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
+
+// 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
+// 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 {
+ return nil, false, nil
+ }
+ if s.SpecialistID == "" || s.SpecialistID != k.MakerSpecialistID || !slices.Contains(boundCaps(*s), specialist.CapabilityPageRender) {
+ return nil, false, nil
+ }
+ holds, err := t.bindingHolds(*s, *k)
+ if err != nil || !holds {
+ return nil, false, err
+ }
+ digests := map[string]string{}
+ var out []keptCapture
+ for _, o := range opts {
+ for _, c := range o.Captures {
+ call, _, _ := strings.Cut(c.ID, "-")
+ tree := wire.CaptureTree(c.ID)
+ if tree == "diff" {
+ tree = "work"
+ }
+ if d, seen := digests[call+"-"+tree]; seen && d != c.TreeDigest {
+ return nil, false, nil
+ }
+ digests[call+"-"+tree] = c.TreeDigest
+ var f taskFileRecord
+ if err := t.db.Where("step_id = ? AND attempt = ? AND image_id = ? AND source = ? AND complete = ?", s.ID, s.Attempt, c.ID, taskFileRender, true).First(&f).Error; errors.Is(err, gorm.ErrRecordNotFound) {
+ return nil, false, nil
+ } else if err != nil {
+ return nil, false, err
+ }
+ if f.SHA256 != c.SHA256 {
+ return nil, false, nil
+ }
+ data, err := t.fileBytes(f.ID)
+ if err != nil {
+ return nil, false, err
+ }
+ w, h, ok := checkCapture(data)
+ if !ok {
+ return nil, false, nil
+ }
+ out = append(out, keptCapture{file: f, option: o.Name, digest: c.TreeDigest, w: w, h: h})
+ }
+ }
+ return out, true, nil
+}
+
+// checkCapture checks a complete capture's bytes (renderFile checked
+// their size and hash): a PNG whose header says it is within the capture
+// bounds, read before any pixel is decoded; one attach keeps byte for
+// byte (nothing after its end, no location); and fully decoded (every
+// chunk's CRC and the image data checked; image/png decodes exactly the
+// header's size).
+func checkCapture(data []byte) (w, h int, ok bool) {
+ cfg, err := png.DecodeConfig(bytes.NewReader(data))
+ if err != nil || cfg.Width < 1 || cfg.Height < 1 || cfg.Width > wire.MaxCaptureWidth || cfg.Height > wire.MaxCaptureHeight {
+ return 0, 0, false
+ }
+ info, clean, err := attach.Inspect("capture.png", attach.PNG, data)
+ if err != nil || info.MediaType != attach.PNG || !bytes.Equal(clean, data) {
+ return 0, 0, false
+ }
+ if _, err := png.Decode(bytes.NewReader(data)); err != nil {
+ return 0, 0, false
+ }
+ return cfg.Width, cfg.Height, true
+}
+
+// dropUnkept deletes a step's files that are not kept, and their bytes.
+func (t *txn) dropUnkept(stepID string) error { return t.dropResearchFiles(stepID) }
+
+// designView is a done Design attempt's kept options and captures on
+// the task's read shape; nil when it kept none.
+func (t *txn) designView(s stepRecord) (*wire.StepDesign, error) {
+ if s.DesignOptions == "" {
+ return nil, nil
+ }
+ var kept designKept
+ if err := json.Unmarshal([]byte(s.DesignOptions), &kept); err != nil {
+ return nil, err
+ }
+ var files []taskFileRecord
+ if err := t.db.Where("step_id = ? AND attempt = ? AND source = ? AND kept = ? AND complete = ?", s.ID, kept.Attempt, taskFileRender, true, true).Find(&files).Error; err != nil {
+ return nil, err
+ }
+ byID := map[string]taskFileRecord{}
+ for _, f := range files {
+ byID[f.ImageID] = f
+ }
+ 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 {
+ 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})
+ }
+ }
+ v.Options = append(v.Options, vo)
+ }
+ return v, nil
+}
+
+// candidateDesign is what the newest Engineering step of the task kept,
+// once it is done: the options the direction card shows, and Build this
+// reads. nil when it kept none.
+func (t *txn) candidateDesign(p progress) (*wire.StepDesign, error) {
+ if p.eng == nil || p.eng.State != wire.StepDone {
+ return nil, nil
+ }
+ return t.designView(*p.eng)
+}
diff --git a/internal/equipo/chat/design_captures_test.go b/internal/equipo/chat/design_captures_test.go
new file mode 100644
index 00000000..6512082a
--- /dev/null
+++ b/internal/equipo/chat/design_captures_test.go
@@ -0,0 +1,639 @@
+package chat
+
+import (
+ "bytes"
+ "context"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/binary"
+ "encoding/hex"
+ "encoding/json"
+ "errors"
+ "hash/crc32"
+ "image"
+ "image/color"
+ "image/png"
+ "math/rand"
+ "net/http"
+ "net/http/httptest"
+ "strings"
+ "testing"
+
+ "github.com/go-chi/chi/v5"
+ "gorm.io/gorm"
+
+ "amadan.net/oficina/equipo/internal/equipo/personapi"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Task 19 (dynamic specialists slice 1): Design's captures. A Design
+// attempt's render_file chunks are staged for its current attempt and
+// never served; its final report's options are checked against them
+// (ids, hashes, tree digests, each PNG decoded within bounds) and its
+// binding with grantFor in the report's transaction, and only then are
+// they kept. The task page and the direction card show what was kept;
+// with more than one option, Build this needs the person's note.
+
+var (
+ digestWork = strings.Repeat("d", 64)
+ digestBase = strings.Repeat("e", 64)
+)
+
+// capturePNG is a w by h PNG.
+func capturePNG(t *testing.T, w, h int, shade uint8) []byte {
+ t.Helper()
+ img := image.NewNRGBA(image.Rect(0, 0, w, h))
+ for y := 0; y < h; y++ {
+ for x := 0; x < w; x++ {
+ img.Set(x, y, color.NRGBA{R: shade, G: uint8(x), B: uint8(y), A: 255})
+ }
+ }
+ var b bytes.Buffer
+ if err := png.Encode(&b, img); err != nil {
+ t.Fatal(err)
+ }
+ return b.Bytes()
+}
+
+// noisyPNG is a w by h PNG of noise: it does not compress, so it takes
+// several chunks.
+func noisyPNG(t *testing.T, w, h int, seed int64) []byte {
+ t.Helper()
+ rng := rand.New(rand.NewSource(seed))
+ img := image.NewNRGBA(image.Rect(0, 0, w, h))
+ rng.Read(img.Pix)
+ for i := 3; i < len(img.Pix); i += 4 {
+ img.Pix[i] = 255
+ }
+ var b bytes.Buffer
+ if err := png.Encode(&b, img); err != nil {
+ t.Fatal(err)
+ }
+ return b.Bytes()
+}
+
+// brokenIDAT is a PNG whose signature, header and chunk checksums are
+// sound but whose image data is not a zlib stream: it passes every check
+// short of decoding the pixels.
+func brokenIDAT(t *testing.T) []byte {
+ t.Helper()
+ data := capturePNG(t, 40, 30, 9)
+ out := append([]byte(nil), data[:8]...)
+ for i := 8; i < len(data); {
+ n := int(binary.BigEndian.Uint32(data[i:]))
+ kind := data[i+4 : i+8]
+ body := append([]byte(nil), data[i+8:i+8+n]...)
+ if string(kind) == "IDAT" {
+ for j := range body {
+ body[j] = 0xA5
+ }
+ }
+ var head [8]byte
+ binary.BigEndian.PutUint32(head[:], uint32(n))
+ copy(head[4:], kind)
+ out = append(out, head[:]...)
+ out = append(out, body...)
+ var sum [4]byte
+ binary.BigEndian.PutUint32(sum[:], crc32.ChecksumIEEE(append(append([]byte(nil), kind...), body...)))
+ out = append(out, sum[:]...)
+ i += 12 + n
+ }
+ if _, err := png.DecodeConfig(bytes.NewReader(out)); err != nil {
+ t.Fatalf("the broken PNG's header does not read: %v", err)
+ }
+ if _, err := png.Decode(bytes.NewReader(out)); err == nil {
+ t.Fatal("the broken PNG decodes")
+ }
+ return out
+}
+
+func shaOf(b []byte) string { s := sha256.Sum256(b); return hex.EncodeToString(s[:]) }
+
+// renderChunks are a capture's render_file chunks for the step's attempt.
+func renderChunks(s stepRecord, attempt int64, id string, data []byte) []wire.RenderFile {
+ total := (len(data) + wire.RenderFileChunk - 1) / wire.RenderFileChunk
+ var out []wire.RenderFile
+ for i := 0; i < total; i++ {
+ part := data[i*wire.RenderFileChunk : min(len(data), (i+1)*wire.RenderFileChunk)]
+ out = append(out, wire.RenderFile{TaskID: s.TaskID, StepID: s.ID, Attempt: attempt, CaptureID: id, Index: i, Total: total, Size: int64(len(data)), SHA256: shaOf(data), Data: base64.StdEncoding.EncodeToString(part)})
+ }
+ return out
+}
+
+func (r *hkRig) renderFile(l Lease, f wire.RenderFile) error {
+ return r.tx(func(tx *txn) error { return tx.renderFile(l, &f) })
+}
+
+// uploadCapture sends every chunk of a capture, each accepted.
+func (r *hkRig) uploadCapture(l Lease, s stepRecord, id string, data []byte) {
+ r.t.Helper()
+ for _, f := range renderChunks(s, s.Attempt, id, data) {
+ if err := r.renderFile(l, f); err != nil {
+ r.t.Fatalf("chunk %d of %s: %v", f.Index, id, err)
+ }
+ }
+}
+
+func capture(id string, data []byte, digest string) wire.DesignCapture {
+ return wire.DesignCapture{ID: id, SHA256: shaOf(data), TreeDigest: digest}
+}
+
+// designRunning is a Patrix exploration made by Design whose attempt has
+// started and reported its candidate.
+func designRunning(t *testing.T) (*hkRig, Lease, specialistRecord, string, stepRecord) {
+ r, l, _ := grantRig(t)
+ // The direction card reads the person's runners (previews).
+ 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)
+ for k, w := range map[string]string{"work.explore.build_note": "%s said which option to build, in their own words: %s"} {
+ words := r.s.authority.Copy
+ k, w := k, w
+ r.s.authority.Copy = func(key string) string {
+ if key == k {
+ return w
+ }
+ return words(key)
+ }
+ }
+ sp := r.active(l, "Patrix", "p_patrix")
+ task, s := r.runningDesign(l, sp, wire.KindExplore)
+ r.report(l, s, wire.StepReport{State: wire.StepRunning, BaseSHA: strings.Repeat("b", 40), CandidateSHA: candidateSHA})
+ return r, l, sp, task, r.stepNow(s.ID)
+}
+
+// done reports the Design attempt done and pushed with these options.
+func (r *hkRig) done(l Lease, s stepRecord, opts []wire.DesignOption) {
+ r.t.Helper()
+ r.report(l, s, wire.StepReport{State: wire.StepDone, BaseSHA: strings.Repeat("b", 40), CandidateSHA: candidateSHA, Pushed: true, Termination: true, Options: opts})
+}
+
+// files are the task files of the step, by capture id.
+func (r *hkRig) files(stepID string) map[string]taskFileRecord {
+ r.t.Helper()
+ var rows []taskFileRecord
+ r.must(r.s.db.G.Where("step_id = ?", stepID).Find(&rows).Error)
+ out := map[string]taskFileRecord{}
+ for _, f := range rows {
+ out[f.ImageID+"#"+itoa64(f.Attempt)] = f
+ }
+ return out
+}
+
+// keptCount counts the step's kept files, and every file's bytes left.
+func (r *hkRig) keptCount(stepID string) (kept, all, chunks int64) {
+ kept = r.count("SELECT count(*) FROM chat_task_files WHERE step_id = ? AND kept = ?", stepID, true)
+ all = r.count("SELECT count(*) FROM chat_task_files WHERE step_id = ?", stepID)
+ chunks = r.count("SELECT count(*) FROM chat_task_file_data WHERE file_id IN (SELECT id FROM chat_task_files WHERE step_id = ?)", stepID)
+ return
+}
+
+func (r *hkRig) stepDesign(task, stepID string) *wire.StepDesign {
+ r.t.Helper()
+ v, err := r.s.Task(r.ctx, paul, task)
+ r.must(err)
+ for _, s := range v.Steps {
+ if s.ID == stepID {
+ return s.Design
+ }
+ }
+ r.t.Fatalf("no step %s", stepID)
+ return nil
+}
+
+// nothingKept: no file of the step kept or left, and no options.
+func (r *hkRig) nothingKept(task, stepID, why string) {
+ r.t.Helper()
+ if kept, all, chunks := r.keptCount(stepID); kept != 0 || all != 0 || chunks != 0 {
+ r.t.Fatalf("%s: kept %d, files %d, chunks %d", why, kept, all, chunks)
+ }
+ if d := r.stepDesign(task, stepID); d != nil {
+ r.t.Fatalf("%s: options shown %+v", why, d)
+ }
+ if s := r.stepNow(stepID); s.DesignOptions != "" || s.State != wire.StepDone {
+ r.t.Fatalf("%s: step %s %q", why, s.State, s.DesignOptions)
+ }
+}
+
+// TestDesignCapturesKeptByTheReport: staged chunks are never served; the
+// report keeps the captures it names, by option and in its order, with
+// their tree digest and pixel size, and drops what it does not name.
+// Only kept files are served, under their own task.
+func TestDesignCapturesKeptByTheReport(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ calm1, calm2, bold := capturePNG(t, 390, 844, 1), capturePNG(t, 1440, 900, 2), capturePNG(t, 390, 2000, 3)
+ // The first through the runner frame's own path (Apply).
+ for i, f := range renderChunks(s, s.Attempt, "1-work-1.png", calm1) {
+ frame, err := wire.NewFrame("c"+itoa64(int64(900+i)), wire.FrameRenderFile, f)
+ r.must(err)
+ r.must(r.s.Apply(r.ctx, l, frame, &f))
+ }
+ r.uploadCapture(l, s, "1-work-2.png", calm2)
+ r.uploadCapture(l, s, "2-work-1.png", bold)
+ r.uploadCapture(l, s, "2-base-1.png", capturePNG(t, 20, 20, 4))
+ staged := r.files(s.ID)
+ if len(staged) != 4 || !staged["1-work-1.png#1"].Complete || staged["1-work-1.png#1"].Kept || staged["1-work-1.png#1"].Source != taskFileRender {
+ t.Fatalf("staged %+v", staged)
+ }
+ if _, _, err := r.s.TaskFile(r.ctx, paul, task, staged["1-work-1.png#1"].ID); !errors.Is(err, ErrNotFound) {
+ t.Fatalf("a staged capture is served: %v", err)
+ }
+ opts := []wire.DesignOption{
+ {Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-2.png", calm2, digestWork), capture("1-work-1.png", calm1, digestWork)}},
+ {Name: "Bold", Captures: []wire.DesignCapture{capture("2-work-1.png", bold, digestWork)}},
+ {Name: "Plain"},
+ }
+ r.done(l, s, opts)
+ if kept, all, _ := r.keptCount(s.ID); kept != 3 || all != 3 {
+ t.Fatalf("kept %d of %d", kept, all)
+ }
+ files := r.files(s.ID)
+ if f := files["1-work-2.png#1"]; !f.Kept || f.Option != "Calm" || f.TreeDigest != digestWork || f.Width != 1440 || f.Height != 900 || f.MediaType != "image/png" {
+ t.Fatalf("kept capture %+v", f)
+ }
+ if _, ok := files["2-base-1.png#1"]; ok {
+ t.Fatal("an unnamed capture was kept")
+ }
+ d := r.stepDesign(task, s.ID)
+ if d == nil || d.Attempt != 1 || len(d.Options) != 3 || d.Options[0].Name != "Calm" || d.Options[1].Name != "Bold" || d.Options[2].Name != "Plain" || len(d.Options[2].Captures) != 0 {
+ t.Fatalf("design view %+v", d)
+ }
+ if c := d.Options[0].Captures; len(c) != 2 || c[0].CaptureID != "1-work-2.png" || c[1].CaptureID != "1-work-1.png" || c[0].ID != files["1-work-2.png#1"].ID || c[0].Width != 1440 || c[0].Height != 900 || c[0].Size != int64(len(calm2)) {
+ t.Fatalf("Calm's captures %+v", c)
+ }
+ name, data, err := r.s.TaskFile(r.ctx, paul, task, files["2-work-1.png#1"].ID)
+ if err != nil || name != "2-work-1.png" || !bytes.Equal(data, bold) {
+ t.Fatalf("served %q %d bytes %v", name, len(data), err)
+ }
+ // Under another task's route, a kept capture is not found; nor is it
+ // for someone who is not a current member.
+ other := r.plainTask(l, "tk_other_task")
+ if _, _, err := r.s.TaskFile(r.ctx, paul, other.TaskID, files["2-work-1.png#1"].ID); !errors.Is(err, ErrNotFound) {
+ t.Fatalf("served under another task: %v", err)
+ }
+ current := r.s.authority.CurrentPerson
+ r.s.authority.CurrentPerson = func(context.Context, *gorm.DB) error { return ErrForbidden }
+ if _, _, err := r.s.TaskFile(r.ctx, "stranger@example.com", task, files["2-work-1.png#1"].ID); !errors.Is(err, ErrForbidden) {
+ t.Fatalf("served to someone not on the team: %v", err)
+ }
+ r.s.authority.CurrentPerson = current
+}
+
+// TestDesignRenderFileRefused: a chunk is staged only from the runner the
+// Design step runs on, for its current attempt while it runs, at
+// protocol 36, bound to the task's maker, valid, in order, within the
+// capture bound and the declared size and hash; anything else is refused
+// and stages nothing.
+func TestDesignRenderFileRefused(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ data := noisyPNG(t, 400, 300, 5)
+ good := renderChunks(s, s.Attempt, "1-work-1.png", data)
+ if len(good) < 2 {
+ t.Fatalf("want a capture of several chunks, got %d", len(good))
+ }
+ refused := func(why string, l Lease, f wire.RenderFile) {
+ t.Helper()
+ if err := r.renderFile(l, f); !errors.Is(err, ErrRefused) {
+ t.Fatalf("%s: %v", why, err)
+ }
+ }
+ old := l
+ old.Protocol = wire.ProtocolDesign - 1
+ refused("below protocol 36", old, good[0])
+ bad := good[0]
+ bad.Total++
+ refused("a chunk the wire refuses", l, bad)
+ noStep := good[0]
+ noStep.StepID = "s_missing"
+ if err := r.renderFile(l, noStep); !errors.Is(err, ErrRefused) {
+ t.Fatalf("no such step: %v", err)
+ }
+ other := l
+ other.Runner.RunnerID = "RUNNER2"
+ refused("another runner", other, good[0])
+ someone := l
+ someone.Runner.Person = "someone@example.com"
+ refused("another person", someone, good[0])
+ r.exec("UPDATE chat_steps SET withdrawn = ? WHERE id = ?", true, s.ID)
+ refused("a withdrawn attempt", l, good[0])
+ r.exec("UPDATE chat_steps SET withdrawn = ? WHERE id = ?", false, s.ID)
+ stale := renderChunks(s, s.Attempt+1, "1-work-1.png", data)[0]
+ refused("another attempt", l, stale)
+ refused("out of order", l, good[1])
+ if len(good) < 3 {
+ t.Fatalf("want a capture of three chunks or more, got %d", len(good))
+ }
+ plain := r.plainTask(l, "tk_plain_task")
+ r.report(l, plain, wire.StepReport{State: wire.StepRunning})
+ refused("an unbound Engineering step", l, renderChunks(r.stepNow(plain.ID), 1, "1-work-1.png", data)[0])
+ for i, f := range good {
+ if i == len(good)-2 {
+ // One chunk skipped: the last cannot come before it.
+ refused("a chunk skipped", l, good[len(good)-1])
+ }
+ if i == len(good)-1 {
+ break
+ }
+ if err := r.renderFile(l, f); err != nil {
+ t.Fatal(err)
+ }
+ }
+ refused("a chunk again", l, good[0])
+ last := good[len(good)-1]
+ tampered := last
+ raw, _ := base64.StdEncoding.DecodeString(last.Data)
+ raw[0] ^= 0xFF
+ tampered.Data = base64.StdEncoding.EncodeToString(raw)
+ refused("the whole does not match its hash", l, tampered)
+ if f := r.files(s.ID)["1-work-1.png#1"]; f.Complete {
+ t.Fatal("a capture that does not match its hash completed")
+ }
+ // The thirteenth capture of an attempt is refused.
+ for n := 2; n <= wire.MaxDesignCaptures; n++ {
+ r.uploadCapture(l, s, "2-work-"+itoa64(int64(n))+".png", capturePNG(t, 4, 4, uint8(n)))
+ }
+ refused("a thirteenth capture", l, renderChunks(s, s.Attempt, "3-work-1.png", capturePNG(t, 4, 4, 99))[0])
+ // The task cancelled: nothing more is staged.
+ r.exec("UPDATE chat_tasks SET cancel_requested = ? WHERE id = ?", true, task)
+ r.exec("DELETE FROM chat_task_files WHERE step_id = ? AND image_id = ?", s.ID, "2-work-2.png")
+ refused("the task cancelled", l, renderChunks(s, s.Attempt, "3-work-2.png", capturePNG(t, 4, 4, 98))[0])
+ r.exec("UPDATE chat_tasks SET cancel_requested = ? WHERE id = ?", false, task)
+ // A step that is not running stages nothing.
+ r.exec("UPDATE chat_steps SET state = ? WHERE id = ?", wire.StepQueued, s.ID)
+ refused("a queued step", l, renderChunks(s, s.Attempt, "3-work-2.png", capturePNG(t, 4, 4, 98))[0])
+ r.exec("UPDATE chat_steps SET state = ? WHERE id = ?", wire.StepRunning, s.ID)
+ // A step bound to anything but the task's maker stages nothing.
+ r.exec("UPDATE chat_tasks SET maker_specialist_id = ? WHERE id = ?", "sp_other", task)
+ refused("not the task's maker", l, renderChunks(s, s.Attempt, "3-work-2.png", capturePNG(t, 4, 4, 98))[0])
+}
+
+// TestDesignCapturesForeignID: a report naming a capture this attempt
+// never sent keeps nothing, not even the ones it did send.
+func TestDesignCapturesForeignID(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ a := capturePNG(t, 30, 30, 1)
+ r.uploadCapture(l, s, "1-work-1.png", a)
+ r.done(l, s, []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", a, digestWork)}}, {Name: "Bold", Captures: []wire.DesignCapture{capture("1-work-2.png", a, digestWork)}}})
+ r.nothingKept(task, s.ID, "a foreign capture id")
+}
+
+// TestDesignCapturesIncomplete: a capture whose chunks did not all
+// arrive keeps nothing.
+func TestDesignCapturesIncomplete(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ a, b := capturePNG(t, 30, 30, 1), noisyPNG(t, 400, 300, 2)
+ r.uploadCapture(l, s, "1-work-1.png", a)
+ chunks := renderChunks(s, s.Attempt, "1-work-2.png", b)
+ if err := r.renderFile(l, chunks[0]); err != nil {
+ t.Fatal(err)
+ }
+ r.done(l, s, []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", a, digestWork), capture("1-work-2.png", b, digestWork)}}})
+ r.nothingKept(task, s.ID, "an incomplete upload")
+}
+
+// TestDesignCapturesChecked: what the report says must be exactly what
+// was staged, and each PNG must decode within the capture bounds: a PNG
+// that passes its signature and header but not decoding, one wider than
+// a capture can be, one with bytes after its end, a hash that is not the
+// file's, tree digests that disagree within one render, options the wire
+// refuses. Each keeps nothing.
+func TestDesignCapturesChecked(t *testing.T) {
+ good := func(t *testing.T) []byte { return capturePNG(t, 30, 30, 1) }
+ for _, c := range []struct {
+ name string
+ upload func(t *testing.T) []byte
+ opts func(data []byte) []wire.DesignOption
+ }{
+ {"not decodable", brokenIDAT, nil},
+ {"too wide", func(t *testing.T) []byte { return capturePNG(t, wire.MaxCaptureWidth+1, 2, 1) }, nil},
+ {"too tall", func(t *testing.T) []byte { return capturePNG(t, 1, wire.MaxCaptureHeight+1, 1) }, nil},
+ {"bytes after the end", func(t *testing.T) []byte { return append(good(t), "<html>"...) }, nil},
+ {"another hash", good, func(data []byte) []wire.DesignOption {
+ return []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{{ID: "1-work-1.png", SHA256: strings.Repeat("0", 64), TreeDigest: digestWork}}}}
+ }},
+ {"digests disagree", good, func(data []byte) []wire.DesignOption {
+ return []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", data, digestWork)}}, {Name: "Bold", Captures: []wire.DesignCapture{capture("1-diff-1.png", data, digestBase)}}}
+ }},
+ {"invalid options", good, func(data []byte) []wire.DesignOption {
+ return []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", data, digestWork)}}, {Name: "calm"}}
+ }},
+ } {
+ t.Run(c.name, func(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ data := c.upload(t)
+ r.uploadCapture(l, s, "1-work-1.png", data)
+ r.uploadCapture(l, s, "1-diff-1.png", data)
+ opts := []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", data, digestWork)}}}
+ if c.opts != nil {
+ opts = c.opts(data)
+ }
+ r.done(l, s, opts)
+ r.nothingKept(task, s.ID, c.name)
+ })
+ }
+ // A base capture carries the base tree's digest, a diff its work's:
+ // both kept beside a work capture of the same render.
+ r, l, _, task, s := designRunning(t)
+ data := good(t)
+ for _, id := range []string{"1-work-1.png", "1-diff-1.png", "1-base-1.png"} {
+ r.uploadCapture(l, s, id, data)
+ }
+ r.done(l, s, []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", data, digestWork), capture("1-diff-1.png", data, digestWork), capture("1-base-1.png", data, digestBase)}}})
+ if kept, _, _ := r.keptCount(s.ID); kept != 3 {
+ t.Fatalf("kept %d of a consistent render", kept)
+ }
+ if d := r.stepDesign(task, s.ID); d == nil || len(d.Options[0].Captures) != 3 {
+ t.Fatalf("design view %+v", d)
+ }
+}
+
+// TestDesignCapturesRevokedDuringUpload: Design removed while its
+// captures arrive: the report's transaction finds no grant, and nothing
+// is kept, though the chunks were all staged.
+func TestDesignCapturesRevokedDuringUpload(t *testing.T) {
+ r, l, sp, task, s := designRunning(t)
+ a := noisyPNG(t, 400, 300, 1)
+ chunks := renderChunks(s, s.Attempt, "1-work-1.png", a)
+ if err := r.renderFile(l, chunks[0]); err != nil {
+ t.Fatal(err)
+ }
+ r.revoke(sp.ID)
+ for _, f := range chunks[1:] {
+ if err := r.renderFile(l, f); err != nil {
+ t.Fatal(err)
+ }
+ }
+ r.done(l, r.stepNow(s.ID), []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", a, digestWork)}}})
+ r.nothingKept(task, s.ID, "revoked during the upload")
+}
+
+// TestDesignCapturesMakerChanged: a step that is no longer its task's
+// maker keeps nothing, though its captures were staged while it was.
+func TestDesignCapturesMakerChanged(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ a := capturePNG(t, 30, 30, 1)
+ r.uploadCapture(l, s, "1-work-1.png", a)
+ r.exec("UPDATE chat_tasks SET maker_specialist_id = ? WHERE id = ?", "sp_other", task)
+ r.done(l, s, []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-1.png", a, digestWork)}}})
+ if kept, all, chunks := r.keptCount(s.ID); kept != 0 || all != 0 || chunks != 0 || r.stepNow(s.ID).DesignOptions != "" {
+ t.Fatalf("the maker changed: kept %d, files %d, chunks %d", kept, all, chunks)
+ }
+}
+
+// TestDesignCapturesStaleAttempt: after a failover the step's attempt
+// moved on; the old attempt's chunks are refused, its staged captures are
+// never kept, even when the new attempt's report names them, and they
+// are dropped when the step ends.
+func TestDesignCapturesStaleAttempt(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ a := noisyPNG(t, 400, 300, 1)
+ old := capturePNG(t, 30, 30, 7)
+ r.uploadCapture(l, s, "1-work-3.png", old)
+ chunks := renderChunks(s, 1, "1-work-1.png", a)
+ if err := r.renderFile(l, chunks[0]); err != nil {
+ t.Fatal(err)
+ }
+ r.report(l, s, wire.StepReport{State: wire.StepRunning, Attempt: 2})
+ s = r.stepNow(s.ID)
+ if s.Attempt != 2 {
+ t.Fatalf("attempt %d", s.Attempt)
+ }
+ if err := r.renderFile(l, chunks[1]); !errors.Is(err, ErrRefused) {
+ t.Fatalf("a stale attempt's chunk: %v", err)
+ }
+ r.uploadCapture(l, s, "1-work-2.png", a)
+ // Attempt 1's whole capture, named by attempt 2's report.
+ r.done(l, s, []wire.DesignOption{{Name: "Calm", Captures: []wire.DesignCapture{capture("1-work-3.png", old, digestWork), capture("1-work-2.png", a, digestWork)}}})
+ r.nothingKept(task, s.ID, "the old attempt's capture named")
+}
+
+// TestDesignCapturesDroppedOnFailure: a Design attempt that ends any way
+// but done keeps nothing it sent.
+func TestDesignCapturesDroppedOnFailure(t *testing.T) {
+ r, l, _, _, s := designRunning(t)
+ r.uploadCapture(l, s, "1-work-1.png", capturePNG(t, 30, 30, 1))
+ r.report(l, s, wire.StepReport{State: wire.StepFailed, Reason: "model_failed", Termination: true})
+ if kept, all, chunks := r.keptCount(s.ID); kept != 0 || all != 0 || chunks != 0 {
+ t.Fatalf("after a failure: kept %d, files %d, chunks %d", kept, all, chunks)
+ }
+}
+
+// designDirection takes the running Design attempt to done with opts
+// (each capture uploaded as a small PNG) and its review to approve: the
+// direction card is open.
+func (r *hkRig) designDirection(l Lease, task string, s stepRecord, names ...string) cardRecord {
+ r.t.Helper()
+ var opts []wire.DesignOption
+ for i, name := range names {
+ data := capturePNG(r.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: name, Captures: []wire.DesignCapture{capture(id, data, digestWork)}})
+ }
+ r.done(l, s, opts)
+ var review stepRecord
+ r.must(r.s.db.G.Where("task_id = ? AND specialist = ?", task, wire.SpecialistReview).Order("idx DESC").First(&review).Error)
+ r.report(l, review, wire.StepReport{State: wire.StepDone, CandidateSHA: candidateSHA, Verdict: wire.VerdictApprove, ReviewLabel: wire.ReviewOtherFamily, Termination: true, Findings: []wire.Finding{}})
+ var c cardRecord
+ r.must(r.s.db.G.Where("task_id = ? AND kind = ? AND state = ?", task, wire.CardDirection, wire.CardOpen).First(&c).Error)
+ return c
+}
+
+// TestDirectionShowsCapturesAndBuildNeedsANote: the direction shows the
+// kept captures by option. With more than one option Build this without
+// a note is a card conflict (direction_note) and builds nothing; with a
+// note the new task's brief quotes it as the person's own words.
+func TestDirectionShowsCapturesAndBuildNeedsANote(t *testing.T) {
+ r, l, sp, task, s := designRunning(t)
+ c := r.designDirection(l, task, s, "Calm", "Bold")
+ v, err := r.s.Task(r.ctx, paul, task)
+ r.must(err)
+ d := v.Direction
+ if d == nil || !d.NoteNeeded || len(d.Options) != 2 || d.Options[1].Name != "Bold" || len(d.Options[1].Captures) != 1 || d.Options[1].Captures[0].CaptureID != "2-work-1.png" {
+ t.Fatalf("direction %+v", d)
+ }
+ if _, _, err := r.s.Answer(r.ctx, paul, c.ID, wire.AnswerCard{Choice: wire.ChoiceBuild, Revision: c.Revision}); !errors.Is(err, ErrCardConflict) || !errors.Is(err, ErrDirectionNote) {
+ t.Fatalf("Build without a note: %v", err)
+ }
+ if k := r.load(task); k.BuiltAs != "" {
+ t.Fatalf("built without a note: %s", k.BuiltAs)
+ }
+ // The person API says so in its conflict.
+ h := &HTTP{Store: r.s}
+ body, _ := json.Marshal(wire.AnswerCard{Choice: wire.ChoiceBuild, Revision: c.Revision})
+ route := chi.NewRouteContext()
+ route.URLParams.Add("id", c.ID)
+ req := httptest.NewRequest(http.MethodPost, "/cards/"+c.ID+"/answer", bytes.NewReader(body)).WithContext(context.WithValue(r.ctx, chi.RouteCtxKey, route))
+ req.Header.Set("Content-Type", "application/json")
+ w := httptest.NewRecorder()
+ h.answer(w, req, personapi.PersonPrincipal{Address: paul, CredentialID: "cr_phone"})
+ var conflict wire.CardConflict
+ if w.Code != http.StatusConflict || json.Unmarshal(w.Body.Bytes(), &conflict) != nil || conflict.Code != wire.ConflictDirectionNote || conflict.CopyKey != "api."+wire.ConflictDirectionNote || conflict.Card.ID != c.ID || conflict.Card.State != wire.CardOpen {
+ t.Fatalf("person API: %d %s", w.Code, w.Body.String())
+ }
+ note := "The \"Bold\" one, with the calm header."
+ if _, _, err := r.s.Answer(r.ctx, paul, c.ID, wire.AnswerCard{Choice: wire.ChoiceBuild, Note: note, Revision: c.Revision}); err != nil {
+ t.Fatal(err)
+ }
+ built := r.load(r.load(task).BuiltAs)
+ name, _ := DisplayName(paul)
+ if want := name + " said which option to build, in their own words: " + wire.QuotedData(note); !strings.HasSuffix(built.Brief, want) || built.MakerSpecialistID != sp.ID {
+ t.Fatalf("brief %q", built.Brief)
+ }
+}
+
+// TestBuildNoteFitsTheBrief: a long exploration brief is cut, never the
+// person's note.
+func TestBuildNoteFitsTheBrief(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ r.exec("UPDATE chat_tasks SET brief = ? WHERE id = ?", strings.Repeat("x", wire.MaxTaskBrief), task)
+ c := r.designDirection(l, task, s, "Calm", "Bold")
+ note := strings.Repeat("Bold. ", 150)
+ if _, _, err := r.s.Answer(r.ctx, paul, c.ID, wire.AnswerCard{Choice: wire.ChoiceBuild, Note: note, Revision: c.Revision}); err != nil {
+ t.Fatal(err)
+ }
+ built := r.load(r.load(task).BuiltAs)
+ if len(built.Brief) > wire.MaxTaskBrief || !strings.HasSuffix(built.Brief, wire.QuotedData(strings.TrimSpace(note))) {
+ t.Fatalf("brief %d bytes, ends %q", len(built.Brief), built.Brief[max(0, len(built.Brief)-80):])
+ }
+}
+
+// TestBuildNoteThatCannotFit: a note whose quoting grows past what a
+// brief holds builds nothing (it is never cut).
+func TestBuildNoteThatCannotFit(t *testing.T) {
+ r, l, _, task, s := designRunning(t)
+ c := r.designDirection(l, task, s, "Calm", "Bold")
+ note := strings.Repeat("\x01", wire.MaxDirectionNote)
+ if _, _, err := r.s.Answer(r.ctx, paul, c.ID, wire.AnswerCard{Choice: wire.ChoiceBuild, Note: note, Revision: c.Revision}); !errors.Is(err, ErrInvalid) {
+ t.Fatalf("an oversized note: %v", err)
+ }
+ if k := r.load(task); k.BuiltAs != "" {
+ t.Fatalf("built %s", k.BuiltAs)
+ }
+ var open cardRecord
+ r.must(r.s.db.G.Where("id = ?", c.ID).First(&open).Error)
+ if open.State != wire.CardOpen {
+ t.Fatalf("card %s", open.State)
+ }
+}
+
+// TestBuildOneOptionNeedsNoNote: one option, or none, needs no note.
+func TestBuildOneOptionNeedsNoNote(t *testing.T) {
+ for _, names := range [][]string{{"Calm"}, nil} {
+ r, l, _, task, s := designRunning(t)
+ c := r.designDirection(l, task, s, names...)
+ v, err := r.s.Task(r.ctx, paul, task)
+ r.must(err)
+ if v.Direction == nil || v.Direction.NoteNeeded || len(v.Direction.Options) != len(names) {
+ t.Fatalf("direction %+v", v.Direction)
+ }
+ if len(names) == 0 && r.makerStep(task).DesignOptions != "" {
+ t.Fatalf("no options stored as %q", r.makerStep(task).DesignOptions)
+ }
+ if _, _, err := r.s.Answer(r.ctx, paul, c.ID, wire.AnswerCard{Choice: wire.ChoiceBuild, Revision: c.Revision}); err != nil {
+ t.Fatalf("%d options: %v", len(names), err)
+ }
+ if built := r.load(r.load(task).BuiltAs); strings.Contains(built.Brief, "said which option") {
+ t.Fatalf("a note line with no note: %q", built.Brief)
+ }
+ }
+}
diff --git a/internal/equipo/chat/explore.go b/internal/equipo/chat/explore.go
index 9971cd75..10ed403a 100644
--- a/internal/equipo/chat/explore.go
+++ b/internal/equipo/chat/explore.go
@@ -231,13 +231,23 @@ func (t *txn) answerDirection(person string, c cardRecord, in wire.AnswerCard) (
if wire.NormalKind(k.Kind) != wire.KindExplore || wire.FinalStage(k.Stage) || k.CancelRequested || p.moved || p.candidate == "" || k.DirectionAsked != p.candidate || verdict != wire.VerdictApprove || busy(steps, false) || k.BuiltAs != "" {
return wire.Card{}, v, ErrCardConflict
}
+ if in.Choice == wire.ChoiceBuild && note == "" {
+ // With more than one option, the person says which (spec §5).
+ d, err := t.candidateDesign(p)
+ if err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ if d != nil && len(d.Options) > 1 {
+ return wire.Card{}, v, ErrDirectionNote
+ }
+ }
c.State, c.Choice = wire.CardAnswered, in.Choice
if err := t.saveCard(&c); err != nil {
return wire.Card{}, wire.Card{}, err
}
switch in.Choice {
case wire.ChoiceBuild:
- if err := t.buildThisOne(&k, p); err != nil {
+ if err := t.buildThisOne(&k, p, note); err != nil {
return wire.Card{}, wire.Card{}, err
}
case wire.ChoiceAgain:
@@ -272,8 +282,11 @@ func (t *txn) answerDirection(person string, c cardRecord, in wire.AnswerCard) (
// exploration is done, linked to it. A request that follows the
// exploration follows the new task too, before anything of it is
// dispatched or told: as work it made when it made the exploration
-// (team_cancel stops it), else as work it joined.
-func (t *txn) buildThisOne(k *taskRecord, p progress) error {
+// (team_cancel stops it), else as work it joined. The person's note, when
+// they gave one (which option, with more than one), ends the brief,
+// quoted as their own words under their name; the exploration's brief is
+// cut to make room, never the note.
+func (t *txn) buildThisOne(k *taskRecord, p progress, note string) error {
now := t.now()
title := t.words("work.explore.build_title", k.Title)
if title == "" {
@@ -284,7 +297,19 @@ func (t *txn) buildThisOne(k *taskRecord, p progress) error {
if more == "" {
more = "Build the direction explored on branch " + k.Branch + " at " + short(p.candidate) + " (" + TaskLink(k.ID) + ")."
}
- brief := clipText(strings.TrimSpace(k.Brief+"\n\n"+more), wire.MaxTaskBrief)
+ if note != "" {
+ name, _ := DisplayName(k.Creator)
+ said := t.words("work.explore.build_note", name, wire.QuotedData(note))
+ if said == "" {
+ said = name + "'s note on which option to build, in their own words: " + wire.QuotedData(note)
+ }
+ more += "\n\n" + said
+ }
+ if len(more) > wire.MaxTaskBrief-2 {
+ // Only a note escaped far past its own bound gets here.
+ return ErrInvalid
+ }
+ brief := strings.TrimSpace(clipText(strings.TrimSpace(k.Brief), wire.MaxTaskBrief-len(more)-2) + "\n\n" + more)
// The exploration's maker builds it too (dynamic specialists §1).
n := taskRecord{ID: newTaskID(), ProjectID: k.ProjectID, Title: title, Brief: brief, Stage: wire.StageNoted, Creator: k.Creator, Kind: wire.KindChange, ExploredFrom: k.ID, Revision: 1, CreatedAt: now, UpdatedAt: now, Lane: k.Lane, MakerSpecialistID: k.MakerSpecialistID}
n.Branch = wire.TaskBranch(n.ID, title)
@@ -446,9 +471,17 @@ func (s *Store) ExploreOnce(ctx context.Context, id string) (switched bool, err
// directionView is what the direction card and the task page show: the
// candidate's deployed preview, else its branch on Amadan, and whether
-// the primary (at protocol 10) says previews are off.
+// the primary (at protocol 10) says previews are off; and what the newest
+// Design attempt kept, by option, with whether Build this needs a note.
func (t *txn) directionView(k taskRecord, repo string, steps []stepRecord, p progress) (*wire.TaskDirection, error) {
d := &wire.TaskDirection{BranchURL: BranchURL(repo, k.Branch)}
+ design, err := t.candidateDesign(p)
+ if err != nil {
+ return nil, err
+ }
+ if design != nil {
+ d.Options, d.NoteNeeded = design.Options, len(design.Options) > 1
+ }
now := t.now()
for i := len(steps) - 1; i >= 0; i-- {
s := steps[i]
diff --git a/internal/equipo/chat/http.go b/internal/equipo/chat/http.go
index b77545dc..3c853820 100644
--- a/internal/equipo/chat/http.go
+++ b/internal/equipo/chat/http.go
@@ -553,6 +553,11 @@ func (h *HTTP) answer(w http.ResponseWriter, r *http.Request, p personapi.Person
case wire.CardOpen, wire.CardAdded, wire.CardWorking, wire.CardCreated, wire.CardHomeSet, wire.CardHomeAsk:
code = "card_stale"
}
+ if errors.Is(err, ErrDirectionNote) {
+ // Build this needs the person's note saying which option
+ // (wire.ConflictDirectionNote, a literal for the copy scan).
+ code = "direction_note"
+ }
writeJSON(w, http.StatusConflict, wire.CardConflict{Code: code, CopyKey: "api." + code, RequestID: r.Header.Get("Idempotency-Key"), Card: current})
return
}
diff --git a/internal/equipo/chat/research_results.go b/internal/equipo/chat/research_results.go
index 644565b5..455021aa 100644
--- a/internal/equipo/chat/research_results.go
+++ b/internal/equipo/chat/research_results.go
@@ -568,6 +568,10 @@ func (s *Store) TaskFile(ctx context.Context, person, taskID, id string) (name s
return ErrNotFound
}
name = f.ImageID + ".png"
+ if f.Source == taskFileRender {
+ // A capture's id is its file name.
+ name = f.ImageID
+ }
return nil
})
return name, data, err
diff --git a/internal/equipo/chat/runner.go b/internal/equipo/chat/runner.go
index 518cdfb3..9539cba4 100644
--- a/internal/equipo/chat/runner.go
+++ b/internal/equipo/chat/runner.go
@@ -365,6 +365,8 @@ func (s *Store) Apply(ctx context.Context, l Lease, f wire.Frame, body any) erro
return t.changeDiff(l, v)
case *wire.ResearchFile:
return t.researchFile(l, v)
+ case *wire.RenderFile:
+ return t.renderFile(l, v)
}
return ErrInvalid
})
diff --git a/internal/equipo/chat/stream.go b/internal/equipo/chat/stream.go
index 52e69c3c..d90a64e1 100644
--- a/internal/equipo/chat/stream.go
+++ b/internal/equipo/chat/stream.go
@@ -179,7 +179,7 @@ func (rc *runnerConn) read(ctx context.Context) websocket.StatusCode {
switch v := body.(type) {
case *wire.Hello:
err = store.Heartbeat(ctx, rc.lease, *v)
- case *wire.ChangeDiffUpload, *wire.AccessReport, *wire.Sync, *wire.Ack, *wire.DeltaReport, *wire.Reply, *wire.TurnReport, *wire.ToolCall, *wire.ActivityReport, *wire.MoveIn, *wire.NotebookReport, *wire.StepReport, *wire.MergedReport, *wire.AnswerReport, *wire.BranchReport, *wire.ConnectionReport, *wire.UsageReport, *wire.StepActivityReport, *wire.Blob, *wire.PublishedReport, *wire.ResearchFile, *wire.GlanceReport:
+ case *wire.ChangeDiffUpload, *wire.AccessReport, *wire.Sync, *wire.Ack, *wire.DeltaReport, *wire.Reply, *wire.TurnReport, *wire.ToolCall, *wire.ActivityReport, *wire.MoveIn, *wire.NotebookReport, *wire.StepReport, *wire.MergedReport, *wire.AnswerReport, *wire.BranchReport, *wire.ConnectionReport, *wire.UsageReport, *wire.StepActivityReport, *wire.Blob, *wire.PublishedReport, *wire.ResearchFile, *wire.RenderFile, *wire.GlanceReport:
err = store.Apply(ctx, rc.lease, f, body)
case *wire.LeaseCheck:
// Answered only while this connection holds the lease; at
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go
index 5e4a9995..a83c52bd 100644
--- a/internal/equipo/chat/tasks.go
+++ b/internal/equipo/chat/tasks.go
@@ -301,6 +301,9 @@ type stepRecord struct {
SpecialistRevision int64 `gorm:"not null;default:0"`
SpecialistProject string `gorm:"not null;default:''"`
SpecialistCaps string `gorm:"not null;default:''"`
+ // 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:''"`
}
func (stepRecord) TableName() string { return "chat_steps" }
@@ -570,6 +573,13 @@ func (t *txn) taskViewWith(k taskRecord, options taskViewOptions) (wire.Task, er
}
sv.Research = rv
}
+ if s.Specialist == wire.SpecialistEngineering && s.DesignOptions != "" {
+ dv, err := t.designView(s)
+ if err != nil {
+ return v, err
+ }
+ sv.Design = dv
+ }
v.Steps = append(v.Steps, sv)
if s.Pushed {
v.URL = BranchURL(p.Repo, k.Branch)
@@ -794,6 +804,13 @@ func (t *txn) saveStep(s *stepRecord, k *taskRecord) error {
if err := t.saveTask(k); err != nil {
return err
}
+ if s.Specialist == wire.SpecialistEngineering && s.SpecialistID != "" && wire.StepTerminal(s.State) {
+ // A maker's attempt ended, however it ended: what it sent and its
+ // report did not keep goes.
+ if err := t.dropUnkept(s.ID); err != nil {
+ return err
+ }
+ }
if s.Specialist == wire.SpecialistResearch && wire.StepTerminal(s.State) {
// Research ended, however it ended: the Engineering it held goes.
return t.releaseResearch(k)
@@ -810,7 +827,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", "hold", "housekeeping_attempt", "coordinator_attempt", "held_at", "publish", "model").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").Updates(s).Error; err != nil {
return err
}
if s.Retired {
@@ -1673,6 +1690,13 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error {
}
s.Apple = v.Apple
s.Askable = v.Askable
+ 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 {
+ return err
+ }
+ }
if s.Rebase && s.BaseSHA != "" {
// The change sits on the new tip now: review reads it from
// there, and a later rebase starts from there.
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index dc1026b5..388c88d8 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -113,6 +113,10 @@ type chatCard struct {
// PlaceChoices are a place card's candidates in the card's order, each
// labelled from code-derived console and account words.
PlaceChoices []placeChoice
+ // Gallery is an open direction card's kept Design captures, by
+ // option; with more than one, BuildNote: Build this takes a note.
+ Gallery *designGallery
+ BuildNote bool
}
// placeChoice is one button of a place card.
@@ -250,6 +254,9 @@ func cardView(c wire.Card, choices []string, tasks map[string]wire.Task) chatCar
}
case wire.CardDirection:
v.Line, v.Open = c.Question, c.State == wire.CardOpen
+ if t, ok := tasks[c.TaskID]; ok && v.Open && t.Direction != nil {
+ v.Gallery, v.BuildNote = galleryOf(c.TaskID, t.Direction.Options), t.Direction.NoteNeeded
+ }
switch {
case c.State == wire.CardAnswered:
v.Note = copyText("chat.card.direction_chose_" + c.Choice)
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index ce08e8f4..4291157e 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -2035,6 +2035,20 @@ var pageCopy = map[string]string{
"work.design.design_renderer": "Waiting for the runner’s page renderer. Updating the runner fixes it.", // COPY REVIEW PENDING
"work.design.design_no_claude": "Waiting for a Claude connection on the runner. Design works only with Claude.", // COPY REVIEW PENDING
+ // Dynamic specialists slice 1, task 19: Design's captures on the task
+ // page and the direction card, and Build this's note.
+ "work.captures.option": "Option %d: %s", // COPY REVIEW PENDING
+ "work.captures.alt": "%s, screenshot %d", // COPY REVIEW PENDING
+ "work.captures.none": "No screenshots of this option.", // COPY REVIEW PENDING
+ "work.captures.tree.work": "Mockup", // COPY REVIEW PENDING
+ "work.captures.tree.base": "Before", // COPY REVIEW PENDING
+ "work.captures.tree.diff": "What changed", // COPY REVIEW PENDING
+ "work.decide.direction_ask_options": "Say which option to build, try again with a note, or drop it.", // COPY REVIEW PENDING
+ "chat.card.direction_note_options": "Which option should Equipo build, or what should change? A note is required to build or try again.", // COPY REVIEW PENDING
+ "chat.card.build_note": "Which option should Equipo build? Say it in your own words.", // COPY REVIEW PENDING
+ "api.direction_note": "Say which option to build. Open this card on the web to add your note.", // COPY REVIEW PENDING
+ "work.explore.build_note": "%s said which option to build, in their own words: %s", // COPY REVIEW PENDING
+
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): preferences.title
"preferences.title": "Preferences",
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): preferences.confirmed
diff --git a/internal/equipo/design_views.go b/internal/equipo/design_views.go
new file mode 100644
index 00000000..518a0329
--- /dev/null
+++ b/internal/equipo/design_views.go
@@ -0,0 +1,56 @@
+package equipo
+
+import (
+ "fmt"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// A Design attempt's kept captures as the task page and the direction
+// card show them (dynamic specialists spec, sections 3 and 5): grouped by
+// option in the report's order, each loaded only from this instance's
+// authenticated task-file route. Option names are the specialist's
+// labels; the page escapes them like any text.
+
+// designGallery is what one Design attempt kept, by option.
+type designGallery struct {
+ Options []designOptionView
+}
+
+// designOptionView is one option: its label ("Option 1: Calm") and its
+// captures; none when it named none or none was kept.
+type designOptionView struct {
+ Label string
+ Captures []designCaptureView
+}
+
+// designCaptureView is one kept capture: Src is the task-file route, Alt
+// names its option, Tree says which tree it shows.
+type designCaptureView struct {
+ ID, Src, Alt, Tree string
+ Width, Height int
+}
+
+// galleryOf is the gallery of a task's kept options; nil when there are
+// none.
+func galleryOf(taskID string, opts []wire.StepDesignOption) *designGallery {
+ if len(opts) == 0 {
+ return nil
+ }
+ g := &designGallery{}
+ for i, o := range opts {
+ ov := designOptionView{Label: fmt.Sprintf(copyText("work.captures.option"), i+1, o.Name)}
+ for n, c := range o.Captures {
+ ov.Captures = append(ov.Captures, designCaptureView{
+ ID: c.ID,
+ Src: "/tasks/" + taskID + "/files/" + c.ID,
+ Alt: fmt.Sprintf(copyText("work.captures.alt"), o.Name, n+1),
+ Tree: copyText("work.captures.tree." + wire.CaptureTree(c.CaptureID)),
+ Width: c.Width,
+ Height: c.Height,
+ })
+ }
+ g.Options = append(g.Options, ov)
+ }
+ return g
+}
diff --git a/internal/equipo/design_views_test.go b/internal/equipo/design_views_test.go
new file mode 100644
index 00000000..fd0e5c32
--- /dev/null
+++ b/internal/equipo/design_views_test.go
@@ -0,0 +1,134 @@
+package equipo
+
+import (
+ "bytes"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Task 19 (dynamic specialists slice 1): the task page and the direction
+// card show Design's kept captures by option, each from this instance's
+// task-file route; with more than one option, Build this takes the
+// person's note, in scriptless forms.
+
+func designOptions() []wire.StepDesignOption {
+ return []wire.StepDesignOption{
+ {Name: "Calm", Captures: []wire.StepCapture{{ID: "tf_calm1", CaptureID: "1-work-1.png", Size: 10, Width: 390, Height: 844}, {ID: "tf_calm2", CaptureID: "1-diff-1.png", Size: 10, Width: 390, Height: 844}}},
+ {Name: "Bold", Captures: []wire.StepCapture{{ID: "tf_bold", CaptureID: "2-work-1.png", Size: 10, Width: 1440, Height: 900}}},
+ {Name: "Plain", Captures: []wire.StepCapture{}},
+ }
+}
+
+// galleryWants are what a rendered gallery of designOptions holds.
+func galleryWants(task string) []string {
+ return []string{
+ "Option 1: Calm", "Option 2: Bold", "Option 3: Plain", copyText("work.captures.none"),
+ `src="/tasks/` + task + `/files/tf_calm1"`, `src="/tasks/` + task + `/files/tf_bold"`,
+ `alt="Calm, screenshot 2"`, `width="1440" height="900"`,
+ "<figcaption>" + copyText("work.captures.tree.work") + "</figcaption>", "<figcaption>" + copyText("work.captures.tree.diff") + "</figcaption>",
+ }
+}
+
+func mustContain(t *testing.T, html string, wants ...string) {
+ t.Helper()
+ for _, w := range wants {
+ if !strings.Contains(html, w) {
+ t.Errorf("missing %q in:\n%s", w, html)
+ }
+ }
+}
+
+// TestTaskPageShowsDesignCaptures: a done Design attempt's timeline
+// entry shows its kept captures by option.
+func TestTaskPageShowsDesignCaptures(t *testing.T) {
+ now := time.Now()
+ task := wire.Task{ID: "tk1", Creator: "owner@example.com", Stage: wire.StageInReview, Kind: wire.KindExplore, Steps: []wire.Step{{ID: "s1", Specialist: wire.SpecialistEngineering, State: wire.StepDone, Attempt: 1, Pushed: true, CandidateSHA: strings.Repeat("c", 40), FinishedAt: &now, Design: &wire.StepDesign{Attempt: 1, Options: designOptions()}}}}
+ var item *timelineItem
+ for _, it := range timelineOf(task, taskLineOf(task, task.Creator)) {
+ if it.Design != nil {
+ item = &it
+ }
+ }
+ if item == nil {
+ t.Fatal("no timeline entry shows the captures")
+ }
+ var b bytes.Buffer
+ if err := pages["work_task"].ExecuteTemplate(&b, "design-gallery", item.Design); err != nil {
+ t.Fatal(err)
+ }
+ mustContain(t, b.String(), galleryWants("tk1")...)
+ if strings.Count(b.String(), "<section equipo-capture-option") != 3 {
+ t.Fatalf("options shown: %s", b.String())
+ }
+}
+
+func directionTask(note bool, opts []wire.StepDesignOption) (wire.Task, *wire.Card) {
+ card := &wire.Card{ID: "c1", Kind: wire.CardDirection, State: wire.CardOpen, Revision: 2, TaskID: "tk1", Options: []string{wire.ChoiceBuild, wire.ChoiceAgain, wire.ChoiceDrop}}
+ return wire.Task{ID: "tk1", Creator: "owner@example.com", Stage: wire.StageInReview, Kind: wire.KindExplore, NeedsYou: wire.NeedsDirection, Direction: &wire.TaskDirection{BranchURL: "https://amadan.net/x?branch=y", Options: opts, NoteNeeded: note}}, card
+}
+
+// TestDirectionDecisionShowsOptions: the task page's direction card shows
+// the captures; with more than one option its one note field is required
+// (Build and Try again both take it) and Drop alone skips it.
+func TestDirectionDecisionShowsOptions(t *testing.T) {
+ task, card := directionTask(true, designOptions())
+ d := decisionOf(task, taskLine{Task: task, Card: card})
+ if d == nil || d.Gallery == nil || !d.BuildNote || d.Ask != copyText("work.decide.direction_ask_options") {
+ t.Fatalf("decision %+v", d)
+ }
+ var b bytes.Buffer
+ if err := pages["work_task"].ExecuteTemplate(&b, "decision", map[string]any{"Task": taskLine{Task: task, Decision: d}, "Head": false, "From": "task"}); err != nil {
+ t.Fatal(err)
+ }
+ html := b.String()
+ mustContain(t, html, galleryWants("tk1")...)
+ mustContain(t, html, `name="note" required`, copyText("chat.card.direction_note_options"), `value="drop" data-merge-choice="drop" formnovalidate`)
+ if strings.Contains(html, `value="build" data-merge-choice="build" formnovalidate`) || strings.Contains(html, `value="again" data-merge-choice="again" formnovalidate`) {
+ t.Fatalf("Build or Try again skips the note: %s", html)
+ }
+
+ one, card := directionTask(false, designOptions()[:1])
+ d = decisionOf(one, taskLine{Task: one, Card: card})
+ b.Reset()
+ if err := pages["work_task"].ExecuteTemplate(&b, "decision", map[string]any{"Task": taskLine{Task: one, Decision: d}, "Head": false, "From": "task"}); err != nil {
+ t.Fatal(err)
+ }
+ if html := b.String(); strings.Contains(html, `name="note" required`) || strings.Contains(html, "formnovalidate") || !strings.Contains(html, "Option 1: Calm") || d.Ask != copyText("work.decide.direction_ask") {
+ t.Fatalf("one option: %s", html)
+ }
+}
+
+// TestConversationDirectionCardBuildNote: the conversation's direction
+// card shows the captures; with more than one option Build this is a
+// form of its own whose note is required, and the card has no bare
+// Build button.
+func TestConversationDirectionCardBuildNote(t *testing.T) {
+ render := func(task wire.Task, card *wire.Card) string {
+ t.Helper()
+ v := cardView(*card, nil, map[string]wire.Task{task.ID: task})
+ var b bytes.Buffer
+ if err := pages["chat"].ExecuteTemplate(&b, "chat-card", v); err != nil {
+ t.Fatal(err)
+ }
+ return b.String()
+ }
+ html := render(directionTask(true, designOptions()))
+ mustContain(t, html, galleryWants("tk1")...)
+ mustContain(t, html, "data-direction-build", `<input type="hidden" name="choice" value="build">`, `<textarea name="note" required maxlength="1000" rows="1" aria-label="`+copyText("chat.card.build_note")+`"`)
+ if strings.Contains(html, `name="choice" value="build" type="submit"`) {
+ t.Fatalf("a Build button without the note: %s", html)
+ }
+ html = render(directionTask(false, designOptions()[:1]))
+ mustContain(t, html, `name="choice" value="build" type="submit"`, "Option 1: Calm")
+ if strings.Contains(html, "data-direction-build") {
+ t.Fatalf("one option asks for a note: %s", html)
+ }
+ // No Design: the card as it was.
+ html = render(directionTask(false, nil))
+ if strings.Contains(html, "equipo-captures") || strings.Contains(html, "data-direction-build") {
+ t.Fatalf("no options: %s", html)
+ }
+}
diff --git a/internal/equipo/migrations/0117_design_options.sql b/internal/equipo/migrations/0117_design_options.sql
new file mode 100644
index 00000000..bd8b498a
--- /dev/null
+++ b/internal/equipo/migrations/0117_design_options.sql
@@ -0,0 +1,6 @@
+-- Dynamic specialists slice 1 (protocol 36): the options a done Design
+-- attempt's final report named, kept with its captures once the report
+-- validated them (JSON: the attempt, and each option's name and capture
+-- ids in the report's order); "" is none. A team record, as its step;
+-- no existing row changes.
+ALTER TABLE chat_steps ADD COLUMN design_options text NOT NULL DEFAULT "";
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql
index 0c190cab..2b4dec04 100644
--- a/internal/equipo/migrations/schema.sql
+++ b/internal/equipo/migrations/schema.sql
@@ -874,3 +874,10 @@ ALTER TABLE chat_task_files ADD COLUMN tree_digest text NOT NULL DEFAULT "";
-- changes.
CREATE TABLE chat_specialist_turns (card_id text PRIMARY KEY, turn_id text, person text, specialist_id text, project_id text, asked_turn text, words text NOT NULL DEFAULT "", task_id text NOT NULL DEFAULT "", created_at datetime);
CREATE UNIQUE INDEX chat_specialist_turn ON chat_specialist_turns(turn_id);
+
+-- Dynamic specialists slice 1 (protocol 36): the options a done Design
+-- attempt's final report named, kept with its captures once the report
+-- validated them (JSON: the attempt, and each option's name and capture
+-- ids in the report's order); "" is none. A team record, as its step;
+-- no existing row changes.
+ALTER TABLE chat_steps ADD COLUMN design_options text NOT NULL DEFAULT "";
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index 113f151e..a7f57486 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -1242,6 +1242,14 @@ a[equipo-source]:hover, a[equipo-source]:focus-visible { color: var(--rst-text);
[equipo-kept] img { inline-size: 100%; block-size: 6rem; object-fit: contain; border: 1px solid var(--rst-line); border-radius: var(--rst-radius); background: var(--rst-surface-2); }
[equipo-kept] figcaption { font-size: var(--rst-fs-xs); color: var(--rst-text-muted); overflow-wrap: anywhere; }
[equipo-kept] figcaption b { font-weight: 600; color: var(--rst-text); }
+/* Design's kept captures, by option (task page and direction card). */
+[equipo-captures] { display: grid; gap: var(--rst-sp-3); margin-block: var(--rst-sp-2); }
+[equipo-capture-option] h3 { margin: 0 0 var(--rst-sp-1); font-size: var(--rst-fs-sm); font-weight: 600; color: var(--rst-text); overflow-wrap: anywhere; }
+[equipo-capture-option] [equipo-quiet] { margin: 0; }
+[equipo-captures] [equipo-kept] { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
+[equipo-captures] [equipo-kept] img { block-size: 10rem; object-fit: cover; object-position: top; }
+[equipo-captures] [equipo-kept] a { display: block; color: inherit; text-decoration: none; border-radius: var(--rst-radius); }
+[equipo-captures] [equipo-kept] a:focus-visible { outline: 2px solid var(--rst-focus-edge, var(--rst-accent)); outline-offset: 2px; }
[equipo-fetch-log] { margin: var(--rst-sp-2) 0 0; padding-inline-start: var(--rst-sp-5); display: grid; gap: var(--rst-sp-1); font-size: var(--rst-fs-xs); color: var(--rst-text-muted); font-variant-numeric: tabular-nums; }
[equipo-fetch-log] li { overflow-wrap: anywhere; }
[equipo-fetch-log] [data-reason] { color: var(--rst-tone-negative-fg); }
@@ -1919,6 +1927,7 @@ label[equipo-sp-label] { cursor: pointer; }
[equipo-mini-composer][data-has-content] [equipo-mini-pill] button { color: var(--rst-on-accent-fill); background: var(--rst-accent-fill); box-shadow: var(--rst-shadow-lift); }
[equipo-card] [equipo-thread-open] { color: var(--rst-text); cursor: pointer; padding: var(--rst-sp-2) 0; font-size: var(--rst-fs-sm); }
[equipo-subchat][data-direction-thread]:not([open]) { margin: 0; padding: 0; border: 0; background: transparent; }
+[equipo-subchat][data-direction-build]:not([open]) { margin: 0; padding: 0; border: 0; background: transparent; }
[equipo-subchat][open] > summary { margin-block-end: var(--rst-sp-3); }
[equipo-thread-wait] { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rst-sp-2); color: var(--rst-text-muted); font-size: var(--rst-fs-sm); }
[equipo-thread-draft] { inline-size: 100%; white-space: pre-wrap; }
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html
index aed7b8b6..6c879fb0 100644
--- a/internal/equipo/templates/chat.html
+++ b/internal/equipo/templates/chat.html
@@ -12,7 +12,7 @@
<div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn data-first><span equipo-thread-avatar>{{if eq .AuthorIcon "sparkles"}}{{template "roster-mark" .}}{{else}}{{icon .AuthorIcon}}{{end}}</span><div equipo-thread-bubble><div equipo-thread-who>{{.Author}}</div><div equipo-thread-text>{{.Line}}</div></div></div>{{template "roster-thread-turns" .}}</div>
{{if .Open}}{{if .Options}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn name="choice" value="{{.}}" type="submit">{{.}}</button>{{end}}</form>{{else}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}<div equipo-mini-pill><textarea name="choice" required maxlength="2000" rows="1" aria-label="{{copy "chat.card.answer"}}" placeholder="{{copy "chat.card.answer"}}"></textarea><button type="submit" data-thread-send aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form>{{end}}{{else if not .Presentation.Waiting}}<form method="post" action="/conversation/cards/{{.ID}}/reply" data-card-form equipo-mini-composer><input type="hidden" name="request_id" value="{{.ReplyKey}}">{{template "card-job" .}}<div equipo-mini-pill><textarea name="body" required maxlength="2000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form>{{end}}</div>
{{else if eq .Kind "home"}}<p equipo-card-line>{{icon "folder"}}<span>{{.Line}}</span></p><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit">{{copy "chat.card.confirm"}}</button></form>
-{{else if eq .Kind "direction"}}<p equipo-card-line>{{.Line}}</p>{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}{{if eq . "again"}}<button type="button" rst-btn data-thread-open>{{copy "chat.card.again"}}</button>{{else}}<button rst-btn="{{if eq . "build"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-direction-choice="{{.}}"{{if eq . "build"}} data-busy-label="{{copy "roster.building"}}"{{end}}>{{copy (printf "chat.card.%s" .)}}</button>{{end}}{{end}}</form><details equipo-subchat data-direction-thread><summary equipo-thread-open>{{copy "chat.card.again"}}</summary><div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn><span equipo-thread-avatar>{{icon .AuthorIcon}}</span><div equipo-thread-bubble><div equipo-thread-who>{{.Author}}</div><div equipo-thread-text>{{copy "roster.change"}}</div></div></div></div><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="choice" value="again">{{template "card-job" .}}<div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send data-direction-choice="again" aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}{{with .Note}}<p equipo-card-done role="status">{{.}}</p>{{end}}{{if .Presentation.Thread}}<div equipo-subchat data-roster-step="{{.Presentation.StepID}}"><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div></div>{{end}}{{end}}
+{{else if eq .Kind "direction"}}<p equipo-card-line>{{.Line}}</p>{{template "design-gallery" .Gallery}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}{{if eq . "again"}}<button type="button" rst-btn data-thread-open>{{copy "chat.card.again"}}</button>{{else if and (eq . "build") $.BuildNote}}{{else}}<button rst-btn="{{if eq . "build"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-direction-choice="{{.}}"{{if eq . "build"}} data-busy-label="{{copy "roster.building"}}"{{end}}>{{copy (printf "chat.card.%s" .)}}</button>{{end}}{{end}}</form>{{if .BuildNote}}<details equipo-subchat data-direction-build><summary equipo-thread-open>{{copy "chat.card.build"}}</summary><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="choice" value="build">{{template "card-job" .}}<div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "chat.card.build_note"}}" placeholder="{{copy "chat.card.build_note"}}"></textarea><button type="submit" data-thread-send data-direction-choice="build" aria-label="{{copy "chat.card.build"}}" data-busy-label="{{copy "roster.building"}}">{{icon "arrow-up"}}</button></div></form></details>{{end}}<details equipo-subchat data-direction-thread><summary equipo-thread-open>{{copy "chat.card.again"}}</summary><div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn><span equipo-thread-avatar>{{icon .AuthorIcon}}</span><div equipo-thread-bubble><div equipo-thread-who>{{.Author}}</div><div equipo-thread-text>{{copy "roster.change"}}</div></div></div></div><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="choice" value="again">{{template "card-job" .}}<div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send data-direction-choice="again" aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}{{with .Note}}<p equipo-card-done role="status">{{.}}</p>{{end}}{{if .Presentation.Thread}}<div equipo-subchat data-roster-step="{{.Presentation.StepID}}"><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div></div>{{end}}{{end}}
{{else if eq .Kind "specialist"}}<p equipo-card-line>{{.Line}}</p>{{with .Specialist}}{{range .Capabilities}}<p equipo-card-note data-capability="{{.ID}}">{{.Words}}</p>{{end}}<p equipo-card-note data-specialist-brief>{{printf (copy "chat.card.specialist_brief") .Brief}}</p>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "add"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-specialist-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if eq .Kind "research_sources"}}<p equipo-card-line>{{.Line}}</p>{{with .Name}}<p equipo-card-note data-research-task>{{printf (copy "chat.card.research_for") .}}</p>{{end}}{{with .Research}}<p equipo-card-note data-research-question>{{printf (copy "chat.card.research_looks_for") .Question}}</p><ul equipo-card-list data-research-urls>{{range .URLs}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "allow"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-research-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if eq .Kind "research_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-research-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit" data-inventory-confirm>{{copy "chat.card.inventory_confirm"}}</button></form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html
index 4e1be335..8f5643f5 100644
--- a/internal/equipo/templates/work_parts.html
+++ b/internal/equipo/templates/work_parts.html
@@ -36,8 +36,8 @@
{{define "decision"}}{{$t := .Task}}{{with $t.Decision}}<div equipo-decision{{if eq $.From "task"}} id="decide"{{end}}{{with .Tone}} data-tone="{{.}}"{{end}} data-need="{{.Need}}" data-decision="{{$t.ID}}">
{{if $.Head}}{{template "mono" $t.Mono}}<div equipo-d-title><a href="/tasks/{{$t.ID}}">{{$t.Title}}</a><div equipo-quiet>{{template "placement-chip" $t}} · {{template "source" $t}}</div></div>{{end}}
<p equipo-d-why>{{.Why}}</p>
-{{with .Ask}}<p equipo-d-ask>{{.}}</p>{{end}}{{if .Link}}<p equipo-quiet data-direction-line>{{with .LinkText}}{{.}} {{end}}<a equipo-link href="{{.Link}}" rel="noopener noreferrer" target="_blank" data-direction-link>{{.LinkLabel}}</a>{{with .AltLink}} <a equipo-link href="{{.}}" rel="noopener noreferrer" target="_blank" data-direction-branch>{{$t.Decision.AltLabel}}</a>{{end}}</p>{{end}}{{with .Said}}<p equipo-quiet data-triage-said>{{.}}</p>{{end}}{{with .Failed}}<p equipo-quiet data-triage-failed>{{.}}</p>{{end}}{{with .Recommend}}<p equipo-quiet data-triage-recommend>{{.}}</p>{{end}}
-<div equipo-d-actions>{{if .CopyContinue}}<form method="post" action="/conversation/tasks/{{$t.ID}}/continue-without-copy"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{if $.Task.Decision.Note}}<textarea rst-input name="note" maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note"}}" placeholder="{{copy "chat.card.direction_note"}}" data-direction-note></textarea>{{end}}{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}">{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{with .Unsandboxed}}<details equipo-mach-confirm data-unsandboxed><summary equipo-btn>{{copy "work.decide.unsandboxed"}}</summary><div><p>{{.Warning}}</p><form method="post" action="/conversation/tasks/{{$t.ID}}/unsandboxed"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="step" value="{{.Step}}"><input type="hidden" name="attempt" value="{{.Attempt}}"><button equipo-btn data-danger type="submit" data-task-unsandboxed>{{copy "work.decide.unsandboxed_confirm"}}</button></form></div></details>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Round}}<form method="post" action="/conversation/tasks/{{$t.ID}}/round"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-round>{{copy "work.decide.round"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation?about={{$t.ID}}" data-ask-coordinator>{{copy "work.decide.ask_coordinator"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div>
+{{with .Ask}}<p equipo-d-ask>{{.}}</p>{{end}}{{if .Link}}<p equipo-quiet data-direction-line>{{with .LinkText}}{{.}} {{end}}<a equipo-link href="{{.Link}}" rel="noopener noreferrer" target="_blank" data-direction-link>{{.LinkLabel}}</a>{{with .AltLink}} <a equipo-link href="{{.}}" rel="noopener noreferrer" target="_blank" data-direction-branch>{{$t.Decision.AltLabel}}</a>{{end}}</p>{{end}}{{template "design-gallery" .Gallery}}{{with .Said}}<p equipo-quiet data-triage-said>{{.}}</p>{{end}}{{with .Failed}}<p equipo-quiet data-triage-failed>{{.}}</p>{{end}}{{with .Recommend}}<p equipo-quiet data-triage-recommend>{{.}}</p>{{end}}
+<div equipo-d-actions>{{if .CopyContinue}}<form method="post" action="/conversation/tasks/{{$t.ID}}/continue-without-copy"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{if $.Task.Decision.Note}}{{if $.Task.Decision.BuildNote}}<textarea rst-input name="note" required maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note_options"}}" placeholder="{{copy "chat.card.direction_note_options"}}" data-direction-note></textarea>{{else}}<textarea rst-input name="note" maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note"}}" placeholder="{{copy "chat.card.direction_note"}}" data-direction-note></textarea>{{end}}{{end}}{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}"{{if and $.Task.Decision.BuildNote (eq .Value "drop")}} formnovalidate{{end}}>{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{with .Unsandboxed}}<details equipo-mach-confirm data-unsandboxed><summary equipo-btn>{{copy "work.decide.unsandboxed"}}</summary><div><p>{{.Warning}}</p><form method="post" action="/conversation/tasks/{{$t.ID}}/unsandboxed"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="step" value="{{.Step}}"><input type="hidden" name="attempt" value="{{.Attempt}}"><button equipo-btn data-danger type="submit" data-task-unsandboxed>{{copy "work.decide.unsandboxed_confirm"}}</button></form></div></details>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Round}}<form method="post" action="/conversation/tasks/{{$t.ID}}/round"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-round>{{copy "work.decide.round"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation?about={{$t.ID}}" data-ask-coordinator>{{copy "work.decide.ask_coordinator"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div>
</div>{{end}}{{end}}
{{define "star-toggle"}}{{$p := .P}}<form method="post" action="/projects/{{$p.ID}}/star" equipo-star-form><input type="hidden" name="starred" value="{{if $p.Star.On}}0{{else}}1{{end}}"><input type="hidden" name="from" value="{{.From}}"><button type="submit" equipo-star{{if $p.Star.On}} aria-pressed="true"{{if $p.Star.Auto}} data-auto{{end}}{{else}} aria-pressed="false"{{end}} aria-label="{{$p.Star.Label}}" title="{{$p.Star.Who}}" data-star-toggle>{{icon "star"}}</button></form>{{end}}
{{define "project-facts"}}{{with .StackLine}}<span>{{if $.PhoneStack}}{{icon "phone"}}{{else}}{{icon "code"}}{{end}}{{.}}</span>{{end}}{{with .Repos}}<span data-repos>{{icon "git"}}{{if eq (len .) 1}}{{copy "work.project.one_repo"}}{{else}}{{printf (copy "work.project.repos") (len .)}}{{end}}</span>{{end}}{{with .ChecksLine}}<span data-tone="{{if $.Checks.Here}}positive{{else}}warning{{end}}" data-checks-fact>{{if $.Checks.Here}}{{icon "check-circle"}}{{else}}{{icon "help-circle"}}{{end}}{{.}}</span>{{end}}{{end}}
@@ -53,3 +53,6 @@
<noscript><button equipo-btn data-primary type="submit">{{copy "thinking.use"}}</button></noscript>
</form>
</div>{{end}}{{end}}
+{{/* A Design attempt's kept captures, by option, from this instance's
+ task-file route only (the task page and the direction card). */}}
+{{define "design-gallery"}}{{with .}}<div equipo-captures data-captures>{{range .Options}}<section equipo-capture-option data-option><h3>{{.Label}}</h3>{{if .Captures}}<ul equipo-kept>{{range .Captures}}<li><a href="{{.Src}}" target="_blank" rel="noopener" data-capture="{{.ID}}"><figure><img src="{{.Src}}" alt="{{.Alt}}" width="{{.Width}}" height="{{.Height}}" loading="lazy" decoding="async"><figcaption>{{.Tree}}</figcaption></figure></a></li>{{end}}</ul>{{else}}<p equipo-quiet>{{copy "work.captures.none"}}</p>{{end}}</section>{{end}}</div>{{end}}{{end}}
diff --git a/internal/equipo/templates/work_task.html b/internal/equipo/templates/work_task.html
index 1c90f06c..35893073 100644
--- a/internal/equipo/templates/work_task.html
+++ b/internal/equipo/templates/work_task.html
@@ -33,6 +33,7 @@
{{with .Headline}}<p equipo-headline>{{.}}</p>{{end}}
{{if .Lines}}<ol equipo-tl-lines data-step-lines>{{range .Lines}}<li>{{.}}</li>{{end}}</ol>{{end}}
{{with .Research}}{{template "research-findings" .}}{{end}}
+{{with .Design}}{{template "design-gallery" .}}{{end}}
{{if .HasDetails}}<details equipo-tl-more id="tl-more-{{$i}}"><summary>{{icon "chevron-down"}}<span>{{copy "work.details"}}</span></summary><div equipo-tl-body>
{{with .Markdown}}<div equipo-markdown equipo-md>{{chatMarkdown .}}</div>{{end}}
{{with .Findings}}<ul equipo-findings>{{range .}}<li>{{with .Headline}}<b>{{.}}</b> {{end}}{{.Text}}{{if .Path}}<small><code>{{.Path}}{{if .Line}}:{{.Line}}{{end}}</code></small>{{end}}</li>{{end}}</ul>{{end}}
diff --git a/internal/equipo/work_views.go b/internal/equipo/work_views.go
index 924f38ce..24aeda9c 100644
--- a/internal/equipo/work_views.go
+++ b/internal/equipo/work_views.go
@@ -155,6 +155,10 @@ type decisionView struct {
// not paired).
AltLink, AltLabel string
Note bool
+ // Gallery is what the newest Design attempt kept, by option; with
+ // more than one, BuildNote: Build this needs the note too.
+ Gallery *designGallery
+ BuildNote bool
// Recover settles a step stopped when its machine was removed.
Recover bool
// Mac: checks wait for a Mac; the card links setting one up.
@@ -797,6 +801,10 @@ func decisionOf(t wire.Task, v taskLine) *decisionView {
default:
d.LinkText, d.Link, d.LinkLabel = copyText("work.direction.no_preview"), dir.BranchURL, copyText("work.direction.branch")
}
+ d.Gallery, d.BuildNote = galleryOf(t.ID, dir.Options), dir.NoteNeeded
+ if d.BuildNote {
+ d.Ask = copyText("work.decide.direction_ask_options")
+ }
}
if d.Card != nil {
for _, o := range d.Card.Options {
@@ -960,6 +968,8 @@ type timelineItem struct {
// once done (research_views.go).
Specialist string
Research *researchView
+ // Design is a done Design attempt's kept captures, by option.
+ Design *designGallery
// RetryPost and RetryStep are a stopped step's own Retry (a failed
// preview behind the merge), for the task's creator.
RetryPost, RetryStep string
@@ -1167,6 +1177,9 @@ func timelineOf(t wire.Task, v taskLine) []timelineItem {
}
case wire.SpecialistEngineering:
it := timelineItem{Kind: "step", What: title, Took: took(s), Headline: headline(s.Headline, s.Summary), Markdown: s.Summary, At: s.FinishedAt}
+ if s.Design != nil {
+ it.Design = galleryOf(t.ID, s.Design.Options)
+ }
if s.Pushed {
it.Text = append(it.Text, fmt.Sprintf(copyText("work.tl.pushed"), short(s.CandidateSHA)))
// step_timeout: it ran out of time; this is its work so far.
diff --git a/internal/runner/renderpage/wire_test.go b/internal/runner/renderpage/wire_test.go
index dbff4608..edac6ef9 100644
--- a/internal/runner/renderpage/wire_test.go
+++ b/internal/runner/renderpage/wire_test.go
@@ -9,12 +9,18 @@ import (
)
// TestCapturesFitTheWire: every capture a step can write has a name the
-// wire's capture id accepts and a size within its render_file bound, so a
+// wire's capture id accepts, a size within its render_file bound and
+// pixels within the bounds the instance decodes, so a
// Design step can name any of them in its options (protocol 36).
func TestCapturesFitTheWire(t *testing.T) {
if MaxCaptureBytes != wire.MaxCaptureBytes {
t.Fatalf("capture bound %d, the wire's %d", MaxCaptureBytes, wire.MaxCaptureBytes)
}
+ // The instance decodes a capture only within the wire's pixel bounds
+ // (task 19): every capture render_page writes fits them.
+ if MaxWidth != wire.MaxCaptureWidth || MaxHeight != wire.MaxCaptureHeight {
+ t.Fatalf("capture bounds %dx%d, the wire's %dx%d", MaxWidth, MaxHeight, wire.MaxCaptureWidth, wire.MaxCaptureHeight)
+ }
for call := 1; call <= MaxCalls; call++ {
for _, tree := range []string{TreeBase, TreeWork, "diff"} {
for n := 1; n <= render.MaxPages; n++ {
diff --git a/internal/wire/design.go b/internal/wire/design.go
index ddbf0175..af695420 100644
--- a/internal/wire/design.go
+++ b/internal/wire/design.go
@@ -36,6 +36,11 @@ const (
// MaxSpecialistBrief bounds a dispatch's SpecialistBrief: the menu's
// bound on a specialist's brief (specialist.MaxBrief).
MaxSpecialistBrief = 2 << 10
+ // MaxCaptureWidth and MaxCaptureHeight bound a capture's pixels: the
+ // widest viewport (desktop) and a full page's clip (spec: full pages
+ // capped at 10,000 px), as render_page writes them.
+ MaxCaptureWidth = 1440
+ MaxCaptureHeight = 10000
)
// A Design step that waits, by placement: PlacementDesign while the
@@ -83,6 +88,43 @@ type DesignCapture struct {
TreeDigest string `json:"tree_digest"`
}
+// StepDesign is what a done Design attempt kept, on the task's read
+// shape only: the options its final report named, in its order, each
+// with the captures the instance kept for it (a capture is kept only
+// once the report validated it).
+type StepDesign struct {
+ Attempt int64 `json:"attempt"`
+ Options []StepDesignOption `json:"options"`
+}
+
+// StepDesignOption is one option and its kept captures, in the report's
+// order. Name is the specialist's label for it.
+type StepDesignOption struct {
+ Name string `json:"name"`
+ Captures []StepCapture `json:"captures"`
+}
+
+// StepCapture is one kept capture: ID is its task file (GET
+// /tasks/{task}/files/{id}), CaptureID the render_page file it was
+// (its tree is in the name), with its size and pixel size.
+type StepCapture struct {
+ ID string `json:"id"`
+ CaptureID string `json:"capture_id"`
+ Size int64 `json:"size"`
+ Width int `json:"width"`
+ Height int `json:"height"`
+}
+
+// CaptureTree is the tree a capture id names: base, work or diff ("" for
+// an id that is not a capture's).
+func CaptureTree(id string) string {
+ m := captureID.FindStringSubmatch(id)
+ if m == nil {
+ return ""
+ }
+ return m[2]
+}
+
// RenderFile is one chunk of a named capture, runner to instance, sent
// before the step's final report. Index counts from 0 to Total-1; SHA256
// and Size are the whole file's.
diff --git a/internal/wire/design_test.go b/internal/wire/design_test.go
index 51f4f1e6..339b3686 100644
--- a/internal/wire/design_test.go
+++ b/internal/wire/design_test.go
@@ -395,3 +395,13 @@ func TestValidSpecialistBinding(t *testing.T) {
}
}
}
+
+// TestCaptureTree: the tree a capture id names, "" for anything else
+// (task 19 checks one render's digests by it).
+func TestCaptureTree(t *testing.T) {
+ for id, want := range map[string]string{"1-work-2.png": "work", "3-base-1.png": "base", "12-diff-6.png": "diff", "0-work-1.png": "", "1-work-1.jpg": "", "../1-work-1.png": "", "": ""} {
+ if got := wire.CaptureTree(id); got != want {
+ t.Errorf("CaptureTree(%q) = %q, want %q", id, got, want)
+ }
+ }
+}
diff --git a/internal/wire/explore.go b/internal/wire/explore.go
index 568160f4..00d2d7d4 100644
--- a/internal/wire/explore.go
+++ b/internal/wire/explore.go
@@ -40,13 +40,21 @@ const MaxDirectionNote = 1000
// TaskDirection is what the direction card shows: the candidate's
// deployed preview, else its branch on Amadan, and whether the primary
-// said previews are off.
+// said previews are off. Options are what the newest Design attempt kept
+// (protocol 36), by option; with more than one, NoteNeeded: Build this
+// needs the person's note saying which.
type TaskDirection struct {
- PreviewURL string `json:"preview_url,omitempty"`
- BranchURL string `json:"branch_url"`
- PreviewsOff bool `json:"previews_off,omitempty"`
+ PreviewURL string `json:"preview_url,omitempty"`
+ BranchURL string `json:"branch_url"`
+ PreviewsOff bool `json:"previews_off,omitempty"`
+ Options []StepDesignOption `json:"options,omitempty"`
+ NoteNeeded bool `json:"note_needed,omitempty"`
}
+// ConflictDirectionNote is the card conflict a Build this without a note
+// gets on a direction card with more than one option.
+const ConflictDirectionNote = "direction_note"
+
// SetKind is POST /api/v1/tasks/{id}/kind: the creator switches a task
// between a change and an exploration, at the task's current revision.
type SetKind struct {
diff --git a/internal/wire/tasks.go b/internal/wire/tasks.go
index cff7379f..46579f82 100644
--- a/internal/wire/tasks.go
+++ b/internal/wire/tasks.go
@@ -319,6 +319,9 @@ type Step struct {
// Research: a done Research step's findings, fetch log and kept
// images, on the task's read shape only.
Research *StepResearch `json:"research,omitempty"`
+ // Design: a done Design attempt's kept captures by option, on the
+ // task's read shape only.
+ Design *StepDesign `json:"design,omitempty"`
// Hold is why the scheduler holds the step now (absent when it does
// not).
Hold *StepHold `json:"hold,omitempty"`
diff --git a/internal/wire/wireschema/wireschema.go b/internal/wire/wireschema/wireschema.go
index 2c0d126f..9d0924bf 100644
--- a/internal/wire/wireschema/wireschema.go
+++ b/internal/wire/wireschema/wireschema.go
@@ -192,7 +192,7 @@ var Enums = map[string][]string{
"SetPriority.priority": {wire.PriorityUrgent, wire.PriorityNormal, wire.PriorityLow},
"UsageTotals.period": wire.UsagePeriods,
"UsageTotals.by": wire.UsageGroupings,
- "CardConflict.code": {"card_stale", "card_answered"},
+ "CardConflict.code": {"card_stale", "card_answered", wire.ConflictDirectionNote},
"ActionConflict.code": {"not_undoable"},
"RegisterPush.environment": {wire.APNsProduction, wire.APNsDevelopment},