4. Proof plan
4.1 Drop-in: piscina's own suite against vortex
Mechanism: copy test/ and test/fixtures/ from tag v5.3.2 into
compat/piscina-5.3.2/ byte-for-byte (sha256 manifest committed beside them, MIT
licence notice kept), and resolve their imports of .., ../dist, ../dist/* and
../package.json to vortex through a generated package.json/dist shim directory,
so no test file is edited. Fixtures that require('../..') or import Piscina from '../..' resolve the same way, which is also how isWorkerThread/workerData inside
workers are exercised. Run with piscina's runner flags (node --test --import=tsx --test-concurrency=4), concurrency capped at 4 per machine rules.
Inventory (28 *.test.ts files with 153 test(...) cases by grep, plus 1 jest spec, at v5.3.2) and expectation:
| File | Cases | Expectation |
|---|---|---|
| simple-test, option-validation, post-task, abort-task, pool-close, pool-destroy, pool, idle-timeout, thread-count, task-queue, queues, fixed-queue, stricter-fifo, generics, messages, move-test, test-is-buffer-transferred, test-uncaught-exception-from-handler, ready-message, workers, issue-513, load-with-esm, async-context, console-log, histogram | 147 | Pass. These assert only public behaviour or the deep-import paths vortex re-exports. |
| atomics-optimization | 3 | Pass expected. Two cases block workers inside tasks with a user SharedArrayBuffer (side lane) and assert scheduling with concurrentTasksPerWorker: 2; the third pushes 10 000 tasks ("unbounded recursion"), which the batched drain must handle without deep recursion. |
| test-resourcelimits | 1 | Pass expected: a worker killed by V8 OOM must reject its task with the piscina error. This is the test that proves the "die at any instruction" design (2.2). |
| nice | 2 | Pass on Linux with @napi-rs/nice installed; piscina itself skips elsewhere. Same skip conditions. |
| jest/ready-message.spec | 1 | Pass; run under jest exactly as piscina's CI does. |
Every case is expected to pass; there is no planned exclusion. If a case fails because
it pins a piscina internal (not public behaviour), it is listed in docs/COMPAT.md
with the reason and the owner decides; it is never silently skipped. The same suite is
also run against real piscina 5.3.2 in the same harness, so a failure that piscina
shares (environment, flake) is visible as such.
Added beyond piscina's suite: the post-5.3.2 bug-fix cases from piscina master that
do not contradict 5.3.2 (1.1), and vortex-only tests for the codec, shared-memory
recovery and browser mode.
Every vortex-written guard or test gets a negative control (break → red for the right
reason → restore byte-identical by sha256 → touch → green), recorded in the lane
record.
4.2 Benchmark harness (bench/)
Contenders, pinned exact versions in bench/package.json with a lockfile: vortex
(working tree), piscina 5.3.2, tinypool 2.2.0, workerpool 10.0.3. Optional second
tier: poolifier 6.1.1.
Workloads (identical task module per pool, adapted only for each pool's export convention):
| ID | Workload | Metric |
|---|---|---|
| W1 | Empty task (() => 0), 1 000 000 tasks, saturating submission |
tasks/s |
| W2 | Small payload round trip (64 B object), closed loop, one in flight | latency p50/p90/p99/p99.9 (µs) |
| W3 | Small payload, open loop at fixed rates (10 k, 100 k, 500 k/s) | latency percentiles and achieved rate |
| W4 | CPU-bound fan-out (fixed 1 ms and 10 ms busy work), N = maxThreads × 100 | makespan, overhead vs ideal |
| W5 | Large buffers: 1 MiB and 64 MiB ArrayBuffer, transferred and copied |
MB/s, p50/p99 |
| W6 | Cold start: construct pool → first result | ms |
| W7 | Idle-to-burst: pool idle 1 s, then a burst of 10 000 | p99 of the burst |
Rules: same minThreads = maxThreads across pools (stated), fixed iteration counts (no
time-boxed runs), warm-up discarded, 10 runs per cell reporting median and spread,
uptime captured before and after each cell and printed beside the number; a cell
whose load exceeds 15 is marked invalid and not reported. Hardware, OS, Node version,
CPU governor and the git sha of vortex go in every report. Raw samples written to
bench/results/<date>-<sha>.json (bounded size, overwritten per run). Runs only in a
benchmark window granted by the coordinator.
Ablations reported alongside: vortex with ring ops in plain JS; vortex without spin;
vortex with completions via port instead of waitAsync. These show which technique
from 3.2 bought what.
4.3 Rust core tests
- loom models (host target,
cfg(loom)only in the test build, no test code in production paths: the core is written against a smallsyncfacade that maps tocore::sync::atomicnormally and toloomtypes undercfg(loom)): slot alloc / free ABA, MPMC ring push/pop with 2–3 consumers, MPSC completion ring, park/unpark lost-wakeup protocol, main-waiter arm/notify protocol. - Death injection: models where a consumer thread stops permanently at every
possible step, followed by the recovery routine; assert no slot is lost and no
other thread blocks. This is the property
resourceLimits/abort rely on. - Property tests (proptest) for histogram bucket error bounds and summary arithmetic, slot arena range allocation.
- Native stress on the host with real threads (
stdonly in the test crate) and wasm stress in Node with real workers against the built module, both fixed iteration counts, no timing assertions. cargo miriover the non-atomic-heavy pieces where miri supports them.