Skip to content

Phase 6a: ticket retention, summary then purge - #1944

Merged
neuromechanist merged 9 commits into
feature/issue-1893-epic-email-cffrom
feature/issue-1943-phase6a-retention
Oct 24, 2026
Merged

neuromechanist merged 9 commits into
feature/issue-1893-epic-email-cffrom
feature/issue-1943-phase6a-retention

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Maintainer decision (2026-10-24): after the retention period only a summary of a support ticket is kept; everything else is removed. 730 days in production, 30 on staging, matching the raw-mail lifecycle rules.

  • Summary: PUT /admin/mail/tickets/:id/summary and nemar admin mail summarize <id>, under the same visibility predicate as every ticket route. The nemarAdmin agent writes summaries for closed tickets it can see (list --needs-summary); the Worker never calls a model. Restricted tickets (security, conduct) are never shown to a model and get an owner-written summary or none. A summary containing an email address is refused (summary_has_address).
  • Purge: a daily job (MAIL_RETENTION_DAYS; missing or invalid deletes nothing) removes messages, reply keys, non-queue tags, event details, the subject, the requester's address and account link of each ticket whose last message is past the period. It keeps the id, queue, status, dates, summary and the conduct exclusion (an excluded account still cannot read the summary). Active tickets become closed; spam stays spam. It never sends mail and never touches R2. Bounded per run; idempotent.
  • After purge: actions answer 409 ticket_purged; a raw key of a purged ticket cannot be reprocessed back into existence (tombstone table); mail to a purged ticket's plus address opens a new ticket.
  • Migration 0104 (rebuilds mail_ticket_events so its CHECK allows the new summary and purged kinds). ADR 0111 retention section amended.

Closes #1943
Part of epic #1893. Gate for Phase 6 together with nemarOrg/docs#84 (privacy policy).

Test plan

  • ticket-retention (summary rules, visibility incl. excluded owner after purge, cutoff boundary, what is removed and kept, spam stays spam, idempotence, bad config deletes nothing, batch bound, reprocess tombstone), retention vars, cron wiring and allowlist pins, mail routes, cascades, migrations
  • CLI summarize, --needs-summary, purged show, escaping
  • Route inventory, export surface, typecheck, lint
  • CI

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR1944

Version: 0.10.24-PR1944.45a4331
Commit: 45a4331


🤖 Updated on each push.

The upstream-freshness epic (#1046) already holds ADR 0111 and migrations 0104-0106. This epic keeps 0102 and 0103 and moves its later numbers past theirs so both epics merge to dev without a collision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@neuromechanist
neuromechanist merged commit 322799d into feature/issue-1893-epic-email-cf Oct 24, 2026
13 of 14 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-1943-phase6a-retention branch October 24, 2026 20:51

This branch was previously deployed

1 inactive deployment
npm — 45a4331b Deployed Oct 24, 2026 by neuromechanist via publish #3927
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