Compare commits

..
Author SHA1 Message Date
Vojtech Novak a42de8ad81 [eas-cli] Verify the simulator stop response before clearing credentials 2026-11-25 08:57:31 +01:00
Tomasz Mazur d16d5695d7 [build-tools] Send an Idempotency-Key header when creating artifact upload sessions (#4877) 2026-11-23 21:20:18 +01:00
SJ Kim 73a3d3e434 [build-tools] Send the end reason when the worker stops a Simulator session (ENG-28039) (#4911) 2026-11-23 12:15:08 -05:00
Tomek Czajecki 31885bdbc6 [eas-cli] Stop selecting deprecated GraphQL fields (#4926) 2026-11-23 18:21:46 +02:00
SJ Kim 87cab80c8f [build-tools] Classify "Requires a Newer Version of iOS" install failures as user errors (ENG-29116) (#4910) 2026-11-23 10:39:06 -05:00
Ash Wu bf5ba2b25a [build-tools] run the after_checkout hook in builds without custom steps (#4920) 2026-11-23 15:30:12 +08:00
Expo CI b78cda16a5 bump STAGING and PRODUCTION to 27.11.0 in cli-versions.json 2026-11-19 17:02:36 +00:00
Expo CI 67972c5d6a v27.11.0 2026-11-19 16:17:39 +00:00
Mustafa Abban d88708d842 [eas-build-job] support Observe error occurrence events (#4860) 2026-11-19 10:41:38 -05:00
expo-tuft[bot] 13056cac22 [build-tools] report the installed app identifier in the agent-device remote config (#4831) 2026-11-19 18:02:26 +08:00
David Mokos 1b45814e3c updates agent-cli-detector to 0.1.8 (#4912) 2026-11-19 00:34:22 +01:00
Tomasz Mazur 8d00e33806 [build-tools] Compress dSYMs with zip level 1 in fastlane gym (#4909) 2026-11-18 21:05:24 +01:00
Szymon Świerk f27e7988a1 [eas-build-job] Accept issue_comment as a workflow github.event_name (#4906) 2026-11-17 18:45:59 +01:00
Gabe DebesandClaude Opus 5.5 b4e4229464 [build-tools] Add step functions to record simulator crash artifacts (#4596)
* [build-tools] Collect simulator crash artifacts

* [build-tools] Use shared crash artifact upload deadlines

* [build-tools] Link crash artifact changelog entry

* [build-tools] Bound crash collection retries and uploads

* [build-tools] Keep retrying productive crash streams

* [build-tools] preserve crash shutdown mock in merged host tests

* Save individual native IPS crash artifacts

* [build-tools] Keep missing crash reports outside artifact limits

* [build-tools] Verify missing crash reports across reconnects

* [build-tools] Reserve crash collection before asynchronous setup

* [build-tools] Release failed crash recorder initialization

* [build-tools] Address crash artifact review findings

Skip a crash occurrence whose detail fails or exceeds 8 MiB instead of
reconnecting, and check each device's crash list once more on stop so
occurrences the stream had not delivered are kept. Key occurrences by
capture time and report path, merge the seen and skipped sets, create the
directory before the session is registered, and log dropped errors.
Artifacts are now kind simulator-crash with per-device numbered ids,
names, and filenames.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Retry transient crash detail failures

Try a failed crash detail up to three times before skipping it; skip a
missing, mismatched, malformed, or oversized detail at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Address second crash artifact review

Keep each device's serve-sim address current for the final pass, warn
when its deadline stops a device, report poller and upload failures to
Sentry, name failed uploads by report, and fall back to the process name
when the app name is empty.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Skip crash details that a retry cannot fix

Treat invalid JSON and permanent 4xx responses as unusable, so they are
not retried three times before later reports are collected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Upload crash reports with the shared file upload helper

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-16 16:09:00 -07:00
Gabe DebesandClaude Opus 5.5 a04489e678 [build-tools] Add step functions to record simulator HAR artifacts (#4495)
* [build-tools] record network capture with serve-sim capture har steps

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* [build-tools] Rename the network capture recording step

Edited-by: Codex

* [build-tools] Remove the capture recorder command override

Edited-by: Codex

* [build-tools] Bound failed network capture followers

* [build-tools] Limit HAR artifact uploads to 500 MiB

* [build-tools] Address HAR capture review findings

Rename the record step to eas/start_serve_sim_network_capture and the
upload helper to a one-file serveSimNetworkCaptureArtifacts; the collect
step numbers parts. Count HARs by their entry log so empty recordings
are neither uploaded nor use recording slots, give followers that record
nothing a slower restart and a separate start cap, drop the spawn
failure throttle and unreachable guards, and allow 60 s for the final
HAR rebuild with followers stopped together.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Bound HAR recording slots and uploads

Exited followers that recorded nothing no longer use recording slots, a
restarted serve-sim replaces the old identity's follower, the recording
limit warns once, and each HAR upload has a 10-minute limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Keep the ngrok token from the HAR follower

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Drop requests a restarted HAR follower replays

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Keep unflushed HAR requests and remove replayed parts

Rebuild every kept HAR from its entry log before its requests count as
recorded, and delete the files of a follower that held only replayed
requests when it is dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Upload network captures with the shared file upload helper

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [build-tools] Import formatBytes from eas-build-job

Main moved formatBytes into @expo/eas-build-job (#4854).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-11-16 16:09:00 -07:00
114 changed files with 1556 additions and 2127 deletions

No files matched your search

@@ -1,5 +0,0 @@
---
'@expo/build-tools': minor
---
Count Android web preview input as session activity, so `max_idle_time_minutes` works on Android sessions. `eas/start_serve_sim_remote_session` no longer rejects it on Android; the API does not accept an idle timeout for Android web-preview-only sessions yet.
@@ -0,0 +1,5 @@
---
'@expo/build-tools': patch
---
Send an `Idempotency-Key` header when creating device run session and sandbox artifact upload sessions, reuse it when an upload is retried, and stop retrying an upload that EAS rejects.
+5
View File
@@ -0,0 +1,5 @@
---
'@expo/build-tools': minor
---
Run the `after_checkout` workflow hook in build jobs that do not use custom steps.
+5
View File
@@ -0,0 +1,5 @@
---
'eas-cli': patch
---
Keep simulator credentials when the stop response does not confirm that the allocated session stopped.
@@ -0,0 +1,5 @@
---
'eas-cli': patch
---
Stop selecting the deprecated `Build.logFiles`, `Build.queuePosition`, `Build.initialQueuePosition`, `Build.estimatedWaitTimeLeftSeconds` and `AndroidSubmissionConfig.applicationIdentifier` GraphQL fields.
@@ -0,0 +1,5 @@
---
'@expo/build-tools': patch
---
Report an iOS Simulator app install that fails with "Requires a Newer Version of iOS" as the user error `EAS_INSTALL_APPLICATION_REQUIRES_NEWER_IOS`, with a message that asks for a Simulator device whose iOS version meets the app's minimum, or a lower iOS deployment target. Other install failures still report `SERVER_ERROR`.
-5
View File
@@ -1,5 +0,0 @@
---
'eas-cli': minor
---
Add `--network-capture-recording` to keep captured traffic as HAR session artifacts.
-5
View File
@@ -1,5 +0,0 @@
---
'@expo/build-tools': minor
---
Add start and collect steps that attach serve-sim simulator crash reports to device run sessions as IPS files.
-5
View File
@@ -1,5 +0,0 @@
---
'@expo/build-tools': minor
---
Add start and collect steps that attach serve-sim network captures to device run sessions as HAR files.
-5
View File
@@ -1,5 +0,0 @@
---
'eas-cli': patch
---
Mark the default device for each platform in `eas simulator:devices` and include `isDefault` in JSON output.
-5
View File
@@ -1,5 +0,0 @@
---
'eas-cli': minor
---
Add `simulator:network-requests` to list, follow, and inspect captured requests and download HAR files.
@@ -1,5 +0,0 @@
---
'@expo/build-tools': patch
---
A successful remote device run session no longer fails when its agent-device, Appium, or Argent tunnel does not stop within its time-out.
+5
View File
@@ -0,0 +1,5 @@
---
'@expo/build-tools': patch
---
Send the reason when the worker stops a Simulator session: `idle_timeout` after the idle timeout, and `max_duration` when the session reaches its maximum duration, which now also stops the session through the worker stop route. A canceled build step sends no stop.
+18
View File
@@ -2,6 +2,24 @@
This is the log of notable changes to EAS CLI and related packages.
## [27.11.0](https://github.com/expo/eas-cli/releases/tag/v27.11.0) - 2026-11-19
### 🎉 New features
- [build-tools] Report the identifier of the installed app as `applicationIdentifier` in the agent-device remote config, so clients can attach to the app of an `application_archive_url` session. ([#4831](https://github.com/expo/eas-cli/pull/4831) by [@expo-tuft](https://github.com/apps/expo-tuft))
- [build-tools] Count Android web preview input as session activity, so `max_idle_time_minutes` works on Android sessions. `eas/start_serve_sim_remote_session` no longer rejects it on Android; the API does not accept an idle timeout for Android web-preview-only sessions yet. ([#4890](https://github.com/expo/eas-cli/pull/4890) by [@szdziedzic](https://github.com/szdziedzic))
- [eas-build-job] Accept `issue_comment` as a `github.event_name` value in the workflow interpolation context. ([#4906](https://github.com/expo/eas-cli/pull/4906) by [@sswrk](https://github.com/sswrk))
- [eas-build-job] Support error occurrence events in Observe workflow context. ([#4860](https://github.com/expo/eas-cli/pull/4860) by [@AbbanMustafa](https://github.com/AbbanMustafa))
- [build-tools] Add start and collect steps that attach serve-sim simulator crash reports to device run sessions as IPS files. ([#4596](https://github.com/expo/eas-cli/pull/4596) by [@gwdp](https://github.com/gwdp))
- [build-tools] Add start and collect steps that attach serve-sim network captures to device run sessions as HAR files. ([#4495](https://github.com/expo/eas-cli/pull/4495) by [@gwdp](https://github.com/gwdp))
### 🐛 Bug fixes
- [eas-cli] Detect Factory Droid, Grok Bot, Claude Cowork, and Muse in EAS CLI telemetry. ([#4912](https://github.com/expo/eas-cli/pull/4912) by [@davidmokos](https://github.com/davidmokos))
- [build-tools] Default `fastlane gym` dSYM compression level to 1. ([#4909](https://github.com/expo/eas-cli/pull/4909) by [@AHGIJMKLKKZNPJKQR](https://github.com/AHGIJMKLKKZNPJKQR))
- [eas-cli] Mark the default device for each platform in `eas simulator:devices` and include `isDefault` in JSON output. ([#4895](https://github.com/expo/eas-cli/pull/4895) by [@gwdp](https://github.com/gwdp))
- [build-tools] A successful remote device run session no longer fails when its agent-device, Appium, or Argent tunnel does not stop within its time-out. ([#4893](https://github.com/expo/eas-cli/pull/4893) by [@szdziedzic](https://github.com/szdziedzic))
## [27.10.0](https://github.com/expo/eas-cli/releases/tag/v27.10.0) - 2026-11-13
### 🎉 New features
+2 -2
View File
@@ -1,4 +1,4 @@
{
"STAGING": "27.10.0",
"PRODUCTION": "27.10.0"
"STAGING": "27.11.0",
"PRODUCTION": "27.11.0"
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"version": "27.10.0",
"version": "27.11.0",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
+14
View File
@@ -1,5 +1,19 @@
# @expo/build-tools
## 27.11.0
### Minor Changes
- Report the identifier of the installed app as `applicationIdentifier` in the agent-device remote config, so clients can attach to the app of an `application_archive_url` session. ([#4831](https://github.com/expo/eas-cli/pull/4831) by [@expo-tuft](https://github.com/apps/expo-tuft))
- Count Android web preview input as session activity, so `max_idle_time_minutes` works on Android sessions. `eas/start_serve_sim_remote_session` no longer rejects it on Android; the API does not accept an idle timeout for Android web-preview-only sessions yet. ([#4890](https://github.com/expo/eas-cli/pull/4890) by [@szdziedzic](https://github.com/szdziedzic))
- Add start and collect steps that attach serve-sim simulator crash reports to device run sessions as IPS files. ([#4596](https://github.com/expo/eas-cli/pull/4596) by [@gwdp](https://github.com/gwdp))
- Add start and collect steps that attach serve-sim network captures to device run sessions as HAR files. ([#4495](https://github.com/expo/eas-cli/pull/4495) by [@gwdp](https://github.com/gwdp))
### Patch Changes
- Default `fastlane gym` dSYM compression level to 1. ([#4909](https://github.com/expo/eas-cli/pull/4909) by [@AHGIJMKLKKZNPJKQR](https://github.com/AHGIJMKLKKZNPJKQR))
- A successful remote device run session no longer fails when its agent-device, Appium, or Argent tunnel does not stop within its time-out. ([#4893](https://github.com/expo/eas-cli/pull/4893) by [@szdziedzic](https://github.com/szdziedzic))
## 27.10.0
### Minor Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@expo/build-tools",
"version": "27.10.0",
"version": "27.11.0",
"bugs": "https://github.com/expo/eas-cli/issues",
"license": "BUSL-1.1",
"author": "Expo <[email protected]>",
@@ -42,17 +42,17 @@
"dependencies": {
"@expo/config": "55.0.10",
"@expo/config-plugins": "55.0.7",
"@expo/downloader": "27.10.0",
"@expo/eas-build-job": "27.10.0",
"@expo/downloader": "27.11.0",
"@expo/eas-build-job": "27.11.0",
"@expo/env": "^0.4.0",
"@expo/logger": "27.10.0",
"@expo/logger": "27.11.0",
"@expo/package-manager": "1.9.10",
"@expo/plist": "^0.3.5",
"@expo/results": "^1.0.0",
"@expo/spawn-async": "1.7.2",
"@expo/steps": "27.10.0",
"@expo/template-file": "27.10.0",
"@expo/turtle-spawn": "27.10.0",
"@expo/steps": "27.11.0",
"@expo/template-file": "27.11.0",
"@expo/turtle-spawn": "27.11.0",
"@expo/xcpretty": "^4.4.7",
"@ngrok/ngrok": "1.7.0",
"@sentry/node": "7.77.0",
@@ -91,7 +91,7 @@ describe(androidBuilder, () => {
);
});
it('passes the install_node_modules anchor and a hooks ref to setupAsync', async () => {
it('passes a hooks ref to setupAsync', async () => {
const ctx = new BuildContext(createTestAndroidJob(), {
workingdir: '/workingdir',
logBuffer: { getLogs: () => [], getPhaseLogs: () => [] },
@@ -105,7 +105,6 @@ describe(androidBuilder, () => {
expect(setupAsync).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
wrappedAnchors: ['install_node_modules'],
jobHooksRef: expect.objectContaining({ current: null }),
})
);
+1 -1
View File
@@ -72,7 +72,7 @@ async function buildInnerAsync(
ctx: BuildContext<Android.Job>,
jobHooksRef: JobHooksRef
): Promise<void> {
await setupAsync(ctx, { wrappedAnchors: ['install_node_modules'], jobHooksRef });
await setupAsync(ctx, { jobHooksRef });
const evictUsedBefore = new Date();
const workingDirectory = ctx.getReactNativeProjectDirectory();
const hasNativeCode = ctx.job.type === Workflow.GENERIC;
+1 -1
View File
@@ -76,7 +76,7 @@ async function buildInnerAsync(
ctx: BuildContext<Ios.Job>,
jobHooksRef: JobHooksRef
): Promise<void> {
await setupAsync(ctx, { wrappedAnchors: ['install_node_modules'], jobHooksRef });
await setupAsync(ctx, { jobHooksRef });
const hasNativeCode = ctx.job.type === Workflow.GENERIC;
const evictUsedBefore = new Date();
const credentialsManager = new CredentialsManager(ctx);
@@ -1,10 +1,10 @@
import { BuildPhase, BuildTrigger, Hooks, Ios } from '@expo/eas-build-job';
import { BuildPhase, BuildTrigger, HookKey, Hooks, Ios } from '@expo/eas-build-job';
import { bunyan } from '@expo/logger';
import { executeHookStepsAsync } from '@expo/steps';
import { createTestIosJob } from '../../__tests__/utils/job';
import { BuildContext } from '../../context';
import { runHookableBuildPhaseAsync } from '../hookableBuildPhase';
import { runHookEntriesAsync, runHookableBuildPhaseAsync } from '../hookableBuildPhase';
import { ParsedJobHooks, parseJobHooksAsync } from '../jobHooks';
// The primitive's step-execution rules (failure()/success(), no-if continuation,
@@ -16,7 +16,10 @@ jest.mock('@expo/steps', () => ({
}));
const executeHookStepsMock = jest.mocked(executeHookStepsAsync);
async function setup(hooks: Hooks | undefined): Promise<{
async function setup(
hooks: Hooks | undefined,
hookKeys: readonly HookKey[] = ['before_install_node_modules', 'after_install_node_modules']
): Promise<{
ctx: BuildContext<Ios.Job>;
hooks: ParsedJobHooks | null;
}> {
@@ -40,7 +43,7 @@ async function setup(hooks: Hooks | undefined): Promise<{
jest
.spyOn(ctx, 'runBuildPhase')
.mockImplementation((_phase: BuildPhase, fn: () => Promise<unknown>) => fn() as never);
return { ctx, hooks: await parseJobHooksAsync(ctx, ['install_node_modules']) };
return { ctx, hooks: await parseJobHooksAsync(ctx, hookKeys) };
}
const runArgs = <TJob extends Ios.Job>(
@@ -162,3 +165,23 @@ describe(runHookableBuildPhaseAsync, () => {
expect(writeBack).toHaveBeenCalled();
});
});
describe(runHookEntriesAsync, () => {
beforeEach(() => {
executeHookStepsMock.mockReset();
executeHookStepsMock.mockResolvedValue({ failedLocally: false, firstError: undefined });
});
it('runs the after_checkout entries that the parser built', async () => {
const { ctx, hooks } = await setup({ after_checkout: [{ run: 'echo after' }] }, [
'after_checkout',
]);
await runHookEntriesAsync({ ctx, hooks: hooks!, timing: 'after', anchor: 'checkout' });
expect(hooks!.hookEntriesByKey.after_checkout).toHaveLength(1);
expect(executeHookStepsMock).toHaveBeenCalledWith(
hooks!.globalContext,
hooks!.hookEntriesByKey.after_checkout,
{ anchor: 'checkout', timing: 'after', anchorResult: 'success' }
);
});
});
@@ -9,7 +9,7 @@ import { createTestIosJob } from '../../__tests__/utils/job';
import { BuildContext } from '../../context';
import { parseJobHooksAsync } from '../jobHooks';
const INSTALL: ['install_node_modules'] = ['install_node_modules'];
const INSTALL = ['before_install_node_modules', 'after_install_node_modules'] as const;
function createCtx(
hooks: Hooks | undefined,
@@ -4,7 +4,7 @@ import { createTestAndroidJob } from '../../__tests__/utils/job';
import { createMockLogger } from '../../__tests__/utils/logger';
import { BuildContext } from '../../context';
import { resolveEnvFromBuildProfileAsync, runEasBuildInternalAsync } from '../easBuildInternal';
import { runHookableBuildPhaseAsync } from '../hookableBuildPhase';
import { runHookEntriesAsync, runHookableBuildPhaseAsync } from '../hookableBuildPhase';
import { JobHooksRef, setupAsync } from '../setup';
import { ParsedJobHooks, parseJobHooksAsync } from '../jobHooks';
import { prepareProjectSourcesAsync } from '../projectSources';
@@ -15,7 +15,10 @@ jest.mock('../easBuildInternal', () => ({
resolveEnvFromBuildProfileAsync: jest.fn(),
runEasBuildInternalAsync: jest.fn(),
}));
jest.mock('../hookableBuildPhase', () => ({ runHookableBuildPhaseAsync: jest.fn() }));
jest.mock('../hookableBuildPhase', () => ({
runHookEntriesAsync: jest.fn(),
runHookableBuildPhaseAsync: jest.fn(),
}));
jest.mock('../jobHooks', () => ({ parseJobHooksAsync: jest.fn() }));
jest.mock('../../utils/npmrc', () => ({ setUpNpmrcAsync: jest.fn() }));
jest.mock('../../utils/hooks', () => ({
@@ -79,6 +82,9 @@ describe(setupAsync, () => {
order.push('parse-hooks');
return PARSED;
});
jest.mocked(runHookEntriesAsync).mockImplementation(async () => {
order.push('after-checkout-hooks');
});
jest.mocked(runHookableBuildPhaseAsync).mockImplementation(async () => {
// Record the wrapper call; deliberately do NOT run its `fn` so the install
// internals stay out of the ordering test.
@@ -91,23 +97,50 @@ describe(setupAsync, () => {
}));
});
it('parses hooks after project prep + profile-env + pre-install hook, and before the install wrapper', async () => {
it('parses hooks after project prep + profile-env + pre-install hook, then runs the after_checkout hooks before the install wrapper', async () => {
const jobHooksRef: JobHooksRef = { current: null };
await setupAsync(createCtx(BuildTrigger.GIT_BASED_INTEGRATION), {
wrappedAnchors: ['install_node_modules'],
jobHooksRef,
});
const parseAt = order.indexOf('parse-hooks');
expect(order.indexOf('prepare-project')).toBeLessThan(parseAt);
expect(order.indexOf('profile-env')).toBeLessThan(parseAt);
expect(order.indexOf('pre-install-hook')).toBeLessThan(parseAt);
expect(parseAt).toBeLessThan(order.indexOf('install-wrapper'));
expect(order).toEqual([
'prepare-project',
'profile-env',
'pre-install-hook',
'parse-hooks',
'after-checkout-hooks',
'install-wrapper',
]);
expect(parseJobHooksAsync).toHaveBeenCalledWith(expect.anything(), [
'after_checkout',
'before_install_node_modules',
'after_install_node_modules',
]);
expect(runHookEntriesAsync).toHaveBeenCalledWith(
expect.objectContaining({ hooks: PARSED, timing: 'after', anchor: 'checkout' })
);
});
it('publishes the parsed hooks to the ref before an after_checkout hook can fail', async () => {
jest.mocked(runHookEntriesAsync).mockRejectedValueOnce(new Error('hook boom'));
const jobHooksRef: JobHooksRef = { current: null };
await expect(
setupAsync(createCtx(BuildTrigger.GIT_BASED_INTEGRATION), { jobHooksRef })
).rejects.toThrow('hook boom');
expect(jobHooksRef.current).toBe(PARSED);
expect(runHookableBuildPhaseAsync).not.toHaveBeenCalled();
});
it('runs no after_checkout hooks when the job has no hooks', async () => {
jest.mocked(parseJobHooksAsync).mockResolvedValueOnce(null);
await setupAsync(createCtx(BuildTrigger.GIT_BASED_INTEGRATION), {
jobHooksRef: { current: null },
});
expect(runHookEntriesAsync).not.toHaveBeenCalled();
});
it('parses hooks unconditionally on a non-git-based build (never parked in the git-only branch)', async () => {
const jobHooksRef: JobHooksRef = { current: null };
await setupAsync(createCtx(BuildTrigger.EAS_CLI), {
wrappedAnchors: ['install_node_modules'],
jobHooksRef,
});
expect(parseJobHooksAsync).toHaveBeenCalledTimes(1);
@@ -119,7 +152,6 @@ describe(setupAsync, () => {
it('publishes the parsed hooks to the ref before the install wrapper runs', async () => {
const jobHooksRef: JobHooksRef = { current: null };
await setupAsync(createCtx(BuildTrigger.GIT_BASED_INTEGRATION), {
wrappedAnchors: ['install_node_modules'],
jobHooksRef,
});
expect(jobHooksRef.current).toBe(PARSED);
@@ -5,3 +5,7 @@ export const COMMON_FASTLANE_ENV = {
FASTLANE_HIDE_TIMESTAMP: 'true',
LC_ALL: 'en_US.UTF-8',
};
export const DEFAULT_FASTLANE_GYM_ENV = {
ZIPOPT: '-1',
};
@@ -57,7 +57,7 @@ export async function runHookableBuildPhaseAsync<TJob extends BuildJob, T>({
return result;
}
async function runHookEntriesAsync<TJob extends BuildJob>({
export async function runHookEntriesAsync<TJob extends BuildJob>({
ctx,
hooks,
timing,
+32 -36
View File
@@ -2,7 +2,6 @@ import {
BuildJob,
CompositeFunctionCatalog,
ErrorCode,
HookAnchorId,
HookKey,
UserError,
parseHookKey,
@@ -37,12 +36,12 @@ export interface ParsedJobHooks {
/**
* Parses the native job's `hooks` into engine-ready entries, once, at setup
* time. Shape-validates every registered key (reachable or not); constructs
* entries only for the anchors this build actually wraps. Returns null when the
* entries only for the hook keys this build runs. Returns null when the
* job declares no hooks.
*/
export async function parseJobHooksAsync<TJob extends BuildJob>(
ctx: BuildContext<TJob>,
wrappedAnchors: readonly HookAnchorId[]
hookKeys: readonly HookKey[]
): Promise<ParsedJobHooks | null> {
const hooks = ctx.job.hooks;
if (!hooks || Object.keys(hooks).length === 0) {
@@ -81,8 +80,8 @@ export async function parseJobHooksAsync<TJob extends BuildJob>(
}
}
// Construct entries for the wrapped anchors in EXECUTION order (per anchor,
// before_ then after_) so generated step ids and output references follow the
// Construct entries for the given hook keys in the order given, which is
// EXECUTION order, so generated step ids and output references follow the
// order steps actually run. All entries share one globalContext, so env and
// outputs accumulate across keys.
const hookEntriesByKey: Partial<Record<HookKey, HookEntry[]>> = {};
@@ -92,37 +91,34 @@ export async function parseJobHooksAsync<TJob extends BuildJob>(
ctx.getReactNativeProjectDirectory(),
{ logger: ctx.logger }
);
for (const anchor of wrappedAnchors) {
for (const side of ['before', 'after'] as const) {
const key: HookKey = `${side}_${anchor}`;
const steps = hooks[key];
if (!Array.isArray(steps) || steps.length === 0) {
continue;
}
let entries: HookEntry[];
try {
// Extended per key so a bad `uses:` path is attributed to that hook key.
await extendCompositeFunctionCatalogFromStepsAsync({
catalog: compositeFunctionCatalog,
rootSteps: steps,
loadCompositeFunction,
});
entries = await constructHookEntriesAsync(globalContext, steps, {
externalFunctions,
externalFunctionGroups,
compositeFunctionCatalog,
});
} catch (err) {
throw new UserError(
ErrorCode.HOOKS_ERROR,
`Failed to parse hooks.${key}: ${err instanceof Error ? err.message : String(err)}. Hooks use the same syntax as workflow steps.`,
{ cause: err }
);
}
hookEntriesByKey[key] = entries;
for (const entry of entries) {
orderedSteps.push(...entry.steps);
}
for (const key of hookKeys) {
const steps = hooks[key];
if (!Array.isArray(steps) || steps.length === 0) {
continue;
}
let entries: HookEntry[];
try {
// Extended per key so a bad `uses:` path is attributed to that hook key.
await extendCompositeFunctionCatalogFromStepsAsync({
catalog: compositeFunctionCatalog,
rootSteps: steps,
loadCompositeFunction,
});
entries = await constructHookEntriesAsync(globalContext, steps, {
externalFunctions,
externalFunctionGroups,
compositeFunctionCatalog,
});
} catch (err) {
throw new UserError(
ErrorCode.HOOKS_ERROR,
`Failed to parse hooks.${key}: ${err instanceof Error ? err.message : String(err)}. Hooks use the same syntax as workflow steps.`,
{ cause: err }
);
}
hookEntriesByKey[key] = entries;
for (const entry of entries) {
orderedSteps.push(...entry.steps);
}
}
+15 -7
View File
@@ -3,7 +3,6 @@ import {
BuildJob,
BuildPhase,
BuildTrigger,
HookAnchorId,
Ios,
Job,
Platform,
@@ -15,7 +14,7 @@ import nullthrows from 'nullthrows';
import path from 'path';
import { resolveEnvFromBuildProfileAsync, runEasBuildInternalAsync } from './easBuildInternal';
import { runHookableBuildPhaseAsync } from './hookableBuildPhase';
import { runHookEntriesAsync, runHookableBuildPhaseAsync } from './hookableBuildPhase';
import { installDependenciesAsync, resolvePackagerDir } from './installDependencies';
import { ParsedJobHooks, parseJobHooksAsync } from './jobHooks';
import { prepareProjectSourcesAsync } from './projectSources';
@@ -50,10 +49,7 @@ export interface JobHooksRef {
export async function setupAsync<TJob extends BuildJob>(
ctx: BuildContext<TJob>,
{
wrappedAnchors,
jobHooksRef,
}: { wrappedAnchors: readonly HookAnchorId[]; jobHooksRef: JobHooksRef }
{ jobHooksRef }: { jobHooksRef: JobHooksRef }
): Promise<void> {
await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {
await retryAsync(
@@ -111,7 +107,19 @@ export async function setupAsync<TJob extends BuildJob>(
// Parse hooks unconditionally, after every pre-install env mutation
// (PREPARE_PROJECT, the git-based profile-env block, PRE_INSTALL_HOOK) and
// before the first wrapped phase.
jobHooksRef.current = await parseJobHooksAsync(ctx, wrappedAnchors);
jobHooksRef.current = await parseJobHooksAsync(ctx, [
'after_checkout',
'before_install_node_modules',
'after_install_node_modules',
]);
if (jobHooksRef.current) {
await runHookEntriesAsync({
ctx,
hooks: jobHooksRef.current,
timing: 'after',
anchor: 'checkout',
});
}
await runHookableBuildPhaseAsync({
ctx,
@@ -23,13 +23,19 @@ const WORKING_DIR = '/workingdir';
// BuildContext.getReactNativeProjectDirectory() nests the RN project under `${workingdir}/build`.
const IOS_DIR = path.join(WORKING_DIR, 'build', 'ios');
function makeIosBuildContext({ simulator }: { simulator: boolean }): BuildContext<Ios.Job> {
function makeIosBuildContext({
simulator,
env = {},
}: {
simulator: boolean;
env?: Record<string, string>;
}): BuildContext<Ios.Job> {
const job: Ios.Job = { ...createTestIosJob(), simulator };
return new BuildContext(job, {
workingdir: WORKING_DIR,
logger: createMockLogger(),
logBuffer: { getLogs: () => [], getPhaseLogs: () => [] },
env: { __API_SERVER_URL: 'http://api.expo.test' },
env: { __API_SERVER_URL: 'http://api.expo.test', ...env },
uploadArtifact: jest.fn(),
});
}
@@ -125,4 +131,25 @@ describe(runFastlaneGym, () => {
workspacePath: IOS_DIR,
});
});
it.each<{ name: string; env: Record<string, string>; expectedZipopt: string }>([
{ name: 'defaults ZIPOPT to -1', env: {}, expectedZipopt: '-1' },
{ name: 'keeps ZIPOPT from the build env', env: { ZIPOPT: '-9' }, expectedZipopt: '-9' },
])('$name', async ({ env, expectedZipopt }) => {
const ctx = makeIosBuildContext({ simulator: false, env });
await runFastlaneGym(ctx, {
scheme: 'App',
credentials: ARCHIVE_CREDENTIALS,
entitlements: null,
});
expect(spawn).toHaveBeenCalledWith(
'fastlane',
['gym'],
expect.objectContaining({
env: expect.objectContaining({ ZIPOPT: expectedZipopt }),
})
);
});
});
+2 -2
View File
@@ -10,7 +10,7 @@ import type { Credentials } from './credentials/manager';
import { createFastfileForResigningBuild } from './fastfile';
import { createGymfileForArchiveBuild, createGymfileForSimulatorBuild } from './gymfile';
import { isTVOS } from './tvos';
import { COMMON_FASTLANE_ENV } from '../common/fastlane';
import { COMMON_FASTLANE_ENV, DEFAULT_FASTLANE_GYM_ENV } from '../common/fastlane';
import { XcodeBuildLogger } from '../common/xcpretty';
import { BuildContext, SkipNativeBuildError } from '../context';
@@ -52,7 +52,7 @@ export async function runFastlaneGym<TJob extends Ios.Job>(
await runFastlane(['gym'], {
cwd: workspacePath,
logger: ctx.logger,
env: { ...ctx.env, ...extraEnv },
env: { ...DEFAULT_FASTLANE_GYM_ENV, ...ctx.env, ...extraEnv },
});
} finally {
await buildLogger.flush();
@@ -216,6 +216,36 @@ describe('runAgentDeviceRemoteSessionAsync orchestration', () => {
);
});
it.each([
[
BuildRuntimePlatform.DARWIN,
{
iosSimulatorUdid: 'selected-udid',
application: Promise.resolve({
installAppPath: '/tmp/App.app',
launchAppIdentifier: 'com.example.archive',
}),
},
],
[
BuildRuntimePlatform.LINUX,
{ booted: Promise.resolve(), ready: Promise.resolve('com.example.archive') },
],
])(
'reports the identifier of the app the %s device launched',
async (runtimePlatform, device) => {
const logger = { info: jest.fn(), warn: jest.fn(), child: jest.fn().mockReturnThis() };
await runAsync(logger, runtimePlatform, { device });
expect(uploadRemoteSessionConfigAsync).toHaveBeenCalledWith(
expect.objectContaining({
remoteConfig: expect.objectContaining({ applicationIdentifier: 'com.example.archive' }),
})
);
}
);
it('uses the warm daemon after adoption and starts no daemon of its own', async () => {
const logger = { info: jest.fn(), warn: jest.fn(), child: jest.fn().mockReturnThis() };
const warmServer = { port: 3200 } as never;
@@ -517,6 +517,10 @@ describe(createStartAgentDeviceSessionBuildFunction, () => {
expect(launchApplicationAsync).toHaveBeenCalledWith(
expect.objectContaining({ applicationIdentifier: 'dev.example.app', activityName: '.Main' })
);
// The remote session reports it so clients can attach to an archive session's app.
await expect((sessionDevice() as { ready: Promise<unknown> }).ready).resolves.toBe(
'dev.example.app'
);
});
it('stops the download and waits for it when Android boot fails', async () => {
@@ -126,7 +126,8 @@ export async function runAgentDeviceRemoteSessionAsync(
device:
| {
booted: Promise<unknown>;
ready: Promise<unknown>;
/** Resolves with the identifier of the app it installed, if any. */
ready: Promise<string | void>;
}
| {
iosSimulatorUdid: string;
@@ -244,6 +245,7 @@ export async function runAgentDeviceRemoteSessionAsync(
const [
{ port: daemonPort, token: daemonToken, remoteSessionUrl: agentDeviceRemoteSessionUrl },
webPreview,
installedApplicationIdentifier,
] = await Promise.all([agentDeviceStartup, sessionHostStartup, deviceReady]).catch(
(err: unknown) => {
// Also aborts for a `device.ready` that does not come from `tasks.run`.
@@ -253,6 +255,11 @@ export async function runAgentDeviceRemoteSessionAsync(
);
tasks.signal.throwIfAborted();
logger.info(tasks.summary());
// Reported so clients can attach to the app of a session with no build record, like an
// `application_archive_url` one. The session host already launched the iOS app.
const applicationIdentifier = hostBootedDevice?.application
? (await tasks.untilAborted(hostBootedDevice.application))?.launchAppIdentifier
: installedApplicationIdentifier;
const sessionStart = await uploadRemoteSessionConfigWithLocalEgressAsync({
env,
@@ -265,6 +272,7 @@ export async function runAgentDeviceRemoteSessionAsync(
webPreviewUrl: webPreview.previewPageUrl,
previewApiUrl: webPreview.apiUrl,
...(webPreview.previewToken ? { webPreviewToken: webPreview.previewToken } : {}),
...(applicationIdentifier ? { applicationIdentifier } : {}),
},
logger,
});
@@ -226,6 +226,7 @@ export function createStartAgentDeviceSessionBuildFunction(
let sessionOwnsTeardown = false;
let downloaded: Promise<string> | undefined;
let applicationReady: Promise<ServeSimApplicationOptions | void> | undefined;
let installedAndroidApplication: Promise<string> | undefined;
try {
if (isIos) {
@@ -321,7 +322,7 @@ export function createStartAgentDeviceSessionBuildFunction(
installAppPath,
});
} else if (!isIos && (installAppPath || downloadedApp)) {
applicationReady = tasks.run('app install and launch', async taskLogger => {
installedAndroidApplication = tasks.run('app install and launch', async taskLogger => {
await tasks.untilAborted(booted!);
const artifactPath = installAppPath ?? (await downloadedApp);
if (!artifactPath) {
@@ -344,6 +345,7 @@ export function createStartAgentDeviceSessionBuildFunction(
env,
logger: taskLogger,
});
return applicationIdentifier;
});
}
@@ -374,7 +376,7 @@ export function createStartAgentDeviceSessionBuildFunction(
}
: {
booted,
ready: applicationReady ?? tasks.untilAborted(booted),
ready: installedAndroidApplication ?? tasks.untilAborted(booted),
},
});
} catch (error) {
@@ -388,7 +390,12 @@ export function createStartAgentDeviceSessionBuildFunction(
throw error;
} finally {
tasks.abort(new Error('Agent-device session ended.'));
await Promise.allSettled([booted, downloaded, applicationReady]);
await Promise.allSettled([
booted,
downloaded,
applicationReady,
installedAndroidApplication,
]);
}
};
try {
@@ -5,14 +5,20 @@ import timers from 'node:timers/promises';
import { CustomBuildContext } from '../../../customBuildContext';
import { Sentry } from '../../../sentry';
import { uploadDeviceRunSessionArtifactAsync } from '../deviceRunSessionArtifacts';
import {
DeviceRunSessionArtifactRejectedError,
uploadDeviceRunSessionArtifactAsync,
} from '../deviceRunSessionArtifacts';
import {
listAgentDeviceArtifactsAsync,
pollAgentDeviceArtifactsForUploadAsync,
uploadAgentDeviceArtifactAsync,
} from '../agentDeviceArtifacts';
jest.mock('../deviceRunSessionArtifacts');
jest.mock('../deviceRunSessionArtifacts', () => ({
...jest.requireActual('../deviceRunSessionArtifacts'),
uploadDeviceRunSessionArtifactAsync: jest.fn(),
}));
jest.mock('../../../sentry');
jest.mock('node-fetch');
@@ -32,6 +38,16 @@ async function flushPromisesAsync(): Promise<void> {
}
}
async function waitForUploadCallsAsync(count: number): Promise<void> {
for (
let i = 0;
i < 100 && jest.mocked(uploadDeviceRunSessionArtifactAsync).mock.calls.length < count;
i++
) {
await jest.advanceTimersByTimeAsync(0);
}
}
function createLoggerMock(): bunyan {
return {
info: jest.fn(),
@@ -163,6 +179,7 @@ describe(uploadAgentDeviceArtifactAsync, () => {
deviceRunSessionId: 'drs-id',
daemonUrl: 'http://127.0.0.1:1234',
daemonToken: 'daemon-token',
request: { idempotencyKey: 'idempotency-key' },
logger,
artifact: {
id: 'artifact-id',
@@ -182,6 +199,7 @@ describe(uploadAgentDeviceArtifactAsync, () => {
kind: 'agent-device-test-report',
size: data.length,
openStream: expect.any(Function),
idempotencyKey: 'idempotency-key',
});
});
@@ -201,6 +219,7 @@ describe(uploadAgentDeviceArtifactAsync, () => {
deviceRunSessionId: 'drs-id',
daemonUrl: 'http://127.0.0.1:1234',
daemonToken: 'daemon-token',
request: { idempotencyKey: 'idempotency-key' },
logger,
artifact: {
id: 'artifact-id',
@@ -236,6 +255,7 @@ describe(uploadAgentDeviceArtifactAsync, () => {
deviceRunSessionId: 'drs-id',
daemonUrl: 'http://127.0.0.1:1234',
daemonToken: 'daemon-token',
request: { idempotencyKey: 'idempotency-key' },
logger,
artifact: {
id: 'artifact-id',
@@ -276,6 +296,7 @@ describe(uploadAgentDeviceArtifactAsync, () => {
deviceRunSessionId: 'drs-id',
daemonUrl: 'http://127.0.0.1:1234',
daemonToken: 'daemon-token',
request: { idempotencyKey: 'idempotency-key' },
logger,
artifact: { id: 'artifact-id', artifactType: 'screenshot', filename: 'shot.png' },
});
@@ -305,6 +326,7 @@ describe(uploadAgentDeviceArtifactAsync, () => {
deviceRunSessionId: 'drs-id',
daemonUrl: 'http://127.0.0.1:1234',
daemonToken: 'daemon-token',
request: { idempotencyKey: 'idempotency-key' },
logger: createLoggerMock(),
artifact: { id: 'artifact-id', artifactType: 'screen-recording', filename: 'session.mp4' },
});
@@ -627,7 +649,7 @@ describe(pollAgentDeviceArtifactsForUploadAsync, () => {
expect(Sentry.capture).toHaveBeenCalledTimes(2);
});
it('retries an artifact after a failed upload', async () => {
it('retries an artifact with its first idempotency key and gives each artifact its own key', async () => {
const data = Buffer.from('artifact-data');
const logger = createLoggerMock();
const ctx = {} as unknown as CustomBuildContext;
@@ -635,18 +657,24 @@ describe(pollAgentDeviceArtifactsForUploadAsync, () => {
id: 'artifact-id',
filename: 'report.json',
};
const listResponse = () => new Response(JSON.stringify({ artifacts: [artifact] }));
const otherArtifact = {
id: 'other-artifact-id',
filename: 'other.json',
};
const listResponse = () =>
new Response(JSON.stringify({ artifacts: [artifact, otherArtifact] }));
jest
.mocked(fetch)
.mockResolvedValueOnce(listResponse())
.mockResolvedValueOnce(new Response(Readable.from([data])))
.mockResolvedValueOnce(new Response(Readable.from([data])))
.mockResolvedValueOnce(listResponse())
.mockResolvedValueOnce(new Response(Readable.from([data])));
jest
.mocked(uploadDeviceRunSessionArtifactAsync)
.mockRejectedValueOnce(new Error('upload failed'))
.mockImplementationOnce(async (_ctx, { openStream }) => {
.mockImplementation(async (_ctx, { openStream }) => {
await readStreamAsync(openStream());
});
@@ -658,12 +686,98 @@ describe(pollAgentDeviceArtifactsForUploadAsync, () => {
});
await flushPromisesAsync();
expect(jest.mocked(uploadDeviceRunSessionArtifactAsync)).toHaveBeenCalledTimes(1);
expect(jest.mocked(uploadDeviceRunSessionArtifactAsync)).toHaveBeenCalledTimes(2);
await jest.advanceTimersByTimeAsync(5_000);
await flushPromisesAsync();
expect(jest.mocked(uploadDeviceRunSessionArtifactAsync)).toHaveBeenCalledTimes(2);
const calls = jest
.mocked(uploadDeviceRunSessionArtifactAsync)
.mock.calls.map(([, { artifactId, idempotencyKey }]) => ({ artifactId, idempotencyKey }));
expect(calls.map(call => call.artifactId)).toEqual([
'artifact-id',
'other-artifact-id',
'artifact-id',
]);
expect(calls[0].idempotencyKey).toEqual(expect.any(String));
expect(calls[2].idempotencyKey).toBe(calls[0].idempotencyKey);
expect(calls[1].idempotencyKey).not.toBe(calls[0].idempotencyKey);
});
it('does not retry an artifact that EAS rejects', async () => {
const data = Buffer.from('artifact-data');
const logger = createLoggerMock();
const ctx = {} as unknown as CustomBuildContext;
const listResponse = () =>
new Response(JSON.stringify({ artifacts: [{ id: 'artifact-id', filename: 'report.json' }] }));
jest
.mocked(fetch)
.mockResolvedValueOnce(listResponse())
.mockResolvedValueOnce(new Response(Readable.from([data])))
.mockResolvedValueOnce(listResponse());
jest
.mocked(uploadDeviceRunSessionArtifactAsync)
.mockRejectedValueOnce(new DeviceRunSessionArtifactRejectedError('Rejected.'));
void pollAgentDeviceArtifactsForUploadAsync(ctx, {
deviceRunSessionId: 'drs-id',
daemonUrl: 'http://127.0.0.1:1234',
daemonToken: 'daemon-token',
logger,
});
await flushPromisesAsync();
await jest.advanceTimersByTimeAsync(5_000);
await flushPromisesAsync();
expect(jest.mocked(fetch)).toHaveBeenCalledTimes(3);
expect(jest.mocked(uploadDeviceRunSessionArtifactAsync)).toHaveBeenCalledTimes(1);
});
it('sends the first metadata again when it retries an artifact', async () => {
const png = Buffer.from(
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aF9sAAAAASUVORK5CYII=',
'base64'
);
const logger = createLoggerMock();
const ctx = {} as unknown as CustomBuildContext;
const listResponse = () =>
new Response(
JSON.stringify({
artifacts: [{ id: 'artifact-id', artifactType: 'screenshot', filename: 'shot.png' }],
})
);
jest
.mocked(fetch)
.mockResolvedValueOnce(listResponse())
.mockResolvedValueOnce(new Response(Readable.from([Buffer.from('not-an-image')])))
.mockResolvedValueOnce(listResponse())
.mockResolvedValueOnce(new Response(Readable.from([png])));
jest
.mocked(uploadDeviceRunSessionArtifactAsync)
.mockRejectedValueOnce(new Error('upload failed'))
.mockImplementation(async (_ctx, { openStream }) => {
await readStreamAsync(openStream());
});
void pollAgentDeviceArtifactsForUploadAsync(ctx, {
deviceRunSessionId: 'drs-id',
daemonUrl: 'http://127.0.0.1:1234',
daemonToken: 'daemon-token',
logger,
});
await waitForUploadCallsAsync(1);
await jest.advanceTimersByTimeAsync(5_000);
await waitForUploadCallsAsync(2);
expect(
jest
.mocked(uploadDeviceRunSessionArtifactAsync)
.mock.calls.map(([, { metadata }]) => metadata)
).toEqual([{ source: 'agent-device' }, { source: 'agent-device' }]);
});
it('stops polling when the daemon does not expose artifact inventory', async () => {
@@ -1,9 +1,13 @@
import { SystemError } from '@expo/eas-build-job';
import fetch from 'node-fetch';
import { Readable } from 'node:stream';
import { CustomBuildContext } from '../../../customBuildContext';
import { turtleFetch } from '../../../utils/turtleFetch';
import { uploadDeviceRunSessionArtifactAsync } from '../deviceRunSessionArtifacts';
import {
DeviceRunSessionArtifactRejectedError,
uploadDeviceRunSessionArtifactAsync,
} from '../deviceRunSessionArtifacts';
import { DEVICE_RUN_SESSION_TOKEN_HEADER } from '../deviceRunSessionWorkerApi';
jest.mock('node-fetch');
@@ -13,13 +17,26 @@ const { Response } = jest.requireActual('node-fetch') as typeof import('node-fet
const TOKEN = 'device-run-session-token-value';
function jsonResponse(body: unknown): InstanceType<typeof Response> {
function jsonResponse(body: unknown, status = 200): InstanceType<typeof Response> {
return new Response(JSON.stringify(body), {
status: 200,
status,
headers: { 'Content-Type': 'application/json' },
});
}
const uploadSessionResponse = () =>
jsonResponse({ data: { uploadSession: { url: 'https://uploads.expo.test/a', headers: {} } } });
const artifact = {
deviceRunSessionId: 'drs-id',
artifactId: 'artifact-id',
name: 'Screenshot',
filename: 'screenshot.png',
kind: 'screenshot',
size: 0,
openStream: () => Readable.from([]),
};
function createCtx(): CustomBuildContext {
return {
env: { EAS_DEVICE_RUN_SESSION_TOKEN: TOKEN },
@@ -60,13 +77,17 @@ describe(uploadDeviceRunSessionArtifactAsync, () => {
metadata: { firstFrameRecordAt: 'test-time' },
size: reportedSize,
openStream: () => stream,
idempotencyKey: 'idempotency-key',
});
expect(jest.mocked(turtleFetch)).toHaveBeenCalledWith(
'https://api.expo.test/v2/device-run-session-worker/artifact-upload-sessions',
'POST',
expect.objectContaining({
headers: { [DEVICE_RUN_SESSION_TOKEN_HEADER]: TOKEN },
headers: {
[DEVICE_RUN_SESSION_TOKEN_HEADER]: TOKEN,
'Idempotency-Key': 'idempotency-key',
},
json: {
name: 'Artifact report.json (artifact-id)',
filename: 'report.json',
@@ -116,4 +137,84 @@ describe(uploadDeviceRunSessionArtifactAsync, () => {
expect(allocationSignal).toBeInstanceOf(AbortSignal);
expect(allocationSignal?.aborted).toBe(true);
});
it('sends a new idempotency key for each upload without one', async () => {
jest
.mocked(turtleFetch)
.mockResolvedValueOnce(uploadSessionResponse())
.mockResolvedValueOnce(uploadSessionResponse());
jest.mocked(fetch).mockResolvedValue(new Response('', { status: 200 }));
await uploadDeviceRunSessionArtifactAsync(createCtx(), artifact);
await uploadDeviceRunSessionArtifactAsync(createCtx(), artifact);
const [first, second] = jest
.mocked(turtleFetch)
.mock.calls.map(
([, , options]) => (options.headers as Record<string, string>)['Idempotency-Key']
);
expect(first).toEqual(expect.any(String));
expect(second).toEqual(expect.any(String));
expect(second).not.toBe(first);
});
it.each([
{
status: 409,
code: 'ARTIFACT_NAME_CONFLICT',
message:
'Device run session already has an artifact named "Screenshot". Use a different name for this artifact.',
},
{
status: 400,
code: 'VALIDATION_ERROR',
message: 'Device run session backing job run has finished.',
},
{
status: 403,
code: 'UNAUTHORIZED',
message:
'You are not authorized to create artifact upload sessions for this device run session.',
},
{ status: 409, code: 'OTHER_CONFLICT', message: 'Failed.' },
])(
'reports HTTP $status $code as a rejected upload session',
async ({ status, code, message }) => {
jest
.mocked(turtleFetch)
.mockResolvedValueOnce(jsonResponse({ errors: [{ code, message }] }, status));
await expect(
uploadDeviceRunSessionArtifactAsync(createCtx(), artifact)
).rejects.toBeInstanceOf(DeviceRunSessionArtifactRejectedError);
expect(fetch).not.toHaveBeenCalled();
}
);
it.each([
{
description: 'HTTP 429',
respond: async () => jsonResponse({ errors: [{ message: 'Too many requests.' }] }, 429),
},
{
description: 'HTTP 500',
respond: async () =>
jsonResponse({ errors: [{ code: 'UNEXPECTED_ERROR', message: 'Failed.' }] }, 500),
},
{
description: 'no response',
respond: async () => {
throw new Error('socket hang up');
},
},
])('does not report $description as a rejected upload session', async ({ respond }) => {
jest.mocked(turtleFetch).mockImplementationOnce(respond);
const error = await uploadDeviceRunSessionArtifactAsync(createCtx(), artifact).catch(
(err: unknown) => err
);
expect(error).toBeInstanceOf(SystemError);
expect(error).not.toBeInstanceOf(DeviceRunSessionArtifactRejectedError);
});
});
@@ -7,14 +7,21 @@ import path from 'node:path';
import type { CustomBuildContext } from '../../../customBuildContext';
import { Sentry } from '../../../sentry';
import { uploadDeviceRunSessionArtifactAsync } from '../deviceRunSessionArtifacts';
import {
type ArtifactUploadRequest,
DeviceRunSessionArtifactRejectedError,
uploadDeviceRunSessionArtifactAsync,
} from '../deviceRunSessionArtifacts';
import { createScreenshotMetadataAsync } from '../deviceRunSessionScreenshotMetadata';
import {
startDeviceRunSessionScreenshotsAsync,
uploadDeviceRunSessionScreenshotsAsync,
} from '../deviceRunSessionScreenshots';
jest.mock('../deviceRunSessionArtifacts');
jest.mock('../deviceRunSessionArtifacts', () => ({
...jest.requireActual('../deviceRunSessionArtifacts'),
uploadDeviceRunSessionArtifactAsync: jest.fn(),
}));
jest.mock('../deviceRunSessionScreenshotMetadata');
jest.mock('../../../sentry');
const ctx = {} as CustomBuildContext;
@@ -22,7 +29,10 @@ const logger = { info: jest.fn(), warn: jest.fn() } as unknown as bunyan;
const options = { deviceRunSessionId: 'session-id', logger };
let directory: string;
let uploaded: Buffer[];
let failedUploads: Map<string, { attempts: number; lastError: Error }>;
let failedUploads: Map<
string,
{ attempts: number; lastError: Error; request: ArtifactUploadRequest }
>;
beforeEach(async () => {
jest.clearAllMocks();
@@ -91,7 +101,11 @@ it('uploads captures that never failed first, oldest first, before retrying fail
for (const name of [newer, failed, older]) {
await writeFile(path.join(directory, name), name);
}
failedUploads.set(failed, { attempts: 1, lastError: new Error('stalled') });
failedUploads.set(failed, {
attempts: 1,
lastError: new Error('stalled'),
request: { idempotencyKey: 'failed-key' },
});
await flush();
expect(
jest
@@ -124,6 +138,57 @@ it('keeps failed uploads and retries the same artifact ID, logging the failed at
expect(Sentry.capture).not.toHaveBeenCalled();
});
it('retries a screenshot with its first idempotency key and gives each screenshot its own key', async () => {
const first = 'screenshot-2026-09-24T08-45-00-000Z-aaaaaaaaaaaa.png';
const second = 'screenshot-2026-09-24T08-45-30-000Z-bbbbbbbbbbbb.png';
await writeFile(path.join(directory, first), 'png');
await writeFile(path.join(directory, second), 'png');
jest.mocked(uploadDeviceRunSessionArtifactAsync).mockRejectedValueOnce(new Error('offline'));
await flush();
await flush();
const calls = jest
.mocked(uploadDeviceRunSessionArtifactAsync)
.mock.calls.map(([, { artifactId, idempotencyKey }]) => ({ artifactId, idempotencyKey }));
expect(calls.map(call => call.artifactId)).toEqual(
[first, second, first].map(name => name.slice(0, -4))
);
expect(calls[0].idempotencyKey).toEqual(expect.any(String));
expect(calls[2].idempotencyKey).toBe(calls[0].idempotencyKey);
expect(calls[1].idempotencyKey).not.toBe(calls[0].idempotencyKey);
});
it('keeps a screenshot that EAS rejects without retrying it', async () => {
const filename = 'screenshot-2026-09-24T08-45-59-123Z-ffffffffffff.png';
await writeFile(path.join(directory, filename), 'png');
jest
.mocked(uploadDeviceRunSessionArtifactAsync)
.mockRejectedValueOnce(new DeviceRunSessionArtifactRejectedError('Rejected.'));
await flush();
await flush();
expect(uploadDeviceRunSessionArtifactAsync).toHaveBeenCalledTimes(1);
expect(await readdir(directory)).toEqual([filename]);
expect(logger.warn).toHaveBeenCalledWith(
expect.objectContaining({ attempt: 1 }),
'EAS rejected the preview screenshot upload. Not retrying it.'
);
});
it('sends the first metadata again when it retries a screenshot', async () => {
const filename = 'screenshot-2026-09-24T08-45-59-123Z-ffffffffffff.png';
await writeFile(path.join(directory, filename), 'png');
jest.mocked(createScreenshotMetadataAsync).mockResolvedValueOnce({ source: 'manual' });
jest.mocked(uploadDeviceRunSessionArtifactAsync).mockRejectedValueOnce(new Error('offline'));
await flush();
await flush();
expect(
jest.mocked(uploadDeviceRunSessionArtifactAsync).mock.calls.map(([, { metadata }]) => metadata)
).toEqual([
{ __eas_type: 'screenshot', source: 'manual' },
{ __eas_type: 'screenshot', source: 'manual' },
]);
expect(createScreenshotMetadataAsync).toHaveBeenCalledTimes(1);
});
it('uploads atomic captures immediately, including a capture arriving during another upload', async () => {
jest.useFakeTimers();
const collector = await startDeviceRunSessionScreenshotsAsync(ctx, options);
@@ -244,6 +309,7 @@ it('warns for the first three attempts and every tenth after, without reporting
expect(failedUploads.get(filename)).toEqual({
attempts: 12,
lastError: expect.objectContaining({ message: 'offline' }),
request: expect.objectContaining({ idempotencyKey: expect.any(String) }),
});
expect(Sentry.capture).not.toHaveBeenCalled();
});
@@ -210,7 +210,10 @@ it('keeps the signed upload URL out of the error when the upload connection drop
handle = request => request.socket.destroy();
const filename = 'screenshot-2026-09-24T08-45-59-123Z-a1b2c3d4e5f6.png';
await writeFile(path.join(directory, filename), 'png');
const failedUploads = new Map<string, { attempts: number; lastError: Error }>();
const failedUploads = new Map<
string,
{ attempts: number; lastError: Error; request: { idempotencyKey: string } }
>();
const logger = { info: jest.fn(), warn: jest.fn() } as unknown as bunyan;
await uploadDeviceRunSessionScreenshotsAsync(ctx, {
directory,
@@ -136,6 +136,15 @@ describe(DeviceRunSessionWorkerApi, () => {
data: { id: 'drs-id', status: 'stopped' },
expected: { id: 'drs-id', status: 'stopped' },
},
{
name: 'stopAsync with a reason',
call: (api: DeviceRunSessionWorkerApi) => api.stopAsync({ reason: 'max_duration' }),
method: 'POST',
route: 'stop',
json: { reason: 'max_duration' },
data: { id: 'drs-id', status: 'stopped' },
expected: { id: 'drs-id', status: 'stopped' },
},
{
name: 'createArtifactUploadSessionAsync',
call: (api: DeviceRunSessionWorkerApi) =>
@@ -145,9 +154,11 @@ describe(DeviceRunSessionWorkerApi, () => {
kind: 'screenshot',
size: 12,
metadata: { __eas_type: 'screenshot' },
idempotencyKey: 'idempotency-key',
}),
method: 'POST',
route: 'artifact-upload-sessions',
headers: { 'Idempotency-Key': 'idempotency-key' },
json: {
name: 'Screenshot',
filename: 'screenshot.png',
@@ -228,7 +239,7 @@ describe(DeviceRunSessionWorkerApi, () => {
},
])(
'$name calls $method /v2/device-run-session-worker/$route with the session token header',
async ({ call, method, route, json, data, expected }) => {
async ({ call, method, route, headers, json, data, expected }) => {
jest.mocked(turtleFetch).mockResolvedValueOnce(jsonResponse({ data }));
await expect(call(createApi())).resolves.toEqual(expected);
@@ -237,7 +248,7 @@ describe(DeviceRunSessionWorkerApi, () => {
const [url, calledMethod, options] = jest.mocked(turtleFetch).mock.calls[0];
expect(url).toBe(`https://api.expo.test/v2/device-run-session-worker/${route}`);
expect(calledMethod).toBe(method);
expect(options.headers).toEqual({ [DEVICE_RUN_SESSION_TOKEN_HEADER]: TOKEN });
expect(options.headers).toEqual({ ...headers, [DEVICE_RUN_SESSION_TOKEN_HEADER]: TOKEN });
expect(options.json).toEqual(json);
expect(options).toEqual(expect.objectContaining({ retries: 0, shouldThrowOnNotOk: false }));
}
@@ -330,6 +330,10 @@ describe('with a device run session token', () => {
});
expectWorkerApiCall('artifact-upload-sessions', 'POST', {
headers: {
[DEVICE_RUN_SESSION_TOKEN_HEADER]: TOKEN,
'Idempotency-Key': expect.any(String),
},
json: {
name: 'Report',
filename: 'report.json',
@@ -190,6 +190,14 @@ function workerApiCallCount(route: string): number {
.mock.calls.filter(([url]) => url === `${DEVICE_RUN_SESSION_WORKER_URL}${route}`).length;
}
/** The JSON body of each stop request the worker sent. */
function stopRequestBodies(): unknown[] {
return jest
.mocked(turtleFetch)
.mock.calls.filter(([url]) => url === `${DEVICE_RUN_SESSION_WORKER_URL}stop`)
.map(([, , options]) => (options as { json?: unknown } | undefined)?.json);
}
/**
* Serves session status polls from `results` in order, and idle stops, through the device run
* session worker API.
@@ -1872,7 +1880,7 @@ describe(waitForDeviceRunSessionStoppedAsync, () => {
expect(jest.mocked(turtleFetch)).not.toHaveBeenCalled();
});
it('returns normally when the maximum duration elapses', async () => {
it('stops the session with max_duration when the maximum duration elapses', async () => {
const ctx = createStatusCtxMock([{ status: 'in-progress' }]);
const logger = createLoggerMock();
const waitPromise = waitForDeviceRunSessionStoppedAsync({
@@ -1891,9 +1899,43 @@ describe(waitForDeviceRunSessionStoppedAsync, () => {
expect(logger.info).toHaveBeenCalledWith(
'Device run session drs-id reached its maximum duration.'
);
expect(stopRequestBodies()).toEqual([{ reason: 'max_duration' }]);
expect(clearTimeoutCallback).toHaveBeenCalledWith(durationTimeout);
});
it('stops with max_duration when the maximum duration interrupts a status poll', async () => {
const ctx = createStatusCtxMock([{ error: new Error('The operation was aborted.') }]);
const waitPromise = waitForDeviceRunSessionStoppedAsync({
ctx,
deviceRunSessionId: 'drs-id',
logger: createLoggerMock(),
maxDurationSeconds: 1,
});
jest.mocked(setTimeoutCallback).mock.calls[0][0]();
await waitPromise;
expect(stopRequestBodies()).toEqual([{ reason: 'max_duration' }]);
});
it('does not stop the session when the build step is canceled', async () => {
const ctx = createStatusCtxMock([{ status: 'in-progress' }]);
const abortController = new AbortController();
const waitPromise = waitForDeviceRunSessionStoppedAsync({
ctx,
deviceRunSessionId: 'drs-id',
logger: createLoggerMock(),
maxDurationSeconds: 1,
signal: abortController.signal,
});
abortController.abort();
jest.mocked(setTimeoutCallback).mock.calls[0][0]();
await waitPromise;
expect(workerApiCallCount('stop')).toBe(0);
});
it('clears the duration timeout when the session stops first', async () => {
await waitForDeviceRunSessionStoppedAsync({
ctx: createStatusCtxMock([{ status: 'stopped' }]),
@@ -2082,6 +2124,7 @@ describe(waitForDeviceRunSessionStoppedAsync, () => {
// One minute at the 5-second poll interval is 12 status polls.
expect(workerApiCallCount('session')).toBe(12);
expect(workerApiCallCount('stop')).toBe(1);
expect(stopRequestBodies()).toEqual([{ reason: 'idle_timeout' }]);
expect(logger.info).toHaveBeenCalledWith(
'Device run session drs-id had no activity for 1 minute(s) (max idle time). Stopping the session.'
);
@@ -2171,9 +2214,9 @@ describe(waitForDeviceRunSessionStoppedAsync, () => {
'Could not mark device run session drs-id as stopped. The session job ends anyway.'
);
expect(jest.mocked(Sentry).capture).toHaveBeenCalledWith(
'Could not mark idle device run session as stopped',
'Could not mark device run session as stopped',
expect.any(Error),
{ level: 'warning', extras: { deviceRunSessionId: 'drs-id' } }
{ level: 'warning', extras: { deviceRunSessionId: 'drs-id', reason: 'idle_timeout' } }
);
});
});
@@ -23,7 +23,7 @@ import { setTimeout as delay } from 'node:timers/promises';
import { inspect } from 'node:util';
import { SandboxArtifactUploadManager, startSandboxArtifactUploadAsync } from '../sandboxArtifacts';
import { type SandboxWorkerApi } from '../sandboxWorkerApi';
import { SandboxWorkerApi } from '../sandboxWorkerApi';
import { WorkerApiError } from '../workerApi';
const { AbortError, FetchError, Response } = jest.requireActual(
@@ -46,7 +46,7 @@ describe('sandbox artifact uploads', () => {
createArtifactUploadSessionAsync: jest.Mock;
finalizeArtifactAsync: jest.Mock;
};
let logger: { info: jest.Mock; error: jest.Mock };
let logger: { info: jest.Mock; warn: jest.Mock; error: jest.Mock };
let uploadArtifactAsync: (options: {
filePath: string;
name: string;
@@ -62,7 +62,7 @@ describe('sandbox artifact uploads', () => {
createArtifactUploadSessionAsync: jest.fn(),
finalizeArtifactAsync: jest.fn(),
};
logger = { info: jest.fn(), error: jest.fn() };
logger = { info: jest.fn(), warn: jest.fn(), error: jest.fn() };
uploadArtifactAsync = async options =>
await startSandboxArtifactUploadAsync({
workerApi: workerApi as unknown as SandboxWorkerApi,
@@ -218,13 +218,28 @@ describe('sandbox artifact uploads', () => {
});
it.each([
{ status: 400, code: 'VALIDATION_ERROR' },
{ status: 403, code: 'UNAUTHORIZED' },
{
status: 409,
code: 'ARTIFACT_NAME_CONFLICT',
apiMessage:
'Sandbox already has an artifact named "Crash log". Use a different name for this artifact.',
},
{
status: 400,
code: 'VALIDATION_ERROR',
apiMessage:
'Sandbox is stopped, so it cannot upload artifacts. Upload artifacts while the sandbox is running.',
},
{
status: 403,
code: 'UNAUTHORIZED',
apiMessage:
'You are not authorized to upload artifacts for this sandbox. Only the user who created the sandbox can upload its artifacts.',
},
])(
'rejects a $code upload session error as a bad request with the API message',
async ({ status, code }) => {
const message =
'POST /v2/sandbox-worker/artifact-upload-sessions failed with status 400: Sandbox already has an artifact named "Crash log". Use a different name for this artifact.';
async ({ status, code, apiMessage }) => {
const message = `POST /v2/sandbox-worker/artifact-upload-sessions failed with status ${status}: ${apiMessage}`;
workerApi.createArtifactUploadSessionAsync.mockRejectedValueOnce(
new WorkerApiError(message, status, undefined, code)
);
@@ -246,6 +261,7 @@ describe('sandbox artifact uploads', () => {
it.each([
{ status: 500, code: 'UNEXPECTED_ERROR' },
{ status: 401, code: 'AUTHENTICATION_ERROR' },
{ status: 409, code: 'OTHER_CONFLICT' },
])('rethrows a $code upload session error unchanged', async ({ status, code }) => {
const error = new WorkerApiError('Request failed.', status, undefined, code);
workerApi.createArtifactUploadSessionAsync.mockRejectedValueOnce(error);
@@ -387,6 +403,117 @@ describe('sandbox artifact uploads', () => {
await manager.stoppedPromise;
});
describe('with the sandbox worker API', () => {
const uploadSessionsUrl = 'https://api.expo.test/v2/sandbox-worker/artifact-upload-sessions';
afterEach(() => {
jest.useRealTimers();
});
it('retries a failed upload session request with the same idempotency key', async () => {
jest.useFakeTimers({ doNotFake: ['nextTick', 'setImmediate', 'queueMicrotask'] });
jest
.mocked(fetch)
.mockResolvedValueOnce(new Response('unavailable', { status: 503 }))
.mockResolvedValueOnce(jsonResponse({ data: createdSession }))
.mockResolvedValueOnce(new Response('', { status: 200 }))
.mockResolvedValueOnce(
jsonResponse({ data: { id: ARTIFACT_ID, downloadUrl: DOWNLOAD_URL } })
);
const uploadPromise = uploadWithWorkerApiAsync();
while (uploadSessionRequests().length === 0) {
await new Promise(resolve => setImmediate(resolve));
}
await jest.advanceTimersByTimeAsync(1000);
const upload = await uploadPromise;
await expect(upload.completed).resolves.toEqual({
status: 'uploaded',
downloadUrl: DOWNLOAD_URL,
});
const keys = uploadSessionRequests().map(
([, init]) => (init?.headers as Record<string, string>)['Idempotency-Key']
);
expect(keys).toEqual([expect.any(String), keys[0]]);
});
it('stops creating the upload session after 25 seconds, before the MCP relay timeout', async () => {
jest.useFakeTimers({ doNotFake: ['nextTick', 'setImmediate', 'queueMicrotask'] });
jest.mocked(fetch).mockImplementation(
async (_url, init) =>
await new Promise((_resolve, reject) => {
const timer = setTimeout(
() => reject(new FetchError('network timeout', 'request-timeout')),
init?.timeout
);
init?.signal?.addEventListener('abort', () => {
clearTimeout(timer);
reject(new AbortError('The user aborted a request.'));
});
})
);
const manager = new SandboxArtifactUploadManager({
workerApi: new SandboxWorkerApi('https://api.expo.test/v2/', 'sandbox-worker-token'),
logger: logger as unknown as bunyan,
signal: new AbortController().signal,
});
const assertion = expect(
manager.startAsync({ filePath, name: 'Crash log', yieldTimeMs: 30_000 })
).rejects.toThrow(
'Could not create an upload session for sandbox artifact "Crash log" within 25 seconds.'
);
while (uploadSessionRequests().length === 0) {
await new Promise(resolve => setImmediate(resolve));
}
await jest.advanceTimersByTimeAsync(25_000);
await assertion;
const keys = uploadSessionRequests().map(
([, init]) => (init?.headers as Record<string, string>)['Idempotency-Key']
);
expect(keys).toEqual([expect.any(String), keys[0], keys[0]]);
});
it('does not retry an artifact name conflict', async () => {
const apiMessage =
'Sandbox already has an artifact named "Crash log". Use a different name for this artifact.';
jest
.mocked(fetch)
.mockResolvedValueOnce(
jsonResponse({ errors: [{ code: 'ARTIFACT_NAME_CONFLICT', message: apiMessage }] }, 409)
);
await expect(uploadWithWorkerApiAsync()).rejects.toMatchObject({
code: SandboxDaemonErrorCode.BAD_REQUEST,
message: `POST /v2/sandbox-worker/artifact-upload-sessions failed with status 409: ${apiMessage}`,
});
expect(fetch).toHaveBeenCalledTimes(1);
});
async function uploadWithWorkerApiAsync(): ReturnType<typeof startSandboxArtifactUploadAsync> {
return await startSandboxArtifactUploadAsync({
workerApi: new SandboxWorkerApi('https://api.expo.test/v2/', 'sandbox-worker-token'),
logger: logger as unknown as bunyan,
filePath,
name: 'Crash log',
signal: new AbortController().signal,
});
}
function uploadSessionRequests(): Parameters<typeof fetch>[] {
return jest.mocked(fetch).mock.calls.filter(([url]) => url === uploadSessionsUrl);
}
function jsonResponse(body: unknown, status = 200): InstanceType<typeof Response> {
return new Response(JSON.stringify(body), {
status,
headers: { 'Content-Type': 'application/json' },
});
}
});
function createManager(signal: AbortSignal): SandboxArtifactUploadManager {
return new SandboxArtifactUploadManager({
workerApi: workerApi as unknown as SandboxWorkerApi,
@@ -85,6 +85,7 @@ describe(SandboxWorkerApi, () => {
call: (api: SandboxWorkerApi) =>
api.createArtifactUploadSessionAsync({ name: 'Crash log', filename: 'crash.log', size: 5 }),
route: 'artifact-upload-sessions',
headers: { 'Idempotency-Key': expect.any(String) },
json: { name: 'Crash log', filename: 'crash.log', size: 5 },
data: {
artifact: { id: ARTIFACT_ID },
@@ -105,7 +106,7 @@ describe(SandboxWorkerApi, () => {
},
])(
'$name calls POST /v2/sandbox-worker/$route with the sandbox worker token header',
async ({ call, route, json, data, expected }) => {
async ({ call, route, headers, json, data, expected }) => {
jest.mocked(turtleFetch).mockResolvedValueOnce(jsonResponse({ data }));
await expect(call(new SandboxWorkerApi(BASE_URL, TOKEN))).resolves.toEqual(expected);
@@ -113,11 +114,35 @@ describe(SandboxWorkerApi, () => {
const [url, method, options] = jest.mocked(turtleFetch).mock.calls[0];
expect(url).toBe(`https://api.expo.test/v2/sandbox-worker/${route}`);
expect(method).toBe('POST');
expect(options.headers).toEqual({ 'expo-sandbox-worker-token': TOKEN });
expect(options.headers).toEqual({ ...headers, 'expo-sandbox-worker-token': TOKEN });
expect(options.json).toEqual(json);
}
);
it('sends a new idempotency key for each artifact upload session', async () => {
jest.mocked(turtleFetch).mockImplementation(async () =>
jsonResponse({
data: {
artifact: { id: ARTIFACT_ID },
uploadSession: { url: 'https://uploads.expo.test/a', headers: {} },
},
})
);
const api = new SandboxWorkerApi(BASE_URL, TOKEN);
await api.createArtifactUploadSessionAsync({ name: 'A', filename: 'a.log', size: 1 });
await api.createArtifactUploadSessionAsync({ name: 'B', filename: 'b.log', size: 1 });
const [first, second] = jest
.mocked(turtleFetch)
.mock.calls.map(
([, , options]) => (options.headers as Record<string, string>)['Idempotency-Key']
);
expect(first).toEqual(expect.any(String));
expect(second).toEqual(expect.any(String));
expect(second).not.toBe(first);
});
it('escapes the artifact ID in the finalize route', async () => {
jest
.mocked(turtleFetch)
@@ -1,3 +1,4 @@
import { ExpoError, SystemError, UserError } from '@expo/eas-build-job';
import { once } from 'node:events';
import {
access,
@@ -101,6 +102,49 @@ it.each([
expect(attempts).toBe(1);
});
// Shaped like `xcrun simctl install` output for an app whose minimum iOS version is above the Simulator runtime.
const NEWER_IOS_REQUIRED_STDERR = [
'An error was encountered processing the command (domain=IXUserPresentableErrorDomain):',
'Requires a Newer Version of iOS',
'“Example” requires a newer version of iOS.',
].join('\n');
async function rejectActionAsync(action: string, stderr: string): Promise<ExpoError> {
server.on('connection', socket => {
socket.send(JSON.stringify({ ready: true }));
socket.on('message', () => socket.send(JSON.stringify({ id: 1, exitCode: 1, stderr })));
});
const error = await runServeSimActionAsync({ ...request(), action }).catch(err => err);
expect(error).toBeInstanceOf(ExpoError);
return error;
}
it('classifies an app install that requires a newer iOS version as a user error', async () => {
const error = await rejectActionAsync('app.install', NEWER_IOS_REQUIRED_STDERR);
expect(error).toBeInstanceOf(UserError);
expect(error.toExternalExpoError()).toMatchObject({
errorCode: 'EAS_INSTALL_APPLICATION_REQUIRES_NEWER_IOS',
message: expect.stringContaining('Choose an iOS Simulator device whose iOS version meets'),
});
expect((error.cause as Error).message).toContain('Requires a Newer Version of iOS');
});
it.each([
[
'app.install',
'An error was encountered processing the command (domain=IXUserPresentableErrorDomain):\nThis app could not be installed at this time.',
],
['app.install', 'install refused'],
['app.launch', NEWER_IOS_REQUIRED_STDERR],
])('keeps other %s failures as server errors', async (action, stderr) => {
const error = await rejectActionAsync(action, stderr);
expect(error).toBeInstanceOf(SystemError);
expect(error.toExternalExpoError()).toMatchObject({
errorCode: 'SERVER_ERROR',
message: `serve-sim ${action} failed: ${stderr}`,
});
});
it('rejects a connection that closes before its action finishes', async () => {
server.on('connection', socket => socket.close());
await expect(runServeSimActionAsync(request())).rejects.toThrow('closed before completion');
@@ -192,6 +192,29 @@ describe('worker API retries', () => {
});
});
it('sends the same idempotency key on every attempt', async () => {
jest
.mocked(turtleFetch)
.mockRejectedValueOnce(new Error('socket hang up'))
.mockResolvedValueOnce(new Response('unavailable', { status: 503 }))
.mockResolvedValueOnce(jsonResponse({ data: { id: 'thing-id' } }));
const assertion = expect(
new WorkerApi(BASE_URL, AUTH).requestAsync('POST', 'things', ThingSchema, {
json: {},
idempotencyKey: 'idempotency-key',
retries: 3,
})
).resolves.toEqual({ id: 'thing-id' });
await jest.runAllTimersAsync();
await assertion;
expect(jest.mocked(turtleFetch).mock.calls.map(([, , options]) => options.headers)).toEqual(
Array.from({ length: 3 }, () => ({
'expo-test-worker-token': 'test-worker-token-value',
'Idempotency-Key': 'idempotency-key',
}))
);
});
it('recovers from a network failure', async () => {
jest
.mocked(turtleFetch)
@@ -1,5 +1,6 @@
import { SystemError, formatBytes } from '@expo/eas-build-job';
import { type bunyan } from '@expo/logger';
import { randomUUID } from 'node:crypto';
import { createReadStream, createWriteStream } from 'node:fs';
import { mkdtemp, rm, stat } from 'node:fs/promises';
import fetch from 'node-fetch';
@@ -11,7 +12,11 @@ import { z } from 'zod';
import { CustomBuildContext } from '../../customBuildContext';
import { Sentry } from '../../sentry';
import { uploadDeviceRunSessionArtifactAsync } from './deviceRunSessionArtifacts';
import {
type ArtifactUploadRequest,
DeviceRunSessionArtifactRejectedError,
uploadDeviceRunSessionArtifactAsync,
} from './deviceRunSessionArtifacts';
import { createScreenshotMetadataAsync } from './deviceRunSessionScreenshotMetadata';
const AGENT_DEVICE_ARTIFACT_UPLOAD_POLL_INTERVAL_MS = 5_000;
@@ -58,7 +63,8 @@ export async function pollAgentDeviceArtifactsForUploadAsync(
}
): Promise<void> {
logger.info('Started polling agent-device daemon for artifacts.');
const uploadedArtifactIds = new Set<string>();
const finishedArtifactIds = new Set<string>();
const uploadRequests = new Map<string, ArtifactUploadRequest>();
let listArtifactsErrorCount = 0;
// Ending normal polling must not cancel a transfer that the session already produced.
@@ -92,23 +98,31 @@ export async function pollAgentDeviceArtifactsForUploadAsync(
});
listArtifactsErrorCount = 0;
for (const artifact of artifacts) {
if (uploadedArtifactIds.has(artifact.id)) {
if (finishedArtifactIds.has(artifact.id)) {
continue;
}
const request = uploadRequests.get(artifact.id) ?? { idempotencyKey: randomUUID() };
uploadRequests.set(artifact.id, request);
try {
await uploadAgentDeviceArtifactAsync(ctx, {
deviceRunSessionId,
daemonUrl,
daemonToken,
artifact,
request,
logger,
...(transferSignal ? { signal: transferSignal } : {}),
signal: transferSignal,
});
uploadedArtifactIds.add(artifact.id);
finishedArtifactIds.add(artifact.id);
uploadRequests.delete(artifact.id);
} catch (err) {
if (transferSignal?.aborted) {
return;
}
if (err instanceof DeviceRunSessionArtifactRejectedError) {
finishedArtifactIds.add(artifact.id);
uploadRequests.delete(artifact.id);
}
const error = err instanceof Error ? err : new Error(String(err));
Sentry.capture('Could not upload agent-device remote session artifact', error);
logger.warn({ err: error }, 'Could not upload agent-device remote session artifact.');
@@ -192,6 +206,7 @@ export async function uploadAgentDeviceArtifactAsync(
daemonUrl,
daemonToken,
artifact,
request,
logger,
signal,
}: {
@@ -199,6 +214,7 @@ export async function uploadAgentDeviceArtifactAsync(
daemonUrl: string;
daemonToken: string;
artifact: AgentDeviceArtifact;
request: ArtifactUploadRequest;
logger: bunyan;
signal?: AbortSignal;
}
@@ -219,7 +235,7 @@ export async function uploadAgentDeviceArtifactAsync(
const display = artifact.displayRotation
? { displayRotation: artifact.displayRotation }
: undefined;
const metadata =
request.metadata ??=
artifact.artifactType === 'screenshot'
? await createScreenshotMetadataAsync(temporaryArtifactPath, {
source: 'agent-device',
@@ -234,9 +250,10 @@ export async function uploadAgentDeviceArtifactAsync(
name: `${artifact.filename} (${artifact.id})`,
filename: artifact.filename,
kind: artifact.artifactType ?? undefined,
...(metadata ? { metadata } : {}),
...(request.metadata ? { metadata: request.metadata } : {}),
size,
openStream: () => createReadStream(temporaryArtifactPath),
idempotencyKey: request.idempotencyKey,
...(signal ? { signal } : {}),
});
} finally {
@@ -1,4 +1,5 @@
import { SystemError } from '@expo/eas-build-job';
import { randomUUID } from 'node:crypto';
import type { Readable } from 'node:stream';
import { CustomBuildContext } from '../../customBuildContext';
@@ -10,6 +11,7 @@ import {
} from '../../storage/uploadWithSignedUrl';
import { withDeviceRunSessionTimeoutAsync } from './deviceRunSessionTimeout';
import { requireDeviceRunSessionWorkerApi } from './deviceRunSessionWorkerApi';
import { WorkerApiError } from './workerApi';
export type ArtifactMetadata = {
deviceRunSessionId: string;
@@ -21,18 +23,30 @@ export type ArtifactMetadata = {
size: number;
};
export type ArtifactUploadRequest = {
idempotencyKey: string;
metadata?: Record<string, unknown>;
};
export async function uploadDeviceRunSessionArtifactAsync(
ctx: CustomBuildContext,
options: ArtifactMetadata & {
openStream: () => Readable;
signal?: AbortSignal;
attempts?: number;
idempotencyKey?: string;
}
): Promise<void> {
const idempotencyKey = options.idempotencyKey ?? randomUUID();
try {
const uploadSession = await withDeviceRunSessionTimeoutAsync(
{ name: 'Artifact upload session creation', timeoutMs: 15_000, signal: options.signal },
async signal => await createDeviceRunSessionArtifactUploadSessionAsync(ctx, options, signal)
async signal =>
await createDeviceRunSessionArtifactUploadSessionAsync(
ctx,
{ ...options, idempotencyKey },
signal
)
);
options.signal?.throwIfAborted();
await uploadWithSignedUrl(
@@ -47,6 +61,8 @@ export async function uploadDeviceRunSessionArtifactAsync(
}
}
export class DeviceRunSessionArtifactRejectedError extends SystemError {}
class DeviceRunSessionArtifactUploadError extends SystemError {
constructor(artifactId: string, reason: string) {
super(`Failed to upload device run session artifact ${artifactId}: ${reason}.`);
@@ -55,7 +71,16 @@ class DeviceRunSessionArtifactUploadError extends SystemError {
async function createDeviceRunSessionArtifactUploadSessionAsync(
ctx: CustomBuildContext,
{ deviceRunSessionId, artifactId, name, filename, kind, metadata, size }: ArtifactMetadata,
{
deviceRunSessionId,
artifactId,
name,
filename,
kind,
metadata,
size,
idempotencyKey,
}: ArtifactMetadata & { idempotencyKey: string },
signal: AbortSignal
): Promise<SignedUrl> {
const workerApi = requireDeviceRunSessionWorkerApi(ctx);
@@ -68,17 +93,19 @@ async function createDeviceRunSessionArtifactUploadSessionAsync(
...(kind !== undefined ? { kind } : {}),
...(metadata !== undefined ? { metadata } : {}),
size,
idempotencyKey,
},
{ signal }
);
} catch (err) {
signal.throwIfAborted();
throw new SystemError(
`Failed to create upload session for device run session artifact ${artifactId}: ${
err instanceof Error ? err.message : String(err)
}`,
{ cause: err }
);
const message = `Failed to create upload session for device run session artifact ${artifactId}: ${
err instanceof Error ? err.message : String(err)
}`;
if (err instanceof WorkerApiError && !err.isTransient) {
throw new DeviceRunSessionArtifactRejectedError(message, { cause: err });
}
throw new SystemError(message, { cause: err });
}
signal.throwIfAborted();
return uploadSession;
@@ -1,5 +1,6 @@
import { formatBytes } from '@expo/eas-build-job';
import type { bunyan } from '@expo/logger';
import { randomUUID } from 'node:crypto';
import { type FSWatcher, createReadStream, watch } from 'node:fs';
import { mkdtemp, readFile, readdir, rm, rmdir, stat } from 'node:fs/promises';
import os from 'node:os';
@@ -8,7 +9,11 @@ import { z } from 'zod';
import type { CustomBuildContext } from '../../customBuildContext';
import { Sentry } from '../../sentry';
import { uploadDeviceRunSessionArtifactAsync } from './deviceRunSessionArtifacts';
import {
type ArtifactUploadRequest,
DeviceRunSessionArtifactRejectedError,
uploadDeviceRunSessionArtifactAsync,
} from './deviceRunSessionArtifacts';
import { createScreenshotMetadataAsync } from './deviceRunSessionScreenshotMetadata';
import {
type ScreenshotSession,
@@ -51,7 +56,10 @@ async function reportScreenshotFailureRecordAsync(file: string, logger: bunyan):
await rm(file, { force: true });
}
type FailedUploads = Map<string, { attempts: number; lastError: Error }>;
type FailedUploads = Map<
string,
{ attempts: number; lastError: Error; request: ArtifactUploadRequest }
>;
type ScreenshotEntry = { kind: 'failureRecord' } | { kind: 'screenshot'; timestamp: string };
@@ -74,6 +82,7 @@ async function uploadScreenshotAsync(
session,
signal,
failedUploads,
request,
logger,
}: {
file: string;
@@ -84,31 +93,34 @@ async function uploadScreenshotAsync(
session: Promise<ScreenshotSession | null>;
signal: AbortSignal;
failedUploads: FailedUploads;
request: ArtifactUploadRequest;
logger: bunyan;
}
): Promise<void> {
const artifactDetails = screenshotArtifactDetails(timestamp, await session);
const startedAt = Date.now();
request.metadata ??= {
...artifactDetails.metadata,
...(await createScreenshotMetadataAsync(file, { source: 'manual', logger })),
};
await uploadDeviceRunSessionArtifactAsync(ctx, {
deviceRunSessionId,
artifactId: name.slice(0, -4),
name: artifactDetails.name,
filename: artifactDetails.filename,
metadata: {
...artifactDetails.metadata,
...(await createScreenshotMetadataAsync(file, { source: 'manual', logger })),
},
metadata: request.metadata,
kind: 'screenshot',
size,
openStream: () => createReadStream(file),
attempts: 3,
signal,
idempotencyKey: request.idempotencyKey,
});
await rm(file);
const previousFailures = failedUploads.get(name)?.attempts ?? 0;
failedUploads.delete(name);
// Each earlier failed attempt may have left an artifact row without a file on the server.
// The API deletes such rows when the job run finishes (expo/universe#31539).
// An earlier failed attempt may have created the artifact row without uploading the file.
// The retry reuses that row through the Idempotency-Key.
const retryNote =
previousFailures > 0
? ` after ${previousFailures} failed attempt${previousFailures === 1 ? '' : 's'}`
@@ -127,6 +139,7 @@ function recordUploadFailure(
size,
signal,
failedUploads,
request,
logger,
}: {
file: string;
@@ -134,6 +147,7 @@ function recordUploadFailure(
size: number | undefined;
signal: AbortSignal;
failedUploads: FailedUploads;
request: ArtifactUploadRequest;
logger: bunyan;
}
): 'aborted' | 'recorded' {
@@ -146,7 +160,14 @@ function recordUploadFailure(
}
const error = err instanceof Error ? err : new Error(String(err));
const attempt = (failedUploads.get(name)?.attempts ?? 0) + 1;
failedUploads.set(name, { attempts: attempt, lastError: error });
failedUploads.set(name, { attempts: attempt, lastError: error, request });
if (error instanceof DeviceRunSessionArtifactRejectedError) {
logger.warn(
{ err: error, file, attempt, size },
'EAS rejected the preview screenshot upload. Not retrying it.'
);
return 'recorded';
}
// A sustained outage would otherwise warn for every waiting file on each 30 s scan.
if (attempt <= 3 || attempt % 10 === 0) {
logger.warn(
@@ -202,6 +223,11 @@ export async function uploadDeviceRunSessionScreenshotsAsync(
saveFailures++;
continue;
}
const failure = failedUploads.get(entry.name);
if (failure?.lastError instanceof DeviceRunSessionArtifactRejectedError) {
continue;
}
const request = failure?.request ?? { idempotencyKey: randomUUID() };
let size: number | undefined;
try {
size = (await stat(file)).size;
@@ -214,6 +240,7 @@ export async function uploadDeviceRunSessionScreenshotsAsync(
session,
signal,
failedUploads,
request,
logger,
});
uploadedCount++;
@@ -227,6 +254,7 @@ export async function uploadDeviceRunSessionScreenshotsAsync(
size,
signal,
failedUploads,
request,
logger,
});
if (outcome === 'aborted') {
@@ -61,8 +61,12 @@ export type CreateDeviceRunSessionArtifactUploadSessionInput = {
kind?: string | null;
size: number;
metadata?: Record<string, unknown> | null;
idempotencyKey: string;
};
/** Why the worker stops a session; www stores it as the session's end reason. */
export type DeviceRunSessionStopReason = 'idle_timeout' | 'max_duration';
/**
* Client for the www routes under `/v2/device-run-session-worker/`. These routes act only on the
* session that the token names.
@@ -96,19 +100,25 @@ export class DeviceRunSessionWorkerApi {
});
}
public async stopAsync(options: WorkerApiRequestOptions = {}): Promise<DeviceRunSessionStatus> {
return await this.client.requestAsync('POST', 'stop', DeviceRunSessionStatusSchema, options);
public async stopAsync(
{ reason }: { reason?: DeviceRunSessionStopReason } = {},
options: WorkerApiRequestOptions = {}
): Promise<DeviceRunSessionStatus> {
return await this.client.requestAsync('POST', 'stop', DeviceRunSessionStatusSchema, {
...options,
...(reason ? { json: { reason } } : {}),
});
}
public async createArtifactUploadSessionAsync(
input: CreateDeviceRunSessionArtifactUploadSessionInput,
{ idempotencyKey, ...input }: CreateDeviceRunSessionArtifactUploadSessionInput,
options: WorkerApiRequestOptions = {}
): Promise<DeviceRunSessionUploadSession> {
const { uploadSession } = await this.client.requestAsync(
'POST',
'artifact-upload-sessions',
UploadSessionSchema,
{ ...options, json: input }
{ ...options, json: input, idempotencyKey }
);
return uploadSession;
}
@@ -3,7 +3,7 @@ import { BuildStepEnv } from '@expo/steps';
import spawn, { SpawnResult } from '@expo/turtle-spawn';
import path from 'path';
import { COMMON_FASTLANE_ENV } from '../../../common/fastlane';
import { COMMON_FASTLANE_ENV, DEFAULT_FASTLANE_GYM_ENV } from '../../../common/fastlane';
import { XcodeBuildLogger } from '../../../common/xcpretty';
export async function runFastlaneGym({
@@ -25,7 +25,7 @@ export async function runFastlaneGym({
await runFastlane(['gym'], {
cwd: path.join(workingDir, 'ios'),
logger,
env,
env: { ...DEFAULT_FASTLANE_GYM_ENV, ...env },
extraEnv,
});
} finally {
@@ -29,6 +29,7 @@ import { createProcessOutput } from './processOutput';
import { withDeviceRunSessionTimeoutAsync } from './deviceRunSessionTimeout';
import {
type DeviceRunSessionStatus,
type DeviceRunSessionStopReason,
requireDeviceRunSessionWorkerApi,
} from './deviceRunSessionWorkerApi';
import { WorkerApiError } from './workerApi';
@@ -193,7 +194,12 @@ export async function waitForDeviceRunSessionStoppedAsync({
`Device run session ${deviceRunSessionId} had no activity for ` +
`${idleTimeout.maxIdleTimeMinutes} minute(s) (max idle time). Stopping the session.`
);
await ensureDeviceRunSessionStoppedSafelyAsync({ ctx, deviceRunSessionId, logger });
await ensureDeviceRunSessionStoppedSafelyAsync({
ctx,
deviceRunSessionId,
logger,
reason: 'idle_timeout',
});
return;
}
}
@@ -212,7 +218,7 @@ export async function waitForDeviceRunSessionStoppedAsync({
throw err;
}
if (signal.aborted) {
return;
break;
}
const error = err instanceof Error ? err : new Error(String(err));
@@ -227,6 +233,15 @@ export async function waitForDeviceRunSessionStoppedAsync({
}
await sleepUntilAbortedAsync(DEVICE_RUN_SESSION_STATUS_POLL_INTERVAL_MS, signal);
}
// Stop through the worker route so www records the reason; a canceled step is not a max-duration end.
if (durationAbortController.signal.aborted && !cancelSignal?.aborted) {
await ensureDeviceRunSessionStoppedSafelyAsync({
ctx,
deviceRunSessionId,
logger,
reason: 'max_duration',
});
}
} finally {
if (durationTimeout !== undefined) {
clearTimeout(durationTimeout);
@@ -254,20 +269,23 @@ async function ensureDeviceRunSessionStoppedSafelyAsync({
ctx,
deviceRunSessionId,
logger,
reason,
}: {
ctx: CustomBuildContext;
deviceRunSessionId: string;
logger: bunyan;
reason: DeviceRunSessionStopReason;
}): Promise<void> {
try {
await requireDeviceRunSessionWorkerApi(ctx).stopAsync({
timeoutMs: DEVICE_RUN_SESSION_WORKER_REQUEST_TIMEOUT_MS,
});
await requireDeviceRunSessionWorkerApi(ctx).stopAsync(
{ reason },
{ timeoutMs: DEVICE_RUN_SESSION_WORKER_REQUEST_TIMEOUT_MS }
);
} catch (err) {
const error = err instanceof Error ? err : new Error(String(err));
Sentry.capture('Could not mark idle device run session as stopped', error, {
Sentry.capture('Could not mark device run session as stopped', error, {
level: 'warning',
extras: { deviceRunSessionId },
extras: { deviceRunSessionId, reason },
});
logger.warn(
{ err: error },
@@ -15,8 +15,15 @@ import { type SandboxArtifactUploadSession, type SandboxWorkerApi } from './sand
import { WorkerApiError } from './workerApi';
const WORKER_API_REQUEST_TIMEOUT_MS = 15_000;
const UPLOAD_SESSION_RETRIES = 2;
const UPLOAD_SESSION_ATTEMPT_TIMEOUT_MS = 8_000;
const UPLOAD_SESSION_DEADLINE_MS = 25_000;
const FINALIZE_RETRIES = 2;
const REJECTED_UPLOAD_SESSION_ERROR_CODES = new Set(['VALIDATION_ERROR', 'UNAUTHORIZED']);
const REJECTED_UPLOAD_SESSION_ERROR_CODES = new Set([
'VALIDATION_ERROR',
'UNAUTHORIZED',
'ARTIFACT_NAME_CONFLICT',
]);
type SandboxArtifactUploadOutcome =
| { status: 'uploaded'; downloadUrl: string }
@@ -124,7 +131,7 @@ export async function startSandboxArtifactUploadAsync({
} = await createSandboxArtifactUploadSessionAsync(
workerApi,
{ name, filename: path.basename(filePath), size },
signal
{ signal, logger }
);
const completed = (async (): Promise<SandboxArtifactUploadOutcome> => {
logger.info(`Uploading sandbox artifact "${name}" (${artifactId}, ${size} bytes).`);
@@ -158,15 +165,30 @@ export async function startSandboxArtifactUploadAsync({
async function createSandboxArtifactUploadSessionAsync(
workerApi: SandboxWorkerApi,
input: { name: string; filename: string; size: number },
signal: AbortSignal
{ signal, logger }: { signal: AbortSignal; logger: bunyan }
): Promise<SandboxArtifactUploadSession> {
const deadline = new AbortController();
const deadlineTimer = setTimeout(
() =>
deadline.abort(
new Error(
`Could not create an upload session for sandbox artifact "${input.name}" within ${
UPLOAD_SESSION_DEADLINE_MS / 1000
} seconds.`
)
),
UPLOAD_SESSION_DEADLINE_MS
);
try {
return await workerApi.createArtifactUploadSessionAsync(input, {
signal,
timeoutMs: WORKER_API_REQUEST_TIMEOUT_MS,
signal: AbortSignal.any([signal, deadline.signal]),
timeoutMs: UPLOAD_SESSION_ATTEMPT_TIMEOUT_MS,
retries: UPLOAD_SESSION_RETRIES,
logger,
});
} catch (error) {
signal.throwIfAborted();
deadline.signal.throwIfAborted();
if (
error instanceof WorkerApiError &&
error.code !== undefined &&
@@ -177,6 +199,8 @@ async function createSandboxArtifactUploadSessionAsync(
});
}
throw error;
} finally {
clearTimeout(deadlineTimer);
}
}
@@ -1,4 +1,5 @@
import { type Env, type EnvironmentSecret, type Job, SystemError } from '@expo/eas-build-job';
import { randomUUID } from 'node:crypto';
import { z } from 'zod';
import {
@@ -65,7 +66,7 @@ export class SandboxWorkerApi {
'POST',
'artifact-upload-sessions',
ArtifactUploadSessionSchema,
{ ...options, json: input }
{ ...options, json: input, idempotencyKey: randomUUID() }
);
}
@@ -1,4 +1,4 @@
import { SystemError } from '@expo/eas-build-job';
import { SystemError, UserError } from '@expo/eas-build-job';
import { constants } from 'node:fs';
import { cp, mkdir, mkdtemp, realpath, rm } from 'node:fs/promises';
import os from 'node:os';
@@ -104,8 +104,11 @@ export async function runServeSimActionWithResultAsync({
finish(
reply.exitCode === 0
? undefined
: new SystemError(
`serve-sim ${action} failed: ${(typeof reply.error === 'string' && reply.error) || (typeof reply.stderr === 'string' && reply.stderr) || 'invalid response'}`
: createServeSimActionError(
action,
(typeof reply.error === 'string' && reply.error) ||
(typeof reply.stderr === 'string' && reply.stderr) ||
'invalid response'
),
typeof reply.stdout === 'string' ? reply.stdout : ''
);
@@ -116,3 +119,18 @@ export async function runServeSimActionWithResultAsync({
}
});
}
// simctl's IXUserPresentableErrorDomain message when the app's minimum iOS version is above the Simulator runtime.
const NEWER_IOS_REQUIRED_MESSAGE = 'Requires a Newer Version of iOS';
function createServeSimActionError(action: string, detail: string): Error {
const message = `serve-sim ${action} failed: ${detail}`;
if (action === 'app.install' && detail.includes(NEWER_IOS_REQUIRED_MESSAGE)) {
return new UserError(
'EAS_INSTALL_APPLICATION_REQUIRES_NEWER_IOS',
"This app requires a newer iOS version than the selected iOS Simulator runs. Choose an iOS Simulator device whose iOS version meets the app's minimum iOS version, or lower the app's iOS deployment target.",
{ cause: new Error(message) }
);
}
return new SystemError(message);
}
@@ -26,6 +26,11 @@ export type WorkerApiRequestOptions = {
logger?: bunyan;
};
type WorkerApiRequest = WorkerApiRequestOptions & {
json?: Record<string, unknown>;
idempotencyKey?: string;
};
const ApiV2ErrorResponseSchema = z.object({
errors: z.array(z.object({ code: z.string().optional(), message: z.string() })).min(1),
});
@@ -47,7 +52,7 @@ export class WorkerApiError extends Error {
}
get isTransient(): boolean {
return this.status === undefined || this.status >= 500;
return this.status === undefined || this.status === 429 || this.status >= 500;
}
}
@@ -66,7 +71,7 @@ export class WorkerApi {
method: 'GET' | 'POST',
route: string,
dataSchema: z.ZodType<T>,
{ retries = 0, ...options }: WorkerApiRequestOptions & { json?: Record<string, unknown> } = {}
{ retries = 0, ...options }: WorkerApiRequest = {}
): Promise<T> {
const url = new URL(route, this.baseUrl);
const routeDescription = `${method} ${url.pathname}`;
@@ -79,10 +84,7 @@ export class WorkerApi {
}
return await promiseRetryWithCondition(
request,
error =>
!options.signal?.aborted &&
error instanceof WorkerApiError &&
(error.status === undefined || error.status === 429 || error.status >= 500),
error => !options.signal?.aborted && error instanceof WorkerApiError && error.isTransient,
{ retries, factor: 2, minTimeout: 1000 },
({ attemptNumber, maxAttemptsCount }) =>
options.logger?.warn(
@@ -96,18 +98,14 @@ export class WorkerApi {
url: string,
routeDescription: string,
dataSchema: z.ZodType<T>,
{
signal,
timeoutMs,
logger,
json,
}: Omit<WorkerApiRequestOptions, 'retries'> & {
json?: Record<string, unknown>;
}
{ signal, timeoutMs, logger, json, idempotencyKey }: Omit<WorkerApiRequest, 'retries'>
): Promise<T> {
const responseResult = await asyncResult(
turtleFetch(url, method, {
headers: { [this.auth.authHeader]: this.auth.token },
headers: {
[this.auth.authHeader]: this.auth.token,
...(idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : {}),
},
...(json ? { json } : {}),
...(signal ? { signal } : {}),
...(timeoutMs !== undefined ? { timeout: timeoutMs } : {}),
@@ -1,5 +1,9 @@
# create-eas-build-function
## 27.11.0
No changes in this release.
## 27.10.0
No changes in this release.
@@ -1,6 +1,6 @@
{
"name": "create-eas-build-function",
"version": "27.10.0",
"version": "27.11.0",
"description": "Create functions for use in EAS Build custom builds.",
"keywords": [
"expo",
@@ -35,7 +35,7 @@
"clean": "rimraf ./build/ \"*.tsbuildinfo\""
},
"dependencies": {
"@expo/steps": "27.10.0"
"@expo/steps": "27.11.0"
},
"devDependencies": {
"@expo/package-manager": "1.9.10",
+4
View File
@@ -1,5 +1,9 @@
# @expo/downloader
## 27.11.0
No changes in this release.
## 27.10.0
No changes in this release.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@expo/downloader",
"version": "27.10.0",
"version": "27.11.0",
"bugs": "https://github.com/expo/eas-cli/issues",
"license": "BUSL-1.1",
"author": "Expo <[email protected]>",
@@ -1,5 +1,9 @@
# eas-build-cache-provider
## 27.11.0
No changes in this release.
## 27.10.0
No changes in this release.
@@ -1,6 +1,6 @@
{
"name": "eas-build-cache-provider",
"version": "27.10.0",
"version": "27.11.0",
"description": "A build cache provider plugin for the Expo CLI",
"homepage": "https://github.com/expo/eas-cli",
"bugs": "https://github.com/expo/eas-cli/issues",
+7
View File
@@ -1,5 +1,12 @@
# @expo/eas-build-job
## 27.11.0
### Minor Changes
- Accept `issue_comment` as a `github.event_name` value in the workflow interpolation context. ([#4906](https://github.com/expo/eas-cli/pull/4906) by [@sswrk](https://github.com/sswrk))
- Support error occurrence events in Observe workflow context. ([#4860](https://github.com/expo/eas-cli/pull/4860) by [@AbbanMustafa](https://github.com/AbbanMustafa))
## 27.10.0
No changes in this release.
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@expo/eas-build-job",
"version": "27.10.0",
"version": "27.11.0",
"bugs": "https://github.com/expo/eas-cli/issues",
"license": "MIT",
"author": "Expo <[email protected]>",
@@ -25,9 +25,9 @@
"clean": "rimraf node_modules dist coverage \"*.tsbuildinfo\""
},
"dependencies": {
"@expo/logger": "27.10.0",
"@expo/logger": "27.11.0",
"@expo/results": "1.0.0",
"@expo/turtle-spawn": "27.10.0",
"@expo/turtle-spawn": "27.11.0",
"joi": "^17.13.9",
"semver": "^7.6.2",
"zod": "^4.6.7"
@@ -922,6 +922,50 @@ describe('GitHub context event payload passthrough', () => {
expect(parsed.github?.event).toMatchObject(context.github.event);
});
it('accepts the issue_comment event with issue and comment fields', () => {
const context = {
after: {},
needs: {},
github: {
event_name: 'issue_comment',
sha: 'abc123',
ref: 'refs/heads/main',
ref_name: 'main',
ref_type: 'branch',
event: {
action: 'created',
issue: {
number: 123,
title: 'Issue title',
},
comment: {
id: 456,
body: 'Comment body',
},
},
},
workflow: {
id: 'workflow-id',
name: 'Workflow',
filename: 'workflow.yml',
url: 'https://expo.dev',
},
app: {
id: 'app-id',
slug: 'app-slug',
},
account: {
id: 'account-id',
name: 'account-name',
},
};
const parsed = StaticWorkflowInterpolationContextZ.parse(context);
expect(parsed.github?.event_name).toBe('issue_comment');
expect(parsed.github?.event).toMatchObject(context.github.event);
});
});
describe('fetchEasCliVersionsAsync', () => {
@@ -1,7 +1,7 @@
import { ArchiveSourceType, BuildTrigger, StaticWorkflowInterpolationContextZ } from '../common';
import { Generic } from '../generic';
function createContext() {
function createContext(eventType: 'new_error' | 'error_occurrence' = 'new_error') {
return {
after: {},
needs: {},
@@ -16,7 +16,7 @@ function createContext() {
observe: {
event: {
id: '123e4567-e89b-42d3-a456-426614174001',
type: 'new_error' as const,
type: eventType,
occurredAt: '2026-10-29T12:00:00.000Z',
appId: '123e4567-e89b-42d3-a456-426614174000',
fingerprint: { value: 'error-fingerprint', version: 'v1' },
@@ -31,23 +31,36 @@ function createContext() {
}
describe('Observe workflow context', () => {
it('preserves the event when validating a generic job', () => {
it.each(['new_error', 'error_occurrence'] as const)(
'preserves %s events when validating a generic job',
eventType => {
const context = createContext(eventType);
const job = {
projectArchive: { type: ArchiveSourceType.GIT, gitCommitHash: 'abc123', gitRef: null },
steps: [{ run: 'echo "${{ observe.event.exception.message }}"', shell: 'sh' }],
secrets: { robotAccessToken: 'token', environmentSecrets: [] },
expoDevUrl: context.workflow.url,
builderEnvironment: { image: 'ubuntu', env: {} },
triggeredBy: BuildTrigger.GIT_BASED_INTEGRATION,
appId: context.app.id,
initiatingUserId: '123e4567-e89b-42d3-a456-426614174002',
workflowInterpolationContext: context,
};
const parsed = Generic.JobZ.parse(job);
expect(parsed.workflowInterpolationContext).toEqual(context);
}
);
it('rejects unknown Observe event types', () => {
const context = createContext();
const job = {
projectArchive: { type: ArchiveSourceType.GIT, gitCommitHash: 'abc123', gitRef: null },
steps: [{ run: 'echo "${{ observe.event.exception.message }}"', shell: 'sh' }],
secrets: { robotAccessToken: 'token', environmentSecrets: [] },
expoDevUrl: context.workflow.url,
builderEnvironment: { image: 'ubuntu', env: {} },
triggeredBy: BuildTrigger.GIT_BASED_INTEGRATION,
appId: context.app.id,
initiatingUserId: '123e4567-e89b-42d3-a456-426614174002',
workflowInterpolationContext: context,
};
const parsed = Generic.JobZ.parse(job);
expect(parsed.workflowInterpolationContext).toEqual(context);
expect(
StaticWorkflowInterpolationContextZ.safeParse({
...context,
observe: { event: { ...context.observe.event, type: 'unknown' } },
}).success
).toBe(false);
});
it('accepts nullable event metadata and an omitted device OS', () => {
+2 -2
View File
@@ -194,7 +194,7 @@ export const CacheSchema = Joi.object({
const GitHubContextZ = z.object({
triggering_actor: z.string().optional(),
event_name: z.enum(['push', 'pull_request', 'workflow_dispatch', 'schedule']),
event_name: z.enum(['push', 'pull_request', 'workflow_dispatch', 'schedule', 'issue_comment']),
sha: z.string(),
ref: z.string(),
ref_name: z.string(),
@@ -347,7 +347,7 @@ const SentryContextZ = z.looseObject({
const ObserveContextZ = z.looseObject({
event: z.looseObject({
id: z.uuid(),
type: z.literal('new_error'),
type: z.enum(['new_error', 'error_occurrence']),
occurredAt: z.iso.datetime(),
appId: z.uuid(),
fingerprint: z.looseObject({
+7
View File
@@ -1,5 +1,12 @@
# eas-cli
## 27.11.0
### Patch Changes
- Detect Factory Droid, Grok Bot, Claude Cowork, and Muse in EAS CLI telemetry. ([#4912](https://github.com/expo/eas-cli/pull/4912) by [@davidmokos](https://github.com/davidmokos))
- Mark the default device for each platform in `eas simulator:devices` and include `isDefault` in JSON output. ([#4895](https://github.com/expo/eas-cli/pull/4895) by [@gwdp](https://github.com/gwdp))
## 27.10.0
### Minor Changes
+164 -176
View File
File diff suppressed because it is too large. Load diff
+1 -13
View File
@@ -48154,7 +48154,7 @@
},
{
"name": "networkCapture",
"description": "Capture HTTP(S) traffic from apps on the device for live inspection. iOS only.\nHTTPS is decrypted, so captured traffic can contain credentials and cookies in cleartext.\nIf omitted, network capture is disabled.",
"description": "Record HTTP(S) traffic from apps on the device for the whole session. iOS only.\nHTTPS is decrypted, so recordings contain credentials and cookies in cleartext.\nIf omitted, no traffic is recorded.",
"type": {
"kind": "SCALAR",
"name": "Boolean",
@@ -48184,18 +48184,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "networkCaptureRecording",
"description": "Record network capture as a HAR artifact for access after the session. Requires networkCapture.\nIf omitted, HAR artifact recording is disabled.",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "openUrl",
"description": "Expo or development-client URL to open after launching the installed application. Requires\nbuildId, applicationArchiveUrl, or expoGo.",
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "eas-cli",
"version": "27.10.0",
"version": "27.11.0",
"description": "EAS command line tool",
"keywords": [
"cli",
@@ -48,12 +48,12 @@
"@expo/code-signing-certificates": "0.0.5",
"@expo/config": "55.0.10",
"@expo/config-plugins": "55.0.7",
"@expo/eas-build-job": "27.10.0",
"@expo/eas-json": "27.10.0",
"@expo/eas-build-job": "27.11.0",
"@expo/eas-json": "27.11.0",
"@expo/env": "^1.0.0",
"@expo/experimentation": "0.0.5",
"@expo/json-file": "8.3.3",
"@expo/logger": "27.10.0",
"@expo/logger": "27.11.0",
"@expo/multipart-body-parser": "2.0.0",
"@expo/osascript": "2.1.4",
"@expo/package-manager": "1.9.10",
@@ -65,7 +65,7 @@
"@expo/results": "1.0.0",
"@expo/rudder-sdk-node": "1.1.1",
"@expo/spawn-async": "1.7.2",
"@expo/steps": "27.10.0",
"@expo/steps": "27.11.0",
"@expo/timeago.js": "1.0.0",
"@oclif/core": "^4.8.3",
"@oclif/plugin-autocomplete": "^3.2.40",
@@ -73,7 +73,7 @@
"@sentry/node": "7.77.0",
"@urql/core": "4.0.11",
"@urql/exchange-retry": "1.2.0",
"agent-cli-detector": "0.1.7",
"agent-cli-detector": "0.1.8",
"ajv": "8.20.0",
"ajv-formats": "2.1.1",
"better-opn": "3.0.2",
@@ -190,7 +190,7 @@ describe(WorkflowLogView, () => {
},
},
platform: AppPlatform.Android,
logFiles: ['https://example.com/log1'],
logFileUrls: ['https://example.com/log1'],
});
let promptCalls = 0;
let stepPrompt: any;
@@ -72,7 +72,7 @@ function createMockBuildFragment({
updatedAt: new Date().toISOString(),
platform: AppPlatform.Android,
id: buildId ?? uuid(),
logFiles: [],
logFileUrls: [],
priority: BuildPriority.Normal,
app: {
__typename: 'App',
@@ -70,7 +70,7 @@ function createMockBuildFragment({
return {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
logFiles: [],
logFileUrls: [],
platform: AppPlatform.Android,
id: buildId ?? uuid(),
priority: BuildPriority.Normal,
@@ -26,7 +26,7 @@ function createBuildFragment(overrides: Partial<BuildFragment> = {}): BuildFragm
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
platform: AppPlatform.Android,
logFiles: [],
logFileUrls: [],
priority: BuildPriority.Normal,
app: {
__typename: 'App',
@@ -98,7 +98,7 @@ describe(logSourceForBuild, () => {
} as any);
const source = logSourceForBuild(
createBuildFragment({ logFiles: ['https://logs.test/first', 'https://logs.test/second'] })
createBuildFragment({ logFileUrls: ['https://logs.test/first', 'https://logs.test/second'] })
);
await expect(source.fetchRawLogLinesAsync()).resolves.toEqual([
@@ -113,7 +113,7 @@ describe(logSourceForBuild, () => {
it('returns null when the build has no log file', async () => {
await expect(
logSourceForBuild(createBuildFragment({ logFiles: [] })).fetchRawLogLinesAsync()
logSourceForBuild(createBuildFragment({ logFileUrls: [] })).fetchRawLogLinesAsync()
).resolves.toBeNull();
expect(fetch).not.toHaveBeenCalled();
});
@@ -47,7 +47,7 @@ function createBuildFragment(status: BuildStatus): BuildFragment {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
platform: AppPlatform.Android,
logFiles: [],
logFileUrls: [],
priority: BuildPriority.Normal,
app: {
__typename: 'App',
+2 -85
View File
@@ -2,7 +2,6 @@ import { ArchiveSource, ArchiveSourceType, BuildJob, Metadata, Platform, formatB
import { CredentialsSource } from '@expo/eas-json';
import assert from 'assert';
import chalk from 'chalk';
import cliProgress from 'cli-progress';
import fs from 'fs-extra';
import { GraphQLError } from 'graphql/error';
import nullthrows from 'nullthrows';
@@ -61,7 +60,6 @@ import {
BuildFragment,
BuildMetadataInput,
BuildParamsInput,
BuildPriority,
BuildStatus,
FingerprintSourceInput,
UploadSessionType,
@@ -651,12 +649,6 @@ type BuildLogsProgressOptions = {
installRender: (render: () => void) => void;
};
let queueProgressBarStarted = false;
const queueProgressBar = new cliProgress.SingleBar(
{ format: '|{bar}| {estimatedWaitTime}' },
cliProgress.Presets.rect
);
let statusNewSetAt: number | null = null;
const NEW_STATUS_GRACE_PERIOD_MS = 15_000;
@@ -677,18 +669,6 @@ async function handleSingleBuildProgressAsync(
return { refetch: true };
}
if (queueProgressBarStarted && build?.status && build.status !== BuildStatus.InQueue) {
if (build.status === BuildStatus.InProgress) {
queueProgressBar.update(queueProgressBar.getTotal(), {
estimatedWaitTime: '',
});
}
queueProgressBar.stop();
Log.newLine();
queueProgressBarStarted = false;
spinner.start('Build is about to start');
}
switch (build.status) {
case BuildStatus.Finished:
spinner.succeed('Build finished');
@@ -708,40 +688,9 @@ async function handleSingleBuildProgressAsync(
}
break;
}
case BuildStatus.InQueue: {
case BuildStatus.InQueue:
updateSpinnerText(spinner, { text: 'Build queued...' });
const progressBarPayload =
typeof build.estimatedWaitTimeLeftSeconds === 'number'
? { estimatedWaitTime: formatEstimatedWaitTime(build.estimatedWaitTimeLeftSeconds) }
: { estimatedWaitTime: '' };
if (
!queueProgressBarStarted &&
typeof build.initialQueuePosition === 'number' &&
typeof build.queuePosition === 'number' &&
typeof build.estimatedWaitTimeLeftSeconds === 'number'
) {
spinner.stopAndPersist();
if (build.priority !== BuildPriority.High) {
Log.newLine();
Log.log('Start builds sooner in the priority queue.');
Log.log(`Sign up for a paid plan at ${link(getAccountBillingUrl(accountName))}`);
}
Log.newLine();
Log.log(`Waiting in ${priorityToQueueDisplayName[build.priority]}`);
queueProgressBar.start(
build.initialQueuePosition + 1,
build.initialQueuePosition - build.queuePosition + 1,
progressBarPayload
);
queueProgressBarStarted = true;
}
if (typeof build.queuePosition === 'number') {
queueProgressBar.update(build.queuePosition, progressBarPayload);
}
break;
}
case BuildStatus.PendingCancel:
case BuildStatus.Canceled:
spinner.fail('Build canceled');
@@ -771,12 +720,6 @@ async function handleSingleBuildProgressAsync(
return { refetch: true };
}
const priorityToQueueDisplayName: Record<BuildPriority, string> = {
[BuildPriority.Normal]: 'Free tier queue',
[BuildPriority.NormalPlus]: 'Free tier queue',
[BuildPriority.High]: 'priority queue',
};
const statusToDisplayName: Record<BuildStatus, string> = {
[BuildStatus.New]: 'waiting to enter the queue',
[BuildStatus.InQueue]: 'in queue',
@@ -880,26 +823,9 @@ function formatPendingBuildsText(
showConcurrencyWarning && build?.status === BuildStatus.New
? ' (concurrency limit reached)'
: '';
let extraInfo = '';
if (
build?.status === BuildStatus.InQueue &&
typeof build.initialQueuePosition === 'number' &&
typeof build.queuePosition === 'number'
) {
const percent = Math.floor(
((build.initialQueuePosition - build.queuePosition + 1) /
(build.initialQueuePosition + 1)) *
100
);
const estimatedWaitTime =
typeof build.estimatedWaitTimeLeftSeconds === 'number'
? ` - ${formatEstimatedWaitTime(build.estimatedWaitTimeLeftSeconds)}`
: '';
extraInfo = ` - queue progress: ${chalk.bold(`${percent}%`)}${estimatedWaitTime}`;
}
return `${appPlatformEmojis[platform]} ${
appPlatformDisplayNames[platform]
} build - status: ${chalk.bold(status)}${concurrencyWarning}${extraInfo}`;
} build - status: ${chalk.bold(status)}${concurrencyWarning}`;
}),
].join('\n ');
}
@@ -908,15 +834,6 @@ function isBuildFragment(maybeBuild: MaybeBuildFragment): maybeBuild is BuildFra
return maybeBuild !== null;
}
function formatEstimatedWaitTime(estimatedWaitTimeLeftSeconds: number): string {
if (estimatedWaitTimeLeftSeconds < 5 * 60) {
return 'starting soon...';
} else {
const n = Math.floor(estimatedWaitTimeLeftSeconds / (10 * 60)) + 1;
return `starting in about ${n}0 minutes...`;
}
}
async function computeAndMaybeUploadRuntimeAndFingerprintMetadataAsync<T extends Platform>(
ctx: BuildContext<T>
): Promise<{
+1 -1
View File
@@ -15,7 +15,7 @@ const SINGLE_BUILD_MAX_LOG_LINES = 5;
const MULTIPLE_BUILDS_MAX_LOG_LINES = 3;
async function fetchAndParseLogsForBuildAsync(build: BuildFragment): Promise<RawLogLine[] | null> {
const logFileUrl = build.logFiles[0];
const logFileUrl = build.logFileUrls[0];
if (!logFileUrl) {
return null;
}
@@ -19,7 +19,7 @@ export async function fetchRawLogsForJobAsync(
const buildFragment = await BuildQuery.byIdAsync(state.graphqlClient, buildId, {
useCache: false,
});
const firstLogFileUrl = buildFragment.logFiles?.[0];
const firstLogFileUrl = buildFragment.logFileUrls?.[0];
if (!firstLogFileUrl) {
return null;
}
@@ -96,9 +96,8 @@ function makeSubmission(overrides: Partial<ProjectStatusSubmission> = {}): Proje
createdAt: '2026-07-02T12:00:00.000Z',
completedAt: '2026-07-02T12:05:00.000Z',
initiatingActor: { id: 'actor-1', displayName: 'jester' },
submittedBuild: { id: 'build-1' },
submittedBuild: { id: 'build-1', appIdentifier: 'com.example.app' },
androidConfig: {
applicationIdentifier: 'com.example.app',
track: 'production',
releaseStatus: null,
rollout: 50,
@@ -1761,48 +1761,6 @@ describe(Simulator, () => {
);
});
it('passes --network-capture-recording when requested', async () => {
const { command } = createCommand([
'--platform',
'ios',
'--non-interactive',
'--network-capture',
'--network-capture-recording',
]);
await command.runAsync();
expect(mockCreateDeviceRunSessionAsync).toHaveBeenCalledWith(
graphqlClient,
expect.objectContaining({ networkCapture: true, networkCaptureRecording: true })
);
});
it.each([false, true])('omits recording without the flag (capture: %s)', async capture => {
const { command } = createCommand([
'--platform',
'ios',
'--non-interactive',
...(capture ? ['--network-capture'] : []),
]);
await command.runAsync();
expect(mockCreateDeviceRunSessionAsync.mock.calls[0][1]).not.toHaveProperty(
'networkCaptureRecording'
);
});
it('rejects --network-capture-recording without --network-capture', async () => {
const { command } = createCommand([
'--platform',
'ios',
'--non-interactive',
'--network-capture-recording',
]);
await expect(command.runAsync()).rejects.toThrow(/network-capture/);
expect(mockCreateDeviceRunSessionAsync).not.toHaveBeenCalled();
});
it('passes the requested capture fields, splitting a comma-separated value', async () => {
const { command } = createCommand([
'--platform',
@@ -3537,6 +3495,31 @@ describe(Simulator, () => {
);
});
it.each([
{ id: 'session-123', status: DeviceRunSessionStatus.InProgress },
{ id: 'another-session', status: DeviceRunSessionStatus.Stopped },
])(
'keeps local credentials when the stop response does not confirm this session: %j',
async response => {
mockByIdAsync
.mockResolvedValueOnce(makeDeviceRunSession())
.mockImplementationOnce(async () => {
process.emit('SIGINT');
return makeDeviceRunSession();
});
mockEnsureDeviceRunSessionStoppedAsync.mockResolvedValueOnce(response);
const { command } = createCommand(['--platform', 'ios']);
await command.runAsync();
expect(mockEnsureDeviceRunSessionStoppedAsync).toHaveBeenCalledWith(
graphqlClient,
'session-123'
);
expect(mockResetSimulatorEnvAsync).not.toHaveBeenCalled();
}
);
it('stops the session when interrupted while it is running', async () => {
mockByIdAsync.mockResolvedValueOnce(makeDeviceRunSession()).mockImplementationOnce(async () => {
process.emit('SIGINT');
@@ -1,492 +0,0 @@
import { Config } from '@oclif/core';
import chalk from 'chalk';
import { stripVTControlCharacters } from 'node:util';
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
import { DeviceRunSessionStatus } from '../../../graphql/generated';
import { DeviceRunSessionQuery } from '../../../graphql/queries/DeviceRunSessionQuery';
import { downloadSimulatorArtifactAsync } from '../../../simulator/artifacts';
import Log from '../../../log';
import { ora } from '../../../ora';
import { loadSimulatorEnvAsync } from '../../../simulator/env';
import {
downloadNetworkCaptureAsync,
readNetworkRequestsAsync,
streamNetworkRequestsAsync,
} from '../../../simulator/networkRequests';
import { resolveSimulatorPreviewAsync } from '../../../simulator/preview';
import { enableJsonOutput, printJsonOnlyOutput } from '../../../utils/json';
import SimulatorNetworkRequests from '../network-requests';
jest.mock('../../../log');
jest.mock('../../../graphql/queries/DeviceRunSessionQuery');
jest.mock('../../../simulator/artifacts', () => ({
...jest.requireActual('../../../simulator/artifacts'),
downloadSimulatorArtifactAsync: jest.fn(),
}));
jest.mock('../../../ora', () => ({
ora: jest.fn(() => {
const spinner = {
fail: jest.fn(),
start: jest.fn(),
succeed: jest.fn(),
};
spinner.start.mockReturnValue(spinner);
return spinner;
}),
}));
jest.mock('../../../simulator/env', () => ({
...jest.requireActual('../../../simulator/env'),
loadSimulatorEnvAsync: jest.fn(),
}));
jest.mock('../../../simulator/networkRequests');
jest.mock('../../../simulator/preview', () => ({
...jest.requireActual('../../../simulator/preview'),
resolveSimulatorPreviewAsync: jest.fn(),
}));
jest.mock('../../../utils/json');
const mockLoadSimulatorEnvAsync = jest.mocked(loadSimulatorEnvAsync);
const mockOra = jest.mocked(ora);
const mockResolvePreviewAsync = jest.mocked(resolveSimulatorPreviewAsync);
const mockReadRequestsAsync = jest.mocked(readNetworkRequestsAsync);
const mockDownloadCaptureAsync = jest.mocked(downloadNetworkCaptureAsync);
const mockStreamRequestsAsync = jest.mocked(streamNetworkRequestsAsync);
const mockEnableJsonOutput = jest.mocked(enableJsonOutput);
const mockPrintJsonOnlyOutput = jest.mocked(printJsonOnlyOutput);
const mockLog = jest.mocked(Log.log);
const originalColorLevel = chalk.level;
const graphqlClient = {} as ExpoGraphqlClient;
const projectDir = '/test/project';
const preview = {
deviceRunSessionId: 'session-id',
baseUrl: new URL('https://preview.test'),
token: 'preview-token',
};
const requestSummary = {
id: 'request-id',
startedAt: Date.parse('2026-10-05T12:00:00.000Z'),
startedDateTime: '2026-10-05T12:00:00.000Z',
method: 'POST',
url: 'https://example.test/posts',
status: 201,
duration: 50,
requestSize: 100,
responseSize: 200,
};
const request = {
_captureId: 'request-id',
startedDateTime: '2026-10-05T12:00:00.000Z',
time: 50,
request: {
method: 'POST',
url: 'https://example.test/posts',
bodySize: 100,
headers: [{ name: 'Content-Type', value: 'application/json' }],
postData: { mimeType: 'application/json', text: '{"title":"Coin Flip"}' },
},
response: {
status: 201,
bodySize: 200,
content: { mimeType: 'application/json', text: '{"id":101}' },
},
};
function getMockOclifConfig(): Config {
const config = new Config({ root: __dirname });
config.runHook = async () => ({ failures: [], successes: [] });
return config;
}
describe(SimulatorNetworkRequests, () => {
beforeEach(() => {
jest.clearAllMocks();
process.env.EAS_SIMULATOR_SESSION_ID = 'session-id';
chalk.level = 0;
mockLoadSimulatorEnvAsync.mockResolvedValue();
jest
.mocked(DeviceRunSessionQuery.byIdAsync)
.mockResolvedValue({ id: 'session-id', status: DeviceRunSessionStatus.InProgress } as Awaited<
ReturnType<typeof DeviceRunSessionQuery.byIdAsync>
>);
mockResolvePreviewAsync.mockResolvedValue(preview);
mockReadRequestsAsync.mockResolvedValue([]);
mockDownloadCaptureAsync.mockResolvedValue('/test/capture.har');
});
afterEach(() => {
delete process.env.EAS_SIMULATOR_SESSION_ID;
chalk.level = originalColorLevel;
});
it.each([DeviceRunSessionStatus.Stopped, DeviceRunSessionStatus.Errored])(
'downloads the capture for a %s session without preview',
async status => {
const session = { id: 'session-id', status } as Awaited<
ReturnType<typeof DeviceRunSessionQuery.byIdAsync>
>;
jest.mocked(DeviceRunSessionQuery.byIdAsync).mockResolvedValue(session);
await createCommand(['--artifact', '2', '--output', 'capture.har', '--json']).runAsync();
expect(downloadSimulatorArtifactAsync).toHaveBeenCalledWith(session, 'network-capture', {
artifact: 2,
output: 'capture.har',
nonInteractive: true,
json: true,
});
expect(mockResolvePreviewAsync).not.toHaveBeenCalled();
expect(DeviceRunSessionQuery.byIdAsync).toHaveBeenCalledTimes(1);
}
);
it.each([['--follow'], ['--request-id', 'r1']])(
'rejects live inspection of a stopped session %s',
async (...args) => {
jest
.mocked(DeviceRunSessionQuery.byIdAsync)
.mockResolvedValue({ id: 'session-id', status: DeviceRunSessionStatus.Stopped } as Awaited<
ReturnType<typeof DeviceRunSessionQuery.byIdAsync>
>);
await expect(createCommand(args).runAsync()).rejects.toThrow('Use --output <path>');
expect(mockResolvePreviewAsync).not.toHaveBeenCalled();
}
);
it('rejects artifact selection on a running session', async () => {
await expect(createCommand(['--artifact', '1']).runAsync()).rejects.toThrow(
'only available for stopped sessions'
);
expect(mockReadRequestsAsync).not.toHaveBeenCalled();
});
it('prints a JSON list for an explicit session with the default limit', async () => {
mockReadRequestsAsync.mockResolvedValue([requestSummary]);
await createCommand(['--id', 'session-id', '--json']).runAsync();
expect(mockEnableJsonOutput).toHaveBeenCalled();
expect(DeviceRunSessionQuery.byIdAsync).toHaveBeenCalledWith(graphqlClient, 'session-id');
expect(mockResolvePreviewAsync).toHaveBeenCalledWith(
expect.objectContaining({ id: 'session-id' })
);
expect(mockReadRequestsAsync).toHaveBeenCalledWith(preview, {
limit: 100,
requestId: undefined,
});
expect(mockPrintJsonOnlyOutput).toHaveBeenCalledWith({
deviceRunSessionId: 'session-id',
requests: [requestSummary],
});
expect(mockLog).not.toHaveBeenCalled();
expect(mockDownloadCaptureAsync).not.toHaveBeenCalled();
});
it('prints a full request detail including captured headers and bodies as JSON', async () => {
mockReadRequestsAsync.mockResolvedValue(request);
await createCommand(['--request-id', 'request-id', '--json']).runAsync();
expect(mockReadRequestsAsync).toHaveBeenCalledWith(preview, {
limit: 100,
requestId: 'request-id',
});
expect(mockPrintJsonOnlyOutput).toHaveBeenCalledWith({
deviceRunSessionId: 'session-id',
request,
});
expect(mockLog).not.toHaveBeenCalled();
});
it('downloads a HAR and prints only the resulting file metadata as JSON', async () => {
await createCommand(['--output', './capture.har', '--json']).runAsync();
expect(mockDownloadCaptureAsync).toHaveBeenCalledWith(preview, './capture.har');
expect(mockPrintJsonOnlyOutput).toHaveBeenCalledWith({
deviceRunSessionId: 'session-id',
filePath: '/test/capture.har',
});
expect(mockReadRequestsAsync).not.toHaveBeenCalled();
expect(mockLog).not.toHaveBeenCalled();
expect(mockOra).not.toHaveBeenCalled();
});
it('shows a spinner with the saved path for human output', async () => {
await createCommand(['-o', './capture.har']).runAsync();
const spinner = mockOra.mock.results[0].value;
expect(mockOra).toHaveBeenCalledWith('Saving network capture');
expect(spinner.succeed).toHaveBeenCalledWith('Saved network capture to /test/capture.har');
expect(mockPrintJsonOnlyOutput).not.toHaveBeenCalled();
expect(mockReadRequestsAsync).not.toHaveBeenCalled();
});
it('forwards an explicit limit and uses the dotenv session ID', async () => {
mockReadRequestsAsync.mockResolvedValue([requestSummary]);
mockLoadSimulatorEnvAsync.mockImplementation(async () => {
process.env.EAS_SIMULATOR_SESSION_ID = 'dotenv-id';
});
await createCommand(['--limit', '3']).runAsync();
expect(mockLoadSimulatorEnvAsync).toHaveBeenCalledWith(projectDir);
expect(DeviceRunSessionQuery.byIdAsync).toHaveBeenCalledWith(graphqlClient, 'dotenv-id');
expect(mockReadRequestsAsync).toHaveBeenCalledWith(preview, { limit: 3, requestId: undefined });
expect(mockLog).toHaveBeenCalledWith(
'request-id POST https://example.test/posts 201 50ms'
);
});
it('sanitizes terminal controls in human request summaries', async () => {
mockReadRequestsAsync.mockResolvedValue([
{ ...requestSummary, url: '\u001b[31mhttps://example.test/posts\u001b[0m\u0007' },
]);
await createCommand([]).runAsync();
expect(mockLog).toHaveBeenCalledWith(
'request-id POST https://example.test/posts 201 50ms'
);
});
it('rounds floating-point HAR timing noise only in human summaries', async () => {
const summary = { ...requestSummary, duration: 2.8999999999999995 };
mockReadRequestsAsync.mockResolvedValue([summary]);
await createCommand([]).runAsync();
expect(mockLog).toHaveBeenCalledWith(
'request-id POST https://example.test/posts 201 2.9ms'
);
await createCommand(['--json']).runAsync();
expect(mockPrintJsonOnlyOutput).toHaveBeenCalledWith({
deviceRunSessionId: 'session-id',
requests: [summary],
});
});
it('adds intentional colors after sanitizing remote text and preserves full URLs', async () => {
chalk.level = 1;
const url = `https://example.test/${'long-path/'.repeat(30)}`;
mockReadRequestsAsync.mockResolvedValue([
{
...requestSummary,
id: '\u001b[35mr1\u001b[0m\u0007',
startedDateTime: '\u001b[35m2026-10-05T12:00:00.000Z\u001b[0m\u0007',
method: '\u001b[35mGET\u001b[0m\u0007',
url: `\u001b[35m${url}\u001b[0m\u0007`,
},
]);
await createCommand(['--timestamp']).runAsync();
const output = mockLog.mock.calls[0][0] as string;
expect(output).toBe(
[
chalk.dim('2026-10-05T12:00:00.000Z'),
chalk.dim('r1 '),
chalk.bold.cyan('GET '),
url,
chalk.green('201'),
chalk.dim('50ms'),
].join(' ')
);
expect(output).toContain('\u001b[1m\u001b[36mGET ');
expect(output).not.toContain('\u001b[35m');
expect(output).not.toContain('\u0007');
expect(stripVTControlCharacters(output)).toBe(
`2026-10-05T12:00:00.000Z r1 GET ${url} 201 50ms`
);
});
it.each([
[200, '\u001b[32m'],
[299, '\u001b[32m'],
[301, '\u001b[36m'],
[399, '\u001b[36m'],
[404, '\u001b[33m'],
[499, '\u001b[33m'],
[500, '\u001b[31m'],
[599, '\u001b[31m'],
[0, '\u001b[31m'],
])('colors numeric status %i by response class', async (status, color) => {
chalk.level = 1;
mockReadRequestsAsync.mockResolvedValue([{ ...requestSummary, status }]);
await createCommand([]).runAsync();
expect(mockLog.mock.calls[0][0]).toContain(`${color}${status}\u001b[39m`);
});
it('leaves JSON data untouched when terminal color is enabled', async () => {
chalk.level = 1;
mockReadRequestsAsync.mockResolvedValue([requestSummary]);
await createCommand(['--json']).runAsync();
expect(mockPrintJsonOnlyOutput).toHaveBeenCalledWith({
deviceRunSessionId: 'session-id',
requests: [requestSummary],
});
expect(JSON.stringify(mockPrintJsonOnlyOutput.mock.calls[0][0])).not.toContain('\\u001b');
expect(mockLog).not.toHaveBeenCalled();
});
it('shows request start timestamps only when requested in human output', async () => {
mockReadRequestsAsync.mockResolvedValue([requestSummary]);
await createCommand(['--timestamp']).runAsync();
expect(mockLog).toHaveBeenCalledWith(
'2026-10-05T12:00:00.000Z request-id POST https://example.test/posts 201 50ms'
);
});
it.each(['--follow', '-f'])(
'streams human summaries with %s without fetching a finite list',
async follow => {
mockStreamRequestsAsync.mockImplementation(async (_preview, onRequest) => {
onRequest(requestSummary);
});
await createCommand([follow, '--timestamp']).runAsync();
expect(mockStreamRequestsAsync).toHaveBeenCalledWith(
preview,
expect.any(Function),
expect.any(AbortSignal)
);
expect(mockLog).toHaveBeenCalledWith(
'2026-10-05T12:00:00.000Z request-id POST https://example.test/posts 201 50ms'
);
expect(mockReadRequestsAsync).not.toHaveBeenCalled();
expect(mockDownloadCaptureAsync).not.toHaveBeenCalled();
expect(mockPrintJsonOnlyOutput).not.toHaveBeenCalled();
}
);
it('stops following on Ctrl+C and removes its interrupt handler', async () => {
const listeners = process.listeners('SIGINT');
let signal: AbortSignal | undefined;
mockStreamRequestsAsync.mockImplementation(async (_preview, _onRequest, followSignal) => {
signal = followSignal;
process.emit('SIGINT');
});
await createCommand(['--follow']).runAsync();
expect(signal?.aborted).toBe(true);
expect(process.listeners('SIGINT')).toEqual(listeners);
});
it.each([
{ options: ['--json'] },
{ options: ['--limit', '1'] },
{ options: ['--request-id', 'r1'] },
{ options: ['--output', 'capture.har'] },
])('rejects incompatible follow options $options before session access', async ({ options }) => {
await expect(createCommand(['--follow', ...options]).runAsync()).rejects.toThrow();
expect(mockResolvePreviewAsync).not.toHaveBeenCalled();
expect(mockStreamRequestsAsync).not.toHaveBeenCalled();
});
it('enables JSON output before rejecting JSON follow output', async () => {
await expect(createCommand(['--json', '--follow']).runAsync()).rejects.toThrow(
'Use either --json or --follow, not both.'
);
expect(mockEnableJsonOutput).toHaveBeenCalled();
expect(mockLoadSimulatorEnvAsync).not.toHaveBeenCalled();
});
it('prints a full request detail for human output', async () => {
mockReadRequestsAsync.mockResolvedValue(request);
await createCommand(['--request-id', 'request-id']).runAsync();
expect(mockLog).toHaveBeenCalledWith(JSON.stringify(request, null, 2));
expect(mockPrintJsonOnlyOutput).not.toHaveBeenCalled();
});
it('explains the initial-launch limitation when the capture is empty', async () => {
await createCommand([]).runAsync();
expect(mockLog).toHaveBeenCalledWith(
'No completed network requests were captured. Initial-launch requests may have been missed.'
);
});
it('rejects combining a request detail and HAR output before resolving a session', async () => {
await expect(
createCommand(['--request-id', 'request-id', '--output', './capture.har']).runAsync()
).rejects.toThrow();
expect(mockResolvePreviewAsync).not.toHaveBeenCalled();
expect(mockReadRequestsAsync).not.toHaveBeenCalled();
expect(mockDownloadCaptureAsync).not.toHaveBeenCalled();
});
it('rejects a nonpositive request limit', async () => {
await expect(createCommand(['--limit', '0']).runAsync()).rejects.toThrow();
expect(mockResolvePreviewAsync).not.toHaveBeenCalled();
});
it('propagates a missing capture error without printing an empty list', async () => {
mockReadRequestsAsync.mockRejectedValue(
new Error('No network capture was found. Start the session with --network-capture.')
);
await expect(createCommand([]).runAsync()).rejects.toThrow(
'Start the session with --network-capture.'
);
expect(mockLog).not.toHaveBeenCalled();
expect(mockPrintJsonOnlyOutput).not.toHaveBeenCalled();
});
it('propagates HAR download failures without claiming a file was saved', async () => {
mockDownloadCaptureAsync.mockRejectedValue(new Error('The output file already exists.'));
await expect(createCommand(['--output', './capture.har', '--json']).runAsync()).rejects.toThrow(
'The output file already exists.'
);
expect(mockPrintJsonOnlyOutput).not.toHaveBeenCalled();
expect(mockLog).not.toHaveBeenCalled();
expect(mockReadRequestsAsync).not.toHaveBeenCalled();
});
it('fails the spinner when the HAR download fails', async () => {
mockDownloadCaptureAsync.mockRejectedValue(new Error('The output file already exists.'));
await expect(createCommand(['--output', './capture.har']).runAsync()).rejects.toThrow(
'The output file already exists.'
);
const spinner = mockOra.mock.results[0].value;
expect(spinner.fail).toHaveBeenCalledWith('Failed to save network capture');
expect(spinner.succeed).not.toHaveBeenCalled();
});
it('stops before reading traffic when there is no simulator session', async () => {
delete process.env.EAS_SIMULATOR_SESSION_ID;
await expect(createCommand([]).runAsync()).rejects.toThrow('No simulator session ID provided.');
expect(mockResolvePreviewAsync).not.toHaveBeenCalled();
expect(mockReadRequestsAsync).not.toHaveBeenCalled();
expect(mockDownloadCaptureAsync).not.toHaveBeenCalled();
});
});
function createCommand(args: string[]): SimulatorNetworkRequests {
const command = new SimulatorNetworkRequests(args, getMockOclifConfig());
// @ts-expect-error getContextAsync is protected
jest.spyOn(command, 'getContextAsync').mockResolvedValue({
loggedIn: { graphqlClient },
projectDir,
});
return command;
}
@@ -135,6 +135,20 @@ describe(SimulatorStop, () => {
}
});
it.each([{ status: DeviceRunSessionStatus.InProgress }, { id: 'another-session' }])(
'preserves credentials when the stop is unconfirmed: %j',
async response => {
mockEnsureDeviceRunSessionStoppedAsync.mockResolvedValueOnce(
makeStoppedDeviceRunSession(response)
);
const { command } = createCommand(['--id', 'session-123', '--json']);
await expect(command.runAsync()).rejects.toThrow('could not confirm');
expect(mockResetSimulatorEnvAsync).not.toHaveBeenCalled();
expect(mockPrintJsonOnlyOutput).not.toHaveBeenCalled();
}
);
it('throws a helpful error when no simulator session ID is available', async () => {
const previousDeviceRunSessionId = process.env[EAS_SIMULATOR_SESSION_ID];
delete process.env[EAS_SIMULATOR_SESSION_ID];
@@ -77,6 +77,7 @@ import {
getLocalEgressConfig,
getPreviewApiAccess,
getRemoteSessionEnvironmentVariables,
isSimulatorStopConfirmed,
sanitizeRemoteConfigForJson,
} from '../../simulator/utils';
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
@@ -198,11 +199,7 @@ With local egress, actions wait for the connection and require interactive mode.
'network-capture': Flags.boolean({
allowNo: true,
description:
'Capture HTTP(S) traffic from apps on the device for live inspection (iOS only). HTTPS is decrypted, so captured traffic can contain credentials in cleartext and certificate-pinned apps fail to connect.',
}),
'network-capture-recording': Flags.boolean({
description: 'Save network capture as HAR artifacts for access after the session ends.',
dependsOn: ['network-capture'],
'Record HTTP(S) traffic from apps on the device (iOS only). HTTPS is decrypted, so recordings contain credentials in cleartext and certificate-pinned apps fail to connect.',
}),
'network-capture-field': Flags.string({
description:
@@ -463,7 +460,6 @@ With local egress, actions wait for the connection and require interactive mode.
publicPreview: flags['public-link'] ?? false,
packageVersion: flags['package-version'],
networkCapture: flags['network-capture'],
...(flags['network-capture-recording'] ? { networkCaptureRecording: true } : {}),
...(networkCaptureFields.length ? { networkCaptureFields } : {}),
...platformInput,
...(buildId ? { buildId } : {}),
@@ -514,7 +510,7 @@ With local egress, actions wait for the connection and require interactive mode.
);
if (flags['network-capture']) {
Log.warn(
'Network capture was requested. HTTPS is decrypted, so captured traffic can contain credentials in cleartext. Relaunch an installed app to capture its traffic.'
'Network capture was requested. HTTPS is decrypted, so recordings contain credentials in cleartext. Relaunch an installed app to record its traffic.'
);
}
} catch (err) {
@@ -1124,11 +1120,11 @@ async function ensureDeviceRunSessionStoppedSafelyAsync(
deviceRunSessionId: string
): Promise<boolean> {
try {
await DeviceRunSessionMutation.ensureDeviceRunSessionStoppedAsync(
const stopped = await DeviceRunSessionMutation.ensureDeviceRunSessionStoppedAsync(
graphqlClient,
deviceRunSessionId
);
return true;
return isSimulatorStopConfirmed(stopped, deviceRunSessionId);
} catch (err) {
// Cleanup is best-effort; surface the failure but don't mask the original error.
Log.warn(
@@ -1,216 +0,0 @@
import { Flags } from '@oclif/core';
import chalk from 'chalk';
import EasCommand from '../../commandUtils/EasCommand';
import {
EasNonInteractiveAndJsonFlags,
resolveNonInteractiveAndJsonFlags,
} from '../../commandUtils/flags';
import { DeviceRunSessionQuery } from '../../graphql/queries/DeviceRunSessionQuery';
import Log from '../../log';
import { downloadSimulatorArtifactAsync, hasSimulatorArtifacts } from '../../simulator/artifacts';
import {
getSimulatorCommandAliases,
getSimulatorCommandHiddenAliases,
} from '../../simulator/commandAliases';
import { ora } from '../../ora';
import {
EAS_SIMULATOR_SESSION_ID,
SIMULATOR_DOTENV_FILE_NAME,
loadSimulatorEnvAsync,
} from '../../simulator/env';
import {
type NetworkRequestSummary,
downloadNetworkCaptureAsync,
readNetworkRequestsAsync,
streamNetworkRequestsAsync,
} from '../../simulator/networkRequests';
import { resolveSimulatorPreviewAsync } from '../../simulator/preview';
import { stripTerminalControlCharacters } from '../../simulator/utils';
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
export default class SimulatorNetworkRequests extends EasCommand {
static override aliases = getSimulatorCommandAliases('network-requests');
static override hiddenAliases = getSimulatorCommandHiddenAliases('network-requests');
static override description =
'[EXPERIMENTAL] inspect completed network requests from a capture-enabled simulator session';
static override examples = [
'<%= config.bin %> simulator:network-requests --json',
'<%= config.bin %> simulator:network-requests --follow --timestamp',
'<%= config.bin %> simulator:network-requests --request-id r1 --json',
'<%= config.bin %> simulator:network-requests --output capture.har',
];
static override flags = {
id: Flags.string({
description: `Simulator session ID. Defaults to ${SIMULATOR_DOTENV_FILE_NAME}.`,
}),
artifact: Flags.integer({
min: 1,
description: 'Artifact index to download from a stopped session (1-based).',
}),
'request-id': Flags.string({
description:
'Show a captured request, including the headers and bodies selected for capture.',
exclusive: ['output'],
}),
output: Flags.string({
char: 'o',
description: 'Save the live HAR or a stopped session capture artifact to this path.',
exclusive: ['request-id'],
}),
follow: Flags.boolean({
char: 'f',
description: 'Stream completed requests, including those retained by the current capture.',
exclusive: ['request-id', 'output', 'limit'],
}),
limit: Flags.integer({
description: 'Maximum number of recent live requests to list without --follow.',
default: 100,
min: 1,
}),
timestamp: Flags.boolean({
description: 'Show request start timestamps in live human-readable lists.',
}),
...EasNonInteractiveAndJsonFlags,
};
static override contextDefinition = {
...this.ContextOptions.LoggedIn,
...this.ContextOptions.ProjectDir,
};
async runAsync(): Promise<void> {
// Before parsing, so only the JSON result reaches stdout.
if (this.argv.includes('--json')) {
enableJsonOutput();
}
const { flags } = await this.parse(SimulatorNetworkRequests);
const { json: jsonFlag, nonInteractive } = resolveNonInteractiveAndJsonFlags(flags);
if (jsonFlag && flags.follow) {
throw new Error('Use either --json or --follow, not both.');
}
const {
projectDir,
loggedIn: { graphqlClient },
} = await this.getContextAsync(SimulatorNetworkRequests, { nonInteractive });
await loadSimulatorEnvAsync(projectDir);
const deviceRunSessionId = flags.id ?? process.env[EAS_SIMULATOR_SESSION_ID];
if (!deviceRunSessionId) {
throw new Error(
`No simulator session ID provided. Pass --id, or run \`eas simulator:start\` first to write ${SIMULATOR_DOTENV_FILE_NAME}.`
);
}
const session = await DeviceRunSessionQuery.byIdAsync(graphqlClient, deviceRunSessionId);
if (hasSimulatorArtifacts(session)) {
if (flags.follow || flags['request-id']) {
throw new Error(
'The session has stopped. --follow and --request-id are only available while it runs. Use --output <path> to download its capture artifact.'
);
}
await downloadSimulatorArtifactAsync(session, 'network-capture', {
artifact: flags.artifact,
output: flags.output,
nonInteractive,
json: jsonFlag,
});
return;
}
const preview = await resolveSimulatorPreviewAsync(session);
if (flags.artifact !== undefined) {
throw new Error(
'--artifact is only available for stopped sessions. Use --output <path> to save the live HAR.'
);
}
if (flags.follow) {
const abortController = new AbortController();
const interruptHandler = (): void => {
if (abortController.signal.aborted) {
process.exit(130);
}
abortController.abort();
};
process.on('SIGINT', interruptHandler);
try {
await streamNetworkRequestsAsync(
preview,
request => {
Log.log(formatRequestSummary(request, flags.timestamp));
},
abortController.signal
);
} finally {
process.removeListener('SIGINT', interruptHandler);
}
return;
}
if (flags.output) {
const downloadSpinner = jsonFlag ? null : ora('Saving network capture').start();
let filePath: string;
try {
filePath = await downloadNetworkCaptureAsync(preview, flags.output);
downloadSpinner?.succeed(`Saved network capture to ${filePath}`);
} catch (err) {
downloadSpinner?.fail('Failed to save network capture');
throw err;
}
if (jsonFlag) {
printJsonOnlyOutput({ deviceRunSessionId: preview.deviceRunSessionId, filePath });
}
return;
}
const result = await readNetworkRequestsAsync(preview, {
limit: flags.limit,
requestId: flags['request-id'],
});
if (jsonFlag) {
printJsonOnlyOutput({
deviceRunSessionId: preview.deviceRunSessionId,
...(Array.isArray(result) ? { requests: result } : { request: result }),
});
} else if (!Array.isArray(result)) {
Log.log(
stripTerminalControlCharacters(JSON.stringify(result, null, 2), {
keepNewlinesAndTabs: true,
})
);
} else if (result.length === 0) {
Log.log(
'No completed network requests were captured. Initial-launch requests may have been missed.'
);
} else {
for (const request of result) {
Log.log(formatRequestSummary(request, flags.timestamp));
}
}
}
}
function formatRequestSummary(request: NetworkRequestSummary, timestamp = false): string {
let status = String(request.status);
if (request.status === 0 || request.status >= 500) {
status = chalk.red(status);
} else if (request.status >= 400) {
status = chalk.yellow(status);
} else if (request.status >= 300) {
status = chalk.cyan(status);
} else if (request.status >= 200) {
status = chalk.green(status);
}
const fields = [
chalk.dim(stripTerminalControlCharacters(request.id ?? '-').padEnd(5)),
chalk.bold.cyan(stripTerminalControlCharacters(request.method).padEnd(6)),
stripTerminalControlCharacters(request.url),
status,
chalk.dim(`${Math.round(request.duration * 10) / 10}ms`),
];
if (timestamp) {
fields.unshift(chalk.dim(stripTerminalControlCharacters(request.startedDateTime)));
}
return fields.join(' ');
}
@@ -13,6 +13,7 @@ import {
loadSimulatorEnvAsync,
resetSimulatorEnvAsync,
} from '../../simulator/env';
import { isSimulatorStopConfirmed } from '../../simulator/utils';
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
import {
getSimulatorCommandAliases,
@@ -67,6 +68,9 @@ export default class SimulatorStop extends EasCommand {
graphqlClient,
flagId
);
if (!isSimulatorStopConfirmed(session, flagId)) {
throw new Error(`EAS could not confirm that simulator session ${flagId} stopped.`);
}
stopSpinner.succeed(`🎉 Simulator session ${session.id} is ${session.status.toLowerCase()}`);
} catch (err) {
stopSpinner.fail(`Failed to stop simulator session ${flagId}`);
+22 -27
View File
@@ -6805,9 +6805,9 @@ export type CreateDeviceRunSessionInput = {
*/
name?: InputMaybe<Scalars['String']['input']>;
/**
* Capture HTTP(S) traffic from apps on the device for live inspection. iOS only.
* HTTPS is decrypted, so captured traffic can contain credentials and cookies in cleartext.
* If omitted, network capture is disabled.
* Record HTTP(S) traffic from apps on the device for the whole session. iOS only.
* HTTPS is decrypted, so recordings contain credentials and cookies in cleartext.
* If omitted, no traffic is recorded.
*/
networkCapture?: InputMaybe<Scalars['Boolean']['input']>;
/**
@@ -6816,11 +6816,6 @@ export type CreateDeviceRunSessionInput = {
* it is asked for. Requires networkCapture.
*/
networkCaptureFields?: InputMaybe<Array<Scalars['String']['input']>>;
/**
* Record network capture as a HAR artifact for access after the session. Requires networkCapture.
* If omitted, HAR artifact recording is disabled.
*/
networkCaptureRecording?: InputMaybe<Scalars['Boolean']['input']>;
/**
* Expo or development-client URL to open after launching the installed application. Requires
* buildId, applicationArchiveUrl, or expoGo.
@@ -15558,7 +15553,7 @@ export type CreateAndroidBuildMutationVariables = Exact<{
}>;
export type CreateAndroidBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', createAndroidBuild: { __typename?: 'CreateBuildResult', build: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type CreateAndroidBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', createAndroidBuild: { __typename?: 'CreateBuildResult', build: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -15573,7 +15568,7 @@ export type CreateIosBuildMutationVariables = Exact<{
}>;
export type CreateIosBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', createIosBuild: { __typename?: 'CreateBuildResult', build: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type CreateIosBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', createIosBuild: { __typename?: 'CreateBuildResult', build: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -15586,7 +15581,7 @@ export type UpdateBuildMetadataMutationVariables = Exact<{
}>;
export type UpdateBuildMetadataMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', updateBuildMetadata: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type UpdateBuildMetadataMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', updateBuildMetadata: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -15599,7 +15594,7 @@ export type RetryIosBuildMutationVariables = Exact<{
}>;
export type RetryIosBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', retryIosBuild: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type RetryIosBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', retryIosBuild: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -15760,7 +15755,7 @@ export type CreateLocalBuildMutationVariables = Exact<{
}>;
export type CreateLocalBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', createLocalBuild: { __typename?: 'CreateBuildResult', build: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type CreateLocalBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', createLocalBuild: { __typename?: 'CreateBuildResult', build: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -16289,7 +16284,7 @@ export type BuildsByIdQueryVariables = Exact<{
}>;
export type BuildsByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type BuildsByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -16301,7 +16296,7 @@ export type BuildsWithSubmissionsByIdQueryVariables = Exact<{
}>;
export type BuildsWithSubmissionsByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', track: string, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type BuildsWithSubmissionsByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', track: string, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -16313,7 +16308,7 @@ export type BuildsWithFingerprintByIdQueryVariables = Exact<{
}>;
export type BuildsWithFingerprintByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string, debugInfoUrl?: string | null, builds: { __typename?: 'AppBuildsConnection', edges: Array<{ __typename?: 'AppBuildEdge', node: { __typename?: 'Build', platform: AppPlatform, id: string } }> }, updates: { __typename?: 'AppUpdatesConnection', edges: Array<{ __typename?: 'AppUpdateEdge', node: { __typename?: 'Update', id: string, platform: string } }> } } | null, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, initiatingActor?:
export type BuildsWithFingerprintByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string, debugInfoUrl?: string | null, builds: { __typename?: 'AppBuildsConnection', edges: Array<{ __typename?: 'AppBuildEdge', node: { __typename?: 'Build', platform: AppPlatform, id: string } }> }, updates: { __typename?: 'AppUpdatesConnection', edges: Array<{ __typename?: 'AppUpdateEdge', node: { __typename?: 'Update', id: string, platform: string } }> } } | null, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -16328,7 +16323,7 @@ export type ViewBuildsOnAppQueryVariables = Exact<{
}>;
export type ViewBuildsOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, builds: Array<{ __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type ViewBuildsOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, builds: Array<{ __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -16741,7 +16736,7 @@ export type SubmissionByIdWithSubmittedBuildQueryVariables = Exact<{
}>;
export type SubmissionByIdWithSubmittedBuildQuery = { __typename?: 'RootQuery', submissions: { __typename?: 'SubmissionQuery', byId: { __typename?: 'Submission', id: string, createdAt: any, completedAt?: any | null, canRetry: boolean, maxRetryTimeMinutes: number, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, submittedBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type SubmissionByIdWithSubmittedBuildQuery = { __typename?: 'RootQuery', submissions: { __typename?: 'SubmissionQuery', byId: { __typename?: 'Submission', id: string, createdAt: any, completedAt?: any | null, canRetry: boolean, maxRetryTimeMinutes: number, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, submittedBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -16757,7 +16752,7 @@ export type GetAllSubmissionsForAppQueryVariables = Exact<{
}>;
export type GetAllSubmissionsForAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, submissions: Array<{ __typename?: 'Submission', id: string, createdAt: any, completedAt?: any | null, canRetry: boolean, maxRetryTimeMinutes: number, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, submittedBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type GetAllSubmissionsForAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, submissions: Array<{ __typename?: 'Submission', id: string, createdAt: any, completedAt?: any | null, canRetry: boolean, maxRetryTimeMinutes: number, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, submittedBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -16776,7 +16771,7 @@ export type GetProjectStatusSubmissionsQuery = { __typename?: 'RootQuery', app:
| { __typename?: 'Robot', id: string, displayName: string }
| { __typename?: 'SSOUser', id: string, displayName: string }
| { __typename?: 'User', id: string, displayName: string }
| null, submittedBuild?: { __typename?: 'Build', id: string } | null, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: string, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }> } } };
| null, submittedBuild?: { __typename?: 'Build', id: string, appIdentifier?: string | null } | null, androidConfig?: { __typename?: 'AndroidSubmissionConfig', track: string, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }> } } };
export type SupabaseConnectionByAccountIdQueryVariables = Exact<{
accountId: Scalars['String']['input'];
@@ -16986,7 +16981,7 @@ export type WorkflowJobByIdQueryVariables = Exact<{
}>;
export type WorkflowJobByIdQuery = { __typename?: 'RootQuery', workflowJobs: { __typename?: 'WorkflowJobQuery', byId: { __typename?: 'WorkflowJob', id: string, key: string, name: string, status: WorkflowJobStatus, type: WorkflowJobType, outputs: any, createdAt: any, updatedAt: any, workflowRun: { __typename?: 'WorkflowRun', id: string }, turtleJobRun?: { __typename?: 'JobRun', id: string, logFileUrls: Array<string>, artifacts: Array<{ __typename?: 'WorkflowArtifact', id: string, name: string, contentType?: string | null, fileSizeBytes?: number | null, filename: string, downloadUrl?: string | null }>, errors: Array<{ __typename?: 'JobRunError', errorCode: string, message: string }> } | null, turtleBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type WorkflowJobByIdQuery = { __typename?: 'RootQuery', workflowJobs: { __typename?: 'WorkflowJobQuery', byId: { __typename?: 'WorkflowJob', id: string, key: string, name: string, status: WorkflowJobStatus, type: WorkflowJobType, outputs: any, createdAt: any, updatedAt: any, workflowRun: { __typename?: 'WorkflowRun', id: string }, turtleJobRun?: { __typename?: 'JobRun', id: string, logFileUrls: Array<string>, artifacts: Array<{ __typename?: 'WorkflowArtifact', id: string, name: string, contentType?: string | null, fileSizeBytes?: number | null, filename: string, downloadUrl?: string | null }>, errors: Array<{ __typename?: 'JobRunError', errorCode: string, message: string }> } | null, turtleBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -17038,7 +17033,7 @@ export type WorkflowRunByIdWithJobsQueryVariables = Exact<{
}>;
export type WorkflowRunByIdWithJobsQuery = { __typename?: 'RootQuery', workflowRuns: { __typename?: 'WorkflowRunQuery', byId: { __typename?: 'WorkflowRun', id: string, status: WorkflowRunStatus, gitCommitMessage?: string | null, gitCommitHash?: string | null, requestedGitRef?: string | null, triggeringLabelName?: string | null, triggerEventType: WorkflowRunTriggerEventType, triggeringSchedule?: string | null, createdAt: any, updatedAt: any, finalizedAt?: any | null, blockingWorkflowRun?: { __typename?: 'WorkflowRun', id: string, name: string, status: WorkflowRunStatus } | null, workflow: { __typename?: 'Workflow', id: string, name?: string | null, fileName: string, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } }, jobs: Array<{ __typename?: 'WorkflowJob', id: string, key: string, name: string, status: WorkflowJobStatus, type: WorkflowJobType, outputs: any, createdAt: any, updatedAt: any, workflowRun: { __typename?: 'WorkflowRun', id: string }, turtleJobRun?: { __typename?: 'JobRun', id: string, logFileUrls: Array<string>, artifacts: Array<{ __typename?: 'WorkflowArtifact', id: string, name: string, contentType?: string | null, fileSizeBytes?: number | null, filename: string, downloadUrl?: string | null }>, errors: Array<{ __typename?: 'JobRunError', errorCode: string, message: string }> } | null, turtleBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type WorkflowRunByIdWithJobsQuery = { __typename?: 'RootQuery', workflowRuns: { __typename?: 'WorkflowRunQuery', byId: { __typename?: 'WorkflowRun', id: string, status: WorkflowRunStatus, gitCommitMessage?: string | null, gitCommitHash?: string | null, requestedGitRef?: string | null, triggeringLabelName?: string | null, triggerEventType: WorkflowRunTriggerEventType, triggeringSchedule?: string | null, createdAt: any, updatedAt: any, finalizedAt?: any | null, blockingWorkflowRun?: { __typename?: 'WorkflowRun', id: string, name: string, status: WorkflowRunStatus } | null, workflow: { __typename?: 'Workflow', id: string, name?: string | null, fileName: string, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } }, jobs: Array<{ __typename?: 'WorkflowJob', id: string, key: string, name: string, status: WorkflowJobStatus, type: WorkflowJobType, outputs: any, createdAt: any, updatedAt: any, workflowRun: { __typename?: 'WorkflowRun', id: string }, turtleJobRun?: { __typename?: 'JobRun', id: string, logFileUrls: Array<string>, artifacts: Array<{ __typename?: 'WorkflowArtifact', id: string, name: string, contentType?: string | null, fileSizeBytes?: number | null, filename: string, downloadUrl?: string | null }>, errors: Array<{ __typename?: 'JobRunError', errorCode: string, message: string }> } | null, turtleBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -17144,21 +17139,21 @@ export type AuditLogFragment = { __typename?: 'AuditLog', id: string, createdAt:
export type BackgroundJobReceiptDataFragment = { __typename?: 'BackgroundJobReceipt', id: string, state: BackgroundJobState, tries: number, willRetry: boolean, resultId?: string | null, resultType: BackgroundJobResultType, resultData?: any | null, errorCode?: string | null, errorMessage?: string | null, createdAt: any, updatedAt: any };
export type BuildFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type BuildFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
| { __typename: 'User', id: string, displayName: string }
| null, app: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, updateChannel?: { __typename?: 'UpdateChannel', id: string, name: string } | null, runtime?: { __typename?: 'Runtime', id: string, version: string } | null, metrics?: { __typename?: 'BuildMetrics', buildWaitTime?: number | null, buildQueueTime?: number | null, buildDuration?: number | null } | null };
export type BuildWithSubmissionsFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', track: string, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type BuildWithSubmissionsFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', track: string, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
| { __typename: 'User', id: string, displayName: string }
| null, app: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, updateChannel?: { __typename?: 'UpdateChannel', id: string, name: string } | null, runtime?: { __typename?: 'Runtime', id: string, version: string } | null, metrics?: { __typename?: 'BuildMetrics', buildWaitTime?: number | null, buildQueueTime?: number | null, buildDuration?: number | null } | null };
export type BuildWithFingerprintFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string, debugInfoUrl?: string | null, builds: { __typename?: 'AppBuildsConnection', edges: Array<{ __typename?: 'AppBuildEdge', node: { __typename?: 'Build', platform: AppPlatform, id: string } }> }, updates: { __typename?: 'AppUpdatesConnection', edges: Array<{ __typename?: 'AppUpdateEdge', node: { __typename?: 'Update', id: string, platform: string } }> } } | null, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, initiatingActor?:
export type BuildWithFingerprintFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string, debugInfoUrl?: string | null, builds: { __typename?: 'AppBuildsConnection', edges: Array<{ __typename?: 'AppBuildEdge', node: { __typename?: 'Build', platform: AppPlatform, id: string } }> }, updates: { __typename?: 'AppUpdatesConnection', edges: Array<{ __typename?: 'AppUpdateEdge', node: { __typename?: 'Update', id: string, platform: string } }> } } | null, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -17203,7 +17198,7 @@ export type StatuspageServiceFragment = { __typename?: 'StatuspageService', id:
export type SubmissionFragment = { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', track: string, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null };
export type SubmissionWithSubmittedBuildFragment = { __typename?: 'Submission', id: string, createdAt: any, completedAt?: any | null, canRetry: boolean, maxRetryTimeMinutes: number, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, submittedBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type SubmissionWithSubmittedBuildFragment = { __typename?: 'Submission', id: string, createdAt: any, completedAt?: any | null, canRetry: boolean, maxRetryTimeMinutes: number, status: SubmissionStatus, platform: AppPlatform, logFiles: Array<string>, submittedBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -17245,7 +17240,7 @@ export type WebhookFragment = { __typename?: 'Webhook', id: string, event: Webho
export type WorkflowFragment = { __typename?: 'Workflow', id: string, name?: string | null, fileName: string, createdAt: any, updatedAt: any, revisionsPaginated: { __typename?: 'WorkflowRevisionsConnection', edges: Array<{ __typename?: 'WorkflowRevisionEdge', node: { __typename?: 'WorkflowRevision', id: string, blobSha: string, commitSha?: string | null, createdAt: any, yamlConfig: string } }> } };
export type WorkflowJobFragment = { __typename?: 'WorkflowJob', id: string, key: string, name: string, status: WorkflowJobStatus, type: WorkflowJobType, outputs: any, createdAt: any, updatedAt: any, workflowRun: { __typename?: 'WorkflowRun', id: string }, turtleJobRun?: { __typename?: 'JobRun', id: string, logFileUrls: Array<string>, artifacts: Array<{ __typename?: 'WorkflowArtifact', id: string, name: string, contentType?: string | null, fileSizeBytes?: number | null, filename: string, downloadUrl?: string | null }>, errors: Array<{ __typename?: 'JobRunError', errorCode: string, message: string }> } | null, turtleBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
export type WorkflowJobFragment = { __typename?: 'WorkflowJob', id: string, key: string, name: string, status: WorkflowJobStatus, type: WorkflowJobType, outputs: any, createdAt: any, updatedAt: any, workflowRun: { __typename?: 'WorkflowRun', id: string }, turtleJobRun?: { __typename?: 'JobRun', id: string, logFileUrls: Array<string>, artifacts: Array<{ __typename?: 'WorkflowArtifact', id: string, name: string, contentType?: string | null, fileSizeBytes?: number | null, filename: string, downloadUrl?: string | null }>, errors: Array<{ __typename?: 'JobRunError', errorCode: string, message: string }> } | null, turtleBuild?: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFileUrls: Array<string>, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, appIdentifier?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?:
| { __typename: 'PartnerActor', id: string, displayName: string }
| { __typename: 'Robot', id: string, displayName: string }
| { __typename: 'SSOUser', id: string, displayName: string }
@@ -156,9 +156,9 @@ export const SubmissionQuery = {
}
submittedBuild {
id
appIdentifier
}
androidConfig {
applicationIdentifier
track
releaseStatus
rollout
+1 -4
View File
@@ -29,7 +29,7 @@ export const BuildFragmentNode = gql`
id
displayName
}
logFiles
logFileUrls
app {
__typename
id
@@ -57,9 +57,6 @@ export const BuildFragmentNode = gql`
}
gitCommitHash
gitCommitMessage
initialQueuePosition
queuePosition
estimatedWaitTimeLeftSeconds
priority
createdAt
updatedAt
@@ -238,7 +238,7 @@ function toSubmissionSummary(
platform: submission.platform,
status: submission.status,
appIdentifier:
submission.androidConfig?.applicationIdentifier ??
(submission.androidConfig ? submission.submittedBuild?.appIdentifier : null) ??
submission.iosConfig?.ascAppIdentifier ??
null,
androidTrack: submission.androidConfig?.track ?? null,
@@ -8,7 +8,6 @@ import SimulatorGet from '../../commands/simulator/get';
import Simulator from '../../commands/simulator/index';
import SimulatorList from '../../commands/simulator/list';
import SimulatorLogs from '../../commands/simulator/logs';
import SimulatorNetworkRequests from '../../commands/simulator/network-requests';
import SimulatorStop from '../../commands/simulator/stop';
import { isSimulatorCommandId } from '../commandAliases';
@@ -23,7 +22,6 @@ describe('simulator command aliases', () => {
['get', SimulatorGet],
['list', SimulatorList],
['logs', SimulatorLogs],
['network-requests', SimulatorNetworkRequests],
['stop', SimulatorStop],
])('runs simulator:%s from every simulator topic alias', (name, command) => {
expect(command.aliases).toEqual([`sim:${name}`]);
@@ -1,519 +0,0 @@
import { mkdtemp, readFile, readdir, rm, stat, symlink, writeFile } from 'node:fs/promises';
import { createServer } from 'node:http';
import { type AddressInfo } from 'node:net';
import os from 'node:os';
import path from 'node:path';
import { Readable } from 'node:stream';
import { Response } from '../../fetch';
import {
type NetworkRequest,
type NetworkRequestSummary,
downloadNetworkCaptureAsync,
readNetworkRequestsAsync,
streamNetworkRequestsAsync,
} from '../networkRequests';
import { fetchSimulatorPreviewAsync, streamSimulatorPreviewAsync } from '../preview';
jest.mock('../preview', () => ({
...jest.requireActual('../preview'),
fetchSimulatorPreviewAsync: jest.fn(),
streamSimulatorPreviewAsync: jest.fn(),
}));
const NOT_ENABLED_MESSAGE =
'Network capture is not enabled for this session. Capture must be requested when the session starts. Start a new session with `eas simulator:start --network-capture`.';
const preview = {
deviceRunSessionId: 'session-id',
baseUrl: new URL('https://preview.test'),
token: 'secret',
};
const signal = new AbortController().signal;
let directory: string;
function entry(id: string): NetworkRequest {
return {
_captureId: id,
_captureStartedAt: 123.45,
startedDateTime: '2026-10-05T20:54:22.074Z',
time: 82,
request: { method: 'POST', url: 'https://example.test/posts', bodySize: 0, postData: null },
response: { status: 201, bodySize: 12, content: { text: '{"id":101}' } },
};
}
function reply(body: string | Readable): void {
jest
.mocked(fetchSimulatorPreviewAsync)
.mockResolvedValue(new Response(typeof body === 'string' ? Readable.from([body]) : body));
}
function rejectOnTimeout(): AbortController {
const controller = new AbortController();
jest.spyOn(AbortSignal, 'timeout').mockReturnValue(controller.signal);
jest.mocked(fetchSimulatorPreviewAsync).mockImplementation(
async (_preview, _route, options) =>
await new Promise<Response>((_resolve, reject) => {
if (options?.signal?.aborted) {
reject(new Error('secret remote URL'));
}
options?.signal?.addEventListener('abort', () => {
reject(new Error('secret remote URL'));
});
})
);
return controller;
}
function capturedRequest(
id: string,
startedAt = Date.parse(entry(id).startedDateTime)
): {
id: string;
startedAt: number;
method: string;
url: string;
status: number;
durationMs: number;
requestBytes: number;
responseBytes: number;
} {
return {
id,
startedAt,
method: 'POST',
url: 'https://example.test/posts',
status: 201,
durationMs: 82,
requestBytes: 0,
responseBytes: 12,
};
}
function streamEvents(events: unknown[]): void {
jest.mocked(streamSimulatorPreviewAsync).mockImplementation(async (_preview, _route, onData) => {
for (const event of events) {
onData(typeof event === 'string' ? event : JSON.stringify(event));
}
});
}
beforeEach(async () => {
jest.clearAllMocks();
directory = await mkdtemp(path.join(os.tmpdir(), 'eas-network-requests-test-'));
});
afterEach(async () => {
jest.restoreAllMocks();
await rm(directory, { recursive: true, force: true });
});
describe(readNetworkRequestsAsync, () => {
it('closes a real HTTP response immediately after a malformed capture frame', async () => {
let markClosed: () => void = () => {};
const closed = new Promise<void>(resolve => {
markClosed = resolve;
});
const server = createServer((_request, response) => {
response.writeHead(200, { 'content-type': 'application/x-ndjson' });
response.write('malformed-frame\n');
const timer = setInterval(() => response.write(' \n'), 10);
response.on('close', () => {
clearInterval(timer);
markClosed();
});
});
await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve));
jest
.mocked(fetchSimulatorPreviewAsync)
.mockImplementationOnce(
jest.requireActual<typeof import('../preview')>('../preview').fetchSimulatorPreviewAsync
);
let timeout: NodeJS.Timeout | undefined;
try {
await expect(
readNetworkRequestsAsync(
{
...preview,
baseUrl: new URL(`http://127.0.0.1:${(server.address() as AddressInfo).port}`),
},
{ limit: 100 }
)
).rejects.toThrow('Could not read the network capture');
await Promise.race([
closed,
new Promise<void>((_resolve, reject) => {
timeout = setTimeout(() => {
reject(new Error('The capture connection stayed open.'));
}, 1000);
}),
]);
} finally {
clearTimeout(timeout);
server.closeAllConnections();
await new Promise<void>(resolve =>
server.close(() => {
resolve();
})
);
}
});
it('keeps recent summaries without retaining captured bodies, including a final line without a newline', async () => {
reply([entry('r1'), entry('r2'), entry('r3')].map(value => JSON.stringify(value)).join('\n'));
const requests = await readNetworkRequestsAsync(preview, { limit: 2 });
expect(fetchSimulatorPreviewAsync).toHaveBeenCalledWith(preview, '/network-capture.ndjson', {
signal: expect.any(AbortSignal),
notFoundMessage: NOT_ENABLED_MESSAGE,
});
expect(requests).toEqual(
['r2', 'r3'].map(id => ({
id,
startedAt: 123.45,
startedDateTime: '2026-10-05T20:54:22.074Z',
method: 'POST',
url: 'https://example.test/posts',
status: 201,
duration: 82,
requestSize: 0,
responseSize: 12,
}))
);
});
it('orders snapshots by start date and limits the latest starts rather than completions', async () => {
const entries = [
{ ...entry('r3'), startedDateTime: '2026-10-05T20:54:24.000Z', _captureStartedAt: 1 },
{ ...entry('r1'), startedDateTime: '2026-10-05T20:54:22.000Z', _captureStartedAt: 3 },
{ ...entry('r2'), startedDateTime: '2026-10-05T20:54:23.000Z', _captureStartedAt: 2 },
];
reply(entries.map(value => JSON.stringify(value)).join('\n'));
expect(await readNetworkRequestsAsync(preview, { limit: 2 })).toEqual([
expect.objectContaining({ id: 'r2' }),
expect.objectContaining({ id: 'r3' }),
]);
reply(entries.map(value => JSON.stringify(value)).join('\n'));
expect(await readNetworkRequestsAsync(preview, { limit: 1 })).toEqual([
expect.objectContaining({ id: 'r3' }),
]);
});
it('uses fractional start times and numeric request IDs to order equal start dates', async () => {
const entries = [
{ ...entry('r10'), _captureStartedAt: 123.45 },
{ ...entry('r3'), _captureStartedAt: 123.5 },
{ ...entry('r2'), _captureStartedAt: 123.45 },
];
reply(entries.map(value => JSON.stringify(value)).join('\n'));
expect(await readNetworkRequestsAsync(preview, { limit: 2 })).toEqual([
expect.objectContaining({ id: 'r10' }),
expect.objectContaining({ id: 'r3' }),
]);
});
it('returns selected captured headers and bodies without depending on the live request buffer', async () => {
const request = entry('r1');
reply(JSON.stringify(request));
expect(await readNetworkRequestsAsync(preview, { limit: 100, requestId: 'r1' })).toEqual(
request
);
});
it('handles UTF-8 split across chunks', async () => {
const bytes = Buffer.from(
JSON.stringify({
...entry('r1'),
request: { ...entry('r1').request, url: 'https://example.test/é' },
})
);
const split = bytes.indexOf(Buffer.from('é')) + 1;
reply(Readable.from([bytes.subarray(0, split), bytes.subarray(split)]));
const result = await readNetworkRequestsAsync(preview, { limit: 1 });
expect(result).toEqual([expect.objectContaining({ url: 'https://example.test/é' })]);
});
it('returns an empty list for an empty capture and reports a missing request', async () => {
reply('');
expect(await readNetworkRequestsAsync(preview, { limit: 100 })).toEqual([]);
reply('');
await expect(
readNetworkRequestsAsync(preview, { limit: 100, requestId: 'r1' })
).rejects.toThrow('not found');
});
it.each([
'secret-body',
'{"startedDateTime":"secret-body"}',
JSON.stringify({ ...entry('r1'), startedDateTime: 'secret-body' }),
])('reports malformed data without echoing decrypted traffic %#', async data => {
reply(data);
const error = readNetworkRequestsAsync(preview, { limit: 100 });
await expect(error).rejects.toThrow('Could not read the network capture.');
await expect(error).rejects.not.toThrow('secret-body');
});
it('reports a capture deadline', async () => {
const controller = rejectOnTimeout();
const pending = readNetworkRequestsAsync(preview, { limit: 100 });
const rejected = expect(pending).rejects.toThrow('The network capture request timed out.');
controller.abort();
await rejected;
expect(AbortSignal.timeout).toHaveBeenCalledWith(10 * 60_000);
});
it('retains useful request failures', async () => {
jest
.mocked(fetchSimulatorPreviewAsync)
.mockRejectedValue(new Error('Preview API access was refused.'));
await expect(readNetworkRequestsAsync(preview, { limit: 100 })).rejects.toThrow(
'Preview API access was refused.'
);
});
});
describe(streamNetworkRequestsAsync, () => {
it('follows retained completed requests and emits live completions immediately', async () => {
const requests: NetworkRequestSummary[] = [];
jest
.mocked(streamSimulatorPreviewAsync)
.mockImplementation(async (_preview, _route, onData) => {
onData(JSON.stringify({ type: 'meta', meta: { attachment: 'starting' }, initial: true }));
onData(JSON.stringify({ type: 'meta', meta: { attachment: 'capturing' } }));
onData(JSON.stringify({ type: 'finished', request: capturedRequest('r1', 1000) }));
onData(JSON.stringify({ type: 'finished', request: capturedRequest('r2', 2000) }));
onData(JSON.stringify({ type: 'started', request: capturedRequest('r3', 3000) }));
onData(JSON.stringify({ type: 'finished', request: capturedRequest('r4', 4000) }));
expect(requests.map(request => request.id)).toEqual(['r1', 'r2', 'r4']);
onData(
JSON.stringify({
type: 'finished',
request: { ...capturedRequest('r3', 3000), status: null, durationMs: null },
})
);
});
await streamNetworkRequestsAsync(preview, request => requests.push(request), signal);
expect(streamSimulatorPreviewAsync).toHaveBeenCalledWith(
preview,
'/network-capture',
expect.any(Function),
{ signal, notFoundMessage: NOT_ENABLED_MESSAGE }
);
expect(fetchSimulatorPreviewAsync).not.toHaveBeenCalled();
expect(requests.map(request => request.id)).toEqual(['r1', 'r2', 'r4', 'r3']);
expect(requests[3]).toEqual({
id: 'r3',
startedAt: 3000,
startedDateTime: '1970-01-01T00:00:03.000Z',
method: 'POST',
url: 'https://example.test/posts',
status: 0,
duration: 0,
requestSize: 0,
responseSize: 12,
});
});
it('keeps following when capture restarts, request IDs are reused, or events are unknown', async () => {
streamEvents([
{ type: 'meta', meta: { attachment: 'capturing' }, initial: true },
{ type: 'session', udid: 'SIM-A' },
{ type: 'finished', request: capturedRequest('r1', 1000) },
{ type: 'cleared' },
{ type: 'meta', meta: { attachment: 'starting' } },
{ type: 'started', request: capturedRequest('r1', 2000) },
{ type: 'finished', request: capturedRequest('r1', 2000) },
{ type: 'evicted', id: 'r1' },
{ type: 'finished', request: capturedRequest('r2', 3000) },
]);
const requests: NetworkRequestSummary[] = [];
await streamNetworkRequestsAsync(preview, request => requests.push(request), signal);
expect(requests.map(request => request.startedAt)).toEqual([1000, 2000, 3000]);
});
it.each([
['not-enabled', NOT_ENABLED_MESSAGE],
[
'failed',
'The network capture failed. The session reported a capture error. Open the session preview to see the error, or start a new session with `eas simulator:start --network-capture`.',
],
])(
'reports the %s capture state without exposing attachment errors',
async (attachment, message) => {
streamEvents([
{ type: 'meta', meta: { attachment, attachError: 'secret remote URL' }, initial: true },
]);
await expect(streamNetworkRequestsAsync(preview, jest.fn(), signal)).rejects.toEqual(
new Error(message)
);
}
);
it('stops on capture failure after emitting earlier completed requests', async () => {
streamEvents([
{ type: 'meta', meta: { attachment: 'capturing' } },
{ type: 'finished', request: capturedRequest('r1') },
{ type: 'meta', meta: { attachment: 'failed' } },
{ type: 'finished', request: capturedRequest('r2') },
]);
const onRequest = jest.fn();
await expect(streamNetworkRequestsAsync(preview, onRequest, signal)).rejects.toThrow(
'The network capture failed.'
);
expect(onRequest).toHaveBeenCalledTimes(1);
});
it('explains when capture is turned off after following has started', async () => {
streamEvents([
{ type: 'meta', meta: { attachment: 'capturing' }, initial: true },
{ type: 'finished', request: capturedRequest('r1', 1000) },
{ type: 'meta', meta: { attachment: 'not-enabled' } },
]);
const onRequest = jest.fn();
await expect(streamNetworkRequestsAsync(preview, onRequest, signal)).rejects.toThrow(
'Network capture was turned off,'
);
expect(onRequest).toHaveBeenCalledTimes(1);
});
it.each(['secret-body', '{"type":"finished","request":{"url":"secret-body"}}'])(
'reports malformed stream data without echoing decrypted traffic %#',
async data => {
streamEvents([data]);
const error = streamNetworkRequestsAsync(preview, jest.fn(), signal);
await expect(error).rejects.toThrow('Could not read the network capture stream.');
await expect(error).rejects.not.toThrow('secret-body');
}
);
it('preserves useful stream setup errors and returns after a clean shared interruption', async () => {
jest
.mocked(streamSimulatorPreviewAsync)
.mockRejectedValueOnce(new Error('The simulator preview is offline.'))
.mockResolvedValueOnce();
await expect(streamNetworkRequestsAsync(preview, jest.fn(), signal)).rejects.toThrow(
'The simulator preview is offline.'
);
await expect(streamNetworkRequestsAsync(preview, jest.fn(), signal)).resolves.toBeUndefined();
});
});
describe(downloadNetworkCaptureAsync, () => {
it('streams an exact HAR into a private file', async () => {
const data = JSON.stringify({ log: { entries: [entry('r1')] } });
reply(Readable.from([data.slice(0, 15), data.slice(15)]));
const output = path.join(directory, 'capture.har');
const oldUmask = process.umask(0);
try {
expect(await downloadNetworkCaptureAsync(preview, output)).toBe(output);
} finally {
process.umask(oldUmask);
}
expect(fetchSimulatorPreviewAsync).toHaveBeenCalledWith(preview, '/network-capture.har', {
signal: expect.any(AbortSignal),
notFoundMessage: NOT_ENABLED_MESSAGE,
});
expect(await readFile(output, 'utf8')).toBe(data);
expect((await stat(output)).mode & 0o777).toBe(0o600);
expect(await readdir(directory)).toEqual(['capture.har']);
});
it('refuses an existing file before requesting the capture', async () => {
const output = path.join(directory, 'capture.har');
await writeFile(output, 'keep');
reply('new capture');
await expect(downloadNetworkCaptureAsync(preview, output)).rejects.toThrow('already exists');
expect(fetchSimulatorPreviewAsync).not.toHaveBeenCalled();
expect(await readFile(output, 'utf8')).toBe('keep');
});
it('does not overwrite a file created during the download', async () => {
const output = path.join(directory, 'capture.har');
jest.mocked(fetchSimulatorPreviewAsync).mockImplementation(async () => {
await writeFile(output, 'created concurrently');
return new Response(Readable.from(['new capture']));
});
await expect(downloadNetworkCaptureAsync(preview, output)).rejects.toThrow('already exists');
expect(await readFile(output, 'utf8')).toBe('created concurrently');
expect(await readdir(directory)).toEqual(['capture.har']);
});
it('keeps a file created during a download whose body fails before the file opens', async () => {
const output = path.join(directory, 'capture.har');
jest.mocked(fetchSimulatorPreviewAsync).mockImplementation(async () => {
await writeFile(output, 'created concurrently');
const body = new Readable({ read() {} });
body.destroy(new Error('secret remote URL'));
return new Response(body);
});
await expect(downloadNetworkCaptureAsync(preview, output)).rejects.toThrow();
expect(await readFile(output, 'utf8')).toBe('created concurrently');
});
it('refuses to write through a dangling symlink', async () => {
const output = path.join(directory, 'capture.har');
await symlink(path.join(directory, 'missing-target'), output);
reply('new capture');
await expect(downloadNetworkCaptureAsync(preview, output)).rejects.toThrow('already exists');
expect(await readdir(directory)).toEqual(['capture.har']);
});
it('explains a missing output directory', async () => {
reply('capture');
await expect(
downloadNetworkCaptureAsync(preview, path.join(directory, 'missing', 'capture.har'))
).rejects.toThrow('Check that the --output directory exists and is writable,');
expect(await readdir(directory)).toEqual([]);
});
it('retains useful request errors without creating a file', async () => {
jest
.mocked(fetchSimulatorPreviewAsync)
.mockRejectedValue(new Error('Start the session with --network-capture.'));
await expect(
downloadNetworkCaptureAsync(preview, path.join(directory, 'capture.har'))
).rejects.toThrow('--network-capture');
expect(await readdir(directory)).toEqual([]);
});
it('removes the partial file after a failed transfer', async () => {
reply(
Readable.from(
(async function* () {
yield 'partial';
throw new Error('secret remote URL');
})()
)
);
const error = downloadNetworkCaptureAsync(preview, path.join(directory, 'capture.har'));
await expect(error).rejects.toThrow('Could not save the download.');
await expect(error).rejects.not.toThrow('secret');
expect(await readdir(directory)).toEqual([]);
});
it('reports a download deadline', async () => {
const controller = rejectOnTimeout();
const pending = downloadNetworkCaptureAsync(preview, path.join(directory, 'capture.har'));
const rejected = expect(pending).rejects.toThrow('The download timed out.');
controller.abort();
await rejected;
expect(AbortSignal.timeout).toHaveBeenCalledWith(10 * 60_000);
expect(await readdir(directory)).toEqual([]);
});
});
@@ -65,18 +65,12 @@ describe('simulator start configuration', () => {
it('lets the CLI disable saved public links and network capture with its saved fields', async () => {
const { parsed } = await resolve(
{
'public-link': true,
'network-capture': true,
'network-capture-field': ['header'],
'network-capture-recording': true,
},
{ 'public-link': true, 'network-capture': true, 'network-capture-field': ['header'] },
['--no-public-link', '--no-network-capture']
);
expect(parsed.flags['public-link']).toBe(false);
expect(parsed.flags['network-capture']).toBe(false);
expect(parsed.flags['network-capture-field']).toBeUndefined();
expect(parsed.flags['network-capture-recording']).toBeUndefined();
});
it('validates dependencies after merging and replaces array flags instead of appending', async () => {
@@ -1,211 +0,0 @@
import readline from 'node:readline';
import { z } from 'zod';
import { downloadSimulatorFileAsync } from './download';
import {
type SimulatorPreview,
fetchSimulatorPreviewAsync,
streamSimulatorPreviewAsync,
} from './preview';
import { type Response } from '../fetch';
const NETWORK_CAPTURE_TIMEOUT_MS = 10 * 60_000;
const NETWORK_CAPTURE_NOT_ENABLED_MESSAGE =
'Network capture is not enabled for this session. Capture must be requested when the session starts. Start a new session with `eas simulator:start --network-capture`.';
const INVALID_NETWORK_CAPTURE_MESSAGE =
'Could not read the network capture. The capture data was incomplete or not in the expected format. Try again.';
const networkRequestSchema = z.looseObject({
_captureId: z.string().optional(),
_captureStartedAt: z.number().nullable().optional(),
startedDateTime: z.string().refine(value => Number.isFinite(Date.parse(value))),
time: z.number(),
request: z.looseObject({ method: z.string(), url: z.string(), bodySize: z.number() }),
response: z.looseObject({ status: z.number(), bodySize: z.number() }),
});
const networkCaptureEventSchema = z.union([
z.object({
type: z.literal('meta'),
initial: z.boolean().optional(),
meta: z.object({ attachment: z.string().optional() }),
}),
z.object({
type: z.literal('finished'),
request: z.object({
id: z.string(),
startedAt: z.number(),
method: z.string(),
url: z.string(),
status: z.number().nullable(),
durationMs: z.number().nullable(),
requestBytes: z.number(),
responseBytes: z.number(),
}),
}),
// Other events, such as `started` and `cleared`, have nothing to print.
z.object({ type: z.string().refine(type => type !== 'meta' && type !== 'finished') }),
]);
export type NetworkRequest = z.infer<typeof networkRequestSchema>;
export type NetworkRequestSummary = {
id: string | null;
startedAt: number | null;
startedDateTime: string;
method: string;
url: string;
status: number;
duration: number;
requestSize: number;
responseSize: number;
};
function parseJson(text: string): unknown {
try {
return JSON.parse(text);
} catch {
return undefined;
}
}
function compareRequestStarts(a: NetworkRequestSummary, b: NetworkRequestSummary): number {
return (
Date.parse(a.startedDateTime) - Date.parse(b.startedDateTime) ||
(a.startedAt ?? 0) - (b.startedAt ?? 0) ||
(a.id ?? '').localeCompare(b.id ?? '', undefined, { numeric: true })
);
}
export async function readNetworkRequestsAsync(
preview: SimulatorPreview,
{ limit, requestId }: { limit: number; requestId?: string }
): Promise<NetworkRequestSummary[] | NetworkRequest> {
const controller = new AbortController();
const signal = AbortSignal.any([
controller.signal,
AbortSignal.timeout(NETWORK_CAPTURE_TIMEOUT_MS),
]);
let response: Response | undefined;
let lines: readline.Interface | undefined;
const requests: NetworkRequestSummary[] = [];
let selected: NetworkRequest | undefined;
try {
response = await fetchSimulatorPreviewAsync(preview, '/network-capture.ndjson', {
signal,
notFoundMessage: NETWORK_CAPTURE_NOT_ENABLED_MESSAGE,
});
lines = readline.createInterface({ input: response.body, crlfDelay: Infinity });
for await (const line of lines) {
if (!line.trim()) {
continue;
}
const result = networkRequestSchema.safeParse(parseJson(line));
if (!result.success) {
throw new Error(INVALID_NETWORK_CAPTURE_MESSAGE);
}
const entry = result.data;
if (requestId) {
if (entry._captureId === requestId) {
selected = entry;
}
continue;
}
requests.push({
id: entry._captureId ?? null,
startedAt: entry._captureStartedAt ?? null,
startedDateTime: entry.startedDateTime,
method: entry.request.method,
url: entry.request.url,
status: entry.response.status,
duration: entry.time,
requestSize: entry.request.bodySize,
responseSize: entry.response.bodySize,
});
}
} catch (error) {
if (signal.aborted) {
throw new Error(
'The network capture request timed out. The capture did not download within 10 minutes. Run `eas simulator:get` to check that the session is still running, then try again.'
);
}
if (!response) {
throw error;
}
throw new Error(INVALID_NETWORK_CAPTURE_MESSAGE);
} finally {
lines?.close();
response?.body.once('error', () => {});
controller.abort();
}
if (!requestId) {
return requests.sort(compareRequestStarts).slice(-limit);
}
if (!selected) {
throw new Error(
'The request was not found in the network capture. The ID does not match a completed request in the current capture. Run `eas simulator:network-requests` to see current request IDs.'
);
}
return selected;
}
export async function streamNetworkRequestsAsync(
preview: SimulatorPreview,
onRequest: (request: NetworkRequestSummary) => void,
signal: AbortSignal
): Promise<void> {
await streamSimulatorPreviewAsync(
preview,
'/network-capture',
data => {
const result = networkCaptureEventSchema.safeParse(parseJson(data));
if (!result.success) {
throw new Error(
'Could not read the network capture stream. An event from the session was not in the expected format. Run the command again.'
);
}
const event = result.data;
if ('meta' in event) {
if (event.meta.attachment === 'not-enabled') {
throw new Error(
event.initial
? NETWORK_CAPTURE_NOT_ENABLED_MESSAGE
: 'Network capture was turned off, so the session no longer records requests. Start a new session with `eas simulator:start --network-capture` to capture again.'
);
}
if (event.meta.attachment === 'failed') {
throw new Error(
'The network capture failed. The session reported a capture error. Open the session preview to see the error, or start a new session with `eas simulator:start --network-capture`.'
);
}
} else if ('request' in event) {
const { request } = event;
onRequest({
id: request.id,
startedAt: request.startedAt,
startedDateTime: new Date(request.startedAt).toISOString(),
method: request.method,
url: request.url,
status: request.status ?? 0,
duration: Math.max(0, request.durationMs ?? 0),
requestSize: request.requestBytes,
responseSize: request.responseBytes,
});
}
},
{ signal, notFoundMessage: NETWORK_CAPTURE_NOT_ENABLED_MESSAGE }
);
}
export async function downloadNetworkCaptureAsync(
preview: SimulatorPreview,
output: string
): Promise<string> {
return await downloadSimulatorFileAsync(
output,
async signal =>
await fetchSimulatorPreviewAsync(preview, '/network-capture.har', {
signal,
notFoundMessage: NETWORK_CAPTURE_NOT_ENABLED_MESSAGE,
})
);
}
@@ -58,12 +58,12 @@ export async function resolveStartConfigAsync(
if (removed.has('expo-go') && !explicitNames.has('sdk-version')) {
delete values['sdk-version'];
}
if (explicitNames.has('network-capture') && values['network-capture'] === false) {
for (const name of ['network-capture-field', 'network-capture-recording']) {
if (!explicitNames.has(name)) {
delete values[name];
}
}
if (
explicitNames.has('network-capture') &&
values['network-capture'] === false &&
!explicitNames.has('network-capture-field')
) {
delete values['network-capture-field'];
}
const effectiveArgv: string[] = [];
for (const [name, value] of Object.entries(values)) {
+8
View File
@@ -6,6 +6,7 @@ import {
AppPlatform,
DeviceRunSessionByIdQuery,
DeviceRunSessionResourceClass,
DeviceRunSessionStatus,
DeviceRunSessionType,
} from '../graphql/generated';
import { link } from '../log';
@@ -21,6 +22,13 @@ import {
type DeviceRunSessionByIdResult = DeviceRunSessionByIdQuery['deviceRunSessions']['byId'];
export type DeviceRunSessionRemoteConfig = NonNullable<DeviceRunSessionByIdResult['remoteConfig']>;
export function isSimulatorStopConfirmed(
session: Pick<DeviceRunSessionByIdResult, 'id' | 'status'>,
requestedId: string
): boolean {
return session.id === requestedId && session.status === DeviceRunSessionStatus.Stopped;
}
/**
* Message shown when EAS Simulator is not enabled for the account. Shared by every
* command that can hit the gate so users always get the same upgrade pointer. The gate
+4
View File
@@ -1,5 +1,9 @@
# @expo/eas-json
## 27.11.0
No changes in this release.
## 27.10.0
No changes in this release.
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@expo/eas-json",
"version": "27.10.0",
"version": "27.11.0",
"description": "A library for interacting with eas.json",
"homepage": "https://github.com/expo/eas-cli",
"bugs": "https://github.com/expo/eas-cli/issues",
@@ -32,7 +32,7 @@
},
"dependencies": {
"@babel/code-frame": "7.23.5",
"@expo/eas-build-job": "27.10.0",
"@expo/eas-build-job": "27.11.0",
"chalk": "4.1.2",
"env-string": "1.0.1",
"fs-extra": "11.2.0",
+4
View File
@@ -1,5 +1,9 @@
# eas-cli-local-build-plugin
## 27.11.0
No changes in this release.
## 27.10.0
No changes in this release.
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "eas-cli-local-build-plugin",
"version": "27.10.0",
"version": "27.11.0",
"description": "Tool for running EAS compatible builds on a local machine.",
"bugs": "https://github.com/expo/eas-cli/issues",
"license": "BUSL-1.1",
@@ -26,12 +26,12 @@
"clean": "rimraf node_modules dist coverage \"*.tsbuildinfo\""
},
"dependencies": {
"@expo/build-tools": "27.10.0",
"@expo/build-tools": "27.11.0",
"@expo/bunyan": "^4.0.1",
"@expo/eas-build-job": "27.10.0",
"@expo/logger": "27.10.0",
"@expo/eas-build-job": "27.11.0",
"@expo/logger": "27.11.0",
"@expo/spawn-async": "^1.7.2",
"@expo/turtle-spawn": "27.10.0",
"@expo/turtle-spawn": "27.11.0",
"chalk": "4.1.2",
"env-paths": "^2.2.1",
"fs-extra": "^11.2.0",
+4
View File
@@ -1,5 +1,9 @@
# @expo/logger
## 27.11.0
No changes in this release.
## 27.10.0
No changes in this release.
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff. Show more