fix(miner): cover worktree-allocator worktree_slots in the right-to-be-forgotten purge#8498
fix(miner): cover worktree-allocator worktree_slots in the right-to-be-forgotten purge#8498tryeverything24 wants to merge 2 commits into
Conversation
…e-forgotten purge
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8498 +/- ##
===========================================
+ Coverage 59.40% 88.77% +29.37%
===========================================
Files 791 99 -692
Lines 79335 22912 -56423
Branches 23965 3930 -20035
===========================================
- Hits 47131 20341 -26790
+ Misses 28743 2393 -26350
+ Partials 3461 178 -3283
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-24 16:59:21 UTC
Review summary Nits — 4 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
What
packages/loopover-miner/lib/worktree-allocator.ts'sworktree_slotstable carries arepo_full_namecolumn but was absent frompurge-cli.ts's right-to-be-forgotten sweep — the same recurring gap class already fixed for other stores in #7091, #6599, and #8009. This wiresworktree-allocatorinto the purge soloopover-miner purge --repo <owner/repo>covers it like every other repo-scoped store.worktree_slotsis a fixed pool of pre-allocated slot rows (slot_indexis the primary key; every slot0..maxConcurrency-1always exists), not an append-only ledger, so the genericDELETE-basedpurgeStoreByRepois the wrong shape — deleting a slot row would shrink the pool and break theensureSlots/selectFreeSlotinvariant. Followinggovernor-state.ts's precedent for a store needing custom purge logic, the purge lives on the store object.Changes
worktree-allocator.ts: addpurgeByRepo(repoFullName): numberto theWorktreeAllocatortype andopenWorktreeAllocator's implementation. It uses a hand-writtenUPDATE(mirroringrelease()/reclaimOrphanedAllocations()'s ownSET ... = NULLstatement) that clears the repo only fromstatus = 'free'rows, and never deletes a row and never touches anactiveslot — an active slot'srepo_full_namereflects a live, in-flight attempt's real worktree checkout on disk, and force-clearing it would desync the allocator from that checkout. Both the realUPDATEand the read-only dry-run counter share one match condition (status = 'free' AND repo_full_name = ?) verbatim so they can never diverge. A code comment states explicitly that this purge is expected to affect 0 rows on the overwhelming majority of real calls, by design (every normal release/reclaim path already blanks these fields on free); it is a defensive backstop for a row predating this fix or stranded by an unexpected crash path. Also exportscountPurgeableWorktreeSlotsByRepofor the dry-run count path.purge-cli.ts: registerworktree-allocatorinREAL_PURGE_TARGETSwith nospec/specsfield (its purge logic lives on the store object), carrying its own status-awarecountByRepocounter — exactly mirroring howgovernor-state's entry carriesspecsfor its own non-uniform case.--dry-run's row-count path counts onlystatus = 'free' AND repo_full_name = ?rows, matching the real purge's match condition exactly so an active-slot row is never reported as purgeable.Tests
Full branch coverage added in
test/unit/miner-worktree-allocator.test.tsandtest/unit/miner-purge-cli.test.ts:freeslot seeded directly with a stale non-nullrepo_full_name(bypassing the normal acquire/release path) — purged and counted (returns1).activeslot for the target repo — left completely untouched, not counted.0.--dry-runreports the same count the real purge would remove, for both the free-stale-row and active-row cases (dry-run count matches the real purge exactly).The fixed pool stays intact in every case (no slot row is ever deleted).
npm run test:cistays green.Closes #8320