Repository navigation
Allow a sent message to be purged on purpose - #51
Merged
Merged
Conversation
protect_msg_parts lets a transaction that sets fmsg.purge (SET LOCAL fmsg.purge = 'on') delete a sent message's parts, so the message can be removed from the host. Once its row is gone, a reply to it is rejected as parent not found. Without the setting, sent messages stay immutable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets an API delete a stored message for good, so that a later reply to it is rejected as parent not found (code 6). This is for a "delete forever" that the web API will offer once no local participant still holds the message.
protect_msg_partsnow returns early for a DELETE when the transaction has setfmsg.purge(SET LOCAL fmsg.purge = 'on'). The purger can then delete the message'smsg_to,msg_add_toandmsg_attachmentrows and themsgrow.psha256. The purger sets theirpidto NULL, which is already allowed, since pid isn't an immutable column.dd.sqlstays idempotent (create or replace).validatePidReplyPathalready rejects a reply whose parent hash isn't stored.Test:
TestPurgeRemovesSentMessagechecks that a purge transaction removes the message (it's no longer found by hash), that its reply keeps its parent hash withpidNULL, and that deleting outside a purge is still refused. The full suite passes against Postgres 17.🤖 Generated with Claude Code