Translate posta.text/v1 at the wire boundary #21
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
posta/server!21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "wire-text-v1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
{"text":"hi"}to{"kind":"posta.text/v1","body":"hi"}before the outbox loop signs it, so the wire payload is the canonical SPEC §13.2 form.renderMessage(REST list, search) andpublishInbound(SSE) unwrapposta.text/v1back to{"text":"hi"}, so TUI/iOS see the shape they already render.{"text":"hi"}rows and unknown wire kinds pass through unchanged — Wrap/Unwrap are deliberately tolerant so existing data is unaffected and peers running ahead of us on §13 stay readable.Test plan
go test ./...PendingOutbound[0].Payload == {"kind":"posta.text/v1","body":"hi"}afterPOST /api/v1/messages.posta.text/v1envelope and assertsGET /messagesreturns{"text":"hello"}in the DTO.internal/payload.🤖 Generated with Claude Code
The client API keeps its ergonomic {"text":"hi"} shape, but posta-server now signs the canonical SPEC §13.2 form {"kind":"posta.text/v1","body":"hi"} on outbound and unwraps the matching kind back to {"text":"hi"} when building client DTOs (REST list, search, SSE inbound). Legacy rows and future kinds pass through unchanged, so existing data and any peer running ahead of us on §13 stay readable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>Without migration 7 the FTS5 index for posta.text/v1 rows would contain the wrapper tokens (posta, kind, body, v1), so searching for any of them would match every text message. The new triggers (and a one-shot reindex on upgrade) index COALESCE(json_extract($.body), payload), preserving legacy {"text":"hi"} rows while restoring useful search for the dominant text case. The SSE inbound publish path also unwraps now (daemon/runner.go) but wasn't exercised by tests; TestPublishInboundUnwrapsTextV1 closes the gap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>