Reply to many threads at once

Merged
RO
3mo ago
+1302-5

Depends on basecamp/haystack#8631 — draft until that merges.

Bulk reply was the one email feature the SDK couldn't reach at all. HEY answers the last
replyable entry of each thread and skips threads it has no reply address for, so the
postings a caller holds are not the entries a reply goes to — only the server can work
that out.

  • BulkReplies.Draft(postingIDs) resolves them: the entries a reply would go to, each
    with its thread and that thread's recipients, plus the content HEY would start you with
    (the name tag, when every thread is on the same account).
  • BulkReplies.Send(entryIDs, content) takes those entries — or a subset, since the
    web lets you drop one — and answers the delivery: how many replies went out, whether the
    send is being held open for undo, and where to call it back.
  • BulkReplies.Undo(bulkReplyID) does that. UndoSendID pulls the id out of the URL
    for callers holding the URL rather than the delivery.

Both operations are generated; POST /bulk_replies leaves spec/excluded-routes.json.
Draft sends the postings as a query on /bulk_replies/new rather than the optional path
segment HEY also routes (/postings/replies/:ids/bulk) — same controller, same params, and
it keeps the modelled path free of the optional-segment syntax the drift gate can't match.

Undo is deliberately not modelled. HEY answers it with a redirect that an existing
server-side test pins — its own apps read it — so the SDK follows the redirect instead of
asking for a body it wouldn't get. That's why it goes through PostForm rather than a
generated operation.

Live-verified against a dev server running the haystack branch: draft two imbox threads →
the entries and recipients come back → send → the delivery. The delayed/undo path isn't
reachable there (undo send is off for the dev identity), so it's covered by the server-side
test in #8631 instead, which asserts the flag, the URL and that undoing cancels the send.

Tests cover each operation, both usage errors, and the undo URL parsing; two conformance
cases (129 pass). make check green.


Summary by cubic

Adds bulk reply to the Go SDK so apps can draft, send, and undo replies across many threads. Previously clients couldn’t bulk reply because postings don’t map to reply targets; now the server resolves targets and the SDK exposes draft/send/undo flows.

  • Models GET /bulk_replies/new.json as NewBulkReply (retries 3x on 429/503; posting_ids is a comma‑separated query) and POST /bulk_replies.json as CreateBulkReply.
  • Generates client types and methods: BulkReplyDraft, BulkReplyEntry, BulkReplyDelivery, and request/param structs; adds BulkReplies service in hey with Draft, Send, Undo, and UndoSendID.
  • Undo follows the server redirect instead of decoding JSON; UndoSendID now requires the exact /bulk_replies/{id}/undo_send URL.
  • Standardizes paths to the .json suffix for literal segments; adds conformance path tests for both operations.
  • Updates Smithy/OpenAPI, behavior model, URL routes, route coverage; removes POST /bulk_replies from excluded routes; adds unit tests.
  • No breaking changes. Depends on basecamp/haystack#8631 for server support.