Skip to content

fix(miner): claim-ledger-expiry.js's sweepExpiredClaims/findExpiredClaims are dead; stale claims never auto-expire #6156

Description

@JSONbored

Context

packages/loopover-miner/lib/claim-ledger-expiry.js:15,30 exports sweepExpiredClaims/findExpiredClaims, with portfolio-queue-expiry.js:38's own comment claiming it "uses the same store/sweep split sweepExpiredClaims uses." But the portfolio-queue side's actual sweep (sweepStuckItems) is called from portfolio-queue-manager.js:114,123, while sweepExpiredClaims/findExpiredClaims have zero callers anywhere in the repo. claim-ledger.js's expireClaim mutation exists and works, but nothing ever calls the sweep that would invoke it — so a claim left behind by a crashed/killed miner process never automatically expires, unlike the portfolio-queue's own stuck-item sweep.

Requirements

  • Wire sweepExpiredClaims/findExpiredClaims into the same recurring-sweep call site portfolio-queue-manager.js's sweepStuckItems already uses (or an equivalent scheduled entry point for the claim ledger specifically, if one exists separately) — read portfolio-queue-manager.js:114,123's call site for the exact integration pattern to mirror.
  • Ensure the sweep actually invokes claim-ledger.js's expireClaim for each expired claim found.
  • Do not change claim-ledger.js's expireClaim mutation itself — it already works correctly.

Test Coverage Requirements

99%+ Codecov patch coverage on the new call site; add a regression test proving a stale claim is actually expired when the sweep runs (not just that the sweep function is called).

Deliverables

  • sweepExpiredClaims/findExpiredClaims wired into a real recurring call site.
  • Regression test: a claim past its expiry gets expired when the sweep runs.

Expected Outcome

A claim left behind by a crashed miner process is automatically expired instead of blocking the repo indefinitely.

Links & Resources

  • packages/loopover-miner/lib/claim-ledger-expiry.js:15,30
  • packages/loopover-miner/lib/portfolio-queue-expiry.js:38, portfolio-queue-manager.js:114,123 (the sibling pattern to mirror)
  • packages/loopover-miner/lib/claim-ledger.js (expireClaim)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions