Skip to content

fix(api): gate the scheduled purge to production; purge deletes private data - #255

Merged
themightychris merged 4 commits into
developfrom
fix/purge-gated-and-private
Oct 15, 2026
Merged

themightychris merged 4 commits into
developfrom
fix/purge-gated-and-private

Conversation

@themightychris

Copy link
Copy Markdown
Member

Follow-up to the v0.10.2 incident: #253 shipped early and the sandbox ran the scheduled sweep against the published branch it shares with production, purging 27 spam-voted accounts there. That also showed purge never touched the private store.

  • Gate: CFP_SCHEDULED_PURGE (default "false"). Only a pod with "true" sweeps, which will be cfp-live-cluster alone. Otherwise the pod logs scheduled spam purge disabled at boot and never runs (not at ready, not on the timer). Deploy env table updated.
  • Purge deletes private data (button and sweep): PrivateStoreTx.deletePersonData removes the private profile, legacy password, password-reset tokens and account-claim requests naming the person, staged with the public delete in the same store.transact; session metadata is cleared after the commit.
  • Cleanup of earlier purges: POST /api/admin/private-data/purge-orphans (administrator; { "apply": false } counts, { "apply": true } deletes). Runs inside the API under the write lock, because the API rewrites whole private-store files from memory, so an out-of-process script would be undone. Counts only, never emails. Runbook has a console snippet.
  • Plugin now registers after the session middleware (the sweep clears session metadata).

Specs: person-lifecycle.md, api/moderation.md. Docs: deploy.md, runbook.md. Plan: plans/purge-gate-and-private-data.md. Tests: gate, deletePersonData persisted (others untouched), purge drops the private profile, cleanup admin-only / count / apply / idempotent. Gate clean; devbox with the flag unset logged "disabled" and wrote nothing.

Release: set CFP_SCHEDULED_PURGE=true in cfp-live-cluster's config in the same deploy; leave sandbox unset. After production is live, run the cleanup with Chris's OK (count first).

🤖 Generated with Claude Code

https://claude.ai/code/session_01TGqwPjt3v4eMfiHpPmCKnR

themightychris and others added 4 commits October 15, 2026 17:22
…vate data

v0.10.2's sandbox ran the sweep against the published branch it shares
with production, and purge never deleted private data. Only the
deployment with CFP_SCHEDULED_PURGE=true sweeps; purge deletes the
person's private profile, legacy password, reset tokens, claim requests
and sessions in the same transaction; an admin endpoint clears private
data left by earlier purges, counts first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGqwPjt3v4eMfiHpPmCKnR
- CFP_SCHEDULED_PURGE (default "false") must be "true" for a pod to
  sweep; otherwise it logs that the sweep is disabled.
- PrivateStoreTx.deletePersonData removes profile, legacy password,
  reset tokens and claim requests; purge stages it with the public
  delete and clears session metadata after the commit.
- POST /api/admin/private-data/purge-orphans (admin, apply: false|true)
  clears private data of people with no public record, under the write
  lock, answering counts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGqwPjt3v4eMfiHpPmCKnR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGqwPjt3v4eMfiHpPmCKnR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGqwPjt3v4eMfiHpPmCKnR
@themightychris
themightychris merged commit c1f5cc5 into develop Oct 15, 2026
1 check passed
@themightychris
themightychris deleted the fix/purge-gated-and-private branch October 15, 2026 21:30
@themightychris themightychris mentioned this pull request Oct 15, 2026
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.

1 participant