fix(db): exclude webhook_events from destructive retention policy - #666
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
gittensory · advisory review Reviewed 2 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | dd220eb | Commit Preview URL Branch Preview URL |
Jun 14 2026, 02:15 PM |
Every table originally flagged as unbounded in #3896 except one turned out already handled: audit_events/ai_usage_events/product_usage_events already have cron-scheduled retention via RETENTION_POLICY (the original audit's grep for literal .delete() calls missed the dynamic DELETE FROM ${table} SQL this module uses), and webhook_events is deliberately excluded per a prior fix (#666) since GitHub can redeliver a webhook long after the original event and this table is the idempotency record that detects that -- adding it back would reintroduce that fixed bug. agent_context_snapshots (one payloadJson blob per agent run, capped only by a per-runId .limit(50) READ, never deleted) was genuinely the only unaddressed table. Add it to RETENTION_POLICY with a 30-day window, reusing the existing generic prune mechanism. Closes #3896
Motivation
Description
webhook_eventsfrom theRETENTION_POLICYinsrc/db/retention.tsso replay-prevention state is not eligible for destructive pruning.src/db/retention.ts.test/unit/retention.test.tsto assert thatwebhook_eventsis excluded from dry-run results, scheduled pruning, and the preview route, and to exercise pruning logic againstai_usage_eventsinstead ofwebhook_events.Testing
test/unit/retention.test.tswithnpm test -- --run test/unit/retention.test.ts; all tests passed.npm run typecheck; it completed with no errors.webhook_eventsis no longer targeted by the default retention policy.Codex Task