Skip to content

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

Description

@JSONbored

This depends on the git-worktree-per-attempt allocator (sibling Phase 6 issue, feat(miner-concurrency): add git-worktree-per-attempt allocator) landing first — there is nothing to regression-test until acquire/release exist. Filing this now so the dependency is visible in the tracker, but a contributor should pick up the allocator issue first (or claim both together).

Once the allocator exists, this is a focused regression suite proving the concurrency guarantees the allocator issue's deliverables promise, rather than just its happy path: that concurrent acquire() calls never hand out the same worktree path, that release() correctly frees a path for reuse, that the configured concurrency cap is actually enforced under simultaneous requests (not just checked sequentially), and that a simulated crash (an allocation recorded as active with no live owner) is reclaimed on the next startup rather than either double-allocated or leaked forever.

Deliverables

  • test/unit/miner-worktree-allocator-collisions.test.ts (or fold into the allocator's own primary test file if that ends up small enough — match whatever filename the allocator issue actually lands, since test/unit/miner-*.test.ts is the established location per test/unit/miner-claim-ledger.test.ts and siblings).
  • Concurrent-acquire test: fire N simultaneous acquire() calls (e.g. via Promise.all) and assert all N returned paths are distinct.
  • Cap-enforcement test: request more than the configured concurrency limit simultaneously and assert the excess requests are rejected or queued (per whatever contract the allocator issue settles on), never silently over-allocated.
  • Release/reuse test: release() a path, then acquire() again, and assert the freed path becomes available (not permanently retired).
  • Crash-recovery test: seed the allocator's persisted state with an "active" allocation that has no live owner, restart/reopen the store, and assert it is reclaimed rather than treated as still-live.
  • Follow the existing miner-package test conventions (node:sqlite-backed local-store tests use a temp DB path per test — see test/unit/miner-claim-ledger.test.ts / test/unit/miner-run-state.test.ts for the setup/teardown pattern already in use).

References

  • Sibling issue: feat(miner-concurrency): add git-worktree-per-attempt allocator (Phase 6) — hard dependency, must land first.
  • test/unit/miner-claim-ledger.test.ts, test/unit/miner-run-state.test.ts — existing SQLite-backed local-store test setup/teardown pattern to reuse for the allocator's own store.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.gittensor:priorityMaintainer-selected Gittensor priority — scores a 1.5x multiplier.help wantedExtra attention is needed

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions