You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
campaign delete reports success but leaves the campaign, its sends and its leads in the database #4
Hi! First off, thanks for cold-cli. The agent-first design is exactly what I was looking for, and the SMTP/IMAP path works nicely with a plain mailbox.
I hit something while cleaning up after a test run.
What happens
campaign delete prints success, but only removes the campaign_leads association. Everything else stays:
the campaigns row itself
its scheduled_sends and email_messages
the leads, email addresses included
Because the association is gone, campaign list then shows the campaign with leads: 0, which makes it look half-deleted rather than not deleted.
Reproduce
cold-cli campaign create --name probe --sequence sequence.yml \
--leads leads.csv --accounts me@example.com
cold-cli campaign activate probe
cold-cli tick # one send goes out
cold-cli campaign delete probe # prints: Deleted campaign "probe" (id=N)
cold-cli campaign list # still there, status completed, leads: 0
sqlite3 ~/.cold-cli/data.db 'select id,name,status from campaigns; select count(*) from leads;'
A campaign deleted before any send does disappear from campaign list, but its leads stay in the leads table either way.
Possible cause
The foreign keys pointing at campaigns are all ON DELETE NO ACTION:
So once sends exist the delete can't proceed, and the error doesn't seem to reach the exit status or the output.
Why it matters to me
Leads are contact data. Deleting a campaign looks like a reasonable way to honour a "please delete my data" request, and right now it silently isn't. I'd also expect a non-zero exit code when nothing was deleted, since scripts and agents key off that.
Happy to send a PR if you'd like: ON DELETE CASCADE on those FKs plus a --purge-leads flag would cover it, but it's your call on whether leads should survive by design.
Version: built from 68a6defb29cc, Go 1.27.1, Linux, SQLite backend.
Activity