Skip to content

refactor(queue): extract data-retention pruning into its own module - #4962

Merged
JSONbored merged 1 commit into
mainfrom
refactor/4013-extract-retention
Jul 11, 2026
Merged

refactor(queue): extract data-retention pruning into its own module#4962
JSONbored merged 1 commit into
mainfrom
refactor/4013-extract-retention

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Part of #4013 (more extraction steps remain in the sequence — not closing the tracking issue).

Test plan

  • npx tsc --noEmit -p . — zero errors
  • npx vitest run test/unit test/integration — 696/697 files passed (1 skipped, pre-existing)
  • npm run test:coverage (unsharded) — 94.46% statements / 93.43% branches / 93.7% functions / 95.04% lines, no threshold failures; retention.ts itself is 100% line + branch + function covered
  • npm run docs:drift-check, npm run manifest:drift-check, npm run engine-parity:drift-check — all ok
  • npm audit --audit-level=moderate — 0 vulnerabilities

Part of #4013's module-split sequence (step 7, after transient-locks.ts,
signal-snapshot.ts, duplicate-detection.ts, slop-detection.ts,
review-evasion.ts, and ci-resolution.ts): runRetentionPrune moves to
src/queue/retention.ts. Pure mechanical move, no behavior change -- a
re-export shim keeps this file's own internal caller and the existing
test/unit/retention.test.ts / test/unit/selfhost-pg-retention.test.ts
imports working unchanged.
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.26%. Comparing base (4a662c8) to head (42ad6fd).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4962   +/-   ##
=======================================
  Coverage   94.26%   94.26%           
=======================================
  Files         447      448    +1     
  Lines       38884    38884           
  Branches    14167    14167           
=======================================
  Hits        36653    36653           
  Misses       1574     1574           
  Partials      657      657           
Flag Coverage Δ
shard-1 46.53% <0.00%> (-0.29%) ⬇️
shard-2 33.57% <88.88%> (+0.27%) ⬆️
shard-3 31.56% <0.00%> (+0.14%) ⬆️
shard-4 32.50% <100.00%> (-0.52%) ⬇️
shard-5 34.49% <0.00%> (+0.95%) ⬆️
shard-6 45.48% <0.00%> (+0.24%) ⬆️

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

Files with missing lines Coverage Δ
src/queue/processors.ts 95.43% <ø> (-0.02%) ⬇️
src/queue/retention.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

loopover-orb Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-11 03:54:47 UTC

2 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
This is a pure, mechanical extraction of runRetentionPrune from processors.ts into a new src/queue/retention.ts, with a re-export shim preserving both processJob's internal call and the two existing test files' imports from processors.ts. The function body is unchanged, import paths resolve identically at the new location, and CI is fully green with no logic touched — a correctly-scoped step in the pre-existing #4013 module-split sequence.

Nits — 4 non-blocking
  • src/queue/processors.ts imports runRetentionPrune and immediately re-exports it in two adjacent lines; functionally correct (internal call site + external re-export for the two test files), but a one-line comment already explains it, so this is just a readability nit, not an issue.
  • src/queue/retention.ts:10's 'obs(selfhost): monitor Cloudflare D1 database size and add bounded dedup retention for signal_snapshots #3810' reference is a GitHub issue number inside a comment, not a magic number in logic — the automated scan's flag is a false positive.
  • None beyond what's already planned — the PR description notes further extraction steps remain in the refactor(queue): split processors.ts into cohesive modules #4013 sequence, the right place to keep shrinking processors.ts from its current ~1056 lines.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 48 registered-repo PR(s), 40 merged, 312 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 48 PR(s), 312 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, JavaScript, MDX, Shell, Solidity
  • Official Gittensor activity: 48 PR(s), 312 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 11, 2026
@JSONbored
JSONbored merged commit ed5e57e into main Jul 11, 2026
18 checks passed
@JSONbored
JSONbored deleted the refactor/4013-extract-retention branch July 11, 2026 04:15
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. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant