oficina / equipo Public

Add next steps and coordinator threads to Roster reports

codex agent, operated by paul@keymail.dev pushed by paul@keymail.dev fe309cf03c9b39042b8ec4a223856acd23f8cd5a parent b46afce
19 files changed, +505 −31
  • .rastrillo/budgets.txt +3 −3
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +5 −0
  • internal/equipo/chat/projects.go +3 −0
  • internal/equipo/chat/report_thread.go +28 −0
  • internal/equipo/chat/report_thread_test.go +112 −0
  • internal/equipo/chat/roster.go +7 −2
  • internal/equipo/chat_page.go +1 −0
  • internal/equipo/chat_roster.go +9 −2
  • internal/equipo/chat_roster_test.go +34 −0
  • internal/equipo/copy.go +7 −2
  • internal/equipo/report_actions.go +38 −0
  • internal/equipo/static/chat-compose.js +1 −1
  • internal/equipo/static/chat-stream.js +17 −1
  • internal/equipo/static/equipo.css +14 −0
  • internal/equipo/templates/chat.html +6 −3
  • internal/thintest/report_actions_browser_test.go +201 −0
  • internal/thintest/roster_browser_test.go +15 −15
  • internal/thintest/roster_reports_browser_test.go +2 −0
  • internal/thintest/testdata/roster-geometry.js +2 −2

