fix(miner): fail closed on an unparseable lease in portfolio-queue findStuckItems - #8033
Conversation
…ndStuckItems findStuckItems skipped any in_progress item whose leasedAt couldn't be parsed (leaseAgeMs returns null -> the old 'if (ageMs === null) continue'), so a corrupted or hand-edited lease timestamp stranded that item 'in_progress' forever, never reclaimed by the stuck-item sweep. claim-ledger-expiry.ts's findExpiredClaims already fails closed on the same shape post-JSONbored#7732 (an unparseable claimedAt is treated as expired). Match that posture: an item whose leasedAt is missing/unparseable is now returned as stuck (swept back to queued) rather than silently skipped. Updated the doc comment and split the existing test so unparseable/missing leases assert the fail-closed sweep instead of being bundled into the 'ignored' case. Closes JSONbored#8007
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-22 14:17:34 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
Closes #8007
What
findStuckItems(packages/loopover-miner/lib/portfolio-queue-expiry.ts) skipped anyin_progressitem whoseleasedAtcouldn't be parsed —leaseAgeMsreturnsnull, and the oldif (ageMs === null) continue;dropped it — so a corrupted or hand-edited lease timestamp stranded that itemin_progressforever, never reclaimed by the stuck-item sweep.claim-ledger-expiry.ts'sfindExpiredClaimsalready fails closed on the exact same shape post-#7732 (an unparseableclaimedAtis treated as expired). This matches that posture: an item whoseleasedAtis missing/unparseable is now returned as stuck (swept back toqueued) instead of silently skipped.Changes
findStuckItems:if (ageMs === null || ageMs > maxLeaseMs) stuck.push(item)— fail closed on the null (unparseable) case.fresh/non-in_progressitems still assert "ignored"; missing/unparseable leases now assert the fail-closed sweep.Verification
Miner-lib lane, verified locally: 15 tests pass; the changed
||branch is covered both ways (unparseable → swept, in-window → not). Test file typechecks clean against the project's exact CI types..jsis gitignored (rebuilt in CI from the.ts).