Skip to content

test(miner-concurrency): parallel-attempt collision regression suite - #4466

Closed
kiannidev wants to merge 3 commits into
JSONbored:mainfrom
kiannidev:feat/4298-worktree-allocator-collisions
Closed

test(miner-concurrency): parallel-attempt collision regression suite#4466
kiannidev wants to merge 3 commits into
JSONbored:mainfrom
kiannidev:feat/4298-worktree-allocator-collisions

Conversation

@kiannidev

@kiannidev kiannidev commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Collision regression suite for the worktree allocator (#4298). Includes a minimal allocator implementation required to run the tests (hard dependency per #4298 — see also #4297).

  • Add test/unit/miner-worktree-allocator-collisions.test.ts proving:
    • cross-process concurrent acquire() returns distinct worktree paths (barriered child_process workers against one dbPath)
    • excess parallel acquires are rejected at the cap (worktree_capacity_exceeded)
    • release() frees a path for reuse
    • crash recovery reclaims orphaned active allocations on reopen
  • Add test/fixtures/miner-worktree-allocator/acquire-child.mjs helper for real multi-process contention (replaces in-process Promise.resolve().then() microtasks that never raced on BEGIN IMMEDIATE).
  • Add test/unit/miner-worktree-allocator.test.ts for path resolution and basic allocator behavior.
  • Includes packages/gittensory-miner/lib/worktree-allocator.js as test scaffolding (full allocator tracked separately in feat(miner-concurrency): add git-worktree-per-attempt allocator #4297).

Closes #4298

Supersedes #4455 (closed after review feedback).

Test plan

  • npm run build:miner
  • npx vitest run test/unit/miner-worktree-allocator.test.ts test/unit/miner-worktree-allocator-collisions.test.ts
  • CI: validate, codecov/patch, security

Review follow-up

Addresses @JSONbored feedback on PR #4455 review #4666332003: collision tests now spawn multiple Node processes that synchronize on a stdin barrier before calling acquire() against the same SQLite store, exercising the BEGIN IMMEDIATE raced-recheck path.

UI Evidence

N/A — test-only / miner library PR (no visible UI).

Made with Cursor

kiannidev and others added 3 commits July 9, 2026 21:26
…suite

Introduce the git-worktree-per-attempt allocator (JSONbored#4297) and prove its
concurrency guarantees with parallel acquire, cap enforcement, release
reuse, and crash-recovery regression tests.

Closes JSONbored#4298

Co-authored-by: Cursor <cursoragent@cursor.com>
…ests

Co-authored-by: Cursor <cursoragent@cursor.com>
…tion

Replace in-process Promise microtask collision tests with barriered
child_process acquires against a shared dbPath so BEGIN IMMEDIATE
contention is genuinely exercised. Also fix isProcessAlive EPERM handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@kiannidev
kiannidev marked this pull request as draft July 9, 2026 20:08
@loopover-orb loopover-orb Bot added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels Jul 9, 2026
@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Important

🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪

🔍 Gittensory is reviewing…

AI analysis is in progress. This comment will update when the review is complete.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing

@loopover-orb loopover-orb Bot closed this Jul 9, 2026
@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Gittensory had already started reviewing this pull request — converting it to draft to dodge the one-shot review process is not allowed. Please open a new pull request with the issues addressed.

@loopover-orb loopover-orb Bot added the review-evasion Gittensor contributor context label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. review-evasion Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(miner-concurrency): add parallel-attempt collision regression suite

1 participant