fix(miner): purge portfolio-queue and run-state in the right-to-be-forgotten sweep - #6698
Closed
ultrahighsuper wants to merge 2 commits into
Closed
Conversation
…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
force-pushed
the
fix/purge-cli-cover-portfolio-runstate-6599
branch
from
July 16, 2026 19:38
fc3a7a7 to
0c1bb68
Compare
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) andrun-state.js(miner_run_state) both key rows byrepo_full_name(part of each table's primary key) but had nopurgeByRepomethod, no purge spec, and noREAL_PURGE_TARGETSentry — so a purge silently left those rows behind, with no warning (unlikeattempt-log, which genuinely has no repo column and is deliberately reported as not-purgeable).Resolves #6599.
Fix
store-maintenance.js: addPORTFOLIO_QUEUE_PURGE_SPECandRUN_STATE_PURGE_SPEC, same shape as the four existing specs.portfolio-queue.js/run-state.js: add apurgeByRepo(repoFullName)method callingpurgeStoreByRepo(db, spec, normalizeRepoFullName(repoFullName)), mirroringclaim-ledger.js(throws on a missing/malformedrepoFullNamerather than silently no-opping).purge-cli.js: add both stores toREAL_PURGE_TARGETS(sorunPurgeDryRunandrunPurgecover them with no special-casing) and update the header comment from "four stores" to name all six.Tests
purgeByRepoblocks in the portfolio-queue and run-state store tests (deletes only the targeted repo, leaves others, returns0on no match, throws on invalid input), mirroringminer-prediction-ledger.test.ts.--dry-runand real-purge tests now seed and assertportfolio-queueandrun-statealongside 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 newpurgeByRepostore 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.