oficina / equipo Public

roster: flat reports on a rail, one inset scale, aligned on phones

Paul on an iPhone at 991f12d5: alignment and padding were off, and
status updates were too cardy.

- A report is flat content on a neutral hairline rail under its
  byline's tile. Only decisions, questions and Copy holds stay cards.
- A report whose decision card is in the stream is one compact line
  (title, stage, chip); set the card aside and the report is whole.
- The eyebrow is the short stage. The reason moves under the title
  and Needs you is said once, by the chip.
- The stage track spans the content with even stops, and each label
  centres under its dot.
- Bylines sit .5rem above what they introduce. On a phone the mark's
  left edge is the card's left edge.
- Raised cards pad evenly and space their parts .75rem apart.
- A card's composer is the main composer's height, its send button
  centred, and Set aside centres on the first line.
- The last item scrolls clear of the composer's fade.

testdata/roster-geometry.js measures all of this for a Chromium test
(CI) and a WebKit one (iPhone at 3x and 1280, light and dark).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 57ed1970ea0bd902b2dd4de1df9cc14c83465627 parent 991f12d
11 files changed, +330 −14
  • .rastrillo/budgets.txt +2 −2
  • internal/equipo/chat_page.go +10 −7
  • internal/equipo/chat_roster.go +30 −0
  • internal/equipo/static/equipo.css +57 −0
  • internal/equipo/templates/chat.html +4 −4
  • internal/thintest/roster_align_browser_test.go +48 −0
  • internal/thintest/roster_align_rig_test.go +24 −0
  • internal/thintest/roster_align_webkit_test.go +45 −0
  • internal/thintest/roster_browser_test.go +8 −1
  • internal/thintest/testdata/roster-geometry.js +56 −0
  • internal/thintest/testdata/roster.mjs +46 −0

