Skip to content

Reactions: react to the message named, the original or an add-to batch - #69

Open
markmnl wants to merge 1 commit into
mainfrom
reactions-per-message
Open

markmnl wants to merge 1 commit into
mainfrom
reactions-per-message

Conversation

@markmnl

@markmnl markmnl commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Makes POST /fmsg/:id/react follow FMSG-005 as written. A reaction's subject is the message its pid names, which may be an add-to batch, and its to is that subject's participants. An add-to batch is a message of its own: the original's contents with a wider audience.

Behaviour:

  • :id may be an add-to batch's sha256: the reaction is to that batch.
    • psha256 is the batch's hash.
    • Recipients are the batch's participants: the message's sender and recipients, the adder, and the people it added.
  • Named by id or the message's hash: the reaction is to the message.
    • It goes to the message's participants only. Before, it also went to everyone added in any batch, who don't hold the message, so their hosts refuse it (code 6).
    • A caller who was only added holds just their batch, so for them the id still means the batch.
  • Effective reactions are per subject.
    • Items carry the message's own reactions in reactions, and each batch's in add_to[].reactions (omitted when there are none).
    • Idempotency is per subject.
    • Existing reactions are grouped by their stored psha256.
  • Lock: the per-message transaction lock (atomic) resolves a batch hash to its message. Before, it answered 404 before the handler ran.

Tests:

  • New TestReactionsPerMessage covers:
    • recipients for a reaction on the message, on the batch, and from an added recipient by id;
    • per-subject idempotency;
    • reactions and add_to[].reactions in GET.
  • Unit and quota tests are updated.
  • The full suite passes against Postgres 17.

README: documents the batch :id, the recipients and add_to[].reactions.

🤖 Generated with Claude Code

FMSG-005: a reaction's subject is the message its pid names, which may be
an add-to batch, and its to is that subject's participants. An add-to batch
is a message of its own, the original's contents with a wider audience. So:

- POST /fmsg/:id/react takes a batch's sha256 as :id, and reacts to that
  batch: psha256 is the batch hash, to is the batch's participants (the
  message's, its adder and those it added). Named by id or the message's
  hash, the reaction is to the message and goes to its participants only,
  no longer to everyone added in any batch. A caller only added has just
  their batch, so for them the id still means it.
- Effective reactions are per subject: message items carry the message's
  own in reactions and each batch's in add_to[].reactions. Idempotency is
  per subject too.
- The per-message transaction lock resolves a batch hash to its message.

Co-authored-by: Claude Opus 5.5 <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