Skip to content

feat: data retention policies, error severity levels and API key scope restriction - #777

Merged
ritaifeoluwa merged 6 commits into
SmartDropLabs:mainfrom
EmmanuelOchaje:feat/smartdrop-685-688-consolidated
Nov 23, 2026
Merged

ritaifeoluwa merged 6 commits into
SmartDropLabs:mainfrom
EmmanuelOchaje:feat/smartdrop-685-688-consolidated

Conversation

@EmmanuelOchaje

@EmmanuelOchaje EmmanuelOchaje commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Three fixes in one PR:

  • src/services/dataRetention.js: per-table retention policies (webhook_delivery, session, audit_logs, temp_files), each with an environment override. Invalid values fall back to the default. Adds getRetentionDays(table). Existing exports are unchanged.
    Note: audit_logs and temp_files policies are defined but not yet applied to cleanup, since findExpired() has no scan for them. Adding one would delete data, so it is left for a follow-up.
  • src/services/errorTracker.js and test/errorTracker.test.js: SEVERITY_LEVELS (info, warning, error, critical), classifyError and track(). Severity is stored on error groups and sent to Sentry (critical maps to fatal). The existing captureException assertion is loosened to objectContaining because fingerprint was already added before this change.
  • src/services/apiKeys.js: POST /keys only accepts known scopes (admin, alerts, airdrops, webhooks, default). Unknown scopes return 400 INVALID_API_KEY_SCOPE, and duplicates are removed. No route or middleware changes.

How to test

Run the existing test suite. The new error severity cases are in test/errorTracker.test.js.

Closes #685
Closes #686
Closes #688
Closes #687

@drips-wave

drips-wave Bot commented Nov 22, 2026

Copy link
Copy Markdown

@EmmanuelOchaje 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

@ritaifeoluwa
ritaifeoluwa merged commit 9fae2b4 into SmartDropLabs:main Nov 23, 2026
2 of 4 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

2 participants