CI failed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index 6ced0391..30c5aba3 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 20359 - The web view models and templates share rendering; Roster adds bylines, fact details, private sub-chat views and the Stop route. Measured 20359 source lines.
+size internal/equipo 20392 - The web view models and templates share rendering; Roster adds bylines, fact details, private sub-chat views, the Stop route, and compact reports beside their decision with one alignment scale. Measured 20392 source lines.
size internal/wire 6197 - Runner and person API types share Encode. Protocol 21 adds Copy fields, 22 adds job lanes and job cards. Measured 6197 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);
@@ -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 - 10742 End-to-end scenarios through a real runner and instance: the Copy setting, wording flag and the Assistant's job threads. Measured 10742 test lines.
-size internal/thintest - 28469 The contract and browser tests share the instance harness; Roster adds Reply/Stop/CSRF guards and desktop/phone state captures. Measured 28469 test lines.
+size internal/thintest - 28593 The contract and browser tests share the instance harness; Roster adds Reply/Stop/CSRF guards and desktop/phone state captures. Measured 28593 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/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index af2367d0..4c107734 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -81,13 +81,16 @@ 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 {
- ProjectMono monoLine
- ThreadActivity string
- ThreadError string
- ResearchReports []*researchView
- HoldReason string
- BylineAt time.Time
- SlimReport bool
+ ProjectMono monoLine
+ ThreadActivity string
+ ThreadError string
+ ResearchReports []*researchView
+ HoldReason string
+ BylineAt time.Time
+ SlimReport bool
+ // Compact: the task's decision card is in the stream, so the report is
+ // one status line and the card carries the facts' action.
+ Compact bool
ExplorationSummary string
ReplyKey string
wire.Card
diff --git a/internal/equipo/chat_roster.go b/internal/equipo/chat_roster.go
index f870f779..2994e641 100644
--- a/internal/equipo/chat_roster.go
+++ b/internal/equipo/chat_roster.go
@@ -116,6 +116,13 @@ func (a *application) presentRoster(ctx context.Context, address string, view *c
c.ThreadError = copyText("chat.cancelled")
}
}
+ deciding := map[string]bool{}
+ for _, c := range cards {
+ deciding[c.TaskID] = deciding[c.TaskID] || c.TaskID != "" && !c.Receipt && c.Interactive() && !c.SetAside()
+ }
+ for _, c := range cards {
+ c.Compact = c.Receipt && c.Task != nil && deciding[c.TaskID] && !c.Interactive()
+ }
turns := map[string]bool{}
own := map[string]bool{}
for _, p := range ps {
@@ -238,6 +245,29 @@ func (v chatCard) AsideTitle() string {
}
func (v taskLine) RosterTone() string { return rosterTone(v.Task) }
+
+// Eyebrow is the report's short state. A task that needs the person
+// names its stage: the chip beside it says Needs you, once.
+func (v taskLine) Eyebrow() string {
+ if v.NeedsYou != "" {
+ for _, s := range v.Track {
+ if s.State == "current" {
+ return s.Label
+ }
+ }
+ }
+ return v.StageLine
+}
+
+// Why is the reason a task needs the person, as a sentence under the
+// title, without the words the chip already says.
+func (v taskLine) Why() string {
+ if v.NeedsYou == "" || v.StageLine == v.Eyebrow() {
+ return ""
+ }
+ why := strings.TrimPrefix(v.StageLine, copyText("nav.needs-you")+": ")
+ return strings.ToUpper(why[:1]) + why[1:]
+}
func (v taskLine) RosterChecks() string {
if v.Step != nil && v.Step.Specialist == wire.SpecialistChecks && (v.Step.State == wire.StepRunning || v.Step.State == wire.StepQueued) {
return copyText("roster.checks_running")
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index 1962f1ae..64e1dd92 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -1991,3 +1991,60 @@ label[equipo-sp-label] { cursor: pointer; }
[equipo-aside-stub] button, [equipo-roster-toast] button { min-inline-size: 2.75rem; }
[equipo-roster-card] [data-preview-link], [equipo-roster-card] [data-site-link] { display: inline-flex; align-items: center; min-block-size: 2.75rem; }
}
+/* Roster alignment. One inset scale: a byline sits .5rem above what it
+ introduces, raised cards pad evenly, and everything inside a card or a
+ report is .75rem apart. Only what waits for the person is a card. A
+ report is flat content on a neutral hairline rail under its byline's
+ tile; state colour stays in the track, the eyebrow and the chip. */
+[equipo-roster-byline] { margin-block-end: .5rem; }
+[equipo-roster-avatar] { box-sizing: border-box; }
+[equipo-conversation] [equipo-message-meta] [equipo-coordinator-mark] { inline-size: 1.875rem; }
+[equipo-conversation] [equipo-scroll] { padding-block-end: 2rem; }
+[equipo-roster-card][data-ask] { padding: 1rem; gap: .75rem; }
+[equipo-roster-card][data-flat]:not([data-ask], [data-done]), [equipo-roster-card][data-research-report] { padding: 0 0 .25rem; border: 0; border-radius: 0; background: transparent; box-shadow: none; gap: .75rem; }
+[equipo-roster-card][data-flat]:not([data-ask], [data-done])::before, [equipo-roster-card][data-research-report]::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: calc(-3rem + .9375rem - 1px); inline-size: 2px; border-radius: 1px; background: var(--rst-line); }
+[equipo-conversation] [equipo-day-box] { padding: 0; border: 0; border-radius: 0; background: transparent; }
+[equipo-roster-report] { gap: .75rem; }
+[equipo-roster-report-head] { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .25rem .5rem; }
+[equipo-roster-report-head] h3, [equipo-roster-why] { grid-column: 1 / -1; margin: 0; }
+[equipo-roster-why] { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); line-height: 1.4; }
+[equipo-roster-report-head]:has([equipo-needs-chip]) [equipo-roster-stage] { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+[equipo-roster-report][data-compact] [equipo-roster-report-head] { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: .125rem .625rem; }
+[equipo-roster-report][data-compact] h3 { order: -1; font-size: .9375rem; }
+[equipo-roster-facts] { padding-block-start: .75rem; }
+[equipo-roster-links] { gap: .25rem 1rem; }
+[data-research-report] > a { justify-self: start; color: var(--rst-text-muted); font-size: var(--rst-fs-sm); text-decoration: none; }
+/* The track runs edge to edge: four equal spans, the last stop only its
+ dot. A label is as wide as its dot and overflows evenly, so it centres. */
+[equipo-roster-report] [equipo-track-full] { display: flex; }
+[equipo-roster-report] [equipo-track-full] li { flex: 1 1 0; min-inline-size: .7rem; padding-block-start: 0; }
+[equipo-roster-report] [equipo-track-full] li:last-child { flex: 0 0 .7rem; }
+[equipo-roster-report] [equipo-track-full] li::before { inset-inline: .7rem 0; inset-block-start: calc(.35rem - 1px); }
+[equipo-roster-report] [equipo-track-full] li > span:not([equipo-dot]), [equipo-roster-report] [equipo-track-full] li > small { display: flex; justify-content: center; inline-size: .7rem; white-space: nowrap; }
+[equipo-roster-report] [equipo-track-full] li:first-child > :not([equipo-dot]) { justify-content: flex-start; }
+[equipo-roster-report] [equipo-track-full] li:last-child > :not([equipo-dot]) { justify-content: flex-end; }
+/* The set-aside control centres on the card's first line. */
+[equipo-set-aside] { inset-block-start: .625rem; inset-inline-end: .5rem; }
+[equipo-roster-card]:has(> [equipo-roster-task], > [equipo-copy-hold]) > [equipo-set-aside] { inset-block-start: .375rem; }
+[equipo-roster-card][data-ask] > [equipo-card-line], [data-question-thread] [data-first] [equipo-thread-bubble] { padding-inline-end: 2.25rem; }
+/* A card's composer is the main composer, in the card. */
+[equipo-subchat] { margin: 0 -1rem -1rem; padding: .75rem 1rem 1rem; }
+[equipo-subchat][data-question-thread] { margin: 0; padding: 0; }
+[equipo-thread-list] { gap: .75rem; margin-block-end: .75rem; }
+[equipo-mini-pill] { box-sizing: border-box; align-items: flex-end; gap: .25rem; min-block-size: 2.875rem; padding: 0 0 0 1rem; border-radius: 1.4375rem; }
+[equipo-mini-pill] textarea { align-self: center; block-size: 1.5rem; min-block-size: 1.5rem; margin-block: .625rem; padding: 0; line-height: 1.5; }
+[equipo-card] [equipo-mini-pill] button, [equipo-card] [equipo-mini-composer][data-has-content] [equipo-mini-pill] button { inline-size: 2.75rem; min-inline-size: 2.75rem; block-size: 2.75rem; min-block-size: 2.75rem; padding: .25rem; background-clip: content-box; box-shadow: none; }
+[equipo-card] [equipo-mini-pill] button[aria-busy="true"] { inline-size: auto; }
+@container roster (max-width: 500px) {
+ [equipo-roster-card][data-ask] { padding: .875rem; }
+ [equipo-roster-card][data-flat]:not([data-ask], [data-done]), [equipo-roster-card][data-research-report] { padding-inline-start: 2.5rem; }
+ [equipo-roster-card][data-flat]:not([data-ask], [data-done])::before, [equipo-roster-card][data-research-report]::before { inset-inline-start: calc(.9375rem - 1px); }
+ [equipo-roster-avatar][equipo-coordinator-mark], [equipo-conversation] [equipo-message-meta] [equipo-coordinator-mark] { justify-items: start; inline-size: 1.875rem; }
+ [equipo-roster-facts] { gap: .375rem; }
+ [equipo-roster-card] [equipo-actions] button:first-of-type:nth-last-of-type(2), [equipo-roster-card] [equipo-actions] button:first-of-type:nth-last-of-type(2) ~ button { grid-column: 1 / -1; }
+ [equipo-set-aside] { inset-block-start: .25rem; inset-inline-end: .25rem; }
+ [equipo-roster-card]:has(> [equipo-roster-task], > [equipo-copy-hold]) > [equipo-set-aside] { inset-block-start: 0; }
+ [equipo-roster-card][data-ask] > [equipo-card-line], [data-question-thread] [data-first] [equipo-thread-bubble] { padding-inline-end: 2.5rem; }
+ [equipo-subchat] { margin: 0 -.875rem -.875rem; padding: .75rem .875rem .875rem; }
+ [equipo-subchat][data-question-thread] { margin: 0; padding: 0; }
+}
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html
index fe91e38d..e704c671 100644
--- a/internal/equipo/templates/chat.html
+++ b/internal/equipo/templates/chat.html
@@ -28,11 +28,11 @@
{{define "roster-byline"}}<div equipo-roster-byline><span equipo-roster-avatar{{if eq .AuthorIcon "sparkles"}} equipo-coordinator-mark{{end}}>{{if eq .AuthorIcon "sparkles"}}{{template "roster-mark" .}}{{else}}{{icon .AuthorIcon}}{{end}}</span><b>{{.Author}}</b><span>{{.Verb}}</span>{{template "roster-project" .}}<time datetime="{{.BylineAt.Format "2006-01-02T15:04:05Z07:00"}}">{{.BylineAt.Format "15:04"}}</time></div>{{end}}
{{define "roster-project"}}{{if .Presentation.Context.ProjectTitle}}<span equipo-roster-project><span aria-hidden="true">·</span>{{template "mono-s" .ProjectMono}}<span equipo-project-name title="{{.Presentation.Context.ProjectTitle}}">{{.Presentation.Context.ProjectTitle}}</span></span>{{end}}{{end}}
{{define "roster-mark"}}<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3c1.1 5.8 3.2 7.9 9 9-5.8 1.1-7.9 3.2-9 9-1.1-5.8-3.2-7.9-9-9 5.8-1.1 7.9-3.2 9-9Z"/></svg>{{end}}
-{{define "work-task-receipt"}}{{$card := .}}{{with .Task}}<div equipo-roster-report{{if $card.SlimReport}} data-slim{{end}}>
-<div equipo-roster-report-head><div><span equipo-roster-stage equipo-stage data-stage="{{.Stage}}" data-tone="{{.RosterTone}}">{{.StageLine}}</span><h3 equipo-card-line><a href="/tasks/{{.ID}}">{{.Title}}</a></h3></div>{{if .NeedsYou}}<span equipo-needs-chip>{{icon "hand"}}{{copy "nav.needs-you"}}</span>{{end}}</div>
-{{if and (ne .Stage "cancelled") (not $card.SlimReport)}}{{template "track-full" .}}{{end}}{{with $card.ExplorationSummary}}<p equipo-exploration-summary>{{.}}</p>{{end}}
+{{define "work-task-receipt"}}{{$card := .}}{{with .Task}}<div equipo-roster-report{{if $card.SlimReport}} data-slim{{end}}{{if $card.Compact}} data-compact{{end}}>
+<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>
+{{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}}
</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}}
diff --git a/internal/thintest/roster_align_browser_test.go b/internal/thintest/roster_align_browser_test.go
new file mode 100644
index 00000000..501475d1
--- /dev/null
+++ b/internal/thintest/roster_align_browser_test.go
@@ -0,0 +1,48 @@
+//go:build browser
+
+package thintest
+
+import (
+ "fmt"
+ "os"
+ "testing"
+)
+
+// TestBrowserRosterAlignment holds the Roster stream's geometry at 1280
+// and 390, light and dark: reports are flat on a neutral rail, a report
+// beside its decision is one compact line, the stage track spans the
+// content with its label under its dot, bylines sit a fixed gap above
+// what they introduce, the card composer matches the main one, and the
+// last item clears the composer. testdata/roster-geometry.js measures.
+func TestBrowserRosterAlignment(t *testing.T) {
+ src, err := os.ReadFile("testdata/roster-geometry.js")
+ if err != nil {
+ t.Fatal(err)
+ }
+ r := newAlignRig(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) {
+ 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-roster-enhanced]')`, "connected")
+ measure := func(phase string) {
+ t.Helper()
+ if bad := eval[string](p, fmt.Sprintf(`(%s)(%q, %t)`, src, phase, width == 390)); bad != "" {
+ t.Errorf("%s: %s", phase, bad)
+ }
+ }
+ measure("compact")
+ p.shot(fmt.Sprintf("roster-align-compact-%d-%s", width, scheme))
+ p.click(`[equipo-card="merge"] [data-set-aside]`)
+ p.wait(`document.querySelector('[equipo-card="merge"] [equipo-aside-stub]') && document.querySelector('[equipo-roster-report] [data-track]')`, "full report")
+ measure("full")
+ p.shot(fmt.Sprintf("roster-align-full-%d-%s", width, scheme))
+ p.fits("Roster alignment")
+ p.click(`[equipo-card="merge"] [equipo-aside-stub] [data-aside-undo]`)
+ p.wait(`document.querySelector('[equipo-card="merge"] [data-set-aside]')`, "restored")
+ })
+ }
+ }
+}
diff --git a/internal/thintest/roster_align_rig_test.go b/internal/thintest/roster_align_rig_test.go
new file mode 100644
index 00000000..b2a38ed9
--- /dev/null
+++ b/internal/thintest/roster_align_rig_test.go
@@ -0,0 +1,24 @@
+//go:build browser || webkit
+
+package thintest
+
+import (
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// newAlignRig is the roll-up conversation (a report that needs a merge
+// decision, with its decision card after it) plus a question whose words
+// wrap on a phone, so every Roster shape is on one screen.
+func newAlignRig(t *testing.T) *rollupRig {
+ r := newRollupRig(t)
+ if res := r.call("align-q", wire.ToolAskPerson, map[string]any{"question": "Yes. What should the website be about, and what would you like visitors to do there?", "options": []string{}}); res.Code != "asked" {
+ t.Fatalf("ask: %+v", res)
+ }
+ if err := r.runner.Send(r.ctx, "align-reply", wire.FrameReply, wire.Reply{TurnID: r.turn, Attempt: 1, Text: "One question before I start."}); err != nil {
+ t.Fatal(err)
+ }
+ r.wait("replied", func(c *Conversation) bool { return c.Turns[r.turn].State == wire.TurnReplied })
+ return r
+}
diff --git a/internal/thintest/roster_align_webkit_test.go b/internal/thintest/roster_align_webkit_test.go
new file mode 100644
index 00000000..1a94f4e8
--- /dev/null
+++ b/internal/thintest/roster_align_webkit_test.go
@@ -0,0 +1,45 @@
+//go:build webkit
+
+package thintest
+
+import (
+ "encoding/json"
+ "os"
+ "os/exec"
+ "testing"
+)
+
+// TestWebKitRosterAlignment: Paul, staging 991f12d5, Safari on an iPhone:
+// "Lots of alignment issues here." In WebKit at 390 (3x, touch) and 1280,
+// light and dark, testdata/roster-geometry.js finds nothing out of line.
+// Needs EQUIPO_PLAYWRIGHT_CORE. EQUIPO_BROWSER_ARTIFACTS saves the shots.
+func TestWebKitRosterAlignment(t *testing.T) {
+ core := os.Getenv("EQUIPO_PLAYWRIGHT_CORE")
+ if core == "" {
+ t.Skip("EQUIPO_PLAYWRIGHT_CORE is not set")
+ }
+ r := newAlignRig(t)
+ c := r.inst.Cookie()
+ raw, _ := json.Marshal(map[string]any{"base": r.inst.URL, "cookie": map[string]string{"name": c.Name, "value": c.Value}, "art": os.Getenv("EQUIPO_BROWSER_ARTIFACTS")})
+ cmd := exec.Command("node", "testdata/roster.mjs")
+ cmd.Env = append(os.Environ(), "EQUIPO_ROSTER="+string(raw))
+ cmd.Stderr = os.Stderr
+ got, err := cmd.Output()
+ if err != nil {
+ t.Fatalf("webkit: %v", err)
+ }
+ var res map[string]map[string]string
+ if err := json.Unmarshal(got, &res); err != nil {
+ t.Fatalf("webkit output %q: %v", got, err)
+ }
+ if len(res) != 4 {
+ t.Fatalf("webkit measured %d screens, want 4", len(res))
+ }
+ for screen, phases := range res {
+ for phase, bad := range phases {
+ if bad != "" {
+ t.Errorf("%s %s: %s", screen, phase, bad)
+ }
+ }
+ }
+}
diff --git a/internal/thintest/roster_browser_test.go b/internal/thintest/roster_browser_test.go
index 26c3f92a..6fc55ac4 100644
--- a/internal/thintest/roster_browser_test.go
+++ b/internal/thintest/roster_browser_test.go
@@ -21,6 +21,13 @@ func TestBrowserRosterVisual(t *testing.T) {
p.open("/conversation")
p.wait(`document.querySelector('[equipo-offline]').hidden`, "connected")
p.check(`!!document.querySelector('[equipo-roster-byline]')`, "roster bylines missing")
+ // A report beside its decision card is one line; with the card
+ // set aside it shows its track, facts and actions.
+ p.check(`document.querySelector('[equipo-roster-report]').hasAttribute('data-compact') || !!document.querySelector('[equipo-card="merge"] [equipo-aside-stub]')`, "report repeats its decision card")
+ if eval[bool](p, `!!document.querySelector('[equipo-card="merge"] [data-set-aside]')`) {
+ p.click(`[equipo-card="merge"] [data-set-aside]`)
+ }
+ p.wait(`document.querySelector('[equipo-roster-report] [data-track]')`, "full report")
p.check(`[...document.querySelectorAll("[equipo-daybar] i")].every(i=>i.getBoundingClientRect().width>0) && !document.querySelector("[equipo-daybar] [style]")`, "roll-up bar violates the style policy")
p.check(`document.querySelector('[equipo-roster-report] [data-track]').children.length===5`, "report needs five stages")
p.check(`!!document.querySelector('[equipo-roster-facts]')`, "report facts missing")
@@ -31,7 +38,7 @@ func TestBrowserRosterVisual(t *testing.T) {
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)<=10 && parseFloat(getComputedStyle(b).marginBottom)<=2 && parseFloat(getComputedStyle(r).rowGap)<=8 && parseFloat(getComputedStyle(c.querySelector('[equipo-roster-facts]')).paddingTop)<=6})()`, "cards remain too loose")
+ 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(`parseFloat(getComputedStyle(document.querySelector('[equipo-roster-report-head] h3 a'),'::after').height)>=44`, "task title has a small phone hit area")
diff --git a/internal/thintest/testdata/roster-geometry.js b/internal/thintest/testdata/roster-geometry.js
new file mode 100644
index 00000000..e2944bb8
--- /dev/null
+++ b/internal/thintest/testdata/roster-geometry.js
@@ -0,0 +1,56 @@
+// Roster alignment, measured in the page. Called as (phase, phone) and
+// returns the failures as text ("" when aligned). Phases: "compact" (a
+// report whose decision card follows it) and "full" (that card set aside).
+// The Chromium and WebKit tests both evaluate this file.
+(phase, phone) => {
+ const bad = [], q = (s, r = document) => r.querySelector(s), all = (s, r = document) => [...r.querySelectorAll(s)];
+ const box = e => e.getBoundingClientRect(), near = (a, b, t = 1) => Math.abs(a - b) <= t;
+ const report = q("[equipo-roster-report]"), flat = report.closest("[equipo-roster-card]");
+ const inner = e => { const b = box(e), s = getComputedStyle(e); return { left: b.left + parseFloat(s.paddingLeft), right: b.right - parseFloat(s.paddingRight) }; };
+ const fs = getComputedStyle(flat);
+ if (parseFloat(fs.borderTopWidth) || parseFloat(fs.borderLeftWidth) || fs.backgroundColor !== "rgba(0, 0, 0, 0)" || fs.boxShadow !== "none") bad.push("a report is still a card");
+ if (parseFloat(getComputedStyle(flat, "::before").width) > 2) bad.push("the report rail is not a hairline");
+ const gaps = all("[equipo-roster-byline]").map(b => box(b.nextElementSibling).top - Math.max(box(b).bottom, box(q("[equipo-roster-avatar]", b)).bottom));
+ if (gaps.some(g => !near(g, 8))) bad.push("byline to content gap is not 8px: " + gaps.map(Math.round));
+ const ask = q("[equipo-roster-card][data-ask]");
+ if (ask && phone) {
+ const mark = q("[equipo-roster-avatar]", ask.previousElementSibling), edge = box(mark.matches("[equipo-coordinator-mark]") ? q("svg", mark) : mark).left;
+ if (!near(edge, box(ask).left)) bad.push(`byline mark at ${edge}, card at ${box(ask).left}`);
+ }
+ 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]");
+ 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`);
+ if (!near(p.bottom - s.bottom, p.right - s.right)) bad.push("send is not inset evenly in the pill");
+ if (main && !near(p.height, box(main).height)) bad.push(`card pill is ${p.height}px, the composer's ${box(main).height}px`);
+ const range = document.createRange(); range.selectNodeContents(q("[data-first] [equipo-thread-text]", pill.closest("[equipo-roster-card]")));
+ const line = range.getClientRects()[0], xb = box(x);
+ 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 (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);
+ if (!near(box(dots[0]).left, content.left) || !near(box(dots.at(-1)).right, content.right)) bad.push(`track ${box(dots[0]).left}..${box(dots.at(-1)).right} does not span ${content.left}..${content.right}`);
+ const steps = dots.slice(1).map((d, i) => box(d).left - box(dots[i]).left);
+ if (steps.some(s => !near(s, steps[0]))) bad.push("track dots are uneven: " + steps.map(Math.round));
+ const now = q("[aria-current]", track), i = [...track.children].indexOf(now);
+ if (i > 0 && i < dots.length - 1) {
+ const range = document.createRange(); range.selectNodeContents(now.querySelector("span:not([equipo-dot])"));
+ const l = box(range), d = box(dots[i]);
+ if (!near((l.left + l.right) / 2, (d.left + d.right) / 2)) bad.push(`stage label is ${(l.left + l.right - d.left - d.right) / 2}px off its dot`);
+ }
+ const head = q("[equipo-roster-report-head]", report), stage = q("[equipo-roster-stage]", head), chip = q("[equipo-needs-chip]", head);
+ if (box(stage).height > 1.6 * parseFloat(getComputedStyle(stage).fontSize)) bad.push("the eyebrow wraps");
+ if (chip && !near((box(stage).top + box(stage).bottom) / 2, (box(chip).top + box(chip).bottom) / 2, 2)) bad.push("eyebrow and chip are not on one line");
+ const links = all("[equipo-roster-links] > a", report), mids = links.map(a => Math.round((box(a).top + box(a).bottom) / 2));
+ if (!phone && new Set(mids).size > 1) bad.push("report actions are not one row");
+ }
+ const scroll = q("[equipo-scroll]"); scroll.scrollTop = scroll.scrollHeight;
+ const last = all("[equipo-feed] > li").filter(e => box(e).height > 0).at(-1), clear = box(q("#chat-composer")).top - box(last).bottom;
+ if (clear < 16) bad.push(`the last item ends ${clear}px above the composer`);
+ return bad.join("; ");
+}
diff --git a/internal/thintest/testdata/roster.mjs b/internal/thintest/testdata/roster.mjs
new file mode 100644
index 00000000..a63ae5f9
--- /dev/null
+++ b/internal/thintest/testdata/roster.mjs
@@ -0,0 +1,46 @@
+// The Roster stream in WebKit: as an iPhone (390x844 at 3x, touch) and at
+// 1280, light and dark. Measures testdata/roster-geometry.js with the
+// decision card beside its report and with it set aside, and saves a shot
+// of each when cfg.art names a directory. Prints one JSON object.
+import { createRequire } from "node:module";
+import { readFileSync } from "node:fs";
+const require = createRequire(import.meta.url);
+const { webkit } = require(process.env.EQUIPO_PLAYWRIGHT_CORE);
+const cfg = JSON.parse(process.env.EQUIPO_ROSTER);
+const geometry = readFileSync("testdata/roster-geometry.js", "utf8");
+const out = {};
+const browser = await webkit.launch();
+try {
+ for (const width of [390, 1280]) for (const scheme of ["light", "dark"]) {
+ const phone = width === 390;
+ const ctx = await browser.newContext(phone ? { viewport: { width, height: 844 }, deviceScaleFactor: 3, hasTouch: true, isMobile: true, colorScheme: scheme } : { viewport: { width, height: 900 }, colorScheme: scheme });
+ await ctx.addCookies([{ name: cfg.cookie.name, value: cfg.cookie.value, url: cfg.base }]);
+ const page = await ctx.newPage();
+ await page.goto(cfg.base + "/conversation");
+ await page.waitForFunction(() => document.querySelector("[equipo-offline]").hidden && !!document.querySelector("[data-roster-enhanced]"));
+ const measure = phase => page.evaluate(`(${geometry})(${JSON.stringify(phase)}, ${phone})`);
+ const shot = async (name, sel) => {
+ if (!cfg.art) return;
+ if (sel) await page.evaluate(s => document.querySelector(s).scrollIntoView({ block: "center" }), sel);
+ await page.waitForTimeout(150);
+ await page.screenshot({ path: `${cfg.art}/roster-${name}-${width}-${scheme}.png` });
+ };
+ const res = {};
+ await shot("report", "[equipo-roster-report]");
+ await shot("question", "[equipo-mini-pill]");
+ res.compact = await measure("compact");
+ await shot("end");
+ await page.click('[equipo-card="merge"] [data-set-aside]');
+ await page.waitForSelector('[equipo-card="merge"] [equipo-aside-stub]');
+ await page.waitForSelector("[equipo-roster-report] [data-track]");
+ await shot("full", "[equipo-roster-report]");
+ res.full = await measure("full");
+ await page.click('[equipo-card="merge"] [equipo-aside-stub] [data-aside-undo]');
+ await page.waitForSelector('[equipo-card="merge"] [data-set-aside]');
+ out[`${width}-${scheme}`] = res;
+ await ctx.close();
+ }
+} finally {
+ await browser.close();
+}
+console.log(JSON.stringify(out));