Skip to content

fix(miner): purge portfolio-queue and run-state in the right-to-be-forgotten sweep - #6698

Closed
ultrahighsuper wants to merge 2 commits into
JSONbored:mainfrom
ultrahighsuper:fix/purge-cli-cover-portfolio-runstate-6599
Closed

fix(miner): purge portfolio-queue and run-state in the right-to-be-forgotten sweep#6698
ultrahighsuper wants to merge 2 commits into
JSONbored:mainfrom
ultrahighsuper:fix/purge-cli-cover-portfolio-runstate-6599

Conversation

@ultrahighsuper

Copy link
Copy Markdown
Contributor

What

loopover-miner purge --repo <owner/repo> (#5564) — the operator-invoked right-to-be-forgotten path — deleted a repo's rows from only four of the six local stores that persist repo-identifying data. portfolio-queue.js (miner_portfolio_queue) and run-state.js (miner_run_state) both key rows by repo_full_name (part of each table's primary key) but had no purgeByRepo method, no purge spec, and no REAL_PURGE_TARGETS entry — so a purge silently left those rows behind, with no warning (unlike attempt-log, which genuinely has no repo column and is deliberately reported as not-purgeable).

Resolves #6599.

Fix

  • store-maintenance.js: add PORTFOLIO_QUEUE_PURGE_SPEC and RUN_STATE_PURGE_SPEC, same shape as the four existing specs.
  • portfolio-queue.js / run-state.js: add a purgeByRepo(repoFullName) method calling purgeStoreByRepo(db, spec, normalizeRepoFullName(repoFullName)), mirroring claim-ledger.js (throws on a missing/malformed repoFullName rather than silently no-opping).
  • purge-cli.js: add both stores to REAL_PURGE_TARGETS (so runPurgeDryRun and runPurge cover them with no special-casing) and update the header comment from "four stores" to name all six.

Tests

  • purgeByRepo blocks in the portfolio-queue and run-state store tests (deletes only the targeted repo, leaves others, returns 0 on no match, throws on invalid input), mirroring miner-prediction-ledger.test.ts.
  • The purge-cli --dry-run and real-purge tests now seed and assert portfolio-queue and run-state alongside the four existing stores (dry-run counts, real per-store + total summary, and the human-readable output line).

Locally green: npx vitest run test/unit/miner-purge-cli.test.ts → 18/18; the new purgeByRepo store tests pass. (The only failures in the store test files are 4 pre-existing Windows-only cases — POSIX path separators and Unix file-mode bits — unrelated to this change and green on CI's Linux.) Diff is additive; lint clean.

…rgotten sweep (JSONbored#6599)

`loopover-miner purge --repo <owner/repo>` (JSONbored#5564) deleted a repo's rows from
only four of the six local stores that persist repo-identifying data.
`portfolio-queue.js` (miner_portfolio_queue) and `run-state.js` (miner_run_state)
both key rows by repo_full_name (part of each table's primary key) but had no
purgeByRepo method, no purge spec, and no REAL_PURGE_TARGETS entry — so an
operator's right-to-be-forgotten sweep silently left those rows behind, with no
warning (unlike attempt-log, which has no repo column and is deliberately
reported as not-purgeable).

- store-maintenance.js: add PORTFOLIO_QUEUE_PURGE_SPEC and RUN_STATE_PURGE_SPEC,
  same shape as the four existing specs.
- portfolio-queue.js / run-state.js: add a purgeByRepo(repoFullName) method that
  calls purgeStoreByRepo with the store's spec + its own normalizeRepoFullName,
  mirroring claim-ledger.js (throws on a missing/malformed repoFullName rather
  than silently no-opping).
- purge-cli.js: add both stores to REAL_PURGE_TARGETS (so runPurgeDryRun and
  runPurge cover them with no special-casing) and update the header comment from
  "four stores" to name all six.

Tests: purgeByRepo blocks in the portfolio-queue and run-state store test files
(deletes only the targeted repo, leaves others, returns 0 on no match, throws on
invalid input), mirroring miner-prediction-ledger.test.ts; and the purge-cli
--dry-run and real-purge tests now seed and assert portfolio-queue and run-state
alongside the four existing stores.

Closes JSONbored#6599
@ultrahighsuper
ultrahighsuper force-pushed the fix/purge-cli-cover-portfolio-runstate-6599 branch from fc3a7a7 to 0c1bb68 Compare July 16, 2026 19:38
@superagent-security

Copy link
Copy Markdown
Contributor

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

@ultrahighsuper

Copy link
Copy Markdown
Contributor Author

Withdrawing — #6599 was resolved on main by #6694 while this was in review, so this change is now a duplicate and conflicts. Closing; no defect here, just a timing overlap.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 16, 2026
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's right-to-be-forgotten sweep misses portfolio-queue.js and run-state.js

1 participant