fix(daemon): collect a suite recording its script closed early

TH
41m ago
+164-8

Summary

A remote test --record-video whose script closes its own session delivers its recording (#5421).

Suite cleanup closes the attempt session it owns. A script that already ran close retires it inside the replay action, so cleanup found no live session and returned before collecting the export that close's teardown had committed: success: true, a test-artifacts download with no recording.mp4, no recordingArtifacts, no warning, and a valid MP4 left on the daemon host.

Cleanup now settles against the attempt's last pinned ref, which still names the session directory and the lifetime guarding that committed export. ADR 0024 ownership, expiry and lease scope are unchanged.

Before / after

  • Remote suite ending in close: base gave no recordingArtifacts and copiedArtifacts: screenshot.png. Head delivers recording.mp4 plus telemetry and names both ids.
  • Same command without close: unchanged, both files once.
  • Timeout, copy-failure and close-failure suites: unchanged refusal and warning.

Validation

Head 0d6d9e79cb, base 17aadacb13 (origin/0.22). Production +24/-8.

  • pnpm check:affected --run --base origin/0.22 --head 0d6d9e79cb: all runnable checks passed, exactCommit=true. Receipt .tmp/validation/run-oYrrM9/receipt.json.
  • The regression fails at base. At a33ad0d2ac, the expanded test verifies delivery of both the MP4 and telemetry. The test and typecheck passed.
  • Live: branch-built 0.22.0-dev daemon, proxy and client state dir; iPhone 17 Pro, iOS 27.0. The report was 27.2.

CI owns Coverage and device lanes.