Cover reconnects and update project placement UI contracts
12 files changed,
+74
−12
.rastrillo/budgets.txt+2 −2internal/equipo/chat/tasks.go+17 −1internal/equipo/placement_test.go+11 −0internal/equipo/templates/work_parts.html+1 −1internal/headless/browser_thread_test.go+2 −2internal/plan3test/person_api_contract_test.go+1 −1internal/plan3test/plan3_release_test.go+2 −1internal/thintest/inner_browser_test.go+1 −1internal/thintest/pages_test.go+1 −1internal/thintest/project_placement_contract_test.go+33 −0internal/thintest/research_pages_test.go+2 −1internal/thintest/rows_pages_test.go+1 −1
CI passed — run details
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index f1e04725..b3273403 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -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 29693 - Transactional authority and dispatch stay together; project confirmation, fenced moves and notebook learning. Measured 29693 source lines. |
| +size internal/equipo/chat 29709 - Transactional authority and dispatch stay together; project confirmation, fenced moves and notebook learning. Measured 29709 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 - 29909 Shared instance harness: placement consent, restart proof, preserved context and responsive browser contracts. Measured 29909 test lines. |
| +size internal/thintest - 29943 Shared instance harness: placement consent, restart proof, preserved context and responsive browser contracts. Measured 29943 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/tasks.go b/internal/equipo/chat/tasks.go| index 903694c4..63657721 100644 |
| --- a/internal/equipo/chat/tasks.go |
| +++ b/internal/equipo/chat/tasks.go |
| @@ -1710,7 +1710,7 @@ func (t *txn) syncSteps(l Lease, held []wire.StepRun) error { |
| // Only this runner's own steps: a worker's sync never settles the |
| // primary's work, nor a Linux attempt awaiting its termination proof. |
| var rows []stepRecord |
| - if err := t.db.Where("runner_id = ? AND person = ? AND state IN ?", l.Runner.RunnerID, l.Runner.Person, []string{wire.StepQueued, wire.StepRunning}).Find(&rows).Error; err != nil { |
| + if err := t.db.Where("runner_id = ? AND person = ? AND (state IN ? OR (coalesce(terminated, 0) = 0 AND task_id IN (SELECT id FROM chat_tasks WHERE coalesce(move_project, '') <> '')))", l.Runner.RunnerID, l.Runner.Person, []string{wire.StepQueued, wire.StepRunning}).Find(&rows).Error; err != nil { |
| return err |
| } |
| for i := range rows { |
| @@ -1729,6 +1729,22 @@ func (t *txn) syncSteps(l Lease, held []wire.StepRun) error { |
| if err != nil { |
| return err |
| } |
| + if k.MoveProject != "" { |
| + // Absence in this authenticated sync proves the dispatched |
| + // attempt has ended, including a lost final termination report. |
| + now := t.now() |
| + if !wire.StepTerminal(s.State) { |
| + s.State, s.Reason = wire.StepCancelled, "cancelled" |
| + } |
| + s.Terminated, s.FinishedAt = true, &now |
| + if err := t.saveStep(&s, &k); err != nil { |
| + return err |
| + } |
| + if err := t.finishMove(&k); err != nil { |
| + return err |
| + } |
| + continue |
| + } |
| if s.Withdrawn { |
| // Its runner holds nothing of it and verified none survives: |
| // the withdrawn attempt is over, and the next one is placed. |
diff --git a/internal/equipo/placement_test.go b/internal/equipo/placement_test.go| index 06750884..7897f695 100644 |
| --- a/internal/equipo/placement_test.go |
| +++ b/internal/equipo/placement_test.go |
| @@ -32,3 +32,14 @@ func TestPlacementPendingHasNoOldActions(t *testing.T) { |
| t.Fatal("pending move lost its status") |
| } |
| } |
| + |
| +func TestPlacementNeedsCardHasMenu(t *testing.T) { |
| + var b bytes.Buffer |
| + task := taskLine{Task: wire.Task{ID: "tkneeds", Project: "Calendar"}, Decision: &decisionView{}} |
| + if err := pages["work_needs"].ExecuteTemplate(&b, "decision", map[string]any{"Task": task, "Head": true, "From": "needs"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + if !strings.Contains(b.String(), `href="/tasks/tkneeds/move"`) { |
| + t.Fatal("Needs you task has no project correction menu") |
| + } |
| +} |
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html| index 5f4401b5..ced6c824 100644 |
| --- a/internal/equipo/templates/work_parts.html |
| +++ b/internal/equipo/templates/work_parts.html |
| @@ -34,7 +34,7 @@ |
| {{define "work-groups"}}{{$from := .From}}<div equipo-tasklist{{with .Scope}} data-scope="{{.}}"{{end}}><div equipo-tcols aria-hidden="true"><span>{{copy "work.col.project"}}</span><span>{{copy "work.col.task"}}</span><span>{{copy "work.col.status"}}</span><span>{{copy "work.col.from"}}</span><span>{{copy "work.col.updated"}}</span></div> |
| {{range .Groups}}<section equipo-group data-group="{{.Key}}"{{if eq .Key "done"}} id="done"{{end}}><h2>{{copy (printf "work.group.%s" .Key)}} <span equipo-n>{{.Count}}</span>{{with copy (printf "work.group.%s_hint" .Key)}}<span equipo-hint>{{.}}</span>{{end}}</h2><ol equipo-rows data-thin-tasks>{{range .Tasks}}{{template "task-row" (dict "T" . "From" $from)}}{{end}}{{if .More}}<li><a equipo-trow-more href="{{.MoreHref}}">{{printf (copy "work.done_more") .More}}</a></li>{{end}}</ol></section>{{end}}</div>{{end}} |
| {{define "decision"}}{{$t := .Task}}{{with $t.Decision}}<div equipo-decision{{if eq $.From "task"}} id="decide"{{end}}{{with .Tone}} data-tone="{{.}}"{{end}} data-need="{{.Need}}" data-decision="{{$t.ID}}"> |
| -{{if $.Head}}{{template "mono" $t.Mono}}<div equipo-d-title><a href="/tasks/{{$t.ID}}">{{$t.Title}}</a><span equipo-quiet>{{$t.Project}} · {{template "source" $t}}</span></div>{{end}} |
| +{{if $.Head}}{{template "mono" $t.Mono}}<div equipo-d-title><a href="/tasks/{{$t.ID}}">{{$t.Title}}</a><div equipo-quiet>{{template "placement-chip" $t}} · {{template "source" $t}}</div></div>{{end}} |
| <p equipo-d-why>{{.Why}}</p> |
| <p equipo-d-ask>{{.Ask}}</p>{{if .Link}}<p equipo-quiet data-direction-line>{{with .LinkText}}{{.}} {{end}}<a equipo-link href="{{.Link}}" rel="noopener noreferrer" target="_blank" data-direction-link>{{.LinkLabel}}</a>{{with .AltLink}} <a equipo-link href="{{.}}" rel="noopener noreferrer" target="_blank" data-direction-branch>{{$t.Decision.AltLabel}}</a>{{end}}</p>{{end}}{{with .Said}}<p equipo-quiet data-triage-said>{{.}}</p>{{end}}{{with .Failed}}<p equipo-quiet data-triage-failed>{{.}}</p>{{end}}{{with .Recommend}}<p equipo-quiet data-triage-recommend>{{.}}</p>{{end}} |
| <div equipo-d-actions>{{if .CopyContinue}}<form method="post" action="/conversation/tasks/{{$t.ID}}/continue-without-copy"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{if $.Task.Decision.Note}}<textarea rst-input name="note" maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note"}}" placeholder="{{copy "chat.card.direction_note"}}" data-direction-note></textarea>{{end}}{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}">{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{with .Unsandboxed}}<details equipo-mach-confirm data-unsandboxed><summary equipo-btn>{{copy "work.decide.unsandboxed"}}</summary><div><p>{{.Warning}}</p><form method="post" action="/conversation/tasks/{{$t.ID}}/unsandboxed"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="step" value="{{.Step}}"><input type="hidden" name="attempt" value="{{.Attempt}}"><button equipo-btn data-danger type="submit" data-task-unsandboxed>{{copy "work.decide.unsandboxed_confirm"}}</button></form></div></details>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Round}}<form method="post" action="/conversation/tasks/{{$t.ID}}/round"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-round>{{copy "work.decide.round"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation?about={{$t.ID}}" data-ask-coordinator>{{copy "work.decide.ask_coordinator"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div> |
diff --git a/internal/headless/browser_thread_test.go b/internal/headless/browser_thread_test.go| index b1fd3c7f..25ad6dfc 100644 |
| --- a/internal/headless/browser_thread_test.go |
| +++ b/internal/headless/browser_thread_test.go |
| @@ -42,7 +42,7 @@ func TestBrowserTaskThread(t *testing.T) { |
| var link string |
| p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error { |
| var err error |
| - link, err = chromedp.Evaluate[string](card+`.querySelector('a[href^="/tasks/"]').href`)(ctx, target) |
| + link, err = chromedp.Evaluate[string](card+`.querySelector('[equipo-roster-links] a[href^="/tasks/"]').href`)(ctx, target) |
| return err |
| })) |
| p.run(chromedp.Navigate(link), browsertest.Wait(`!!document.querySelector('[data-chat-stream][data-task] #composer')`)) |
| @@ -104,7 +104,7 @@ func TestBrowserAskAfterMerge(t *testing.T) { |
| var link string |
| p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error { |
| var err error |
| - link, err = chromedp.Evaluate[string](card+`.querySelector('a[href^="/tasks/"]').href`)(ctx, target) |
| + link, err = chromedp.Evaluate[string](card+`.querySelector('[equipo-roster-links] a[href^="/tasks/"]').href`)(ctx, target) |
| return err |
| })) |
| p.run(chromedp.Navigate(link), browsertest.Wait(`!!document.querySelector('[data-chat-stream][data-task] #composer')`)) |
diff --git a/internal/plan3test/person_api_contract_test.go b/internal/plan3test/person_api_contract_test.go| index 0bafbf25..f9a12e75 100644 |
| --- a/internal/plan3test/person_api_contract_test.go |
| +++ b/internal/plan3test/person_api_contract_test.go |
| @@ -65,7 +65,7 @@ func personAPIContractCoverage(t *testing.T) { |
| registered := map[string]bool{} |
| assistantRoutes := map[string]bool{} |
| // Thin v1 conversation routes are contracted by internal/wire fixtures. |
| - thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/kind": true, "POST /tasks/{id}/round": true, "POST /tasks/{id}/recover": true, "POST /tasks/{id}/merge": true, "POST /tasks/{id}/duplicate": true, "POST /tasks/{id}/uncombine": true, "POST /tasks/{id}/undo-merge": true, "PUT /tasks/{id}/priority": true, "POST /tasks/{id}/run-now": true, "GET /projects/{id}/merge-policy": true, "PUT /projects/{id}/merge-policy": true, "GET /thinking": true, "PUT /thinking": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true, "POST /tasks/{id}/questions": true, "POST /questions/{id}/cancel": true, "POST /connections": true, "POST /connections/{id}/cancel": true, "POST /connections/{id}/secret": true, "POST /connections/{id}/forget": true, "POST /connections/{id}/check": true, "POST /connections/{id}/model": true, "PUT /connections/{id}/budget": true, "PUT /connections/{id}/models": true, "POST /connections/{id}/resume": true, "GET /connections/preference": true, "PUT /connections/preference": true, "GET /housekeeping": true, "PUT /housekeeping": true, "PUT /housekeeping/detectors/{id}": true, "GET /housekeeping/actions": true, "POST /housekeeping/actions/{id}/undo": true, "POST /attachments": true, "GET /attachments/{id}": true, "GET /attachments/{id}/preview": true, "POST /specialists/{id}/revoke": true, "GET /tasks/{id}/files/{file}": true, "GET /usage": true, "GET /advice": true, "POST /advice/{id}/act": true, "POST /advice/{id}/dismiss": true} |
| + thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/move": true, "POST /tasks/{id}/kind": true, "POST /tasks/{id}/round": true, "POST /tasks/{id}/recover": true, "POST /tasks/{id}/merge": true, "POST /tasks/{id}/duplicate": true, "POST /tasks/{id}/uncombine": true, "POST /tasks/{id}/undo-merge": true, "PUT /tasks/{id}/priority": true, "POST /tasks/{id}/run-now": true, "GET /projects/{id}/merge-policy": true, "PUT /projects/{id}/merge-policy": true, "GET /thinking": true, "PUT /thinking": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true, "POST /tasks/{id}/questions": true, "POST /questions/{id}/cancel": true, "POST /connections": true, "POST /connections/{id}/cancel": true, "POST /connections/{id}/secret": true, "POST /connections/{id}/forget": true, "POST /connections/{id}/check": true, "POST /connections/{id}/model": true, "PUT /connections/{id}/budget": true, "PUT /connections/{id}/models": true, "POST /connections/{id}/resume": true, "GET /connections/preference": true, "PUT /connections/preference": true, "GET /housekeeping": true, "PUT /housekeeping": true, "PUT /housekeeping/detectors/{id}": true, "GET /housekeeping/actions": true, "POST /housekeeping/actions/{id}/undo": true, "POST /attachments": true, "GET /attachments/{id}": true, "GET /attachments/{id}/preview": true, "POST /specialists/{id}/revoke": true, "GET /tasks/{id}/files/{file}": true, "GET /usage": true, "GET /advice": true, "POST /advice/{id}/act": true, "POST /advice/{id}/dismiss": true} |
| must(t, chi.Walk(f.Store.PersonAPIHandler().(chi.Routes), func(method, path string, _ http.Handler, _ ...func(http.Handler) http.Handler) error { |
| if thin[method+" "+path] { |
| return nil |
diff --git a/internal/plan3test/plan3_release_test.go b/internal/plan3test/plan3_release_test.go| index 0b664200..b4461ef8 100644 |
| --- a/internal/plan3test/plan3_release_test.go |
| +++ b/internal/plan3test/plan3_release_test.go |
| @@ -178,9 +178,10 @@ func plan3CopyInventory(t *testing.T) { |
| // Paul's own review of the jobs strings and the API section's job prose. |
| approvedJobs := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-14, copy-review cvaxhn3pwgpxhpssj5cgizqtrq, unchanged)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-14, copy-review cvaxhn3pwgpxhpssj5cgizqtrq)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-14, copy-review mbvzxmewxxgud4ksakdb2m7pye)") |
| acceptedRoster := strings.HasPrefix(key, "roster.") && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-14)") |
| + acceptedPlacement := strings.HasPrefix(key, "placement.") && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)") |
| acceptedReportActions := slices.Contains([]string{"roster.talk", "roster.round_busy", "roster.round_done", "roster.merge_busy", "roster.merge_done"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-15)") |
| acceptedCopy := strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Copy, record-bound) sha256:"+copydesk.Hash(rows[key]) |
| - if !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs { |
| + if !acceptedPlacement && !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs { |
| t.Fatal("entry has no copy review status or applicable acceptance", key) |
| } |
| } |
diff --git a/internal/thintest/inner_browser_test.go b/internal/thintest/inner_browser_test.go| index 0c83d0c6..071f7d08 100644 |
| --- a/internal/thintest/inner_browser_test.go |
| +++ b/internal/thintest/inner_browser_test.go |
| @@ -252,7 +252,7 @@ func TestBrowserInnerScreens(t *testing.T) { |
| p.open("/tasks") |
| p.check(`(()=>{const f=[...document.querySelectorAll('[equipo-filter] > summary')].pop();f.focus();return document.activeElement===f})()`, "focus filter") |
| p.do(chromedp.KeyEvent("\t")) |
| - p.check(`document.activeElement===document.querySelector('[equipo-group] [equipo-trow-proj]')`, "Tab did not reach the first row's project") |
| + p.check(`document.activeElement===document.querySelector('[equipo-group] [equipo-trow-proj] summary')`, "Tab did not reach the first row's project") |
| p.do(chromedp.KeyEvent("\t")) |
| first := `document.querySelector('[equipo-group] [equipo-row-link]')` |
| p.check(`document.activeElement===`+first, "Tab did not reach the first row") |
diff --git a/internal/thintest/pages_test.go b/internal/thintest/pages_test.go| index 70b8ad93..f00f35e1 100644 |
| --- a/internal/thintest/pages_test.go |
| +++ b/internal/thintest/pages_test.go |
| @@ -139,7 +139,7 @@ func TestPagesTasksAndProjects(t *testing.T) { |
| list := r.get(owner, "/tasks", 200) |
| // Rows: the whole row links the task; who filed it and from where; the |
| // Done group; the project by name; the detail line says Merged. |
| - for _, want := range []string{`data-task="` + id + `"`, `equipo-row-link href="/tasks/` + id + `"`, "<span>Woodstar</span></a>", ">You</span>", "From your conversation, ", `data-group="done"`, ">Merged.</span>"} { |
| + for _, want := range []string{`data-task="` + id + `"`, `equipo-row-link href="/tasks/` + id + `"`, `<span equipo-project-name>Woodstar</span>`, ">You</span>", "From your conversation, ", `data-group="done"`, ">Merged.</span>"} { |
| if !strings.Contains(list, want) { |
| t.Fatalf("Tasks page lacks %q", want) |
| } |
diff --git a/internal/thintest/project_placement_contract_test.go b/internal/thintest/project_placement_contract_test.go| index 1d9b98c2..6160a6d0 100644 |
| --- a/internal/thintest/project_placement_contract_test.go |
| +++ b/internal/thintest/project_placement_contract_test.go |
| @@ -3,6 +3,7 @@ package thintest |
| import ( |
| "amadan.net/oficina/equipo/internal/wire" |
| "encoding/json" |
| + "fmt" |
| "net/http" |
| "net/url" |
| "strings" |
| @@ -357,3 +358,35 @@ func TestPlacementMergeDuringStopRefusesMove(t *testing.T) { |
| t.Fatal("move restarted a merged task", after) |
| } |
| } |
| + |
| +func TestPlacementReconnectProofRestarts(t *testing.T) { |
| + for _, failed := range []bool{false, true} { |
| + t.Run(fmt.Sprintf("failed-%v", failed), func(t *testing.T) { |
| + r := newToolRigAt(t, wire.ProtocolCurrent) |
| + id := r.shopTask("sync-move") |
| + r.begin("sync-start", id) |
| + old := r.nextDispatch() |
| + if failed { |
| + r.step("failed-unproven", wire.StepReport{TaskID: id, StepID: old.StepID, Attempt: old.Attempt, State: wire.StepFailed, Reason: "interrupted"}) |
| + } |
| + before := r.task(id) |
| + if err := r.movePlacement(id, "oficina/equipo", before.Revision); err != nil { |
| + t.Fatal(err) |
| + } |
| + r.expect(wire.FrameCancelStep) |
| + if err := r.runner.Send(r.ctx, "sync-placement-proof", wire.FrameSync, wire.Sync{Runs: []wire.Run{{TurnID: r.turn, Attempt: 1, State: "running"}}, Steps: []wire.StepRun{}}); err != nil { |
| + t.Fatal(err) |
| + } |
| + // Sync is not acknowledged. The next tool result is a barrier |
| + // on this ordered connection, so the sync has committed by then. |
| + if result := r.call("sync-barrier", wire.ToolStatus, map[string]any{}); result.IsError { |
| + t.Fatal(result) |
| + } |
| + |
| + after := r.task(id) |
| + if after.Moving || after.Repo != "amadan.net/oficina/equipo" || after.Stage != wire.StageInProgress { |
| + t.Fatal("reconnect proof lost pending restart", after.Stage, after.Repo, after.Moving) |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/thintest/research_pages_test.go b/internal/thintest/research_pages_test.go| index e684395c..eea4ee22 100644 |
| --- a/internal/thintest/research_pages_test.go |
| +++ b/internal/thintest/research_pages_test.go |
| @@ -79,7 +79,8 @@ func TestResearchSourcesCardPage(t *testing.T) { |
| t.Fatalf("URL %s not shown in full:\n%s", u, c) |
| } |
| } |
| - if strings.Contains(c, "<a ") || strings.Contains(c, "href=") { |
| + // Local project-correction links do not authorise reading a source URL. |
| + if strings.Contains(c, `href="http`) || strings.Contains(c, `href="//`) { |
| t.Fatalf("the card links a URL:\n%s", c) |
| } |
| noRemoteLoads(t, "the sources card", c) |
diff --git a/internal/thintest/rows_pages_test.go b/internal/thintest/rows_pages_test.go| index 01ce90df..47dba2c9 100644 |
| --- a/internal/thintest/rows_pages_test.go |
| +++ b/internal/thintest/rows_pages_test.go |
| @@ -64,7 +64,7 @@ func TestPagesTaskRows(t *testing.T) { |
| } |
| // The project, the stepper's words, who and from where, the age. |
| retry := taskRow(t, tasks, f.retry) |
| - for _, want := range []string{`<a equipo-trow-proj href="/projects/` + r.task(f.retry).ProjectID + `">`, "<span>Woodstar</span>", |
| + for _, want := range []string{`data-placement-task="` + f.retry + `"`, `href="/tasks/` + f.retry + `/move"`, `<span equipo-project-name>Woodstar</span>`, |
| `role="img" aria-label="Step 3 of 6"`, ">Stopped: the model connection failed</p>", |
| "<span data-short>Conversation, ", "<span data-long>From your conversation, ", ">You</span>", "equipo-ago data-at=", `aria-label="More actions"`, |
| `href="/conversation?about=` + f.retry + `" data-ask-about>Ask about this</a>`} { |