Skip to content

MT-22401: correct the campaign delete precondition to draft-only - #52

Open
Rabsztok wants to merge 1 commit into
mainfrom
MT-22401-campaign-delete-draft-only
Open

MT-22401: correct the campaign delete precondition to draft-only#52
Rabsztok wants to merge 1 commit into
mainfrom
MT-22401-campaign-delete-draft-only

Conversation

@Rabsztok

@Rabsztok Rabsztok commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Motivation

MT-22401

The deleteEmailCampaign description says the campaign "must not be in a sending state", which is weaker than what the API enforces: only a campaign in the draft state can be deleted. Anything else returns 422.

This spec is the source of truth the SDKs are documented against, so the inaccurate wording was copied verbatim into all nine of them (and into example scripts that deleted a campaign after starting it, which would 422). Those are being corrected in the SDK PRs; this fixes the source.

Changes

  • Document the delete precondition as draft-only, matching the wording the updateEmailCampaign operation already uses for the same rule
  • Note that cancel/reset return a scheduled campaign to draft, and that a started campaign has no path back and can no longer be deleted

How to test

  • Open the Email Campaigns reference on docs.mailtrap.io and verify the Delete operation states that only draft campaigns can be deleted
  • Verify the description matches the Update operation's existing draft-only wording

Summary by CodeRabbit

  • Documentation
    • Clarified that only draft email campaigns can be deleted.
    • Documented errors returned when attempting to delete scheduled or sending campaigns.
    • Clarified campaign status transitions, including how scheduled campaigns can be reset.

Decisions:
- The backend allows deleting only a campaign in the draft state, not merely a
  non-sending one, so the previous wording understated the constraint
- Mirror the update operation's phrasing, which already documents the same rule
- Point at cancel/reset as the way back to draft from scheduled; a started
  campaign has no path back and can no longer be deleted
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bfdad741-ad79-4c84-8c5c-dfbc6297a469

📥 Commits

Reviewing files that changed from the base of the PR and between ef45363 and 0966d64.

📒 Files selected for processing (1)
  • specs/email-campaigns.openapi.yml

📝 Walkthrough

Walkthrough

The delete campaign endpoint documentation now restricts deletion to draft campaigns. It documents 422 responses for scheduled and sending campaigns and describes valid transitions for scheduled campaigns.

Changes

Campaign deletion documentation

Layer / File(s) Summary
Delete endpoint contract
specs/email-campaigns.openapi.yml
The endpoint description now limits deletion to draft campaigns, documents 422 responses for scheduled and sending campaigns, and describes cancel or reset transitions for scheduled campaigns.

Estimated code review effort: 2 (Simple) | ~5 minutes

Mergeability Score: ⚪ Minimal · up to 0966d

This localized documentation correction introduces no actionable merge-blocking risk; the PR is merge-ready after normal specification checks.

Suggested reviewers: mklocek

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the campaign delete precondition change and matches the main purpose of the pull request.
Description check ✅ Passed The description covers the motivation, changes, and testing steps; the optional Images and GIFs section is omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Rabsztok
Rabsztok marked this pull request as ready for review August 13, 2026 09:46
@Rabsztok
Rabsztok requested review from IgorDobryn and izikaj August 13, 2026 09:47
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.

3 participants