Skip to content

feat(listener): add configurable event retention policy (#626) - #669

Merged
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
Abdullahi-Code9:feature/configurable-event-retention-policy
Sep 1, 2026
Merged

feat(listener): add configurable event retention policy (#626)#669
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
Abdullahi-Code9:feature/configurable-event-retention-policy

Conversation

@Abdullahi-Code9

Copy link
Copy Markdown
Contributor

Summary

Resolves #626 by making processed event metadata retention configurable (PROCESSED_EVENT_RETENTION_MS) and integrating safe periodic cleanup of expired processed_events records without interrupting active deduplication or cursor tracking.


Key Changes

  • Configurable Retention Duration: Introduced PROCESSED_EVENT_RETENTION_MS environment variable defaulting to 30 days (2592000000 ms).
  • Validation Guards: Added validation in validateConfig rejecting non-integers, non-numeric strings, and durations under 60 seconds (60000 ms).
  • Safe Expired Record Removal: Updated CleanupService to run cleanupOldEvents using SQLite UTC relative datetime offsets while leaving event_cursors intact.
  • Documentation & Unit Tests: Added coverage for configuration boundaries and cleanup invocation in config.test.ts and cleanup-service.test.ts, and updated .env.example and ENVIRONMENT_VARIABLES_AND_SECRETS.md.

Acceptance Criteria Checklist

  • Retention duration is configurable via PROCESSED_EVENT_RETENTION_MS.
  • Expired processed_events records are safely removed based on configured age.
  • Active deduplication and block cursor state remain preserved.
  • Invalid values (non-integers, < 60000 ms) are rejected during configuration loading.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Abdullahi-Code9 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Abd-Standard
Abd-Standard merged commit 85f36a4 into Core-Foundry:main Sep 1, 2026
1 of 9 checks passed
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.

Add Configurable Event Retention Policy

2 participants