[build-tools] Refresh simulator session preview artifacts - #4398
szdziedzic wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4398 +/- ##
==========================================
+ Coverage 71.70% 71.75% +0.05%
==========================================
Files 963 964 +1
Lines 45320 45406 +86
Branches 9724 9740 +16
==========================================
+ Hits 32494 32576 +82
- Misses 11823 11827 +4
Partials 1003 1003 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
| } | ||
| } catch (err) { | ||
| if (!controller.signal.aborted) { | ||
| logger.warn({ err }, 'Could not refresh the session preview; retrying in 60 seconds.'); |
There was a problem hiding this comment.
err could expose a signed url (recall getting this flagged in previous reviews). Maybe we want to log only err.code?
There was a problem hiding this comment.
Good catch! Let’s log the type/code and status instead. Just err.code would miss some errors, like timeouts.
| .split('\n') | ||
| .map(line => line.trim().split(/\s+/)) | ||
| .filter(([, status]) => status === 'device'); | ||
| if (devices.length !== 1) { |
There was a problem hiding this comment.
I could be off (if the case, disregard), but I believe iOS is mostly always trying to get the first available device, not necessarily stopping/throwing if multiple devices. Could/should we do the same here and allow multiple devices, but only consider the first on the list for now?
There was a problem hiding this comment.
iOS gives us the device ID from the preview server, but Android only returns a placeholder. I’d keep this check so we don’t grab the wrong screen. It only skips the thumbnail, the session keeps running.
Why
Keep a current simulator screen image available for future session list-page thumbnails.
How
Capture a WebP up to 320px once the shared preview server and FFmpeg are ready, then refresh it 60 seconds after each attempt completes. Obtain one signed upload URL and reuse it for the entire session; its lifetime already covers the session duration. Stop capture with the session and retry capture or upload failures without failing the session.
The upload-session request preserves worker authentication and combines the attempt and URQL cancellation signals at the fetch boundary. A stalled request is aborted on timeout or shutdown. FFmpeg setup runs in the background on macOS without delaying session readiness; Android retains its existing setup before streaming starts. Stopping a session during setup prevents the thumbnail loop from starting later.
Supports iOS and Android. Because Android readiness currently returns a placeholder ID, resolve the sole connected ADB device and skip capture if selection is ambiguous.
Deploy the API PR first; CI GraphQL schema generation also needs that mutation deployed. The website PR hides preview artifacts without adding thumbnail UI.
Test Plan
Tests