Repository navigation
test: order fake readiness and sweep helpers left by killed CLI calls - #290
Merged
Merged
Conversation
Spawn and check the reap-order fakes inside the try, so one failed spawn no longer leaks the others. Move the same pid checks into the cleanup scope in the other multi-process session tests. The fake Xvfb now creates its socket only after it installs its stop handlers, so readiness implies the handlers exist. Refs #282
The product starts helpers such as adb in their own process groups, so killing the CLI group missed them. Cleanup now bounds session destroy --all, kills it on overrun, and then SIGKILLs every process of this user whose environment holds the test's exact PICKFORGE_HOME. Closes #288
This was referenced Oct 7, 2026
runCli now records the first env for each PICKFORGE_HOME, so the drain, bounded session destroy, and home sweep cover every commands test. afterEach claims only homes under its own tmpDir. Fake adb tests no longer leave the CLI or its helpers running after a timeout (#288).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR audits test fakes for signals that arrive before their handlers exist (#282). It also makes the commands test cleanup stop helpers that outlive a killed CLI (#288). Test code only.
#282: I audited every listed fake. Only the fake Xvfb in
integration.test.tssignalled readiness before it installed its handlers. It now creates its socket afterprocess.on. The lock is still written first. The other fakes either wait for a ready signal written after the handler, or their tests do not depend on the handler. Insession.test.ts, the spawn and pid checks in the reap-order test and three other multi-process tests now run inside thetry. If one spawn fails, thefinallystill kills the fakes that started.#288: a new test helper,
env-process-sweep.ts, scans/procfor this user's processes whose environment holds the exactPICKFORGE_HOME=<home>entry. It SIGKILLs them one pid at a time, skips zombies and processes that change during the scan, and rescans for up to 2 s. Cleanup now drains CLI calls, runssession destroy --allwith a 45 s limit, then sweeps. An Android destroy can take about 35 s, so the hook timeout went from 60 s to 90 s.runClirecords every home it uses, so every commands test is covered. When no CLI call was force-killed and destroy succeeded, any process the sweep kills fails the test as "processes outlived session destroy", so a product leak stays visible. Three more multi-process tests insession.test.tsnow spawn inside thetry.Closes #282
Closes #288
/tmp/exp288session.test.ts10 runs under load/tmp/exp288sleep 300duringandroid install-apk; sweep tests for exact match, group member without the entry, empty value/tmp/exp288session destroy --allemu kill, limit lowered to 1 s/tmp/exp288/usr/bin/sleep 300in a test that never registered its homesleep 60left after a clean destroy; 3 more full runs ofcommands.test.ts~/Artifacts/pickforge-batch2-2026-10-07/290-cov-final.logQA device pass: skipped. The change is test code only, so there is nothing to drive.