Skip to content

feat(identity): cache official miner detection - #50

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
oktofeesh1:codex/identity-miner-cache
May 29, 2026
Merged

feat(identity): cache official miner detection#50
JSONbored merged 1 commit into
JSONbored:mainfrom
oktofeesh1:codex/identity-miner-cache

Conversation

@oktofeesh1

@oktofeesh1 oktofeesh1 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cache official Gittensor miner detection statuses with short TTLs.
  • Fail closed when the official source is unavailable and keep GitHub-history-only contributors quiet.
  • Add audit coverage and regression tests for cache hits, misses, expiry, unavailable source diagnostics, sanitizer behavior, and outage recovery.

What changed

  • Added official_miner_detections D1 storage for confirmed, not_found, and unavailable statuses.
  • Reused cached official detection in PR public-surface and @gittensory command gating.
  • Replaced broad snapshot spreading with an explicit allowlist of cacheable official miner fields.
  • Re-normalized cached confirmed snapshots on read so future or legacy wallet/coldkey/hotkey-like fields cannot leak back out of the cache.
  • Kept unavailable-source cache entries short-lived and covered recovery after the outage window expires.

Why

Closes #37.

Official miner detection was previously fetched for each public-gating path. The cache keeps confirmed-miner gating cheaper while preserving the official-source boundary and failing closed when the source is unavailable.

Validation

  • npm run test:ci
  • Focused checks: npx vitest run test/unit/db-parsers.test.ts test/unit/queue.test.ts
  • Coverage: statements 98.40%, branches 95.09%, functions 96.60%, lines 99.42%

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #50 — request changes
feat(identity): cache official miner detection

Required changes:

  • Replace { ...snapshot, hotkey: undefined } with an explicit allowlist of cacheable miner fields.
  • Ensure no wallet/coldkey/hotkey-like fields can be cached if the upstream API shape changes.
  • Keep unavailable TTL short and test recovery after an outage window expires.
  • Add tests proving cached unavailable fails closed publicly but does not suppress confirmed miners longer than intended.

Cache official miner detection statuses with short TTLs so public GitHub output can reuse confirmed, not_found, and unavailable results without failing open.

Add audit coverage for cache hits, misses, unavailable source checks, and public-surface skips while keeping GitHub-history-only contributors quiet.

Closes JSONbored#37
@oktofeesh1
oktofeesh1 force-pushed the codex/identity-miner-cache branch from 5c793ee to c4c6e83 Compare May 29, 2026 07:47
@dosubot dosubot Bot added size:L and removed size:M labels May 29, 2026
@JSONbored
JSONbored dismissed their stale review May 29, 2026 07:48

all issues resolved

@JSONbored
JSONbored merged commit 7f3ed32 into JSONbored:main May 29, 2026
3 checks passed
@JSONbored JSONbored added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. and removed feature labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(identity): cache official miner detection with outage-safe behavior

2 participants