Files
pipdock/crates
poli0981andClaude Opus 5 2795dda52b fix(test): a failed process query is not zero processes
`main` went red at `bee85dc` on `cancelling_kills_the_grandchildren_too`, failing its
**setup** assertion — "the fixture never started" — on a change that touched nothing in
`exec.rs`. It is the second time this test has flaked, and `19b5df4` had already replaced
one guessed sleep with polling, so the deadline was not the root cause.

`grandchildren_alive` ended in `.unwrap_or(0)`, which makes a PowerShell invocation that
*failed* indistinguishable from a definite **zero processes**. Each poll spawns
PowerShell and a CIM query — seconds apiece on a loaded runner — so twenty seconds of
wall clock was a handful of samples rather than the two hundred a 100 ms sleep suggests,
and a slow or failed query read as a confident "nothing is running".

That conflation is worse in the other direction, which is why this is a correctness fix
rather than a flake fix. The **teardown** assertion wants zero: a query that failed there
would have passed the test over a process tree that was still alive — the test proving
`TreeGuard` works could have passed while `TreeGuard` did not.

So `grandchildren_alive` returns `Option<usize>`, `None` meaning "no answer" rather than
"none alive"; `wait_for` never counts a failed query as an observation, retries, and says
so plainly if none ever succeeds instead of concluding from a number nobody measured. The
deadline goes to sixty seconds, and that number is about the *poll* rather than a guess
about the fixture.

Mutation-checked both ways: forcing the query to always fail now fails the test with its
own message, where before it would have passed on `0 == 0`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 11:31:39 +07:00
..