Skip to content

fix(miner): purge contribution-profile-cache and governor-state's repo-scoped tables#7110

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
luciferlive112116:fix/purge-contribution-profile-governor-7091
Jul 17, 2026
Merged

fix(miner): purge contribution-profile-cache and governor-state's repo-scoped tables#7110
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
luciferlive112116:fix/purge-contribution-profile-governor-7091

Conversation

@luciferlive112116

Copy link
Copy Markdown
Contributor

Closes #7091

Summary

  • purge-cli.js's operator-invoked right-to-be-forgotten sweep purged only six of the miner's repo-scoped local stores. Three genuinely repo-scoped tables with the same repoColumn shape were missed, so a loopover-miner purge --repo <owner/repo> left their per-repo rows behind:
    • contribution-profile-cache.js's miner_contribution_profile table (keyed repo_full_name).
    • governor-state.js's governor_reputation_history and governor_own_submissions tables.
  • Adds the three purge specs to store-maintenance.js — the cache table name comes from its schema module's own CONTRIBUTION_PROFILE_STORE_TABLE constant so the spec can't drift from a second literal — gives each store a purgeByRepo method reusing the shared, identifier-guarded purgeStoreByRepo, and wires both new targets into REAL_PURGE_TARGETS.
  • governor-state purges both its repo-scoped tables against a single open handle (never reopening the file); its governor_reputation_history is deleted on repo_full_name alone (its key is composite with api_base_url), so a purge clears the repo across every forge host it was recorded against. governor_scalar_state — a single whole-run scalar row with no repo dimension — is deliberately left untouched.
  • The --dry-run count path now handles multi-table targets via a specs array, so governor-state's preview sums both tables exactly like a real purge.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused: one coherent change to the miner's local-store purge path (packages/loopover-miner/lib/** + its test). No UI, MCP, API, or dependency changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves — Closes #7091 (bare, above).

Validation

  • git diff --check — clean.
  • npm run typecheck — 0 errors (hand-maintained .d.ts files updated for the new spec exports + purgeByRepo methods).
  • npm run test:coverage (scoped locally): test/unit/miner-purge-cli.test.ts, miner-contribution-profile-cache.test.ts, miner-governor-state.test.ts — 64 tests pass; 100% patch coverage measured on every changed line and branch of all four source files (store-maintenance.js, contribution-profile-cache.js, governor-state.js, purge-cli.js).
  • ESLint clean on all changed files.

If any required check was skipped, explain why:

  • test:workers, build:mcp/test:mcp-pack, ui:openapi:check, ui:lint/ui:typecheck/ui:build, npm audit — not applicable: no worker/MCP/OpenAPI/UI surface and no dependency changes are touched. The full local gate (npm run test:ci) was not re-run end to end; the relevant slices (typecheck, the affected coverage suites) are green above.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed. The purge deletes local rows and reports only row counts + store names.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests — N/A (none).
  • API/OpenAPI/MCP behavior is updated and tested where needed — N/A (none).
  • UI changes use live API data or real empty/error/loading states — N/A (no UI change).
  • Visible UI changes include a UI Evidence section — N/A: this is a backend/CLI-logic change with no rendered surface.
  • Public docs/changelogs are updated where needed; no changelog edited.

UI Evidence

Not applicable — no UI, frontend, or visible change. This PR changes the miner's local-store purge logic and its unit test only.

Notes

  • Regression coverage confirms an end-to-end real purge deletes the cache row and both governor tables for the target repo across two api_base_urls, while another repo's rows and the non-repo-scoped governor_scalar_state pause row survive — plus dry-run parity for the new targets and the existing six.

…o-scoped tables (JSONbored#7091)

purge-cli.js's right-to-be-forgotten sweep covered only six of the miner's
repo-scoped local stores. Three genuinely repo-scoped tables with the same
`repoColumn` shape were missed, leaving per-repo data uncleaned:
contribution-profile-cache's miner_contribution_profile table (keyed
repo_full_name), and governor-state's governor_reputation_history and
governor_own_submissions tables.

Add the three purge specs to store-maintenance.js (the cache table name comes
from its schema module's own CONTRIBUTION_PROFILE_STORE_TABLE constant so it
can't drift), give each store a purgeByRepo method reusing the shared
identifier-guarded purgeStoreByRepo, and wire both into REAL_PURGE_TARGETS.
governor-state purges BOTH its tables against a single open handle; its
reputation history is deleted by repo_full_name alone so a purge clears the repo
across every api_base_url it was recorded against. governor_scalar_state (a
whole-run scalar row with no repo dimension) is deliberately untouched. The
dry-run path counts multi-table targets via a `specs` array.

Closes JSONbored#7091
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.75%. Comparing base (1b42787) to head (6fbfed7).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7110   +/-   ##
=======================================
  Coverage   93.75%   93.75%           
=======================================
  Files         692      692           
  Lines       68808    68816    +8     
  Branches    18781    18781           
=======================================
+ Hits        64511    64519    +8     
  Misses       3302     3302           
  Partials      995      995           
Flag Coverage Δ
shard-1 43.38% <33.33%> (-0.41%) ⬇️
shard-2 36.86% <33.33%> (+0.01%) ⬆️
shard-3 33.15% <33.33%> (+0.01%) ⬆️
shard-4 34.39% <33.33%> (-0.09%) ⬇️
shard-5 31.74% <33.33%> (-0.55%) ⬇️
shard-6 46.12% <100.00%> (+0.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/loopover-miner/lib/contribution-profile-cache.js 100.00% <100.00%> (ø)
packages/loopover-miner/lib/governor-state.js 95.41% <100.00%> (+0.08%) ⬆️
packages/loopover-miner/lib/purge-cli.js 100.00% <100.00%> (ø)
packages/loopover-miner/lib/store-maintenance.js 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 17, 2026
@loopover-orb

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-17 22:01:00 UTC

8 files · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This closes #7091 by adding purge specs for contribution-profile-cache's table and governor-state's two repo-scoped tables, wiring them into REAL_PURGE_TARGETS with a new specs-array path for multi-table dry-run counting, and reusing the existing identifier-guarded purgeStoreByRepo helper throughout. The reasoning is sound: governor_reputation_history is intentionally purged on repo_full_name alone (ignoring the composite api_base_url key) to sweep the repo across every forge host, and governor_scalar_state is correctly left untouched since it has no repo dimension. The contribution-profile-cache table name is sourced from the schema module's own CONTRIBUTION_PROFILE_STORE_TABLE constant rather than a duplicated literal, avoiding drift, and the test suite adds a real end-to-end regression test verifying both tables are purged while another repo's rows and the scalar pause row survive.

Nits — 4 non-blocking
  • The external brief's 'magic numbers' flags on issue-number references (purge-cli.js omits contribution-profile-cache.js and governor-state.js's two repo-scoped tables from its right-to-be-forgotten sweep #7091) in doc comments are non-issues — those are GitHub issue references, not literals needing named constants.
  • The `specs` array on the governor-state target (purge-cli.js:53) and the `spec` field on every other target is a slightly awkward two-shape API; consider always using a `specs` array (single-element for the simple stores) to unify the dry-run reducer logic in runPurgeDryRun.
  • packages/loopover-miner/lib/store-maintenance.js: since three new purge specs were added outside the original 'six real stores' grouping, consider grouping all nine PURGE_SPEC exports under one comment block rather than two, to keep future additions from fragmenting further.
  • test/unit/miner-purge-cli.test.ts: the new REGRESSION test's use of `savePauseState`/scalar-row survival check is a nice touch — worth keeping as the canonical pattern when other stores gain purge specs in the future.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7091
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 179 registered-repo PR(s), 110 merged, 27 issue(s).
Contributor context ✅ Confirmed Gittensor contributor luciferlive112116; Gittensor profile; 179 PR(s), 27 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: significant
Linked issue satisfaction

Addressed
The diff adds CONTRIBUTION_PROFILE_CACHE_PURGE_SPEC, GOVERNOR_REPUTATION_HISTORY_PURGE_SPEC, and GOVERNOR_OWN_SUBMISSIONS_PURGE_SPEC to store-maintenance.js (with the cache spec sourcing its table name from the schema module's own constant), wires all three into purge-cli.js's REAL_PURGE_TARGETS and dry-run path, purges governor-state's two tables against a single open handle with repo_full_name-o

Review context
  • Author: luciferlive112116
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 179 PR(s), 27 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

purge-cli.js omits contribution-profile-cache.js and governor-state.js's two repo-scoped tables from its right-to-be-forgotten sweep

1 participant