Skip to content

FMSG-008 edits: edit route, edited message fields, edit event - #67

Merged
markmnl merged 1 commit into
mainfrom
fmsg-008-edits
Nov 11, 2026
Merged

markmnl merged 1 commit into
mainfrom
fmsg-008-edits

Conversation

@markmnl

@markmnl markmnl commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Implements FMSG-008 Edits as specified for clients by FMSG-003 v0.5.0.

What changes

  • POST /fmsg/:id/edit with {"data": "<complete new body>"}; null reverts. Author only, sent and non-terminal messages only. The server derives the edit document and sends one edit message for the original and one per add-to batch (to the recipients that batch added). Idempotent when the effective data would not change.
  • Message objects gain edit (this message is an edit message, so clients hide it) and edited ({id, time, size} of the edit in force, or null).
  • The server applies the effective edit on read: short_text, GET /fmsg/:id/data (?original=true for the original), GET /fmsg/:id/thread and /thread/messages (body cached under the edit message's hash).
  • An arriving edit is pushed as an edit WebSocket event carrying the refreshed subject, never as new_msg, and sends no Web Push.
  • internal/edit: the edit-document codec (check, apply with a size limit checked before allocation, and a prefix/suffix diff that never exceeds a full replacement).
  • FMSG-005 v0.1.1: reacting to a message sent only to oneself now addresses the reaction to the caller instead of returning 409.

No schema change.

Notes

  • An edit-shaped message from a non-author, or with a malformed edit document, is an ordinary message and never becomes the effective edit.
  • As with replies and reactions, the edit is refused with 409 if a remote recipient host does not hold the subject.
  • Clients that do not yet check edit will show edit messages as small binary messages in lists once someone uses the route.

Testing
go test -race ./... passes against PostgreSQL 17, including new integration tests for the edit lifecycle, refusals, forged and malformed edits, add-to recipients, and notes to self.

🤖 Generated with Claude Code

Implements FMSG-003 v0.5.0. The caller supplies the complete new body; the
server derives a copy/insert edit document and sends one edit message for the
original and one per add-to batch. Reads present the effective edit:
short_text, the data route (original=true for the original) and both thread
routes. Edit messages are flagged, routed as an edit event rather than
new_msg, and trigger no Web Push.

Also FMSG-005 v0.1.1: a reaction to a message sent only to oneself is
addressed to the caller instead of being refused.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant