Skip to content

policy_verdict_cache missing from purge/status/migrate 'known local stores' lists #6987

Description

@JSONbored

Context

packages/loopover-miner/lib/policy-verdict-cache.js (schema at lines 56-67) keys its policy_verdict_cache table on repo_scope TEXT PRIMARY KEY — a genuine per-repo column, structurally identical to the six stores store-maintenance.js already documents as purgeable (packages/loopover-miner/lib/store-maintenance.js:27-36: "the six stores whose rows are directly scoped by a repoColumn"). That comment explains why attempt-log.js is deliberately excluded (its payload has no dedicated repo column) but says nothing about policy-verdict-cache.js — it simply isn't in any of the three "known local stores" lists it structurally qualifies for:

  • purge-cli.js's REAL_PURGE_TARGETS (packages/loopover-miner/lib/purge-cli.js:38-45)
  • status.js's storeIntegrityChecks (packages/loopover-miner/lib/status.js:305-320, whose own comment claims to cover "every durable local SQLite store using resolveLocalStoreDbPath")
  • migrate-cli.js's STORES list (packages/loopover-miner/lib/migrate-cli.js:28-40, citing "doctor's integrity sweep and migrate's proactive sweep both omit four real local stores #6768" and "same eleven stores")

policy-doc-cache.js (keyed by url, not a repo column) is correctly absent from these lists — its omission is intentional, mirroring attempt-log.js. policy-verdict-cache.js's omission is not: it fits the exact repoColumn purge/health-check pattern and was simply never wired in.

Requirements

  • Add a POLICY_VERDICT_CACHE_PURGE_SPEC = { table: "policy_verdict_cache", repoColumn: "repo_scope" } to store-maintenance.js, following the exact shape of the six existing specs.
  • Wire that spec into purge-cli.js's REAL_PURGE_TARGETS.
  • Add policy-verdict-cache.js's resolvePolicyVerdictCacheDbPath to status.js's storeIntegrityChecks and migrate-cli.js's STORES list, following the existing entries' exact shape.
  • Do not touch policy-doc-cache.js — its exclusion is intentional and out of scope for this issue.

Deliverables

  • policy_verdict_cache purgeable via purge-cli.js (by repo scope)
  • policy_verdict_cache covered by status.js's store-integrity check
  • policy_verdict_cache covered by migrate-cli.js's migration sweep
  • Test confirming a purge/status/migrate run actually touches policy_verdict_cache

Test Coverage Requirements

99%+ Codecov patch coverage on every changed line and branch, plus the regression test above confirming all three code paths reach the newly-wired store.

Expected Outcome

policy_verdict_cache is purgeable, health-checked, and migration-covered exactly like the other six repo-scoped stores, closing a gap where per-repo data in this table could persist indefinitely uncleaned and unmonitored.

Links & Resources

packages/loopover-miner/lib/store-maintenance.js:27-36 — the six-store pattern to extend. packages/loopover-miner/lib/purge-cli.js, status.js, migrate-cli.js — the three lists to update.

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