test(miner-concurrency): parallel-attempt collision regression suite - #4469
Conversation
…ion suite Add miner-worktree-allocator-collisions.test.ts with barriered child_process workers that contend on a shared SQLite store, exercising BEGIN IMMEDIATE acquire races for distinct paths, cap enforcement, release/reuse, and crash recovery. Includes minimal worktree-allocator scaffolding required by the JSONbored#4298 hard dependency on acquire/release existing. Closes JSONbored#4298 Co-authored-by: Cursor <cursoragent@cursor.com>
reclaimOrphanedAllocations previously skipped reclaim only when the slot owner matched the reopening process, so slots held by other live processes were incorrectly freed. Check isProcessAlive(row.owner_pid) per slot and add a regression test for live cross-process ownership. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-09 20:59:12 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Collision regression suite for the worktree allocator (#4298). Includes minimal
worktree-allocator.jsscaffolding required to exerciseacquire/release(hard dependency noted in the issue; full allocator tracked separately in #4297).test/unit/miner-worktree-allocator-collisions.test.ts— cross-process collision guarantees via barrieredchild_processworkers against one shareddbPath:worktree_capacity_exceeded) when excess processes contendBEGIN IMMEDIATEraced-recheck path)release()reusetest/fixtures/miner-worktree-allocator/acquire-child.mjs— child worker harness (stdin barrier →acquire())test/unit/miner-worktree-allocator.test.ts— basic scaffolding coverage (path resolution, validation,isProcessAliveEPERM)Addresses maintainer feedback on #4455: replaces in-process
Promise.resolve().then()microtasks (which never raced on synchronousDatabaseSync) with real multi-process contention.Closes #4298
Test plan
npm run build:minernpm run typechecknpx vitest run test/unit/miner-worktree-allocator.test.ts test/unit/miner-worktree-allocator-collisions.test.tsvalidate-code,validate,codecov/patch, securityUI Evidence
N/A — test-only / miner library PR (no visible UI).
Made with Cursor