oficina / equipo Public

chat: mark a refused taste card among earlier days' open cards

Follow-up review of M6. Only today's feed (view.Messages) got the
card_failed marker; an unanswered taste card from an earlier day
stands in the open cards above it (view.Open), so a scriptless third
feel there returned with no inline error. markCardFailed now runs on
view.Open too.

Test (RED first):
  go test ./internal/equipo/ -run TestTasteFormTooManyFeelsInline
    (new subtest "earlier day": the card created 30 hours ago)
    RED: "the card is not shown again with its error ..."
    GREEN: ok (both subtests)
Mutation: not marking view.Open is the RED above.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 6b13c23314cefd012e220950bb0952f41601ab04 parent bd12852
2 files changed, +15 −2
  • internal/equipo/chat_page.go +5 −1
  • internal/equipo/taste_form_test.go +10 −1
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index da7e325f..6cd99711 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -490,7 +490,11 @@ func (a *application) chatPage(w http.ResponseWriter, r *http.Request) {
return
}
view.Messages = feedLines(win.Messages, win.Cards, choices, tasks, loc)
- markCardFailed(view.Messages, r.URL.Query().Get("card_failed"))
+ // The refused card is where it stands open: today's feed, or the
+ // open cards of earlier days above it.
+ failed := r.URL.Query().Get("card_failed")
+ markCardFailed(view.Messages, failed)
+ markCardFailed(view.Open, failed)
// Nothing can answer: no turn shows the thinking line or a timer
// until an attempt starts on a connection. A turn waiting for one, and
// any queued behind it, get a quiet status under the person's message;
diff --git a/internal/equipo/taste_form_test.go b/internal/equipo/taste_form_test.go
index 2bc914b6..90604152 100644
--- a/internal/equipo/taste_form_test.go
+++ b/internal/equipo/taste_form_test.go
@@ -7,6 +7,7 @@ import (
"net/url"
"strings"
"testing"
+ "time"
"amadan.net/oficina/equipo/internal/equipo/identity"
"amadan.net/rastrillo/rastrillo/auth"
@@ -20,6 +21,14 @@ import (
// inline (roster.failed, no new words). A scripted answer keeps its 422,
// which chat-stream.js shows inline itself.
func TestTasteFormTooManyFeelsInline(t *testing.T) {
+ t.Run("today", func(t *testing.T) { tasteFormInline(t, 0) })
+ // Follow-up review: an unanswered card from an earlier day stands
+ // in the open cards above today's feed (view.Open), not in today's
+ // messages; it is marked there too.
+ t.Run("earlier day", func(t *testing.T) { tasteFormInline(t, -30*time.Hour) })
+}
+
+func tasteFormInline(t *testing.T, age time.Duration) {
r := newPreviewPassRig(t)
exec := func(q string, args ...any) {
t.Helper()
@@ -27,7 +36,7 @@ func TestTasteFormTooManyFeelsInline(t *testing.T) {
t.Fatal(e)
}
}
- now := r.s.Chat().Now()
+ now := r.s.Chat().Now().Add(age)
exec("INSERT INTO chat_cards(id,person,kind,state,turn_id,question,options,revision,created_at,updated_at,lane) VALUES('c_taste',?,'design_taste','open','','A few questions','[\"use\",\"skip\"]',1,?,?,'')", r.principal.Address, now, now)
exec("INSERT INTO chat_taste_asks(card_id,person,project_id,turn_id,state,feels,words,answer,created_at,updated_at) VALUES('c_taste',?,'p_preview','','asked','[\"Calm\",\"Bold\",\"Warm\"]','','',?,?)", r.principal.Address, now, now)
app := &application{store: r.s, origin: r.s.personOrigin}