Skip to content

feat(miner-foundation): claim-ledger staleness/expiry sweep #2316

Description

@JSONbored

A local claim that's been "active" for weeks with no plan progress is stale and should stop blocking other miners (real or soft-claim adjudication) from picking up the issue. This is a small, pure, deterministic sweep function over the claim ledger's own rows — no network, no GitHub calls, so it's zero-risk foundation work independent of the rest of this phase.

Deliverables

  • packages/gittensory-miner/src/claim-ledger/expiry.ts exporting findExpiredClaims(claims: LocalClaimRecord[], nowMs: number, maxAgeMs: number): LocalClaimRecord[] — pure, no IO, no Date.now() internally (caller supplies nowMs so the function is fully deterministic and testable, mirroring src/signals/duplicate-winner.ts's own "PURE — no IO, no Date, no random" discipline stated in its header comment)
  • sweepExpiredClaims(store, nowMs, maxAgeMs) — the thin IO wrapper that calls findExpiredClaims then transitions matching rows to status: "expired" via the existing releaseClaim-shaped store API
  • Configurable maxAgeMs with a documented sane default (e.g. 14 days)
  • Unit tests: no expired claims, all expired, mixed, and the boundary (age === maxAgeMs exactly)
  • Depends on the claim-ledger schema issue for the store shape

References

  • src/signals/duplicate-winner.ts:10 (module header's "PURE — no IO, no Date, no random" discipline to mirror for findExpiredClaims)
  • Depends on: the local claim-ledger schema + CRUD issue (packages/gittensory-miner/src/claim-ledger/store.ts)

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