Repository navigation
Conversation
Add SQL-backed retention stores, a purge job scheduler, and database tables for persistent policy storage, enforcement audit logging, and legal holds. Changes: - Create db/migrations/010_data_retention_purge_jobs.sql: retention_policies, retention_enforcement_log, and retention_legal_holds tables with seed data for default policies. Includes -- @down rollback section. - Create backend/gdpr/postgresRetentionStore.ts: implements RetentionDataStore against PostgreSQL with findExpired (excluding legal holds), deleteRecords, anonymizeRecords, and archiveRecords. Factory for default SubTrackr tables. - Create backend/gdpr/purgeJobScheduler.ts: coordinates DataRetentionService, PostgresRetentionStores, and RetentionEnforcementJob. Loads persistent policies from DB on startup, logs enforcement results to audit table. - Create backend/gdpr/__tests__/postgresRetentionStore.test.ts: 11 test cases covering findExpired, delete, anonymize, archive, empty arrays, custom columns, and factory. - Create backend/gdpr/__tests__/purgeJobScheduler.test.ts: 7 test cases covering construction, start/stop, idempotency, DB failure handling, manual enforcement, and report persistence. - Export new types from backend/gdpr/index.ts - Create docs/DATA_RETENTION.md: architecture, policies, legal holds, scheduling, REST API, and configuration reference Acceptance criteria: - [x] Policies documented — docs/DATA_RETENTION.md with 4 default policies, actions, and configuration - [x] Jobs scheduled — PurgeJobScheduler runs RetentionEnforcementJob every 24h with configurable interval - [x] Tested — 18 new test cases covering store operations and scheduler
|
@favvy0217 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! 🚀 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #1799
Add SQL-backed retention stores, a purge job scheduler, and database tables for persistent policy storage, enforcement audit logging, and legal holds.
Changes
db/migrations/010_data_retention_purge_jobs.sql: retention_policies, retention_enforcement_log, and retention_legal_holds tables with seed data for default policies. Includes -- @down rollback section.backend/gdpr/postgresRetentionStore.ts: implements RetentionDataStore against PostgreSQL with findExpired (excluding legal holds), deleteRecords, anonymizeRecords, and archiveRecords. Factory for default SubTrackr tables.backend/gdpr/purgeJobScheduler.ts: coordinates DataRetentionService, PostgresRetentionStores, and RetentionEnforcementJob. Loads persistent policies from DB on startup, logs enforcement results to audit table.backend/gdpr/__tests__/postgresRetentionStore.test.ts: 11 test casesbackend/gdpr/__tests__/purgeJobScheduler.test.ts: 7 test casesbackend/gdpr/index.tsdocs/DATA_RETENTION.md: architecture, policies, legal holds, scheduling, REST API, and configuration referenceAcceptance Criteria
Default Policies