oficina / equipo Public

Keep ended Copy holds out of interactive conversation cards

Paul Campbell pushed by paul@keymail.dev f6a454831430ab6e05ece0e0113b2912b0365a70 parent 81ad2ee
6 files changed, +29 −4
  • .rastrillo/budgets.txt +2 −2
  • internal/equipo/chat/roster.go +3 −0
  • internal/equipo/chat/roster_test.go +10 −0
  • internal/equipo/chat_page.go +4 −1
  • internal/equipo/chat_roster.go +1 −1
  • internal/equipo/work_views_test.go +9 −0

CI passed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index d08d2447..34f5a765 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 20238 - The web view models and templates share rendering; Roster adds bylines, reports, private sub-chat views and the Stop route. Measured 20238 source lines.
+size internal/equipo 20241 - The web view models and templates share rendering; Roster adds bylines, reports, private sub-chat views and the Stop route. Measured 20241 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);
@@ -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 28393 - The transactional conversation store shares authority and dispatch helpers; Roster adds independent personal visibility and links card replies to existing turns. Measured 28393 source lines.
+size internal/equipo/chat 28396 - The transactional conversation store shares authority and dispatch helpers; Roster adds independent personal visibility and links card replies to existing turns. Measured 28396 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.
diff --git a/internal/equipo/chat/roster.go b/internal/equipo/chat/roster.go
index e7e4eb6a..cca934cf 100644
--- a/internal/equipo/chat/roster.go
+++ b/internal/equipo/chat/roster.go
@@ -74,6 +74,9 @@ func (s *Store) SetCardAside(ctx context.Context, person, id string, revision in
if err != nil {
return err
}
+ if wire.FinalStage(k.Stage) || k.CancelRequested {
+ return ErrCardConflict
+ }
v, err := t.taskView(k)
if err != nil {
return err
diff --git a/internal/equipo/chat/roster_test.go b/internal/equipo/chat/roster_test.go
index b2b872e9..cea7c08c 100644
--- a/internal/equipo/chat/roster_test.go
+++ b/internal/equipo/chat/roster_test.go
@@ -99,3 +99,13 @@ func TestRosterCopyCoverageKeepsUnknown(t *testing.T) {
t.Fatalf("coverage: %+v", got.Coverage)
}
}
+
+func TestRosterFinalCopyCannotBeSetAside(t *testing.T) {
+ r := copyPendingRig(t, wire.StepQueued, "copy_budget")
+ r.exec("UPDATE chat_tasks SET stage='cancelled',copy_hold=1 WHERE id='tkcopy'")
+ c := cardRecord{ID: "c_final_copy", Person: hkOwner, Kind: wire.CardTask, TaskID: "tkcopy", State: wire.StageInReview, Revision: 1, Options: "[]", CreatedAt: r.now, UpdatedAt: r.now}
+ r.must(r.s.db.G.Create(&c).Error)
+ if err := r.s.SetCardAside(r.ctx, hkOwner, c.ID, 1, true); !errors.Is(err, ErrCardConflict) {
+ t.Fatalf("ended Copy hold was hidden: %v", err)
+ }
+}
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index bd69fd4e..c2461c87 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -240,6 +240,9 @@ func cardView(c wire.Card, choices []string, tasks map[string]wire.Task) chatCar
if t, ok := tasks[c.TaskID]; ok {
// A task card sits in its creator's own conversation.
pt, dropped := pageTask(t)
+ if wire.FinalStage(pt.Stage) {
+ pt.CopyHold, pt.CopyCanSkip = false, false
+ }
line := taskLineOf(pt, t.Creator)
line.MergeDropped = dropped
line.richOf(pt, t.Creator, nil, t.UpdatedAt)
@@ -262,7 +265,7 @@ func cardView(c wire.Card, choices []string, tasks map[string]wire.Task) chatCar
v.HoldReason = reasonLine(s.Reason, "work.reason.other")
}
}
- v.Task, v.Line, v.Open = &line, t.Title, line.Retry || line.Cancel || line.Merge || line.Recover || t.CopyCanSkip || t.CopyHold
+ v.Task, v.Line, v.Open = &line, t.Title, line.Retry || line.Cancel || line.Merge || line.Recover || line.CopyCanSkip || line.CopyHold
for _, step := range t.Steps {
if step.Specialist == wire.SpecialistResearch && step.Research != nil {
report := researchOf(t.ID, *step.Research)
diff --git a/internal/equipo/chat_roster.go b/internal/equipo/chat_roster.go
index 54e3f994..e640db2b 100644
--- a/internal/equipo/chat_roster.go
+++ b/internal/equipo/chat_roster.go
@@ -21,7 +21,7 @@ func (v *chatCard) rosterAuthor(tasks map[string]wire.Task) {
if v.Kind == wire.CardResearchSources || v.Kind == wire.CardResearchInventory {
who = wire.SpecialistResearch
}
- if t.CopyHold || t.CopyCanSkip {
+ if !wire.FinalStage(t.Stage) && (t.CopyHold || t.CopyCanSkip) {
who, v.Verb = wire.SpecialistCopy, copyText("roster.holds")
}
v.Author = specialistName(who)
diff --git a/internal/equipo/work_views_test.go b/internal/equipo/work_views_test.go
index 3a6a3521..f15e8ef0 100644
--- a/internal/equipo/work_views_test.go
+++ b/internal/equipo/work_views_test.go
@@ -120,3 +120,12 @@ func TestTaskSummaryWaitsOnce(t *testing.T) {
t.Fatalf("fallback %q", got)
}
}
+
+func TestRosterCancelledHoldIsReport(t *testing.T) {
+ task := wire.Task{ID: "tk_roster", Title: "Cancelled work", Creator: "owner@example.com", Stage: wire.StageCancelled, CopyHold: true}
+ v := cardView(wire.Card{ID: "c_roster", Kind: wire.CardTask, TaskID: task.ID}, nil, map[string]wire.Task{task.ID: task})
+ v.Receipt = true
+ if v.Interactive() || v.Task.CopyHold {
+ t.Fatal("cancelled task still asks about its old Copy hold")
+ }
+}