Skip to content

portfolio-queue-expiry's findStuckItems skips the fail-closed fix its sibling findExpiredClaims got in #7732 #8007

Description

@JSONbored

Context

packages/loopover-miner/lib/claim-ledger-expiry.ts's findExpiredClaims was fixed in #7732 (commit 352c49fcb) so a claim with an unparseable claimedAt is now treated as expired and swept, "matching this module's own fail-closed posture" — previously such a claim was silently skipped and left stuck active forever.

packages/loopover-miner/lib/portfolio-queue-expiry.ts's own header comment literally calls itself "Mirror of claim-ledger-expiry.js for the portfolio-queue store," but its findStuckItems (line 36) still has the pre-fix line if (ageMs === null) continue; — a portfolio-queue item with a corrupted/unparseable leasedAt is silently skipped by the sweep and stays in_progress forever (e.g. a crashed-process item that can never be reclaimed by the stuck-item sweep).

The existing test file even locks in the stale behavior: test/unit/miner-portfolio-queue-expiry.test.ts:115 has a test titled "ignores ... unparseable-lease items" — that test's expectation needs to flip along with the fix.

⚠️ Required pattern — read packages/loopover-miner/lib/claim-ledger-expiry.ts's findExpiredClaims (post-#7732, commit 352c49fcb) before starting. Port the exact same fail-closed treatment (unparseable timestamp → treated as expired/stuck, not skipped) to findStuckItems in portfolio-queue-expiry.ts. Do not invent a different resolution strategy — this issue exists specifically because the two modules are meant to mirror each other and drifted.

Requirements

Deliverables

Test Coverage Requirements

packages/loopover-miner/** — this repo's standard 99%+ Codecov patch target on every changed line and branch. Add/update a unit test covering: a portfolio-queue item with an unparseable leasedAt is now swept as stuck (not skipped).

Expected Outcome

A portfolio-queue item with a corrupted/unparseable lease timestamp is reclaimed by the stuck-item sweep instead of remaining in_progress forever, matching the fail-closed posture claim-ledger-expiry.ts already has post-#7732.

Links & Resources

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