oficina / equipo Public

Let a person close their own coordinator question: No longer needed

A coordinator question opened with ask_person only closed when the
person answered on the card, so one that became moot stayed on Needs
you for good.

POST /conversation/cards/{id}/dismiss (and /api/v1/cards/{id}/dismiss,
documented in the OpenAPI contract) resolves the person's own open
coordinator question with the dismiss choice, at the card's revision,
with the current roster checked, the audit row and the card event in
the same transaction. No message is sent and no turn starts. Another
person's card or any other kind is 404; a closed card or a stale
revision is a conflict, as the answer route does. The conversation
says the person closed it (new copy, pending). Plan task T2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 1769d64d0ea559deb31b53bc6d84f68c59c6bc80 parent 246c882
12 files changed, +384 −0
  • docs/api/equipo-v1.md +2 −0
  • docs/api/equipo-v1.openapi.json +102 −0
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +1 −0
  • internal/equipo/app.go +1 −0
  • internal/equipo/chat/http.go +27 −0
  • internal/equipo/chat/question_dismiss.go +62 −0
  • internal/equipo/chat_page.go +4 −0
  • internal/equipo/chat_roster.go +14 −0
  • internal/equipo/copy.go +1 −0
  • internal/thintest/question_dismiss_contract_test.go +161 −0
  • internal/wire/api.go +8 −0
  • internal/wire/wireschema/wireschema.go +1 −0

CI failed — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/needs-you-ux: Type  Size Avail | ext4   96G   84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.4s
ci-box: codex: fetched and verified in 3.6s
ci-box: codex-code-mode-host: fetched and verified in 1.4s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.4s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.7s
ci-box: pi: installed and verified in 7.3s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 4.7s
ci-box: file times set from content: 3774 files, 245 directories
ci-box: ready in 18.3s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
--- FAIL: TestReleaseCopyReviewed (0.09s)
    task_pages_test.go:236: COPY REVIEW REQUIRED: copy-status.py verify found copy pending review or stale bookkeeping
FAIL
rastrillo-budget/v1 ran 87ms
FAIL	amadan.net/oficina/equipo/internal/equipotest	0.233s
FAIL
make: *** [Makefile:260: copy-release-check] Error 1

amadan: step copy failed: exit status 2

amadan: job failed at step copy — its output is above, not at the tail of this log
diff --git a/docs/api/equipo-v1.md b/docs/api/equipo-v1.md
index e0400050..c172ecde 100644
--- a/docs/api/equipo-v1.md
+++ b/docs/api/equipo-v1.md
@@ -123,6 +123,8 @@ Cancel a turn in flight with `POST /api/v1/turns/{id}/cancel`. It returns `202`
Set a card aside with `POST /api/v1/cards/{id}/visibility`, sending `{"aside":true,"revision":2}`, or `false` to bring it back. It never answers, cancels or starts anything, and the card stays in Needs you. It returns `200` with the card. Its `aside` is `true` while you have set it aside. An outdated revision or a card that no longer waits on you returns `409 card_stale` with the current card.
+Close one of your own open coordinator questions without answering it with `POST /api/v1/cards/{id}/dismiss`, sending `{"revision":2}`. Nothing is sent to the coordinator and no turn starts. It returns `200` with the card, now `resolved` with `choice` `dismiss`. A card that is closed already returns `409 card_answered`, an outdated revision `409 card_stale`, both with the current card. Any other card returns `404`.
+
## Receive pushes on a device
Register the device with `POST /api/v1/push-registrations` and the device's bearer token:
diff --git a/docs/api/equipo-v1.openapi.json b/docs/api/equipo-v1.openapi.json
index a07656d5..e2ed2f7f 100644
--- a/docs/api/equipo-v1.openapi.json
+++ b/docs/api/equipo-v1.openapi.json
@@ -13876,6 +13876,97 @@
}
}
},
+ "/cards/{id}/dismiss": {
+ "post": {
+ "operationId": "post_cards_id_dismiss",
+ "summary": "Close a coordinator question you no longer need",
+ "description": "Send the card's current `revision`. Only your own open question from the coordinator closes this way. It closes unanswered: nothing is sent to the coordinator and no turn starts, and the card's `state` becomes `resolved` with `choice` `dismiss`. The answer is 200 with the card. A card that is closed already is 409 with `code` `card_answered`; a stale revision is 409 with `code` `card_stale`; both carry the card as it is now. Any other card is 404.",
+ "security": [
+ {
+ "personBearer": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "minLength": 1
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "Cache-Control": {
+ "schema": {
+ "const": "no-store"
+ }
+ }
+ },
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Card"
+ }
+ }
+ }
+ },
+ "409": {
+ "description": "Conflict: the resource as it is now",
+ "headers": {
+ "Cache-Control": {
+ "schema": {
+ "const": "no-store"
+ }
+ }
+ },
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CardConflict"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/unauthenticated"
+ },
+ "default": {
+ "description": "An error, with one of the codes in `Error`",
+ "headers": {
+ "Cache-Control": {
+ "schema": {
+ "const": "no-store"
+ }
+ }
+ },
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Error"
+ }
+ }
+ }
+ }
+ },
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DismissCard"
+ }
+ }
+ },
+ "x-maxBytes": 32768,
+ "x-rejectUnknownFields": true
+ }
+ }
+ },
"/push-registrations": {
"post": {
"operationId": "post_push_registrations",
@@ -25317,6 +25408,17 @@
],
"additionalProperties": false,
"x-go-type": "wire.Maker"
+ },
+ "DismissCard": {
+ "type": "object",
+ "properties": {
+ "revision": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ "additionalProperties": false,
+ "x-go-type": "wire.DismissCard"
}
},
"responses": {
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 900ffc18..32a6fc6b 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -7221,6 +7221,7 @@ records remain unchanged.
| `work.explore.build_note` | %s said which option to build in their own words: %s | Build task brief (dynamic specialists slice 1, 2026-11-29) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-29) |
| `chat.card.ships_settled_ships` | The merge settings now say merging to main ships to users. | Copy specialist | COPY REVIEW PENDING |
| `chat.card.ships_settled_not_ships` | The merge settings now say main is not a release. | Copy specialist | COPY REVIEW PENDING |
+| `chat.card.question_dismissed` | You closed this question. | Copy specialist | COPY REVIEW PENDING |
## Task 21
diff --git a/internal/equipo/app.go b/internal/equipo/app.go
index 3910ebc3..60c2cf57 100644
--- a/internal/equipo/app.go
+++ b/internal/equipo/app.go
@@ -410,6 +410,7 @@ func RouterWithStore(d *db.DB, cfg Config, mailer mail.Sender, logger *slog.Logg
r.Post("/conversation/cards/{id}/answer", a.chatCardAnswer)
r.Post("/conversation/cards/{id}/visibility", a.chatCardVisibility)
r.Post("/conversation/cards/{id}/reply", a.chatCardReply)
+ r.Post("/conversation/cards/{id}/dismiss", a.chatCardDismiss)
r.Post("/conversation/turns/{id}/stop", a.chatTurnStop)
r.Post("/conversation/turns/{id}/retry", a.chatTurnRetry)
if store.oficina != nil {
diff --git a/internal/equipo/chat/http.go b/internal/equipo/chat/http.go
index 218e0e35..c2f45ff3 100644
--- a/internal/equipo/chat/http.go
+++ b/internal/equipo/chat/http.go
@@ -91,6 +91,7 @@ func (h *HTTP) Mount(r chi.Router) {
r.Delete("/projects/{id}", h.bearer(h.removeProject))
r.Get("/cards/{id}", h.thinOr("GET /cards/{id}", thinCard, h.bearer(h.card)))
r.Post("/cards/{id}/answer", h.bearer(h.answer))
+ r.Post("/cards/{id}/dismiss", h.bearer(h.dismiss))
r.Post("/cards/{id}/visibility", h.bearer(h.cardVisibility))
r.Post("/push-registrations", h.bearer(h.registerPush))
r.Post("/push-registrations/activities", h.bearer(h.registerActivity))
@@ -570,6 +571,32 @@ func (h *HTTP) answer(w http.ResponseWriter, r *http.Request, p personapi.Person
writeJSON(w, 200, out)
}
+// dismiss is POST /api/v1/cards/{id}/dismiss: "No longer needed" on the
+// person's own open coordinator question. 200 with the card; 409 with
+// the card as it is when it is closed already (card_answered) or its
+// revision moved (card_stale).
+func (h *HTTP) dismiss(w http.ResponseWriter, r *http.Request, p personapi.PersonPrincipal) {
+ var in wire.DismissCard
+ if err := readJSON(r, &in); err != nil {
+ h.fail(w, r, err)
+ return
+ }
+ out, err := h.Store.DismissQuestion(r.Context(), p.Address, chi.URLParam(r, "id"), in.Revision)
+ if errors.Is(err, ErrCardConflict) {
+ code := "card_answered"
+ if out.State == wire.CardOpen {
+ code = "card_stale"
+ }
+ writeJSON(w, http.StatusConflict, wire.CardConflict{Code: code, CopyKey: "api." + code, RequestID: r.Header.Get("Idempotency-Key"), Card: out})
+ return
+ }
+ if err != nil {
+ h.fail(w, r, err)
+ return
+ }
+ writeJSON(w, http.StatusOK, out)
+}
+
func (h *HTTP) messages(w http.ResponseWriter, r *http.Request, p personapi.PersonPrincipal) {
h.messagesWith(w, r, p, h.Store.Messages)
}
diff --git a/internal/equipo/chat/question_dismiss.go b/internal/equipo/chat/question_dismiss.go
new file mode 100644
index 00000000..e02571a3
--- /dev/null
+++ b/internal/equipo/chat/question_dismiss.go
@@ -0,0 +1,62 @@
+package chat
+
+import (
+ "context"
+ "errors"
+
+ "amadan.net/oficina/equipo/internal/wire"
+ "gorm.io/gorm"
+)
+
+// auditQuestionDismissed is the audit kind of "No longer needed".
+const auditQuestionDismissed = "question.dismissed"
+
+// coordinatorQuestion reports whether c is a question the coordinator
+// raised with ask_person: a question card in the person's conversation
+// or a job thread, never a placement question (which has its own
+// answer path).
+func coordinatorQuestion(c cardRecord) bool {
+ return c.Kind == wire.CardQuestion && c.Placement == "" && wire.CoordinatorRole(c.Lane)
+}
+
+// DismissQuestion is "No longer needed" (POST /conversation/cards/{id}/
+// dismiss and /api/v1/cards/{id}/dismiss): the person closes their own
+// open coordinator question without answering it. The card is resolved
+// with the dismiss choice, audited, and its event written in the same
+// transaction; no message is sent and no turn starts. Another person's
+// card, or any card that is not such a question, is not found; a closed
+// card or a stale revision is a conflict carrying the card as it is.
+func (s *Store) DismissQuestion(ctx context.Context, person, id string, revision int64) (out wire.Card, err error) {
+ err = s.tx(ctx, func(t *txn) error {
+ if err := s.authority.CurrentPerson(ctx, t.db); err != nil {
+ return err
+ }
+ var c cardRecord
+ if err := t.db.Where("id = ? AND person = ? AND "+coordinatorRole, id, person).First(&c).Error; errors.Is(err, gorm.ErrRecordNotFound) {
+ return ErrNotFound
+ } else if err != nil {
+ return err
+ }
+ if !coordinatorQuestion(c) {
+ return ErrNotFound
+ }
+ if c.State != wire.CardOpen || c.Revision != revision {
+ v, err := t.cardView(c)
+ if err != nil {
+ return err
+ }
+ out = v
+ return ErrCardConflict
+ }
+ c.State, c.Choice = wire.CardResolved, wire.ChoiceDismiss
+ if err := t.saveCard(&c); err != nil {
+ return err
+ }
+ if err := s.authority.Audit(t.db, person, auditQuestionDismissed, c.ID); err != nil {
+ return err
+ }
+ out, err = t.cardView(c)
+ return err
+ })
+ return out, err
+}
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index 1fb057a4..9e9541cd 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -151,6 +151,10 @@ func cardView(c wire.Card, choices []string, tasks map[string]wire.Task) chatCar
}
case wire.CardQuestion:
v.Line, v.Open = c.Question, c.State == wire.CardOpen
+ if c.State == wire.CardResolved && c.Choice == wire.ChoiceDismiss {
+ // Closed by the person: "No longer needed".
+ v.Note = copyText("chat.card.question_dismissed")
+ }
case wire.CardHome:
v.Line = copyText("chat.card.home_cleared")
if c.Name != "" {
diff --git a/internal/equipo/chat_roster.go b/internal/equipo/chat_roster.go
index 1532672e..a3171d46 100644
--- a/internal/equipo/chat_roster.go
+++ b/internal/equipo/chat_roster.go
@@ -185,6 +185,20 @@ func (a *application) chatCardReply(w http.ResponseWriter, r *http.Request) {
})
}
+// chatCardDismiss is "No longer needed" on the person's own open
+// coordinator question: it closes unanswered, and the page returns where
+// it came from (Needs you, a task, a job thread or the conversation).
+func (a *application) chatCardDismiss(w http.ResponseWriter, r *http.Request) {
+ a.chatActionTo(w, r, workBack(r, r.PostFormValue("task")), func(ctx context.Context, address string) error {
+ revision, err := strconv.ParseInt(r.PostFormValue("revision"), 10, 64)
+ if err != nil {
+ return chat.ErrInvalid
+ }
+ _, err = a.store.Chat().DismissQuestion(ctx, address, chi.URLParam(r, "id"), revision)
+ return err
+ })
+}
+
func rosterTrack(t wire.Task) []trackStop {
if t.Kind == wire.KindExplore {
v := taskLine{}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 6efed1cb..e8a04fa2 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -2450,6 +2450,7 @@ var pageCopy = map[string]string{
// Needs you UX pass (needs-you-ux, 2026-11-30): settled questions.
"chat.card.ships_settled_ships": "The merge settings now say merging to main ships to users.", // COPY REVIEW PENDING
"chat.card.ships_settled_not_ships": "The merge settings now say main is not a release.", // COPY REVIEW PENDING
+ "chat.card.question_dismissed": "You closed this question.", // COPY REVIEW PENDING
// The daily roll-up (2026-11-12): earlier days on the conversation page.
"chat.day.today": "Today", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12)
diff --git a/internal/thintest/question_dismiss_contract_test.go b/internal/thintest/question_dismiss_contract_test.go
new file mode 100644
index 00000000..e7f1fb2e
--- /dev/null
+++ b/internal/thintest/question_dismiss_contract_test.go
@@ -0,0 +1,161 @@
+package thintest
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/equipo"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// "No longer needed" on a coordinator question (needs-you-ux T2): the
+// person closes their own open question without answering it. The card
+// is resolved, said so in the conversation, audited, and leaves Needs
+// you; no message is sent and no turn starts. Anyone else's card, or
+// any other card, is not found; an answered card or a stale revision is
+// a conflict, as the answer route does.
+
+func (c *Client) DismissCard(ctx context.Context, id string, revision int64) (out wire.Card, err error) {
+ return out, c.do(ctx, "POST", "/api/v1/cards/"+id+"/dismiss", wire.DismissCard{Revision: revision}, &out)
+}
+
+// openQuestion asks the person question through ask_person and returns
+// the open card. A turn asks once: ask again in a new turn (next).
+func (r *toolRig) openQuestion(key, question string) wire.Card {
+ r.t.Helper()
+ if res := r.call(key, wire.ToolAskPerson, map[string]any{"question": question}); res.Code != "asked" {
+ r.t.Fatalf("ask %+v", res)
+ }
+ var out wire.Card
+ r.wait("question "+key, func(c *Conversation) bool {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardQuestion && k.Question == question && k.State == wire.CardOpen {
+ out = k
+ return true
+ }
+ }
+ return false
+ })
+ return out
+}
+
+func (r *toolRig) cardState(id string) (state, choice string, revision int64) {
+ r.t.Helper()
+ if err := r.inst.DB.Writer().QueryRow("SELECT state, choice, revision FROM chat_cards WHERE id = ?", id).Scan(&state, &choice, &revision); err != nil {
+ r.t.Fatal(err)
+ }
+ return state, choice, revision
+}
+
+func TestContractDismissQuestion(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolCurrent)
+ owner := r.inst.Cookie()
+ q := r.openQuestion("d1", "I can't find anything called Patrix. Where does it live?")
+ if page := r.get(owner, "/tasks?needs=you", 200); !strings.Contains(page, "card="+q.ID) {
+ t.Fatal("setup: the question is not on Needs you")
+ }
+ messages, turns := r.rows("SELECT count(*) FROM chat_messages WHERE person = ?", Owner), r.rows("SELECT count(*) FROM chat_turns WHERE person = ?", Owner)
+
+ // A stale revision is a conflict: back where it came from, still open.
+ status, at := r.post(owner, "/conversation/cards/"+q.ID+"/dismiss", url.Values{"revision": {itoa(int(q.Revision + 1))}, "from": {"needs"}})
+ if state, _, _ := r.cardState(q.ID); status != http.StatusSeeOther || at != "/tasks?needs=you" || state != wire.CardOpen {
+ t.Fatalf("stale: %d %q %s", status, at, state)
+ }
+
+ // Someone else's question: not found, untouched.
+ mate := personToolRig(t, r, "mate@example.com", equipo.RoleOwner)
+ theirs := mate.openQuestion("d2", "Which login page is it?")
+ if status, _ := r.post(owner, "/conversation/cards/"+theirs.ID+"/dismiss", url.Values{"revision": {itoa(int(theirs.Revision))}}); status != http.StatusNotFound {
+ t.Fatalf("someone else's card: %d", status)
+ }
+ if _, err := r.client.DismissCard(r.ctx, theirs.ID, theirs.Revision); Status(err) != http.StatusNotFound {
+ t.Fatalf("someone else's card over the API: %v", err)
+ }
+ if state, _, _ := r.cardState(theirs.ID); state != wire.CardOpen {
+ t.Fatalf("someone else's card is %s", state)
+ }
+
+ // Not a question: not found.
+ if err := r.inst.DB.G.Exec("INSERT INTO chat_cards (id, person, kind, state, project_id, question, options, revision, created_at, updated_at, lane) VALUES ('c_ships', ?, ?, ?, '', 'Does it ship?', '[\"ships\",\"not_ships\"]', 1, datetime('now'), datetime('now'), '')", Owner, wire.CardMergeShips, wire.CardOpen).Error; err != nil {
+ t.Fatal(err)
+ }
+ if status, _ := r.post(owner, "/conversation/cards/c_ships/dismiss", url.Values{"revision": {"1"}}); status != http.StatusNotFound {
+ t.Fatalf("a ships card: %d", status)
+ }
+ if _, err := r.client.DismissCard(r.ctx, "c_ships", 1); Status(err) != http.StatusNotFound {
+ t.Fatalf("a ships card over the API: %v", err)
+ }
+
+ // Cross-site: refused, still open.
+ req, _ := http.NewRequest("POST", r.inst.URL+"/conversation/cards/"+q.ID+"/dismiss", strings.NewReader(url.Values{"revision": {itoa(int(q.Revision))}}.Encode()))
+ req.AddCookie(owner)
+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ req.Header.Set("Origin", "https://foreign.example")
+ req.Header.Set("Sec-Fetch-Site", "cross-site")
+ res, err := http.DefaultClient.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ res.Body.Close()
+ if state, _, _ := r.cardState(q.ID); res.StatusCode != http.StatusForbidden || state != wire.CardOpen {
+ t.Fatalf("cross-site: %d %s", res.StatusCode, state)
+ }
+
+ // The person's own: closed, audited, nothing sent, back on Needs you.
+ status, at = r.post(owner, "/conversation/cards/"+q.ID+"/dismiss", url.Values{"revision": {itoa(int(q.Revision))}, "from": {"needs"}})
+ if status != http.StatusSeeOther || at != "/tasks?needs=you" {
+ t.Fatalf("dismiss: %d %q", status, at)
+ }
+ if state, choice, rev := r.cardState(q.ID); state != wire.CardResolved || choice != wire.ChoiceDismiss || rev != q.Revision+1 {
+ t.Fatalf("dismissed card %s %q %d", state, choice, rev)
+ }
+ if n := r.audits("question.dismissed"); n != 1 {
+ t.Fatalf("%d audit rows", n)
+ }
+ if m, k := r.rows("SELECT count(*) FROM chat_messages WHERE person = ?", Owner), r.rows("SELECT count(*) FROM chat_turns WHERE person = ?", Owner); m != messages || k != turns {
+ t.Fatalf("dismiss sent something: messages %d→%d, turns %d→%d", messages, m, turns, k)
+ }
+ r.wait("the card event", func(c *Conversation) bool {
+ for _, k := range c.Cards {
+ if k.ID == q.ID {
+ return k.State == wire.CardResolved
+ }
+ }
+ return false
+ })
+ if page := r.get(owner, "/tasks?needs=you", 200); strings.Contains(page, "card="+q.ID) {
+ t.Fatal("the dismissed question is still on Needs you")
+ }
+ conv := r.get(owner, "/conversation", 200)
+ if i := strings.Index(conv, `id="card-`+q.ID+`"`); i < 0 || !strings.Contains(conv[i:], "You closed this question.") {
+ t.Fatal("the conversation does not show the question closed")
+ }
+
+ // Closed already: a conflict, over the page and the API.
+ if _, err := r.client.DismissCard(r.ctx, q.ID, q.Revision+1); Status(err) != http.StatusConflict {
+ t.Fatalf("dismissed twice: %v", err)
+ }
+ // Over the API, the person's own open question closes too.
+ r.next("Carry on")
+ api := r.openQuestion("d4", "Which branch?")
+ var out wire.Card
+ out, err = r.client.DismissCard(r.ctx, api.ID, api.Revision)
+ if err != nil || out.State != wire.CardResolved || out.Choice != wire.ChoiceDismiss {
+ t.Fatalf("API dismiss %+v %v", out, err)
+ }
+ // An answered question: a conflict, still answered.
+ r.next("Look again")
+ answered := r.openQuestion("d3", "Is it the web app?")
+ if _, err := r.client.Answer(r.ctx, answered.ID, "Yes, the web app", answered.Revision); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := r.client.DismissCard(r.ctx, answered.ID, answered.Revision+1); Status(err) != http.StatusConflict {
+ t.Fatalf("an answered card: %v", err)
+ }
+ if state, _, _ := r.cardState(answered.ID); state != wire.CardAnswered {
+ t.Fatalf("an answered card is %s", state)
+ }
+}
diff --git a/internal/wire/api.go b/internal/wire/api.go
index 3cb825ea..82777043 100644
--- a/internal/wire/api.go
+++ b/internal/wire/api.go
@@ -414,6 +414,14 @@ type Card struct {
Aside bool `json:"aside,omitempty"`
}
+// DismissCard is the body of POST /api/v1/cards/{id}/dismiss: "No
+// longer needed" on the person's own open coordinator question, at the
+// card's current revision. The card closes unanswered: nothing is sent
+// and no turn starts.
+type DismissCard struct {
+ Revision int64 `json:"revision"`
+}
+
// AnswerCard is the body of POST /api/v1/cards/{id}/answer. Revision must
// be the card's current revision.
type AnswerCard struct {
diff --git a/internal/wire/wireschema/wireschema.go b/internal/wire/wireschema/wireschema.go
index 9d0924bf..bdd4297a 100644
--- a/internal/wire/wireschema/wireschema.go
+++ b/internal/wire/wireschema/wireschema.go
@@ -130,6 +130,7 @@ var Ops = map[string]Op{
// Push and set aside (native slice 2).
"POST /cards/{id}/visibility": {wire.SetCardVisibility{}, map[string]any{"200": wire.Card{}, "409": wire.CardConflict{}}},
+ "POST /cards/{id}/dismiss": {wire.DismissCard{}, map[string]any{"200": wire.Card{}, "409": wire.CardConflict{}}},
"POST /push-registrations": {wire.RegisterPush{}, map[string]any{"200": wire.PushRegistration{}}},
"POST /push-registrations/activities": {wire.RegisterActivity{}, map[string]any{"204": nil}},