Test parallel execution of sleeping commands in JavaScript and Rust - #124
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #22
Implements test for issue #22 that validates the ability to execute 2-3 commands with sleep inside in parallel. The test suite includes: - 2 parallel sleep commands with timing validation - 3 parallel sleep commands with timing validation - Mixed duration sleep commands executed in parallel - Parallel commands with output verification - Individual execution context verification for parallel commands All tests verify that commands execute truly in parallel (not sequentially) by measuring execution time and ensuring it matches the longest sleep duration rather than the sum of all sleep durations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
We need to check that we have programming language parity of all features, so all languages are supported, and latest version of main branch synced here. |
|
🤖 AI Work Session Started Starting automated work session at 2026-09-16T09:07:46.080Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. Runtime: solve |
Relocates tests/parallel-sleep.test.mjs to js/tests/ to match the JavaScript/Rust monorepo layout introduced on main.
Issue #22 asks for a test that 2-3 commands with a sleep inside can be started in parallel and all of them finish. The JavaScript test moved to js/tests/ with the monorepo layout, and the same coverage now exists for the Rust crate so both implementations stay in parity. Wall-clock thresholds alone are a weak signal on a loaded CI machine, so each test also records the window every command occupied and asserts the windows overlap - that is the property 'parallel' actually describes. Coverage spans the built-in sleep, real sleep processes, and sh -c scripts that sleep between writes while keeping their own output and environment.
|
@konard both points are addressed: Latest Language parity — the test exists in both languages with the same six cases, thresholds and assertions:
Each case asserts three independent things rather than wall clock alone: every command succeeded with the expected output, every pair of execution windows overlaps (which is what "parallel" actually means), and the batch finished under 75% of the sequential total. Two implementation notes: JS disables virtual commands via Release triggers for both languages are included: All five CI runs are green on 35b7589: JavaScript checks and release, Rust checks and release, Language parity check, Repository quality checks, Security. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $6.168250📊 Context and tokens usage:Claude Opus 5: (2 sub-sessions)
Total: (2.3K new + 130.5K cache writes + 7.4M cache reads) input tokens, 46.8K output tokens, $6.168250 cost 🤖 Models used:
📎 Log file uploaded as Gist (2573KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🎉 Auto-mergedThis pull request has been automatically merged by hive-mind.
Auto-merged by hive-mind with --auto-merge flag |
Summary
Issue #22 asks for a test that 2-3 commands with a sleep inside can be started in parallel and that all of them execute. This PR adds that coverage to both implementations the repository ships — JavaScript (
js/tests/parallel-sleep.test.mjs) and Rust (rust/tests/parallel_sleep.rs) — and merges the currentmaininto the branch, which is what moved the JavaScript test fromtests/tojs/tests/.What each test asserts
Wall-clock timing alone is a weak signal on a loaded CI machine, so every test checks three independent properties:
0, and the expected output where the command produces some.Cases covered (identical in both languages)
sleep 0.5commands started togethersleep 0.5commands started together0.2s/0.5s/0.3sfinish in the time of the longest one, not the sumsleep(JS:disableVirtualCommands(), Rust:/bin/sleep) so actual child processes are spawnedsh -c 'echo start; sleep; echo end'× 3 — each command keeps its own output intactsh -ckeeps its own shell variableThe
sh -cand real-process cases are skipped on Windows (test.skipIf(isWindows)/#[cfg(unix)]); the first three run everywhere, becausesleepis a built-in virtual command in both implementations.Language parity
The reviewer asked for parity across languages and for
mainto be synced into the branch. Both are done:mainis merged (d7a7c11), so the branch sits on the currentjs/+rust/monorepo layout.js/.changeset/issue-22-parallel-sleep-tests.mdandrust/changelog.d/20260916_091500_parallel_sleep_tests.md.Verification
Full
bun test js/tests/andcargo test --all-featuressuites were run locally as well.Fixes #22