fix(command-runtime): end a wait on its earlier captures when the last one answers late
Summary
Fixes a verdict change that #4794 introduced. Part of #4789.
Since #4794, a wait capture that answers after its cutoff is a timeout. createWaitPolling reported that poll as capture-truncated, so a wait whose earlier captures showed the target absent ended with wait_deadline_exceeded instead of wait_target_absent. Under load the last capture often straddles the cutoff, so the reason changed with host speed. The Coverage job on #4813 failed this way in ios-wait-selector.test.ts (expected wait_target_absent, received wait_deadline_exceeded): https://github.com/callstack/agent-device/actions/runs/44745114108/job/136318310016
Now a capture that answered late ends the poll with no deadline cause. Nothing was cut off mid-capture, so the wait ends on what its earlier captures established: wait_target_absent after a readable capture, wait_capture_stalled when no capture was readable in time. The late answer is still not counted as evidence. A capture that the deadline cancelled in flight keeps capture-truncated, as before. This matches the settle loop, which #4794 already treats this way.
2 files changed. No wire declaration changed.
Validation
Head 476f5f6338.
- The #4794 regression "a capture that answers after the cutoff is a timeout and not a readable capture" now expects
wait_target_absentwith one readable capture. It fails without the change. - New: "a first capture that answers after the cutoff leaves the wait with no readable capture" expects
wait_capture_stalled. - The interaction runtime suite passes (487 tests). Typecheck and lint are clean.
ios-wait-selector.test.tsandsettle-observation.test.ts: 8 of 9 local runs passed with host load about 27. One run failed a different case, "Apple wait selector captures like is when native queries fail". It did not recur in 6 more runs, and I have not found its cause.- No local
check:affectedrun: the host is under load from other validation runs. Hosted CI validates this head.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.