CI failed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index c5123200..b71dd1e8 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -14,7 +14,7 @@ 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 20392 - The web view models and templates share rendering; Roster adds bylines, fact details, sub-chat views, Stop and compact reports. Measured 20392 source lines.
+size internal/equipo 20443 - Shared web view models and templates; report actions reuse task decisions and card sub-chats, with historical thread filtering. Measured 20443 source lines.
size internal/wire 6370 - Runner and person API types share Encode. 21 adds Copy fields, 22 job lanes and cards, 23 the glance frame, 24 the warm command. Measured 6370 source lines.
size internal/equipotest - 13400 Task 21 repairs historical migration and conversation fixtures after Plan 3. Measured 13024 test lines; the 300s time ceiling is unchanged.
time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded);
@@ -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 28846 - Transactional conversation store shares authority and dispatch helpers; roster reads; legacy mirrors; glance relay, warm on open. Measured 28846 source lines.
+size internal/equipo/chat 28882 - Shared transactional authority and dispatch; report threads extend card replies and attach current task facts without a new schema or protocol. Measured 28882 source lines.
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.
@@ -71,7 +71,7 @@ perf GET /tasks/{id}/files/{file} skip Research kept images: the bytes of one im
perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section.
time cmd/equipo-runner 60s TestReleaseRunnerHasNoFakeWorker builds the release runner and the thin package under testbuild (about 12s locally).
size internal/headless - 11062 End-to-end scenarios through a real runner and instance: Copy setting, the Assistant's job threads, streamed replies, warm start, glance. Measured 11062 test lines.
-size internal/thintest - 29241 Contract and browser tests share one instance harness: Assistant hand-off, outcome, job, legacy question, glance and warm contracts, Roster guards. Measured 29241 test lines.
+size internal/thintest - 29444 Shared instance harness; report state, feedback and thread tests at both widths and themes, including reload and historical isolation. Measured 29444 test lines.
perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}.
perf GET /api/v1/usage skip Thin v1 person API: bearer-only JSON for devices; the browser reads usage through /usage.
perf GET /api/v1/advice skip Thin v1 person API: bearer-only JSON for devices; the browser reads advice through /usage and /conversation.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 9cbbdec9..7073cfae 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5437,6 +5437,11 @@ records remain unchanged.
| `device.empty` | You have no approved devices. | 20 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `device.revoked` | Device revoked | 20 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `device.approved` | Device approved | 20 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `roster.talk` | Talk about this | C · Report actions | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15) |
+| `roster.round_busy` | Starting another round… | C · Report actions | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15) |
+| `roster.round_done` | Another round is starting. | C · Report actions | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15) |
+| `roster.merge_busy` | Starting the merge… | C · Report actions | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15) |
+| `roster.merge_done` | The merge is starting. | C · Report actions | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15) |
| `roster.invalid_input` | Check the person, role and active state. | 20 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `roster.forbidden` | Only a team owner can change the roster. Keep at least one owner. | 20 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `roster.revision_conflict` | The roster changed or this person still owns project decisions. Check the roster and project owners before trying again. | 20 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/chat/projects.go b/internal/equipo/chat/projects.go
index dff97863..79cdfe54 100644
--- a/internal/equipo/chat/projects.go
+++ b/internal/equipo/chat/projects.go
@@ -832,6 +832,9 @@ func (t *txn) answerPrefix(m messageRecord) (string, error) {
if err != nil {
return "", err
}
+ if c.Kind == wire.CardTask {
+ return t.reportPrefix(c.TaskID, m.Text)
+ }
if c.Kind == wire.CardProject {
v, err := t.cardView(c)
if err != nil {
diff --git a/internal/equipo/chat/report_thread.go b/internal/equipo/chat/report_thread.go
new file mode 100644
index 00000000..c33ff91e
--- /dev/null
+++ b/internal/equipo/chat/report_thread.go
@@ -0,0 +1,28 @@
+package chat
+
+import "encoding/json"
+
+// Read at dispatch, so a queued reply carries the current report facts.
+func (t *txn) reportPrefix(id, text string) (string, error) {
+ k, err := t.loadTask(id)
+ if err != nil {
+ return "", err
+ }
+ v, err := t.taskView(k)
+ if err != nil {
+ return "", err
+ }
+ facts := map[string]any{"task_id": v.ID, "title": v.Title, "project": v.Project, "project_id": v.ProjectID, "stage": v.Stage, "needs_you": v.NeedsYou, "checks": v.Checks, "checks_reason": v.ChecksReason, "verdict": v.Verdict, "branch": v.Branch, "candidate_sha": v.CandidateSHA}
+ if n := len(v.Findings); n > 0 {
+ facts["latest_finding"] = v.Findings[n-1]
+ }
+ if n := len(v.Steps); n > 0 {
+ s := v.Steps[n-1]
+ facts["latest_step"] = map[string]any{"specialist": s.Specialist, "state": s.State, "summary": s.Summary, "reason": s.Reason}
+ }
+ raw, err := json.Marshal(facts)
+ if err != nil {
+ return "", err
+ }
+ return "(Discussing this task report: " + string(raw) + ") " + text, nil
+}
diff --git a/internal/equipo/chat/report_thread_test.go b/internal/equipo/chat/report_thread_test.go
new file mode 100644
index 00000000..9c889bd2
--- /dev/null
+++ b/internal/equipo/chat/report_thread_test.go
@@ -0,0 +1,112 @@
+package chat
+
+import (
+ "context"
+ "errors"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+func TestReportThreadOwnershipContextAndIsolation(t *testing.T) {
+ r := newMeteredRig(t)
+ ctx := context.Background()
+ now := r.s.now()
+ must := func(err error) {
+ t.Helper()
+ if err != nil {
+ t.Fatal(err)
+ }
+ }
+ must(r.s.db.G.Create(&projectRecord{ID: "p_report", Title: "Woodstar", Repo: "amadan.net/oficina/sample"}).Error)
+ must(r.s.db.G.Create(&taskRecord{ID: "tk_report", ProjectID: "p_report", Title: "Improve sign-in", Creator: hkOwner, Stage: wire.StageInReview, CreatedAt: now, UpdatedAt: now}).Error)
+ c := cardRecord{ID: "c_report", Person: hkOwner, TaskID: "tk_report", Kind: wire.CardTask, State: wire.StageInReview, Options: "[]", Revision: 1, CreatedAt: now, UpdatedAt: now}
+ must(r.s.db.G.Create(&c).Error)
+ must(r.s.db.G.Create(&turnRecord{ID: "t_busy", Person: hkOwner, State: wire.TurnRunning, Dispatched: true, CreatedAt: now}).Error)
+ if err := r.s.ReplyCard(ctx, hkMember, c.ID, "other", "Other person"); !errors.Is(err, ErrNotFound) {
+ t.Fatalf("other person: %v", err)
+ }
+ r.removed = true
+ if err := r.s.ReplyCard(ctx, hkOwner, c.ID, "removed", "Removed member"); !errors.Is(err, ErrForbidden) {
+ t.Fatalf("removed member: %v", err)
+ }
+ r.removed = false
+ send := func(key string) string {
+ var id string
+ must(r.s.tx(ctx, func(tx *txn) error {
+ sent, _, err := tx.send("", hkOwner, key, key, nil, nil)
+ id = sent.Turn.ID
+ return err
+ }))
+ return id
+ }
+ before := send("main-before")
+ r.s.now = func() time.Time { return now.Add(time.Second) }
+ must(r.s.ReplyCard(ctx, hkOwner, c.ID, "reply", "Can we simplify it?"))
+ must(r.s.ReplyCard(ctx, hkOwner, c.ID, "reply", "Can we simplify it?"))
+ if err := r.s.ReplyCard(ctx, hkOwner, c.ID, "reply", "Changed retry"); !errors.Is(err, ErrConflict) {
+ t.Fatalf("idempotency: %v", err)
+ }
+ r.s.now = func() time.Time { return now.Add(2 * time.Second) }
+ after := send("main-after")
+ var links []cardThreadRecord
+ must(r.s.db.G.Find(&links).Error)
+ if len(links) != 1 || links[0].TurnID == before || links[0].TurnID == after {
+ t.Fatalf("thread batched or duplicated: %+v main %s %s", links, before, after)
+ }
+ var m messageRecord
+ must(r.s.db.G.First(&m, "id = ?", links[0].MessageID).Error)
+ must(r.s.db.G.Model(&taskRecord{}).Where("id = ?", c.TaskID).Update("title", "New sign-in title").Error)
+ must(r.s.tx(ctx, func(tx *txn) error {
+ text, err := tx.answerPrefix(m)
+ for _, want := range []string{"tk_report", "New sign-in title", "Woodstar", "in_review", "Can we simplify it?"} {
+ if !strings.Contains(text, want) {
+ t.Errorf("context missing %q: %s", want, text)
+ }
+ }
+ return err
+ }))
+ must(r.s.db.G.Create(&messageRecord{ID: "m_report_reply", Person: hkOwner, Role: wire.RoleCoordinator, TurnID: links[0].TurnID, Text: "We can simplify the first step.", Seq: 100, CreatedAt: now}).Error)
+ ps, err := r.s.CardPresentations(ctx, hkOwner, []string{c.ID})
+ must(err)
+ if len(ps[c.ID].Thread) != 2 || ps[c.ID].Thread[1].Own {
+ t.Fatalf("thread persistence: %+v", ps)
+ }
+ other, err := r.s.CardPresentations(ctx, hkMember, []string{c.ID})
+ must(err)
+ if len(other) != 0 {
+ t.Fatalf("other person read thread: %+v", other)
+ }
+ r.removed = true
+ if _, err := r.s.CardPresentations(ctx, hkOwner, []string{c.ID}); !errors.Is(err, ErrForbidden) {
+ t.Fatalf("removed read: %v", err)
+ }
+}
+
+func TestReportNextStepStoreAuthority(t *testing.T) {
+ for _, action := range []string{"round", "merge"} {
+ t.Run(action, func(t *testing.T) {
+ r := newMeteredRig(t)
+ if err := r.s.db.G.Create(&taskRecord{ID: "tk_actions", Creator: hkOwner, Stage: wire.StageInReview}).Error; err != nil {
+ t.Fatal(err)
+ }
+ run := r.s.RoundTask
+ if action == "merge" {
+ run = r.s.MergeTask
+ }
+ if _, err := run(context.Background(), hkMember, "tk_actions"); !errors.Is(err, ErrForbidden) {
+ t.Fatalf("other creator: %v", err)
+ }
+ r.removed = true
+ if _, err := run(context.Background(), hkOwner, "tk_actions"); !errors.Is(err, ErrForbidden) {
+ t.Fatalf("removed owner: %v", err)
+ }
+ r.removed = false
+ if _, err := run(context.Background(), hkOwner, "tk_actions"); err == nil {
+ t.Fatal("unavailable action accepted")
+ }
+ })
+ }
+}
diff --git a/internal/equipo/chat/roster.go b/internal/equipo/chat/roster.go
index 30036c72..5cdc96c0 100644
--- a/internal/equipo/chat/roster.go
+++ b/internal/equipo/chat/roster.go
@@ -269,7 +269,7 @@ func (s *Store) OpenStandaloneCards(ctx context.Context, person string) (out []S
return
}
-// ReplyCard continues an answered question in the same private lane.
+// ReplyCard continues an answered question or discusses a task report in its private lane.
// The original decision remains answered; the new message owns its turn.
func (s *Store) ReplyCard(ctx context.Context, person, id, key, text string) error {
text, ok := cleanText(text, 2000)
@@ -286,9 +286,14 @@ func (s *Store) ReplyCard(ctx context.Context, person, id, key, text string) err
} else if err != nil {
return err
}
- if c.Kind != wire.CardQuestion || c.State != wire.CardAnswered {
+ if c.Kind != wire.CardTask && (c.Kind != wire.CardQuestion || c.State != wire.CardAnswered) {
return ErrCardConflict
}
+ if c.Kind == wire.CardTask {
+ if _, err := t.loadTask(c.TaskID); err != nil {
+ return err
+ }
+ }
if _, job := wire.JobOf(c.Lane); job {
if err := t.jobRunner(person); err != nil {
return err
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index 4c107734..0fc9b527 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -81,6 +81,7 @@ type chatLine struct {
// chatCard is one card under the message that ends its turn. Line is the
// card's sentence; the forms post to the page routes below.
type chatCard struct {
+ ReportAction *reportAction
ProjectMono monoLine
ThreadActivity string
ThreadError string
diff --git a/internal/equipo/chat_roster.go b/internal/equipo/chat_roster.go
index 2994e641..a62ec7e2 100644
--- a/internal/equipo/chat_roster.go
+++ b/internal/equipo/chat_roster.go
@@ -121,6 +121,9 @@ func (a *application) presentRoster(ctx context.Context, address string, view *c
deciding[c.TaskID] = deciding[c.TaskID] || c.TaskID != "" && !c.Receipt && c.Interactive() && !c.SetAside()
}
for _, c := range cards {
+ if c.Task != nil {
+ c.ReportAction = reportNext(*c.Task, address, cards)
+ }
c.Compact = c.Receipt && c.Task != nil && deciding[c.TaskID] && !c.Interactive()
}
turns := map[string]bool{}
@@ -133,9 +136,13 @@ func (a *application) presentRoster(ctx context.Context, address string, view *c
turns[id] = true
}
}
- view.Messages = slices.DeleteFunc(view.Messages, func(m chatLine) bool {
+ threadMessage := func(m chatLine) bool {
return (own[m.ID] || !m.Own && turns[m.TurnID]) && len(m.Cards) == 0 && len(m.Receipts) == 0
- })
+ }
+ view.Messages = slices.DeleteFunc(view.Messages, threadMessage)
+ for i := range view.Days {
+ view.Days[i].Feed.Lines = slices.DeleteFunc(view.Days[i].Feed.Lines, threadMessage)
+ }
if view.Ended != nil && turns[view.Ended.ID] {
view.Ended = nil
}
diff --git a/internal/equipo/chat_roster_test.go b/internal/equipo/chat_roster_test.go
index ce2748f8..1b368524 100644
--- a/internal/equipo/chat_roster_test.go
+++ b/internal/equipo/chat_roster_test.go
@@ -40,3 +40,37 @@ func TestRosterCardAuthorship(t *testing.T) {
}
}
}
+
+func TestReportActionMatchesTaskAuthority(t *testing.T) {
+ for _, viewer := range []string{"owner@example.com", "member@example.com"} {
+ for _, tc := range []struct {
+ name, stage, checks, verdict, needs, want string
+ merge bool
+ }{
+ {"changes", wire.StageInReview, wire.ChecksPassed, wire.VerdictChanges, wire.NeedsFixRounds, "round", false},
+ {"checks", wire.StageInReview, wire.ChecksFailed, "", wire.NeedsFixRounds, "round", false},
+ {"automatic", wire.StageInReview, wire.ChecksFailed, "", "", "", false},
+ {"merge", wire.StageReadyToMerge, wire.ChecksPassed, wire.VerdictApprove, "", "merge", true},
+ {"merge unavailable", wire.StageReadyToMerge, wire.ChecksPassed, wire.VerdictApprove, "", "", false},
+ {"done", wire.StageDone, wire.ChecksFailed, wire.VerdictChanges, "", "", false},
+ } {
+ task := wire.Task{ID: "tk", Creator: "owner@example.com", Stage: tc.stage, Checks: tc.checks, Verdict: tc.verdict, NeedsYou: tc.needs, MergeOffered: tc.merge}
+ v := taskLineOf(task, task.Creator)
+ v.richOf(task, task.Creator, nil, task.UpdatedAt)
+ got := reportNext(v, viewer, nil)
+ want := tc.want
+ if viewer != task.Creator {
+ want = ""
+ }
+ if got == nil && want != "" || got != nil && got.Kind != want {
+ t.Errorf("%s %s: %+v want %q", viewer, tc.name, got, want)
+ }
+ if got != nil && got.Kind == "round" && (v.Decision == nil || !v.Decision.Round) {
+ t.Fatal("report invented a round")
+ }
+ if got != nil && got.Kind == "merge" && !v.Merge {
+ t.Fatal("report invented a merge")
+ }
+ }
+ }
+}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 2743984c..b4718b50 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -59,8 +59,13 @@ const BootLog = "Equipo could not start."
// COPY APPROVED BY DELEGATION (Luna pass, 2026-11-01, house rules).
var pageCopy = map[string]string{
- "roster.copy_done": "Continuing without Copy.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)
- "roster.stopping": "Stopping…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)
+ "roster.talk": "Talk about this", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)
+ "roster.round_busy": "Starting another round…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)
+ "roster.round_done": "Another round is starting.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)
+ "roster.merge_busy": "Starting the merge…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)
+ "roster.merge_done": "The merge is starting.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)
+ "roster.copy_done": "Continuing without Copy.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)
+ "roster.stopping": "Stopping…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)
"roster.copy_count": "%d of %d strings reviewed", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)
"roster.stop": "Stop", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)
diff --git a/internal/equipo/report_actions.go b/internal/equipo/report_actions.go
new file mode 100644
index 00000000..d842a3d3
--- /dev/null
+++ b/internal/equipo/report_actions.go
@@ -0,0 +1,38 @@
+package equipo
+
+import (
+ "slices"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+type reportAction struct {
+ Kind, Label, Post, Href, CardID string
+ Revision int64
+}
+
+func reportNext(v taskLine, viewer string, cards []*chatCard) *reportAction {
+ post := "/conversation/tasks/" + v.ID + "/"
+ if v.Creator.Address == viewer && !wire.FinalStage(v.Stage) {
+ if v.Decision != nil && v.Decision.Round && (v.Checks == wire.ChecksFailed || v.Verdict == wire.VerdictChanges) {
+ return &reportAction{Kind: "round", Label: copyText("work.decide.round"), Post: post + "round"}
+ }
+ if v.Stage == wire.StageReadyToMerge && v.Merge {
+ return &reportAction{Kind: "merge", Label: copyText("chat.card.merge"), Post: post + "merge"}
+ }
+ for _, c := range cards {
+ if v.Stage == wire.StageReadyToMerge && c.TaskID == v.ID && c.Kind == wire.CardMerge && c.Open && slices.Contains(c.Options, wire.ChoiceMerge) {
+ return &reportAction{Kind: "merge", Label: copyText("chat.card.merge"), Post: "/conversation/cards/" + c.ID + "/answer", CardID: c.ID, Revision: c.Revision}
+ }
+ }
+ }
+ if v.Kind == wire.KindExplore && v.PreviewURL != "" {
+ return &reportAction{Kind: "preview", Label: copyText("chat.card.preview_link"), Href: v.PreviewURL}
+ }
+ return nil
+}
+
+func (v chatCard) ReportThread() chatCard {
+ v.Author, v.AuthorIcon = copyText("conversation.coordinator"), "sparkles"
+ return v
+}
diff --git a/internal/equipo/static/chat-compose.js b/internal/equipo/static/chat-compose.js
index 35d73b06..59da905e 100644
--- a/internal/equipo/static/chat-compose.js
+++ b/internal/equipo/static/chat-compose.js
@@ -48,7 +48,7 @@
form.toggleAttribute("data-has-content", /\S/.test(event.target.value));
});
document.addEventListener("toggle", function (event) {
- if(event.target.matches("[data-direction-thread]") && event.target.open) {if(event.target.hasAttribute("data-restored")){delete event.target.dataset.restored;return;}event.target.querySelector("textarea").focus({preventScroll:true});}
+ if(event.target.matches("[data-direction-thread], [data-report-thread]") && event.target.open) {if(event.target.hasAttribute("data-restored")){delete event.target.dataset.restored;return;}var input=event.target.querySelector("textarea");if(input)input.focus({preventScroll:true});}
},true);
})();
(function () {
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js
index 18acd330..3ad00cf8 100644
--- a/internal/equipo/static/chat-stream.js
+++ b/internal/equipo/static/chat-stream.js
@@ -817,6 +817,7 @@
});
feed.querySelectorAll("[data-card]").forEach(function (card) {
if (card.querySelector("[data-direction-thread][open]")) cardOpen.add(card.dataset.card);
+ var report = card.querySelector("[data-report-thread]"); if (report) reportOpen.set(card.dataset.card, report.open);
var inputs = {};
card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { if (el.value) inputs[el.name] = el.value; });
if (Object.keys(inputs).length) cardDrafts.set(card.dataset.card, inputs);
@@ -824,6 +825,13 @@
next.querySelectorAll("[data-card]").forEach(function (card) {
var old = cardBusy.get(card.dataset.card); if (old) { card.replaceWith(old); return; }
var drawer=card.querySelector("[data-direction-thread]"); if(drawer && cardOpen.has(card.dataset.card)) {drawer.dataset.restored="";drawer.open=true;}
+ var report = card.querySelector("[data-report-thread]");
+ if (report && reportOpen.has(card.dataset.card)) { report.dataset.restored=""; report.open=reportOpen.get(card.dataset.card); }
+ card.querySelectorAll("[data-report-talk]").forEach(function(talk) { if (report) talk.setAttribute("aria-expanded", String(report.open)); });
+ if (cardSuccess.has(card.dataset.card) && card.querySelector("[equipo-roster-links]")) {
+ var status=document.createElement("p"); status.setAttribute("equipo-card-done", ""); status.setAttribute("role", "status"); status.textContent=cardSuccess.get(card.dataset.card);
+ card.querySelector("[equipo-roster-links]").after(status);
+ }
var values = cardDrafts.get(card.dataset.card); if (!values) return;
card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { if (values[el.name]) { el.value = values[el.name]; el.closest("form").setAttribute("data-has-content", ""); } });
});
@@ -1072,7 +1080,7 @@
});
});
// Card actions preserve the card on failure and expose the result in place.
- var cardBusy = new Map(), cardDrafts = new Map(), cardOpen = new Set(), toastTimer;
+ var cardBusy = new Map(), cardDrafts = new Map(), cardOpen = new Set(), reportOpen = new Map(), cardSuccess = new Map(), toastTimer;
function cardSubmit(f, button) {
var card = f.closest("[data-card]"), id = card && card.dataset.card;
if (id && cardBusy.has(id)) return;
@@ -1088,6 +1096,7 @@
fetch(f.action, { method: "POST", credentials: "same-origin", headers: { "Accept": "application/json" }, body: body })
.then(function (r) { if (!r.ok) throw new Error(r.status === 409 ? "stale" : "card");
if (id) { cardBusy.delete(id); if (body.get("aside") === null) { cardDrafts.delete(id); f.querySelectorAll("textarea").forEach(function (el) { el.value=""; }); } }
+ if (id && button && button.dataset.successLabel) cardSuccess.set(id, button.dataset.successLabel);
if (f.matches("[equipo-turn-stop]")) return;
return refreshed();
}).then(function () {
@@ -1120,6 +1129,13 @@
});
}
root.addEventListener("click", function(event) {
+ var talk=event.target.closest("[data-report-talk]");
+ if (talk && !talk.disabled) {
+ var report=document.getElementById(talk.getAttribute("aria-controls")); report.open=!report.open;
+ talk.closest("[data-card]").querySelectorAll("[data-report-talk]").forEach(function(button) { button.setAttribute("aria-expanded", String(report.open)); });
+ if (report.open) { var input=report.querySelector("textarea"); if(input) input.focus({preventScroll:true}); }
+ return;
+ }
var open=event.target.closest("[data-thread-open]"); if(!open || open.disabled)return;
var drawer=open.closest("[data-card]").querySelector("[data-direction-thread]"); drawer.open=true; drawer.querySelector("textarea").focus();
});
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index 2fdaa566..cf179d2e 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -2062,3 +2062,17 @@ label[equipo-sp-label] { cursor: pointer; }
[equipo-conversation]:not([data-task]) [equipo-thinking]:not([data-streaming]) [equipo-message-meta] { padding-inline-start: 0; min-block-size: 0; }
[equipo-conversation]:not([data-task]) [equipo-thinking]:not([data-streaming]) [equipo-message-meta] [equipo-coordinator-mark] { position: static; inline-size: auto; }
}
+
+[data-report-talk] { display: none; }
+[data-roster-enhanced] [data-report-talk] { display: inline-flex; }
+[data-roster-enhanced] [data-report-thread] > summary { display: none; }
+[equipo-subchat][data-report-thread]:not([open]) { margin: 0; padding: 0; border: 0; background: transparent; }
+[equipo-roster-report] [data-report-thread] { margin: 0; border-radius: var(--rst-radius); }
+[equipo-roster-report][data-compact] { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
+[equipo-roster-report][data-compact] [data-report-thread] { grid-column: 1 / -1; }
+@container roster (max-width:500px) {
+ [equipo-roster-links] form:has([data-report-next]) { flex-basis: 100%; }
+ [equipo-roster-links] [data-report-next], [data-report-talk] { min-block-size: 2.75rem; }
+ [equipo-roster-links] form [data-report-next] { inline-size: 100%; }
+ [equipo-roster-report][data-compact] { grid-template-columns: minmax(0, 1fr); }
+}
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html
index ea83090d..61774839 100644
--- a/internal/equipo/templates/chat.html
+++ b/internal/equipo/templates/chat.html
@@ -4,7 +4,7 @@
{{define "chat-card"}}<li equipo-card="{{.Kind}}"{{if .Receipt}} equipo-receipt{{end}} id="card-{{.ID}}" data-card="{{.ID}}" data-state="{{.State}}" data-turn-id="{{.TurnID}}">
{{template "roster-byline" .}}{{if .SetAside}}<section equipo-aside-stub><span data-aside-title title="{{.AsideTitle}}">{{.AsideTitle}}</span><small>{{copy "roster.aside"}}</small>{{template "roster-undo" .}}</section>{{else}}<section equipo-roster-card{{if .Interactive}} data-ask{{end}}{{if .Receipt}} data-flat{{end}}{{if or (and (not .Open) .Note (not .Presentation.Thread)) .Presentation.Coverage.Skipped}} data-done{{end}}>
{{if .Interactive}}<form method="post" action="/conversation/cards/{{.ID}}/visibility" data-card-form equipo-set-aside><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="aside" value="true">{{template "card-job" .}}<button type="submit" data-set-aside aria-label="{{copy "roster.set_aside"}}" title="{{copy "roster.set_aside"}}" data-busy-label="{{copy "roster.setting_aside"}}">{{icon "x"}}</button></form>{{end}}
-{{with .ContextTask}}<p equipo-roster-task>{{.}}</p>{{end}}{{if .Presentation.Coverage.Skipped}}<p equipo-card-done role="status">{{icon "check"}}{{copy "roster.copy_done"}}</p>{{else if and (not .Open) .Note (ne .Kind "direction")}}<p equipo-card-done role="status">{{icon "check"}}{{.Note}}</p>{{else if and .Task (or .Task.CopyHold .Task.CopyCanSkip)}}{{template "roster-copy-hold" .}}{{else if and .Receipt (eq .Kind "task")}}{{template "work-task-receipt" .}}
+{{with .ContextTask}}<p equipo-roster-task>{{.}}</p>{{end}}{{if .Presentation.Coverage.Skipped}}<p equipo-card-done role="status">{{icon "check"}}{{copy "roster.copy_done"}}</p>{{else if and (not .Open) .Note (ne .Kind "direction")}}<p equipo-card-done role="status">{{icon "check"}}{{.Note}}</p>{{else if and .Task (or .Task.CopyHold .Task.CopyCanSkip)}}{{template "roster-copy-hold" .}}<div equipo-roster-links><button type="button" rst-btn data-report-talk aria-controls="report-thread-{{.ID}}" aria-expanded="{{if .Presentation.Thread}}true{{else}}false{{end}}">{{copy "roster.talk"}}</button></div>{{template "report-thread" .ReportThread}}{{else if and .Receipt (eq .Kind "task")}}{{template "work-task-receipt" .}}
{{else if eq .Kind "advice"}}{{if ne .State "resolved"}}<p equipo-card-line data-advice-card>{{icon "lightbulb"}}<span>{{.Line}}</span></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" .}}<button rst-btn="primary" name="choice" value="act" type="submit" data-advice-choice="act">{{.ActLabel}}</button><button rst-btn name="choice" value="dismiss" type="submit" data-advice-choice="dismiss">{{.DismissLabel}}</button></form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}{{end}}
{{else if eq .Kind "housekeeping"}}<p equipo-card-line data-digest>{{icon "list-checks"}}<span>{{.Line}} <a href="/housekeeping" data-digest-link>{{copy "chat.housekeeping.link"}}</a></span></p>
{{else if .Receipt}}<p equipo-card-line>{{icon "folder"}}<span>{{.Line}}</span></p>{{if .Open}}<button type="button" equipo-receipt-more aria-expanded="false" aria-controls="acts-{{.ID}}" aria-label="{{copy "chat.card.more"}}">⋯</button><span equipo-receipt-actions id="acts-{{.ID}}">{{if or (eq .Kind "home") (eq .Kind "combined")}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button equipo-link name="choice" value="undo" type="submit" data-card-undo>{{copy "chat.card.undo"}}</button></form>{{else}}<details equipo-change><summary equipo-link>{{.Change}}</summary><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<select rst-input name="choice" aria-label="{{.Change}}">{{range .Choices}}<option>{{.}}</option>{{end}}</select><button rst-btn="primary" type="submit">{{copy "chat.card.use"}}</button></form></details>{{if .Remove}}<form method="post" action="/conversation/projects/{{.ProjectID}}/remove" data-card-form><button equipo-link type="submit">{{copy "chat.card.remove"}}</button></form>{{end}}{{end}}</span>{{end}}
@@ -20,7 +20,7 @@
{{else if eq .Kind "merge"}}<p equipo-card-line>{{.Line}}</p>{{with .PreviewURL}}<p equipo-card-note><a href="{{.}}" rel="noopener" target="_blank" data-preview-link>{{copy "chat.card.preview_link"}}</a></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" .}}{{range .Options}}<button rst-btn="{{if eq . "merge"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-merge-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if or (eq .Kind "merge_ships") (eq .Kind "merge_policy") (eq .Kind "merge_receipt")}}{{if eq .Kind "merge_receipt"}}<div equipo-card-line equipo-markdown data-merge-receipt>{{chatMarkdown .Line}}</div>{{else}}<p equipo-card-line>{{.Line}}</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" .}}{{range .Options}}<button rst-btn="{{if or (eq . "save") (eq . "not_ships")}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-merge-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if eq .Kind "access"}}<p equipo-card-line>{{.Line}}</p>{{if .Open}}<details equipo-grant><summary rst-btn>{{copy "chat.card.grant"}}</summary><p>{{.GrantHow}}</p><code>amadan agent grant {{.Agent}} {{.Namespace}}</code><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn name="choice" value="check" type="submit" data-grant-check>{{copy "chat.card.grant_check"}}</button></form></details>{{end}}
-{{end}}<p equipo-card-error role="alert" hidden></p></section>{{end}}{{if .Presentation.Coverage.Skipped}}<section equipo-roster-card data-flat>{{template "work-task-receipt" .}}</section>{{end}}{{if not .SetAside}}{{range .ResearchReports}}<div equipo-roster-byline><span equipo-roster-avatar>{{icon "search"}}</span><b>{{copy "work.specialist.research"}}</b><span>{{copy "roster.reports"}}</span>{{template "roster-project" $}}{{with .At}}<time datetime="{{.Format "2006-01-02T15:04:05Z07:00"}}">{{.Format "15:04"}}</time>{{end}}</div><section equipo-roster-card data-research-report><header equipo-roster-research-head><h3>{{copy "roster.research"}}</h3>{{with $.Presentation.Context.TaskTitle}}<span equipo-roster-task>{{.}}</span>{{end}}</header><p>{{.Summary}}</p><ol equipo-roster-findings>{{range .Facts}}<li><div><strong>{{.Label}}</strong> {{.Value}}</div>{{range .Sources}}{{if .URL}}<a href="{{.URL}}" title="{{.URL}}" target="_blank" rel="noopener"><span>{{.Domain}}</span></a>{{else}}<span>{{.ID}}</span>{{end}}{{end}}</li>{{end}}{{range .Gaps}}<li data-gap>{{.}}</li>{{end}}</ol><a href="/tasks/{{$.TaskID}}#research-{{.StepID}}">{{copy "roster.research_log"}} ({{len .Fetches}})</a></section>{{end}}{{end}}
+{{end}}<p equipo-card-error role="alert" hidden></p></section>{{end}}{{if .Presentation.Coverage.Skipped}}<section equipo-roster-card data-flat>{{template "work-task-receipt" .}}</section>{{end}}{{if not .SetAside}}{{range .ResearchReports}}<div equipo-roster-byline><span equipo-roster-avatar>{{icon "search"}}</span><b>{{copy "work.specialist.research"}}</b><span>{{copy "roster.reports"}}</span>{{template "roster-project" $}}{{with .At}}<time datetime="{{.Format "2006-01-02T15:04:05Z07:00"}}">{{.Format "15:04"}}</time>{{end}}</div><section equipo-roster-card data-research-report><header equipo-roster-research-head><h3>{{copy "roster.research"}}</h3>{{with $.Presentation.Context.TaskTitle}}<span equipo-roster-task>{{.}}</span>{{end}}</header><p>{{.Summary}}</p><ol equipo-roster-findings>{{range .Facts}}<li><div><strong>{{.Label}}</strong> {{.Value}}</div>{{range .Sources}}{{if .URL}}<a href="{{.URL}}" title="{{.URL}}" target="_blank" rel="noopener"><span>{{.Domain}}</span></a>{{else}}<span>{{.ID}}</span>{{end}}{{end}}</li>{{end}}{{range .Gaps}}<li data-gap>{{.}}</li>{{end}}</ol><div equipo-roster-links><button type="button" rst-btn data-report-talk aria-controls="report-thread-{{$.ID}}" aria-expanded="{{if $.Presentation.Thread}}true{{else}}false{{end}}">{{copy "roster.talk"}}</button><a href="/tasks/{{$.TaskID}}#research-{{.StepID}}">{{copy "roster.research_log"}} ({{len .Fetches}})</a></div></section>{{end}}{{end}}
</li>{{end}}
{{define "roster-copy-hold"}}<div equipo-copy-hold><span equipo-roster-stage>{{copy "roster.copy_waiting"}}</span><h3>{{.Line}}</h3><p>{{.HoldReason}}</p>{{with .Presentation.Coverage}}<div equipo-copy-meter>{{if .Known}}{{if .Total}}<meter min="0" max="{{.Total}}" value="{{.Reviewed}}" aria-label="{{printf (copy "roster.copy_count") .Reviewed .Total}}"></meter>{{end}}<span>{{printf (copy "roster.copy_count") .Reviewed .Total}}</span>{{else}}<span>{{copy "roster.copy_coverage"}}</span>{{end}}{{with .Since}}<small>{{printf (copy "roster.copy_since") (.Format "15:04")}}</small>{{end}}</div>{{end}}<div equipo-actions><a rst-btn="primary" href="/conversation?about={{.TaskID}}">{{copy "work.decide.ask_coordinator"}}</a>{{if .Task.CopyCanSkip}}<form method="post" action="/conversation/tasks/{{.TaskID}}/continue-without-copy" data-card-form><button rst-btn type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}</div></div>{{end}}
{{define "roster-thread-turns"}}{{range .Presentation.Thread}}<div equipo-thread-turn{{if .Own}} data-own{{end}}>{{if not .Own}}<span equipo-thread-avatar{{if eq $.AuthorIcon "sparkles"}} equipo-coordinator-mark{{end}}>{{if eq $.AuthorIcon "sparkles"}}{{template "roster-mark" .}}{{else}}{{icon $.AuthorIcon}}{{end}}</span>{{end}}<div equipo-thread-bubble>{{if not .Own}}<div equipo-thread-who>{{$.Author}} <time datetime="{{.At.Format "2006-01-02T15:04:05Z07:00"}}">{{.At.Format "15:04"}}</time></div>{{end}}<div equipo-thread-text equipo-markdown>{{chatMarkdown .Text}}</div></div>{{if .Own}}<small equipo-thread-sent>{{copy "roster.sent"}}</small>{{end}}</div>{{end}}{{with .ThreadError}}<p equipo-thread-error role="alert">{{.}}</p>{{end}}{{if .Presentation.Waiting}}<div equipo-thread-wait role="status"><span equipo-reading-dots aria-hidden="true"><i></i><i></i><i></i></span><span>{{if .ThreadActivity}}{{.ThreadActivity}}{{else}}{{printf (copy "roster.waiting") .Author}}{{end}}</span><div equipo-thread-draft></div></div>{{end}}{{end}}
@@ -32,7 +32,8 @@
<div equipo-roster-report-head><span equipo-roster-stage equipo-stage data-stage="{{.Stage}}" data-tone="{{.RosterTone}}">{{.Eyebrow}}</span>{{if .NeedsYou}}<span equipo-needs-chip>{{icon "hand"}}{{copy "nav.needs-you"}}</span>{{end}}<h3 equipo-card-line><a href="/tasks/{{.ID}}">{{.Title}}</a></h3>{{if not $card.Compact}}{{with .Why}}<p equipo-roster-why>{{.}}</p>{{end}}{{end}}</div>
{{if not $card.Compact}}{{if and (ne .Stage "cancelled") (not $card.SlimReport)}}{{template "track-full" .}}{{end}}{{with $card.ExplorationSummary}}<p equipo-exploration-summary>{{.}}</p>{{end}}
<dl equipo-roster-facts>{{if .ChecksLine}}<div><dt>{{copy "roster.checks"}}</dt><dd data-checks>{{.RosterChecks}}</dd>{{with .RosterChecksDetail}}<small>{{.}}</small>{{end}}</div>{{end}}{{if .ReviewLine}}<div><dt>{{copy "roster.review"}}</dt><dd data-verdict>{{.RosterReview}}</dd>{{with .RosterReviewDetail}}<small>{{.}}</small>{{end}}</div>{{end}}{{if .Branch}}<div><dt>{{copy "roster.branch"}}</dt><dd><code title="{{.Branch}}">{{.Branch}}</code></dd><small title="{{.CandidateSHA}}">{{short .CandidateSHA}}</small></div>{{end}}</dl>
-{{if .MergeDropped}}<p equipo-card-note>{{copy "work.tl.merge_dropped"}}</p>{{end}}<div equipo-roster-links><a rst-btn href="/tasks/{{.ID}}">{{copy "roster.open_task"}}</a>{{if and .Pushed (not .MergedLine)}}<a href="{{.URL}}" rel="noopener" target="_blank" data-open-amadan>{{copy "work.open"}}</a>{{end}}{{if .MergedLine}}<span data-merged><span>{{.MergedLine}}</span> <a href="{{.RepoURL}}" rel="noopener" target="_blank" data-open-amadan>{{copy "work.open"}}</a></span>{{end}}{{if .PreviewURL}}<a href="{{.PreviewURL}}" rel="noopener" target="_blank" data-preview>{{copy "chat.card.preview_link"}}</a>{{end}}</div>{{end}}
+{{if .MergeDropped}}<p equipo-card-note>{{copy "work.tl.merge_dropped"}}</p>{{end}}{{end}}<div equipo-roster-links>{{if not $card.Compact}}{{with $card.ReportAction}}{{if .Post}}<form method="post" action="{{.Post}}" data-card-form>{{if not $card.Job}}<input type="hidden" name="from" value="conversation">{{end}}{{if .CardID}}<input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="choice" value="merge">{{end}}{{template "card-job" $card}}<button rst-btn="primary" type="submit" data-report-next data-success-label="{{copy (printf "roster.%s_done" .Kind)}}" data-busy-label="{{copy (printf "roster.%s_busy" .Kind)}}">{{.Label}}</button></form>{{else}}<a rst-btn="primary" href="{{.Href}}" target="_blank" rel="noopener" data-report-next>{{.Label}}</a>{{end}}{{end}}{{end}}<button type="button" {{if $card.Compact}}equipo-link{{else}}rst-btn{{end}} data-report-talk aria-controls="report-thread-{{$card.ID}}" aria-expanded="{{if $card.Presentation.Thread}}true{{else}}false{{end}}">{{copy "roster.talk"}}</button>{{if not $card.Compact}}<a href="/tasks/{{.ID}}">{{copy "roster.open_task"}}</a>{{if and .Pushed (not .MergedLine)}}<a href="{{.URL}}" rel="noopener" target="_blank" data-open-amadan>{{copy "work.open"}}</a>{{end}}{{if .MergedLine}}<a href="{{.RepoURL}}" rel="noopener" target="_blank" data-open-amadan>{{copy "work.open"}}</a>{{end}}{{end}}</div>
+{{template "report-thread" $card.ReportThread}}
</div>{{end}}{{end}}
{{define "message-files"}}{{with .}}<div equipo-message-files>{{range .}}{{if eq .Kind "image"}}<a equipo-file-thumb href="/conversation/attachments/{{.ID}}" target="_blank" rel="noopener" data-attachment="{{.ID}}"><img src="/conversation/attachments/{{.ID}}/preview" alt="{{.Name}}"{{if .Width}} width="{{.Width}}" height="{{.Height}}"{{end}} loading="lazy" decoding="async"></a>{{else}}<a equipo-file-chip href="/conversation/attachments/{{.ID}}" target="_blank" rel="noopener" data-attachment="{{.ID}}">{{icon "file-text"}}<span equipo-file-name>{{.Name}}</span><span equipo-file-size>{{fileSize .Size}}</span></a>{{end}}{{end}}</div>{{end}}{{end}}
{{define "chat-lines"}}{{$address := .Address}}{{range .Lines}}
@@ -107,3 +108,5 @@
</div>
</div>
{{end}}
+
+{{define "report-thread"}}<details equipo-subchat data-report-thread id="report-thread-{{.ID}}" data-roster-turn="{{.Presentation.TurnID}}"{{if .Presentation.Thread}} open{{end}}><summary equipo-thread-open>{{copy "roster.talk"}}</summary><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div>{{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}}</details>{{end}}
diff --git a/internal/thintest/report_actions_browser_test.go b/internal/thintest/report_actions_browser_test.go
new file mode 100644
index 00000000..216ce03c
--- /dev/null
+++ b/internal/thintest/report_actions_browser_test.go
@@ -0,0 +1,201 @@
+//go:build browser
+
+package thintest
+
+import (
+ "fmt"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Stored finished steps make each report state independent of a runner's timing.
+func reportState(r *toolRig, id, state string) {
+ r.t.Helper()
+ exec := func(q string, args ...any) {
+ r.t.Helper()
+ if _, err := r.inst.DB.Writer().Exec(q, args...); err != nil {
+ r.t.Fatal(err)
+ }
+ }
+ exec("DELETE FROM chat_steps WHERE task_id=?", id)
+ stage, kind, checks, verdict, round := wire.StageInReview, "", wire.ChecksPassed, wire.VerdictChanges, 2
+ switch state {
+ case "checks":
+ checks, verdict = wire.ChecksFailed, ""
+ case "merge", "collapsed":
+ stage, verdict = wire.StageReadyToMerge, wire.VerdictApprove
+ case "preview":
+ kind, verdict = wire.KindExplore, wire.VerdictApprove
+ case "running":
+ stage, round = wire.StageInProgress, 0
+ case "done":
+ stage, verdict = wire.StageDone, wire.VerdictApprove
+ case "automatic":
+ round = 0
+ }
+ now := r.inst.Store.Chat().Now()
+ exec("UPDATE chat_tasks SET stage=?,kind=?,title='Show immediate loading feedback on action buttons',base_sha=?,repair_round=? WHERE id=?", stage, kind, strings.Repeat("1", 40), round, id)
+ exec("INSERT INTO chat_steps(id,task_id,idx,specialist,person,state,attempt,round,base_sha,candidate_sha,pushed,terminated,revision,created_at,updated_at) VALUES(?,?,1,'engineering',?,'done',1,?,?,?,1,1,1,?,?)", id+"e", id, Owner, round, strings.Repeat("1", 40), candX, now, now)
+ exec("INSERT INTO chat_steps(id,task_id,idx,specialist,person,state,attempt,candidate_sha,checks,terminated,revision,created_at,updated_at) VALUES(?,?,2,'checks',?,'done',1,?,?,1,1,?,?)", id+"c", id, Owner, candX, checks, now, now)
+ if verdict != "" {
+ exec("INSERT INTO chat_steps(id,task_id,idx,specialist,person,state,attempt,candidate_sha,verdict,review_label,terminated,revision,created_at,updated_at) VALUES(?,?,3,'review',?,'done',1,?,?,'independent',1,1,?,?)", id+"r", id, Owner, candX, verdict, now, now)
+ }
+ if state == "running" || state == "automatic" {
+ exec("INSERT INTO chat_steps(id,task_id,idx,specialist,person,state,attempt,revision,created_at,updated_at) VALUES(?,?,4,'engineering',?,'running',1,1,?,?)", id+"live", id, Owner, now, now)
+ }
+ if state == "preview" {
+ exec("INSERT INTO chat_steps(id,task_id,idx,specialist,person,state,attempt,preview,terminated,revision,created_at,updated_at) VALUES(?,?,4,'preview',?,'done',1,?,1,1,?,?)", id+"p", id, Owner, `{"outcome":"deployed","url":"https://preview.example.test","app":"eq-report"}`, now, now)
+ }
+ exec("DELETE FROM chat_cards WHERE task_id=? AND kind='merge'", id)
+ if state == "collapsed" {
+ exec("INSERT INTO chat_cards(id,task_id,person,turn_id,kind,state,question,options,revision,created_at,updated_at) VALUES(?,?,?,'','merge','open','Merge this change?',?,1,?,?)", id+"merge", id, Owner, `["merge","not_now"]`, now, now)
+ }
+}
+
+func TestBrowserReportNextSteps(t *testing.T) {
+ for _, width := range []int64{1280, 390} {
+ for _, scheme := range []string{"light", "dark"} {
+ t.Run(fmt.Sprintf("%d-%s", width, scheme), func(t *testing.T) {
+ r := newToolRig(t)
+ id := r.shopTask("report")
+ if err := r.runner.Send(r.ctx, "report-ready", wire.FrameReply, wire.Reply{TurnID: r.turn, Attempt: 1, Text: "Here is the report."}); err != nil {
+ t.Fatal(err)
+ }
+ r.wait("finished", func(c *Conversation) bool { return c.Turns[r.turn].State == wire.TurnReplied })
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), width, 844, width == 390, scheme, "reduce")
+ defer p.stop()
+ for _, state := range []string{"changes", "checks", "merge", "preview", "running", "automatic", "done", "collapsed"} {
+ t.Run(state, func(t *testing.T) {
+ p.t = t
+ defer func() { p.t = r.t }()
+ reportState(r, id, state)
+ p.open("/conversation")
+ p.wait(`document.querySelector('[equipo-offline]').hidden && document.querySelector('[equipo-roster-report]')`, "report")
+ expected := map[string]string{"changes": "Try another round", "checks": "Try another round", "merge": "Merge", "preview": "Open the preview"}[state]
+ p.check(fmt.Sprintf(`(()=>{const b=document.querySelectorAll('[equipo-roster-report] [rst-btn="primary"]');return b.length===%d && (!b.length || b[0].textContent===%q)})()`, boolInt(expected != ""), expected), "next step for "+state)
+ p.check(`!!document.querySelector('[equipo-roster-report] [data-report-talk]')`, "Talk about this missing")
+ if state == "collapsed" {
+ p.check(`document.querySelector('[equipo-roster-report]').hasAttribute('data-compact') && !!document.querySelector('[equipo-card="merge"] [rst-btn="primary"]')`, "collapsed action missing or duplicated")
+ } else {
+ p.check(`[...document.querySelectorAll('[equipo-roster-links] a:not([data-report-talk]):not([data-report-next])')].every(a=>!a.hasAttribute('rst-btn'))`, "navigation is not quiet")
+ }
+ p.check(`(()=>{document.querySelector('[equipo-roster-report]').closest('[data-card]').scrollIntoView({block:'start'});document.querySelector('[equipo-scroll]').dispatchEvent(new Event('scroll'));return true})()`, "show report")
+ p.fits(state)
+ p.shot(fmt.Sprintf("report-%s-%d-%s", state, width, scheme))
+ if state == "collapsed" {
+ p.click(`[equipo-card="merge"] [data-set-aside]`)
+ p.wait(`document.querySelector('[data-report-next]')`, "set-aside report action")
+ p.check(`(()=>{const f=document.querySelector('[data-report-next]').form;return f.action.endsWith('/cards/`+id+`merge/answer') && f.elements.revision.value==='1' && f.elements.choice.value==='merge'})()`, "report bypasses decision card revision")
+ p.shot(fmt.Sprintf("report-merge-aside-%d-%s", width, scheme))
+ }
+ if expected != "" && state != "preview" {
+ action := "round"
+ if state == "merge" {
+ action = "merge"
+ }
+ p.check(fmt.Sprintf(`document.querySelector('[data-report-next]').form.action.endsWith('/tasks/%s/%s')`, id, action), "different server action")
+ taskPage := r.get(r.inst.Cookie(), "/tasks/"+id, 200)
+ if !strings.Contains(taskPage, "/conversation/tasks/"+id+"/"+action) {
+ t.Fatalf("task page does not offer %s", action)
+ }
+ }
+ })
+ }
+ })
+ }
+ }
+}
+func boolInt(b bool) int {
+ if b {
+ return 1
+ }
+ return 0
+}
+
+func TestBrowserReportThread(t *testing.T) {
+ for _, width := range []int64{1280, 390} {
+ for _, scheme := range []string{"light", "dark"} {
+ t.Run(fmt.Sprintf("%d-%s", width, scheme), func(t *testing.T) {
+ r := newToolRig(t)
+ id := r.shopTask("thread-report")
+ reportState(r, id, "changes")
+ if err := r.runner.Send(r.ctx, "report-finish", wire.FrameReply, wire.Reply{TurnID: r.turn, Attempt: 1, Text: "Please review the report."}); err != nil {
+ t.Fatal(err)
+ }
+ r.wait("finished", func(c *Conversation) bool { return c.Turns[r.turn].State == wire.TurnReplied })
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), width, 844, width == 390, scheme, "reduce")
+ defer p.stop()
+ p.open("/conversation")
+ p.wait(`document.querySelector('[equipo-offline]').hidden`, "connected")
+ p.click(`[data-report-talk]`)
+ p.wait(`document.querySelector('[data-report-thread][open] textarea')===document.activeElement`, "thread opens and focuses")
+ p.check(`(()=>{const i=document.activeElement;i.value='What should we change next?';i.dispatchEvent(new Event('input',{bubbles:true}));return true})()`, "type reply")
+ p.shot(fmt.Sprintf("report-thread-open-%d-%s", width, scheme))
+ p.click(`[data-report-thread] [data-thread-send]`)
+ f, b := r.expect(wire.FrameMessage)
+ m := b.(*wire.MessageCommand)
+ for _, want := range []string{id, "Show immediate loading feedback", "Woodstar", "in_review", "changes_requested"} {
+ if !strings.Contains(m.Text, want) {
+ t.Fatalf("missing context %q: %s", want, m.Text)
+ }
+ }
+ r.runner.Send(r.ctx, "report-ack", wire.FrameAck, wire.Ack{ID: f.ID})
+ p.wait(`document.querySelector('[data-report-thread] [data-own]') && document.querySelector('[data-report-thread] [equipo-thread-wait]')`, "sent thread")
+ p.shot(fmt.Sprintf("report-thread-waiting-%d-%s", width, scheme))
+ r.runner.Send(r.ctx, "report-delta", wire.FrameDelta, wire.DeltaReport{TurnID: m.TurnID, Attempt: 1, Offset: 0, Text: "Let’s simplify"})
+ p.wait(`document.querySelector('[data-report-thread] [equipo-thread-draft]')?.textContent==='Let’s simplify'`, "reply streams in thread")
+ r.runner.Send(r.ctx, "report-reply", wire.FrameReply, wire.Reply{TurnID: m.TurnID, Attempt: 1, Text: "Let’s simplify the button states."})
+ p.wait(`document.querySelector('[data-report-thread]').textContent.includes('Let’s simplify the button states.')`, "coordinator reply")
+ p.open("/conversation")
+ p.wait(`document.querySelector('[data-report-thread][open]')?.textContent.includes('Let’s simplify the button states.')`, "persistent thread")
+ p.check(`document.querySelector('[data-report-thread] [equipo-thread-who]').textContent.includes('Coordinator')`, "wrong reply author")
+ p.check(`![...document.querySelectorAll('[equipo-message-body]')].some(e=>e.textContent.includes('Let’s simplify the button states.')||e.textContent.includes('What should we change next?'))`, "thread leaked into main chat")
+ p.check(`(()=>{document.querySelector('[data-report-thread]').scrollIntoView({block:'center'});return true})()`, "show thread")
+ p.fits("report thread")
+ p.shot(fmt.Sprintf("report-thread-replied-%d-%s", width, scheme))
+ yesterday := r.inst.Store.Chat().Now().Add(-24 * time.Hour)
+ for _, table := range []string{"chat_messages", "chat_cards"} {
+ if _, err := r.inst.DB.Writer().Exec("UPDATE "+table+" SET created_at=?", yesterday); err != nil {
+ t.Fatal(err)
+ }
+ }
+ p.open("/conversation?day=" + yesterday.Format("2006-01-02"))
+ p.wait(`document.querySelector('[data-report-thread]')?.textContent.includes('Let’s simplify the button states.')`, "historical thread")
+ p.check(`![...document.querySelectorAll('[equipo-message-body]')].some(e=>e.textContent.includes('Let’s simplify the button states.')||e.textContent.includes('What should we change next?'))`, "historical thread leaked into main chat")
+ })
+ }
+ }
+}
+
+func TestBrowserReportActionFeedback(t *testing.T) {
+ for _, width := range []int64{1280, 390} {
+ for _, scheme := range []string{"light", "dark"} {
+ for _, state := range []string{"changes", "merge"} {
+ t.Run(fmt.Sprintf("%s-%d-%s", state, width, scheme), func(t *testing.T) {
+ r := newToolRig(t)
+ id := r.shopTask("feedback")
+ reportState(r, id, state)
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), width, 844, width == 390, scheme, "reduce")
+ defer p.stop()
+ p.open("/conversation")
+ p.wait(`document.querySelector('[equipo-offline]').hidden && document.querySelector('[data-report-next]')`, "action")
+ p.check(`(()=>{window.__fetch=window.fetch;window.fetch=(url,opts)=>opts?.method==='POST'?new Promise(resolve=>{window.__fail=()=>resolve(new Response('{}',{status:503}))}):window.__fetch(url,opts);return true})()`, "hold action")
+ p.click(`[data-report-next]`)
+ p.check(`document.querySelector('[data-report-next]').getAttribute('aria-busy')==='true' && document.querySelector('[data-report-talk]').disabled`, "busy feedback")
+ p.shot(fmt.Sprintf("report-%s-busy-%d-%s", state, width, scheme))
+ p.check(`(()=>{window.__fail();window.fetch=window.__fetch;return true})()`, "fail action")
+ p.wait(`document.querySelector('[equipo-roster-report]').closest('[data-card]').querySelector('[equipo-card-error]:not([hidden])')`, "error feedback")
+ p.check(`!document.querySelector('[data-report-next]').disabled`, "action remains disabled")
+ p.shot(fmt.Sprintf("report-%s-error-%d-%s", state, width, scheme))
+ p.click(`[equipo-card="task"] [equipo-card-error] button`)
+ p.wait(`document.querySelector('[equipo-roster-report] [equipo-card-done]')`, "success feedback")
+ p.check(`!document.querySelector('[equipo-roster-report] [rst-btn="primary"]')`, "success leaves stale primary")
+ p.shot(fmt.Sprintf("report-%s-success-%d-%s", state, width, scheme))
+ })
+ }
+ }
+ }
+}
diff --git a/internal/thintest/roster_browser_test.go b/internal/thintest/roster_browser_test.go
index d2486431..e0b036d4 100644
--- a/internal/thintest/roster_browser_test.go
+++ b/internal/thintest/roster_browser_test.go
@@ -33,14 +33,14 @@ func TestBrowserRosterVisual(t *testing.T) {
p.check(`!!document.querySelector('[equipo-roster-facts]')`, "report facts missing")
p.check(`(()=>{const r=document.querySelector("[equipo-roster-report]"),c=r.closest("[equipo-roster-card]");return c.getBoundingClientRect().bottom-r.getBoundingClientRect().bottom<20})()`, "hidden task actions reserve empty space")
p.check(`(()=>{const s=getComputedStyle(document.querySelector('[equipo-coordinator-mark]'));return s.backgroundColor==='rgba(0, 0, 0, 0)' && s.boxShadow==='none'})()`, "coordinator has a tile")
- p.check(`(()=>{const r=document.querySelector('[equipo-roster-report]');return !r.closest('[data-card]').querySelector('[equipo-receipt-more]') && !r.querySelector('[data-pushed]') && r.querySelector('[equipo-roster-links] a').hasAttribute('rst-btn') && [...r.querySelectorAll('[equipo-roster-links] a')].every(a=>getComputedStyle(a).textDecorationLine==='none')})()`, "report actions drifted")
+ p.check(`(()=>{const r=document.querySelector('[equipo-roster-report]');return !r.closest('[data-card]').querySelector('[equipo-receipt-more]') && !r.querySelector('[data-pushed]') && !r.querySelector('[equipo-roster-links] a').hasAttribute('rst-btn') && !!r.querySelector('[data-report-next]') && [...r.querySelectorAll('[equipo-roster-links] a')].every(a=>getComputedStyle(a).textDecorationLine==='none')})()`, "report actions drifted")
p.check(`document.querySelector('[equipo-roster-report] [aria-current]').dataset.tone==='warning'`, "waiting for you looks failed")
p.check(`[...document.querySelectorAll('[equipo-roster-facts] small')].every(e=>getComputedStyle(e).whiteSpace==='normal' && e.scrollWidth<=e.clientWidth+1)`, "fact details truncate")
p.check(`(()=>{const c=document.querySelector('[equipo-roster-byline] b'),m=document.querySelector('[equipo-message="incoming"] [equipo-message-meta] strong');return !m||getComputedStyle(c).fontSize===getComputedStyle(m).fontSize})()`, "byline sizes differ")
p.check(`[...document.querySelectorAll('[equipo-card="task"], [equipo-card="merge"]')].every(c=>c.querySelector('[equipo-roster-project]')?.textContent.includes('Woodstar') && c.querySelector('[equipo-roster-project] [equipo-mono]'))`, "task and coordinator cards lack project context")
p.check(`(()=>{const c=document.querySelector('[equipo-roster-card]'),b=c.previousElementSibling,r=c.querySelector('[equipo-roster-report]');return parseFloat(getComputedStyle(c).paddingTop)===0 && parseFloat(getComputedStyle(b).marginBottom)===8 && parseFloat(getComputedStyle(r).rowGap)===12 && parseFloat(getComputedStyle(c.querySelector('[equipo-roster-facts]')).paddingTop)===12})()`, "report spacing left the inset scale")
if width == 390 {
- p.check(`document.querySelector('[equipo-roster-links] a[rst-btn]').getBoundingClientRect().height>=44`, "task button lost its phone target")
+ p.check(`document.querySelector('[equipo-roster-links] [data-report-next]').getBoundingClientRect().height>=44`, "task button lost its phone target")
p.check(`parseFloat(getComputedStyle(document.querySelector('[equipo-roster-report-head] h3 a'),'::after').height)>=44`, "task title has a small phone hit area")
}
p.fits("Roster")
@@ -121,42 +121,42 @@ func TestBrowserRosterSubchat(t *testing.T) {
p := openInner(t, r.inst.URL, r.inst.Cookie(), width, 844, width == 390, scheme, "reduce")
defer p.stop()
p.open("/conversation")
- p.wait(`document.querySelector('[equipo-subchat] [equipo-mini-composer]')`, "question as a sub-chat")
- p.check(`document.querySelector('[equipo-subchat] [equipo-thread-turn]').textContent.includes('Which page should change?')`, "first word is not a turn")
- p.check(`(()=>{const i=document.querySelector('[equipo-mini-composer] textarea');i.value='The sign-in page.';i.dispatchEvent(new Event('input',{bubbles:true}));i.focus();return true})()`, "type")
+ p.wait(`document.querySelector('[data-question-thread] [equipo-mini-composer]')`, "question as a sub-chat")
+ p.check(`document.querySelector('[data-question-thread] [equipo-thread-turn]').textContent.includes('Which page should change?')`, "first word is not a turn")
+ p.check(`(()=>{const i=document.querySelector('[data-question-thread] [equipo-mini-composer] textarea');i.value='The sign-in page.';i.dispatchEvent(new Event('input',{bubbles:true}));i.focus();return true})()`, "type")
p.shot(fmt.Sprintf("roster-thread-typing-%d-%s", width, scheme))
p.click(`[data-set-aside]`)
p.wait(`document.querySelector('[equipo-aside-stub]')`, "question set aside")
p.wait(`document.querySelector('[equipo-roster-toast] [data-aside-undo]')`, "question toast")
p.click(`[equipo-roster-toast] [data-aside-undo]`)
- p.wait(`document.querySelector('[equipo-mini-composer] textarea')?.value==='The sign-in page.'`, "undo retains the draft")
+ p.wait(`document.querySelector('[data-question-thread] [equipo-mini-composer] textarea')?.value==='The sign-in page.'`, "undo retains the draft")
p.check(`(()=>{window.__fetch=window.fetch;window.fetch=(url,opts)=>opts?.method==='POST'?new Promise(resolve=>{window.__fail=()=>resolve(new Response('{}',{status:503}))}):window.__fetch(url,opts);return true})()`, "hold question send")
- p.click(`[equipo-mini-composer] [data-thread-send]`)
- p.check(`document.querySelector('[data-thread-send]').getAttribute('aria-busy')==='true'`, "question busy")
+ p.click(`[data-question-thread] [equipo-mini-composer] [data-thread-send]`)
+ p.check(`document.querySelector('[data-question-thread] [data-thread-send]').getAttribute('aria-busy')==='true'`, "question busy")
p.shot(fmt.Sprintf("roster-thread-busy-%d-%s", width, scheme))
p.check(`(()=>{window.__fail();window.fetch=window.__fetch;return true})()`, "question send fails")
p.wait(`document.querySelector('[data-question-thread]').parentElement.querySelector('[equipo-card-error]:not([hidden])')`, "question send error")
p.shot(fmt.Sprintf("roster-thread-error-%d-%s", width, scheme))
- p.click(`[equipo-mini-composer] [data-thread-send]`)
+ p.click(`[data-question-thread] [equipo-mini-composer] [data-thread-send]`)
f, body := r.expect(wire.FrameMessage)
m := body.(*wire.MessageCommand)
r.runner.Send(r.ctx, "roster-a", wire.FrameAck, wire.Ack{ID: f.ID})
- p.wait(`document.querySelector('[equipo-subchat] [data-own]') && document.querySelector('[equipo-thread-wait]')`, "sent and waiting")
+ p.wait(`document.querySelector('[data-question-thread] [data-own]') && document.querySelector('[equipo-thread-wait]')`, "sent and waiting")
p.shot(fmt.Sprintf("roster-thread-waiting-%d-%s", width, scheme))
r.runner.Send(r.ctx, "roster-delta", wire.FrameDelta, wire.DeltaReport{TurnID: m.TurnID, Attempt: 1, Offset: 0, Text: "I’ll start"})
p.wait(`document.querySelector('[equipo-thread-draft]')?.textContent==='I’ll start'`, "streamed reply in the drawer")
r.runner.Send(r.ctx, "roster-answer", wire.FrameReply, wire.Reply{TurnID: m.TurnID, Attempt: 1, Text: "I’ll start with the sign-in page."})
- p.wait(`document.querySelector('[equipo-subchat]').textContent.includes('I’ll start with the sign-in page.')`, "reply inside the sub-chat")
+ p.wait(`document.querySelector('[data-question-thread]').textContent.includes('I’ll start with the sign-in page.')`, "reply inside the sub-chat")
p.open("/conversation")
- p.wait(`document.querySelector('[equipo-subchat]').textContent.includes('I’ll start with the sign-in page.')`, "thread after reload")
+ p.wait(`document.querySelector('[data-question-thread]').textContent.includes('I’ll start with the sign-in page.')`, "thread after reload")
p.check(`!document.querySelector('[equipo-thread-turn][data-own] [equipo-thread-who]')`, "own thread turn repeats a byline")
p.check(`parseFloat(getComputedStyle(document.querySelector('[data-first] [equipo-thread-bubble]')).fontWeight)<600`, "question is entirely title weight")
p.check(`(()=>{const c=document.querySelector('[data-question-thread]').closest('[data-card]');return c.querySelector('[equipo-roster-project]')?.textContent.includes('Woodstar') && c.querySelector('[equipo-roster-task]')?.textContent==='Improve sign-in'})()`, "thread lost project or task context")
p.fits("sub-chat")
p.shot(fmt.Sprintf("roster-thread-answered-%d-%s", width, scheme))
- p.check(`(()=>{const i=document.querySelector('[equipo-mini-composer] textarea');i.value='Keep the email link.';i.dispatchEvent(new Event('input',{bubbles:true}));return true})()`, "follow-up")
- p.click(`[equipo-mini-composer] [data-thread-send]`)
+ p.check(`(()=>{const i=document.querySelector('[data-question-thread] [equipo-mini-composer] textarea');i.value='Keep the email link.';i.dispatchEvent(new Event('input',{bubbles:true}));return true})()`, "follow-up")
+ p.click(`[data-question-thread] [equipo-mini-composer] [data-thread-send]`)
f2, b2 := r.expect(wire.FrameMessage)
m2 := b2.(*wire.MessageCommand)
if !strings.Contains(m2.Text, "Which page should change?") || len(m2.PersonText) != 1 || m2.PersonText[0] != "Keep the email link." {
@@ -164,7 +164,7 @@ func TestBrowserRosterSubchat(t *testing.T) {
}
r.runner.Send(r.ctx, "roster-a2", wire.FrameAck, wire.Ack{ID: f2.ID})
r.runner.Send(r.ctx, "roster-answer2", wire.FrameReply, wire.Reply{TurnID: m2.TurnID, Attempt: 1, Text: "The email link will stay."})
- p.wait(`document.querySelector('[equipo-subchat]').textContent.includes('The email link will stay.') && document.querySelectorAll('[equipo-subchat] [data-own]').length===2`, "second round stays in the thread")
+ p.wait(`document.querySelector('[data-question-thread]').textContent.includes('The email link will stay.') && document.querySelectorAll('[data-question-thread] [data-own]').length===2`, "second round stays in the thread")
})
}
}
diff --git a/internal/thintest/roster_reports_browser_test.go b/internal/thintest/roster_reports_browser_test.go
index 0214509f..2c21f97b 100644
--- a/internal/thintest/roster_reports_browser_test.go
+++ b/internal/thintest/roster_reports_browser_test.go
@@ -49,6 +49,7 @@ func TestBrowserRosterReports(t *testing.T) {
if width == 390 {
p.check(`[...document.querySelectorAll('[data-research-report] a')].every(a=>a.getBoundingClientRect().height>=44)`, "Research links lost phone tap targets")
}
+ p.check(`!!document.querySelector('[data-research-report] [data-report-talk]')`, "Research report cannot be discussed")
p.fits("Research")
p.wait(`(()=>{const b=document.querySelector('[data-research-report]').previousElementSibling.getBoundingClientRect(),s=document.querySelector('[equipo-scroll]').getBoundingClientRect();return b.top>=s.top-1 && b.bottom<s.bottom})()`, "Research byline in view")
p.shot(fmt.Sprintf("roster-research-%d-%s", width, scheme))
@@ -57,6 +58,7 @@ func TestBrowserRosterReports(t *testing.T) {
p.check(`document.querySelector('[data-copy-continue]').getAttribute('rst-btn')!=='primary' && document.querySelector('[equipo-copy-hold] [equipo-actions]').firstElementChild.matches('a[rst-btn="primary"]') && document.querySelector('[equipo-copy-hold] a[rst-btn="primary"]')?.textContent==='Ask the coordinator'`, "Copy skip encouraged")
p.check(`!document.querySelector('[equipo-copy-hold]').textContent.includes('..') && !document.querySelector('[equipo-copy-hold] [equipo-link]')`, "Copy copy or actions drifted")
p.check(`!!document.querySelector('[equipo-copy-hold]').closest('[data-card]').querySelector('[equipo-roster-project] [equipo-mono]')`, "Copy lacks project context")
+ p.check(`!!document.querySelector('[equipo-copy-hold]').closest('[data-card]').querySelector('[data-report-talk]')`, "Copy report cannot be discussed")
p.fits("Copy hold")
if width == 390 {
p.check(`(()=>{const c=document.querySelector("[equipo-copy-hold]"),b=c.querySelector('[rst-btn="primary"]');return b.getBoundingClientRect().width>=c.clientWidth-2 && b.getBoundingClientRect().height>=44})()`, "phone primary does not span its row")
diff --git a/internal/thintest/testdata/roster-geometry.js b/internal/thintest/testdata/roster-geometry.js
index e2944bb8..638d3a2c 100644
--- a/internal/thintest/testdata/roster-geometry.js
+++ b/internal/thintest/testdata/roster-geometry.js
@@ -19,7 +19,7 @@
}
const pads = all("[equipo-roster-card][data-ask]").map(c => getComputedStyle(c)).map(s => [s.paddingTop, s.paddingRight, s.paddingBottom, s.paddingLeft].join(" "));
if (new Set(pads).size > 1 || pads.some(p => new Set(p.split(" ")).size > 1)) bad.push("raised cards use uneven padding: " + pads.join(" | "));
- const pill = q("[equipo-mini-pill]"), main = q("#composer [equipo-pill]");
+ const pill = q("[data-question-thread] [equipo-mini-pill]"), main = q("#composer [equipo-pill]");
if (pill) {
const p = box(pill), s = box(q("button", pill)), x = q("[equipo-set-aside] button", pill.closest("[equipo-roster-card]"));
if (!near((s.top + s.bottom) / 2, (p.top + p.bottom) / 2)) bad.push(`send sits ${(s.top + s.bottom - p.top - p.bottom) / 2}px off the pill's centre`);
@@ -30,7 +30,7 @@
if (!near((xb.top + xb.bottom) / 2, (line.top + line.bottom) / 2, 2)) bad.push(`set aside is ${(xb.top + xb.bottom - line.top - line.bottom) / 2}px off the first line`);
}
if (phase === "compact") {
- if (!report.hasAttribute("data-compact") || q("[data-track], [equipo-roster-facts], [equipo-roster-links]", report)) bad.push("a report beside its decision is not compact");
+ if (!report.hasAttribute("data-compact") || q("[data-track], [equipo-roster-facts], [equipo-roster-links] [rst-btn='primary']", report)) bad.push("a report beside its decision is not compact");
if (all("[equipo-needs-chip]", flat.closest("[data-card]").parentElement).length !== 1) bad.push("Needs you is not said exactly once");
} else {
const track = q("[data-track]", report), dots = all("[equipo-dot]", track), content = inner(report);