Repository navigation
Let staff remove mistaken documents from partner and account records - #148
Merged
Merged
Conversation
…al; recommend HubSpot service keys Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndo, clearer HubSpot states 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.
Staff can now remove a document attached to a partner or account by mistake, to the wrong record, or superseded by a corrected copy.
Behaviour
contract:write, on a real staff session with MFA.Why removal rather than erasure
Attachments are retained evidence (migration 001482): append-only rows and bytes protected from cleanup. Removal is an audited state (migration 001484): the row, its original details and the bytes stay; the service role may update only the removal columns (column grant + trigger), each change advances the document's version so stale removals/restores are refused, and
account.document_removed/account.document_restoredevents record the reason. Purging bytes remains a support operation under the retention rules.HubSpot interplay
files.ui_hidden.read, needed for note attachments.Tests
pgTAP (column grants, trigger, dedupe ignoring removed rows, restore duplicate), DB integration (remove → retry → re-attach → restore conflict → restore, evidence kept, audit trail), UI (reason required, undo, history, version conflict).
🤖 Generated with Claude Code