Skip to content

fix(db): age-prune webhook_events via RETENTION_POLICY#8430

Closed
marktech0813 wants to merge 1 commit into
JSONbored:mainfrom
marktech0813:fix/8381-webhook-events-retention
Closed

fix(db): age-prune webhook_events via RETENTION_POLICY#8430
marktech0813 wants to merge 1 commit into
JSONbored:mainfrom
marktech0813:fix/8381-webhook-events-retention

Conversation

@marktech0813

Copy link
Copy Markdown
Contributor

Summary

Fixes #8381

Test plan

  • npx vitest run test/unit/retention.test.ts
  • npx vitest run test/unit/selfhost-d1-size-probe.test.ts

Made with Cursor

Complete the unfinished JSONbored#3896 retention coverage so inbound webhook
delivery rows stop growing unbounded and the D1 size probe monitors them (JSONbored#8381).

Co-authored-by: Cursor <cursoragent@cursor.com>
@marktech0813
marktech0813 requested a review from JSONbored as a code owner July 24, 2026 12:52
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.60%. Comparing base (191db76) to head (6824855).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #8430       +/-   ##
===========================================
+ Coverage   79.34%   89.60%   +10.26%     
===========================================
  Files         791       98      -693     
  Lines       79289    22763    -56526     
  Branches    23950     3892    -20058     
===========================================
- Hits        62909    20396    -42513     
+ Misses      13305     2187    -11118     
+ Partials     3075      180     -2895     
Flag Coverage Δ
shard-1 70.17% <ø> (+12.41%) ⬆️
shard-2 96.49% <ø> (+48.80%) ⬆️
shard-3 12.28% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/db/retention.ts 96.49% <ø> (ø)

... and 693 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-24 13:15:23 UTC

3 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR closes out the unfinished webhook_events table from #3896 by adding a 90-day retention rule and updating the retention/D1-probe tests to match. The change is small, well-scoped, and the tests directly verify the new pruning behavior against seeded old/recent rows, including the D1 size-probe's DEFAULT_MONITORED_TABLES pickup. The prior comment claiming webhook_events was durable/excluded is now correctly removed since the table is genuinely append-only idempotency history.

Nits — 4 non-blocking
  • src/db/retention.ts:29 — the 90 is inline; the other rules in the array use inline day literals too so this is consistent with existing style, but a named constant would make the shared 90d window across audit_events/ai_usage_events/webhook_events more explicit.
  • The build + boot smoke test check failed with no detail provided; given this branch is 6 commits behind default, this is more likely caused by unrelated changes that landed on default after divergence than by this diff — worth rebasing to confirm.
  • Consider extracting the repeated `90` day window into a shared constant (e.g. `STANDARD_LOG_RETENTION_DAYS`) since three rules now share it, to avoid drift if the window changes for one but not the others.
  • Rebase onto the latest default branch to see if the build+boot smoke test failure clears, given the branch is 6 commits behind.

CI checks failing

  • build + boot smoke test

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #3896, #8381
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (2 linked issues).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 98 registered-repo PR(s), 15 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor marktech0813; Gittensor profile; 98 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The diff adds webhook_events to RETENTION_POLICY (with matching test updates), closing the specific gap called out as issue #8381, and audit_events/ai_usage_events/agent_context_snapshots appear already handled per the existing policy comments — but there is no evidence in this diff that product_usage_events retention (which requires preserving PRODUCT_USAGE_RETENTION_MAX_WINDOW_DAYS for rollup co

Review context
  • Author: marktech0813
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, Go, CoffeeScript, Cuda, Java, QML
  • Official Gittensor activity: 98 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (build + boot smoke test)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

1 participant