Skip to content

fix(db): bound submitter_outcome_log and alert_dedup_claims by retention policy - #10106

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-10058
Jul 31, 2026
Merged

fix(db): bound submitter_outcome_log and alert_dedup_claims by retention policy#10106
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-10058

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

fix(db): bound submitter_outcome_log and alert_dedup_claims by retention policy

Both tables are written per event with no delete path anywhere in src/, the
same class #9473 already bounded: submitter_outcome_log's only reader is
windowed, and alert_dedup_claims is a pure hourly-expiring idempotency claim.
Adds the RETENTION_POLICY entries, their RETENTION_PK_COLUMN/composite-PK
mapping, and the paired leading-column index migration.

Closes #10058

…ion policy

Both tables are written per event with no delete path anywhere in src/, the
same class JSONbored#9473 already bounded: submitter_outcome_log's only reader is
windowed, and alert_dedup_claims is a pure hourly-expiring idempotency claim.
Adds the RETENTION_POLICY entries, their RETENTION_PK_COLUMN/composite-PK
mapping, and the paired leading-column index migration.
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 31, 2026 07:15
@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-31 07:46:36 UTC

3 files · 1 AI reviewer · no blockers · readiness 73/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR extends the established #9473 retention pattern to two more per-event tables (submitter_outcome_log, alert_dedup_claims), adding RETENTION_POLICY entries, PK/composite-PK mappings, a paired leading-column index migration, and thorough regression tests (window pinning, batched-delete PK fallback, and the CURRENT_TIMESTAMP-format seeding needed because these two writers omit the timestamp column). The migration is index-only (CREATE INDEX IF NOT EXISTS), so no schema/migration parity concern, and it follows the 0193/0196 precedent cited in the file. The change closes #10058 and mirrors the exact shape of prior additions in this same file, including correctly classifying submitter_outcome_log's composite PK vs alert_dedup_claims' genuine single-column id.

Nits — 4 non-blocking
  • src/db/retention.ts:130-131 — the 90/14-day windows are bare literals, but every other entry in RETENTION_POLICY follows the same inline-literal convention, so this is consistent with existing style rather than a real gap.
  • test/unit/retention.test.ts's new tests rely on the writer's CURRENT_TIMESTAMP-format timestamps ('YYYY-MM-DD HH:MM:SS'); worth double-checking against src/review/submitter-reputation.ts and src/review/alerts.ts (not in this diff) that those writers do in fact omit the column and let the DB default supply it, since the whole cutoff-comparison correctness argument hinges on that.
  • Confirm the RETENTION_COMPOSITE_PK_TABLES / RETENTION_PK_COLUMN completeness guard test (referenced elsewhere in test/unit/retention.test.ts but not shown in this diff) picks up alert_dedup_claims and submitter_outcome_log automatically.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.

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 #10058
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ⚠️ 12/25 Preflight needs author follow-up before maintainer review.
Contributor workload ✅ 10/10 Author activity: 98 registered-repo PR(s), 67 merged, 3 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 98 PR(s), 3 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds both RETENTION_POLICY entries with the specified windows, maps alert_dedup_claims into RETENTION_PK_COLUMN and submitter_outcome_log into RETENTION_COMPOSITE_PK_TABLES, and adds a migration creating the two required leading-column indexes, plus tests covering pruning behavior and the CURRENT_TIMESTAMP text-comparison edge case called out in the issue.

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 98 PR(s), 3 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 2 steps in the Signals table above.
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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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

@superagent-security

Copy link
Copy Markdown
Contributor

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

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

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.94%. Comparing base (19b6a21) to head (9f8a800).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10106   +/-   ##
=======================================
  Coverage   91.94%   91.94%           
=======================================
  Files         930      930           
  Lines      113890   113890           
  Branches    27491    27491           
=======================================
  Hits       104715   104715           
  Misses       7877     7877           
  Partials     1298     1298           
Flag Coverage Δ
backend 95.67% <ø> (ø)

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

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

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit ec259cb into JSONbored:main Jul 31, 2026
8 checks passed
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

Development

Successfully merging this pull request may close these issues.

retention: submitter_outcome_log and alert_dedup_claims grow without bound, in the same class #9473 already bounded

1 participant