Skip to content

feat: add replay retention and deletion protection#44

Merged
JustinDevB merged 11 commits into
JustinDevB:devfrom
DriftN2Forty:feat/auto-purge-retention-plan
May 1, 2026
Merged

feat: add replay retention and deletion protection#44
JustinDevB merged 11 commits into
JustinDevB:devfrom
DriftN2Forty:feat/auto-purge-retention-plan

Conversation

@DriftN2Forty
Copy link
Copy Markdown
Collaborator

Summary

This branch adds replay deletion protection and automatic retention cleanup across the storage layer, public API, commands, configuration, and documentation.

The core goal is to let administrators protect important replays from both manual deletion and retention cleanup, while allowing old unprotected replays to be removed automatically using a configurable policy.

What changed

Storage and replay metadata

  • Added explicit delete/protection result contracts with ReplayDeleteResult and ReplayProtectionResult.
  • Added ReplaySummary metadata so higher layers can reason about replay age, size, storage type, and protection state without loading the full replay.
  • File storage now persists replay protection metadata in sidecar metadata files, including required audit fields:
    • protectedAt
    • protectedBy
  • MySQL storage now persists the same protection metadata using schema-backed columns and migration logic.
  • Replay deletion enforcement now happens in storage, so protected replays cannot be removed accidentally by higher-level code paths.

Public API and manager orchestration

  • Extended ReplayManager with:
    • listSavedReplaySummaries()
    • protectSavedReplay(...)
    • unprotectSavedReplay(...)
  • Changed deleteSavedReplay(...) to return ReplayDeleteResult instead of a boolean, so callers can distinguish:
    • deleted
    • protected
    • not found
  • Updated ReplayManagerImpl to map storage results cleanly and only refresh caches when a replay is actually removed.

Retention service

  • Added a new retention service and policy model to support automatic replay cleanup.
  • Added parsing and validation for retention durations such as 30d, 1h, 15m, and 30s.
  • Added scheduled retention scans through the plugin lifecycle.
  • Retention only deletes expired replays that are not protected.
  • Protection is therefore enforced consistently for both manual deletion and automated retention.

Commands and user-facing behavior

  • Added:
    • /replay protect <name>
    • /replay unprotect <name>
  • Updated /replay delete <name> to surface protected/not-found/deleted outcomes explicitly.
  • Updated /replay list to render protected replays with a dedicated highlight color.
  • The highlight color is configurable and defaults to gold so protected entries stand out without reading as an error state.
  • Left tab-completion suggestions uncolored because command suggestions are not a reliable surface for color-coding.

Configuration

  • Added retention configuration keys for enabling cleanup, max age, check interval, delete failure behavior, and deletion logging.
  • Added list configuration for page size and protected replay highlight color.
  • Normalized the list settings under proper-case keys:
List:
  Page-Size: 10
  Protected-Highlight-Color: "&6"
  • Kept config version at 3 because v3 has not been published yet.
  • Added migration handling for unpublished intermediate key forms so the plugin upgrades cleanly from:
    • root legacy keys such as list-page-size
    • lowercase grouped keys such as list.page-size
  • Fixed config rewrite cleanup so migrated lowercase list: roots do not leave behind empty sections.

Documentation

  • Added and refined planning documents for retention and auto-purge implementation.
  • Updated the public API documentation to reflect the new replay management contract.
  • Updated the README and changelog to cover protection, retention, commands, and config changes.

Testing

Validated with the full Maven test suite:

  • mvn test
  • Result: 400 tests run, 0 failures, 0 errors

Notes for review

Please pay particular attention to these areas:

  1. Storage-layer enforcement of protection state in both file and MySQL backends.
  2. Public API contract changes around replay deletion results.
  3. Config migration behavior for unpublished v3 layouts, especially legacy list key rewrites.
  4. Retention scheduler behavior and protection-aware deletion semantics.

@JustinDevB JustinDevB merged commit bcbb4e2 into JustinDevB:dev May 1, 2026
1 check passed
@DriftN2Forty DriftN2Forty deleted the feat/auto-purge-retention-plan branch May 1, 2026 01:46
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.

2 participants