oficina / equipo Public

headless: rail drive expects the merge Equipo makes on its own

TestBrowserRailFollowsWork fails on main (ac4a809) as it does here:
its last wait wants Needs you to count the task at Ready to merge, but
since slice 4c Equipo merges a task whose checks passed and whose
review approved, so the task goes to Done ("Merged into main at ...")
and Needs you never counts it. The drive is browser-tagged, which no
hosted CI lane builds (TAGS=testbuild), so nothing caught it.

On this branch it also failed once earlier, at Engineering going idle:
the step sleeps 2.5 s on purpose and Wait allows 5 s, so on docs-t1 at
load 20 to 30 the runner's report and the sidebar's swap sometimes miss
the 2.5 s left (it passed on the next two runs, and with 8 s of slack).
browsertest.WaitWithin gives waits on work their own window; the rail
drive uses 20 s for the two idle transitions, then expects Tasks to
stop counting the task and Needs you to stay empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 32133b5ce52a60f357b163df16b515a3083d0a9a parent 0cff4b8
2 files changed, +19 −5
  • internal/browsertest/browser.go +9 −1
  • internal/headless/browser_review_test.go +10 −4
diff --git a/internal/browsertest/browser.go b/internal/browsertest/browser.go
index 9eb319ba..237127e8 100644
--- a/internal/browsertest/browser.go
+++ b/internal/browsertest/browser.go
@@ -15,8 +15,16 @@ import (
)
func Wait(expression string) chromedp.Action[chromedp.Void] {
+ return WaitWithin(expression, 5*time.Second)
+}
+
+// WaitWithin is Wait with its own window, for a change that waits on
+// work the test asked to take time (a step told to sleep), not on the
+// page: 5 s is room for the page to react, not for the work and the
+// page together on a loaded machine.
+func WaitWithin(expression string, window time.Duration) chromedp.Action[chromedp.Void] {
return chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
- ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
+ ctx, cancel := context.WithTimeout(ctx, window)
defer cancel()
tick := time.NewTicker(20 * time.Millisecond)
defer tick.Stop()
diff --git a/internal/headless/browser_review_test.go b/internal/headless/browser_review_test.go
index e72531a7..fd874c57 100644
--- a/internal/headless/browser_review_test.go
+++ b/internal/headless/browser_review_test.go
@@ -4,6 +4,7 @@ package headless
import (
"testing"
+ "time"
"amadan.net/oficina/equipo/internal/browsertest"
)
@@ -34,6 +35,9 @@ func TestBrowserReceiptFollowsReview(t *testing.T) {
// Paul, staging: the sidebar reads the thin core and follows the stream.
// While a step runs, Engineering says it is working on the task (linked)
// and Tasks counts it; at 1280 and at 390 (inside the menu), no reload.
+// Then checks pass and Review approves, and Equipo merges it on its own
+// (slice 4c): the specialists go idle, Tasks stops counting it and
+// Needs you never does.
func TestBrowserRailFollowsWork(t *testing.T) {
for _, size := range []struct {
w, h int64
@@ -48,10 +52,12 @@ func TestBrowserRailFollowsWork(t *testing.T) {
p.check(eng+`.dataset.state==='idle' && !document.querySelector('#nav-tasks [data-count]') && !document.querySelector('#rail [data-specialist="product"]')`, "idle sidebar")
p.send("tool:record_task:oficina/sample|Slow sidebar change|x\ntool:start_task:$task|stepsleep:2500 edit:README.md|teh panes|the panes")
p.run(browsertest.Wait(eng + `?.dataset.state==='working' && ` + eng + `.querySelector('[equipo-nav-task]')?.textContent==='Slow sidebar change' && document.querySelector('#nav-tasks [data-count]')?.textContent==='1'`))
- p.run(browsertest.Wait(`document.querySelector('#rail [data-specialist="engineering"]')?.dataset.state==='idle'`))
- p.run(browsertest.Wait(`document.querySelector('#rail [data-specialist="review"]')?.dataset.state==='idle'`))
- // Checks and review, then ready to merge: it needs the person.
- p.run(browsertest.Wait(`document.querySelector('#nav-needs-you [data-count]')?.textContent==='1'`))
+ // The step sleeps 2.5 s on purpose; on a loaded machine the
+ // runner's report and the sidebar's swap need more than the 2.5 s
+ // a 5 s wait leaves after it.
+ p.run(browsertest.WaitWithin(`document.querySelector('#rail [data-specialist="engineering"]')?.dataset.state==='idle'`, 20*time.Second))
+ p.run(browsertest.WaitWithin(`document.querySelector('#rail [data-specialist="review"]')?.dataset.state==='idle' && !document.querySelector('#nav-tasks [data-count]')`, 20*time.Second))
+ p.check(`!document.querySelector('#nav-needs-you [data-count]')`, "a task Equipo merged on its own counts as needing the person")
p.check(`performance.getEntriesByType('navigation').length===window.__nav`, "the page reloaded")
p.stop()
}