Skip to content

fix(miner): include portfolio-queue and run-state in purge-by-repo (#6599) - #6694

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
thomasalvaedison7777-lgtm:fix/purge-cli-portfolio-queue-run-state-6599
Jul 16, 2026
Merged

fix(miner): include portfolio-queue and run-state in purge-by-repo (#6599)#6694
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
thomasalvaedison7777-lgtm:fix/purge-cli-portfolio-queue-run-state-6599

Conversation

@thomasalvaedison7777-lgtm

Copy link
Copy Markdown
Contributor

Summary

Closes #6599

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Targeted unit tests run locally (miner-purge-cli, miner-portfolio-queue, miner-run-state). Full test:ci / coverage gate not run yet before commit.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • 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.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

N/A — miner local-store / CLI change only; no UI.

Notes

  • Auth/API/UI boxes above are N/A for this miner local-store purge fix.

…stores

- Implemented `purgeByRepo` method in both `PortfolioQueueStore` and `RunStateStore` to allow explicit deletion of all entries associated with a specific repository.
- Updated related types and specifications in `store-maintenance` to accommodate the new purge functionality.
- Enhanced CLI and test coverage to ensure proper functionality and error handling for the new purge feature.

Closes JSONbored#5564, JSONbored#6599
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.65%. Comparing base (58ab17e) to head (ff57f45).
⚠️ Report is 10 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6694   +/-   ##
=======================================
  Coverage   93.65%   93.65%           
=======================================
  Files         682      682           
  Lines       68112    68116    +4     
  Branches    18708    18708           
=======================================
+ Hits        63788    63792    +4     
  Misses       3347     3347           
  Partials      977      977           
Flag Coverage Δ
shard-1 43.90% <75.00%> (+0.01%) ⬆️
shard-2 36.96% <50.00%> (-0.01%) ⬇️
shard-3 32.30% <50.00%> (-0.16%) ⬇️
shard-4 34.59% <50.00%> (+0.35%) ⬆️
shard-5 31.64% <50.00%> (+0.25%) ⬆️
shard-6 45.75% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
packages/loopover-miner/lib/portfolio-queue.js 97.36% <100.00%> (+0.02%) ⬆️
packages/loopover-miner/lib/purge-cli.js 100.00% <ø> (ø)
packages/loopover-miner/lib/run-state.js 100.00% <100.00%> (ø)
packages/loopover-miner/lib/store-maintenance.js 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-16 19:51:00 UTC

11 files · 1 AI reviewer · no blockers · readiness 83/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR closes a real gap in the right-to-be-forgotten purge sweep: portfolio-queue and run-state both key rows by repo_full_name (visible in their schema DDL) but were absent from purge-cli.js's REAL_PURGE_TARGETS list. The fix follows the existing pattern exactly — new purge specs in store-maintenance.js, a purgeByRepo method on each store reusing the shared purgeStoreByRepo/countStoreByRepo helpers, and wiring into the CLI's target list for both dry-run and real purge. Tests cover the new store methods directly (delete, no-match, invalid repo) and add a #6599 regression test asserting both stores appear in dry-run and real purge summaries end-to-end.

Nits — 3 non-blocking
  • The purgeByRepo methods in portfolio-queue.js and run-state.js don't validate that the store's repo scoping (api_base_url + repo_full_name composite key) is fully covered by a single repo_full_name-only DELETE — worth double-checking this purges all api_base_url variants for a repo, though it appears correct since repoColumn alone is used in the WHERE clause.
  • migrate-cli.js's STORES list (shown in reference context) already includes portfolio-queue and run-state, so no additional wiring is needed there — good consistency, but worth confirming no other consumer of REAL_PURGE_TARGETS-like patterns (e.g. doctor.js) also needs updating for full purge-cli.js's right-to-be-forgotten sweep misses portfolio-queue.js and run-state.js #6599 closure.
  • Consider a brief note in the PR description confirming other repo-scoped-by-repoColumn stores (if any exist beyond these six) were audited, to preempt a #66xx follow-up for a similarly missed store.

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 #6599
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High 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: 16 registered-repo PR(s), 10 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor thomasalvaedison7777-lgtm; Gittensor profile; 16 PR(s), 1 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds PORTFOLIO_QUEUE_PURGE_SPEC and RUN_STATE_PURGE_SPEC to store-maintenance.js, adds purgeByRepo methods to portfolio-queue.js and run-state.js, wires both into purge-cli.js's REAL_PURGE_TARGETS with matching name/optionKey/opener/resolveDbPath/spec, updates the header comment to name all six stores, and includes tests covering deletion of targeted repo rows, isolation of other repos, z

Review context
  • Author: thomasalvaedison7777-lgtm
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, TypeScript
  • Official Gittensor activity: 16 PR(s), 1 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 2 steps in the Signals table above.
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
Contributor

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.

@loopover-orb
loopover-orb Bot merged commit 11a6dac into JSONbored:main Jul 16, 2026
16 checks passed
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