Repository navigation
feat: delete sequences, blocked while active, with an explicit stats warning (#148) - #164
Merged
Merged
Conversation
…removes (#148) DELETE /sequences/:id now answers 409 sequence_active for an active sequence or sending broadcast (re-checked in the delete statement). GET /sequences/:id/deletion-preview returns the enrolled-contact and sent-email counts. Media of sent emails is classified before the cascade removes the deliveries. MCP gains delete_sequence and preview_sequence_deletion. ADR 0007 records hard delete with an explicit stats warning for sequences; archive stays for broadcasts.
A row menu on the Sequences list and a Delete button on the sequence page open a confirmation that loads the deletion preview: how many contacts are enrolled and how many sent emails' stats go with it. Active sequences can't be deleted; the menu item and button say to pause first, and the dialog explains it.
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.
Closes #148
What
DELETE /sequences/:idrefuses an active sequence (or sending broadcast) with409 sequence_active. The status check is repeated in the delete statement, so a sequence started in between is kept. NewGET /sequences/:id/deletion-previewreturns{ status, blocker, enrolledCount, emailsSentCount }. Blocker codes live insrc/sequences/delete-blockers.ts, shared by REST, MCP and the dashboard, ready for Delete broadcasts (with archive for sent ones) #147's broadcast blockers.outbound_messages(delivery link set null), suppressions, contacts, and plan usage (counted fromoutbound_messages/buckets).delete_sequence(destructive) andpreview_sequence_deletion(read); parity manifest, policy and tool count (111) updated.⋯row menu on the Sequences list and a Delete button on the sequence page. Both are disabled while the sequence is active, with the reason ("Delete (pause first)" / title). The confirmation (DeleteConfirmationDialog,Loadingwhile the preview loads) states the enrolled-contact count and that the stats of N sent emails can't be recovered.sequence_deletedgainssequence_status,enrolled_count,emails_sent_count; newsequence_delete_blocked(allowlisted).sequence_activein errors, MCP tools.Tests
deleteMediamocked) even though its deliveries cascade; route 409/204/404/preview; MCP tools.bun run lint, typecheck, all suites (API with--env-file=/dev/null: 922 pass),check:drift,test:conformanceall pass.Browser e2e (real stack: fresh DB, SMTP ESP → Mailpit, MediaLit stub)
DELETEgives 409sequence_active.outbound_messagesand the 3 contacts are kept. MediaLit: the unsent email's image got a DELETE call, the sent email's image did not, and its media row is kept.Screenshots inspected (list menu disabled, page button disabled, both dialogs, list after delete).
Notes for #147 / #134
active). Delete broadcasts (with archive for sent ones) #147 addsbroadcast_sent+ archive indelete-blockers.ts/sequenceDeleteBlocker, and its own UI. The list row menu is only rendered fortype === "sequence"for now.