test(remote): cover remote artifact transfer and Metro process stop CRAP findings
Summary
Layer 1 of the #3421 stack (top: #3473). Burns down the three coverage-based CRAP findings by testing the uncovered branches through the owning modules' public entry points: downloadRemoteArtifactFromUrl (HTTP error response with status/body details, transport error before the response starts, timeout before materialization, and a failed directory extraction that removes its staging while leaving the caller-owned root untouched), createStderrUploadProgressReporter (all four event formats plus the byte/percent helpers they exercise), and stopSpawnedMetroProcess via prepareMetroRuntime (ESRCH/EPERM give-up, SIGKILL escalation, unexpected kill errors).
Adds src/__tests__/test-utils/stream-capture.ts — the stderr fake these tests need, scoped to exactly what the CRAP tests use: begin/scoped capture with restore-by-descriptor (no own-property write/isTTY shadow survives), an interactive terminal option, and a Buffer-passthrough option — plus its regression tests, including the empty-Buffer test for the receiver-bound passthrough call. The repo-wide migration and remaining surface live in #3473.
| Function | Before | After |
|---|---|---|
artifact-download.ts:137 | 42 | 6.2 |
upload-progress.ts:68 formatUploadProgressEvent | 30 | 5 |
client-metro.ts:412 stopSpawnedMetroProcess | 45 | 10 |
Validation
Tested SHA cefb002fe. pnpm check:affected --run passes (format, lint, typecheck, fallow audit, related tests); full unit lane re-run on the stack top confirms no fallout. pnpm check:coverage-crap --all on a map limited to the three owned files: no function at or above 30. All test-only; three Metro test titles reworded to claim only what they assert. 5 files, 613+/23−.