mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-24 06:06:09 -10:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d5a984d1b | ||
|
|
07f0ff7596 | ||
|
|
d16d5695d7 | ||
|
|
73a3d3e434 | ||
|
|
31885bdbc6 | ||
|
|
87cab80c8f |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@expo/build-tools': minor
|
||||
---
|
||||
|
||||
Connect the agent of `eas/run_agent` to the HTTP MCP servers in its `mcp_servers` input, and stop the run when one of them does not connect.
|
||||
@@ -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.
|
||||
@@ -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`.
|
||||
@@ -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.
|
||||
@@ -32,6 +32,7 @@ const inputs = {
|
||||
agent_run_id: { value: '0199b0a0-1111-7222-8333-444455556666' },
|
||||
max_duration_seconds: { value: 1800 },
|
||||
prompt: { value: 'Fix the failing test.' },
|
||||
mcp_servers: { value: undefined },
|
||||
};
|
||||
const env = {
|
||||
PATH: '/usr/local/bin:/usr/bin',
|
||||
@@ -109,6 +110,7 @@ describe(createRunAgentBuildFunction, () => {
|
||||
'CLAUDE_CODE_OAUTH_TOKEN',
|
||||
'HOME',
|
||||
'LANG',
|
||||
'MCP_CONNECTION_NONBLOCKING',
|
||||
'PATH',
|
||||
'TMPDIR',
|
||||
]);
|
||||
@@ -129,6 +131,36 @@ describe(createRunAgentBuildFunction, () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('hands the user MCP servers to the agent run, with no headers when none are given', async () => {
|
||||
const runAgentSpy = jest.spyOn(agentRun, 'runAgentAsync').mockResolvedValue();
|
||||
try {
|
||||
await runAsync({
|
||||
inputs: {
|
||||
...inputs,
|
||||
mcp_servers: {
|
||||
value: {
|
||||
linear: {
|
||||
url: 'https://mcp.linear.test/mcp',
|
||||
headers: { Authorization: 'Bearer linear-token' },
|
||||
},
|
||||
'my-docs': { url: 'https://docs.example.test/mcp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(runAgentSpy.mock.calls[0][0].userMcpServers).toEqual({
|
||||
linear: {
|
||||
url: 'https://mcp.linear.test/mcp',
|
||||
headers: { Authorization: 'Bearer linear-token' },
|
||||
},
|
||||
'my-docs': { url: 'https://docs.example.test/mcp', headers: {} },
|
||||
});
|
||||
} finally {
|
||||
runAgentSpy.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
['wss://staging-mcp.expo.test', 'https://staging-mcp.expo.test/mcp'],
|
||||
['ws://localhost:8787', 'http://localhost:8787/mcp'],
|
||||
@@ -172,6 +204,14 @@ describe(createRunAgentBuildFunction, () => {
|
||||
['a negative duration', { inputs: { ...inputs, max_duration_seconds: { value: -300 } } }],
|
||||
['a fractional duration', { inputs: { ...inputs, max_duration_seconds: { value: 12.5 } } }],
|
||||
['an empty prompt', { inputs: { ...inputs, prompt: { value: '' } } }],
|
||||
[
|
||||
'an MCP server named like the Expo one',
|
||||
{ inputs: { ...inputs, mcp_servers: { value: { expo: { url: 'https://a.test/mcp' } } } } },
|
||||
],
|
||||
[
|
||||
'an MCP server name with an underscore',
|
||||
{ inputs: { ...inputs, mcp_servers: { value: { my_docs: { url: 'https://a.test/mcp' } } } } },
|
||||
],
|
||||
['no EXPO_TOKEN', { env: { ...env, EXPO_TOKEN: '' } }],
|
||||
['no PATH', { env: { ...env, PATH: '' } }],
|
||||
['no Expo API URL', { ctx: { ...ctx, expoApiV2BaseUrl: undefined } }],
|
||||
@@ -199,4 +239,32 @@ describe(createRunAgentBuildFunction, () => {
|
||||
'The "max_duration_seconds" input must be a positive whole number of seconds, but received "0".'
|
||||
);
|
||||
});
|
||||
|
||||
it('names the server and the field of each invalid MCP server', async () => {
|
||||
await expect(
|
||||
runAsync({
|
||||
inputs: {
|
||||
...inputs,
|
||||
mcp_servers: {
|
||||
value: {
|
||||
expo: { url: 'https://a.test/mcp' },
|
||||
my_docs: { url: 'https://a.test/mcp' },
|
||||
linear: { url: 'not a url' },
|
||||
jira: { url: 'https://a.test/mcp', headers: { 'X-N': 1, 'X-M': 2 } },
|
||||
notion: { url: 'https://a.test/mcp', headers: 'Bearer token' },
|
||||
sentry: 'https://a.test/mcp',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
).rejects.toThrow(
|
||||
'The "mcp_servers" input must not have a server named "expo", because the Expo MCP server uses that name. ' +
|
||||
'The "mcp_servers" input has a server named "my_docs", but server names may contain only letters, digits and hyphens. ' +
|
||||
'The "url" of the MCP server "linear" must be a URL. ' +
|
||||
'The header "X-N" of the MCP server "jira" must be a string. ' +
|
||||
'The header "X-M" of the MCP server "jira" must be a string. ' +
|
||||
'The "headers" of the MCP server "notion" must be an object that maps header names to values. ' +
|
||||
'The MCP server "sentry" must be an object with a "url" and optional "headers".'
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,7 @@ import { z } from 'zod';
|
||||
|
||||
import { CustomBuildContext } from '../../customBuildContext';
|
||||
import { AGENT_KINDS, runAgentAsync } from '../utils/agentRun';
|
||||
import { MCP_SERVER_NAME } from '../utils/agents/agent';
|
||||
|
||||
export function createRunAgentBuildFunction(ctx: CustomBuildContext): BuildFunction {
|
||||
return new BuildFunction({
|
||||
@@ -38,6 +39,11 @@ export function createRunAgentBuildFunction(ctx: CustomBuildContext): BuildFunct
|
||||
required: true,
|
||||
allowedValueTypeName: BuildStepInputValueTypeName.STRING,
|
||||
}),
|
||||
BuildStepInput.createProvider({
|
||||
id: 'mcp_servers',
|
||||
required: false,
|
||||
allowedValueTypeName: BuildStepInputValueTypeName.JSON,
|
||||
}),
|
||||
],
|
||||
fn: async (stepCtx, { inputs, env, signal }) => {
|
||||
const inputErrors = {
|
||||
@@ -45,7 +51,24 @@ export function createRunAgentBuildFunction(ctx: CustomBuildContext): BuildFunct
|
||||
agentRunId: `The "agent_run_id" input must be the UUID of an agent run, but received "${String(inputs.agent_run_id.value)}".`,
|
||||
maxDurationSeconds: `The "max_duration_seconds" input must be a positive whole number of seconds, but received "${String(inputs.max_duration_seconds.value)}".`,
|
||||
prompt: 'The "prompt" input must be a non-empty string.',
|
||||
mcpServers: {
|
||||
servers: 'The "mcp_servers" input must be an object that maps server names to servers.',
|
||||
name: (name: string) =>
|
||||
`The "mcp_servers" input has a server named "${name}", but server names may contain only letters, digits and hyphens.`,
|
||||
reservedName: `The "mcp_servers" input must not have a server named "${MCP_SERVER_NAME}", because the Expo MCP server uses that name.`,
|
||||
server: (name: string) =>
|
||||
`The MCP server "${name}" must be an object with a "url" and optional "headers".`,
|
||||
url: (name: string) => `The "url" of the MCP server "${name}" must be a URL.`,
|
||||
headers: (name: string) =>
|
||||
`The "headers" of the MCP server "${name}" must be an object that maps header names to values.`,
|
||||
header: (name: string, headerName: string) =>
|
||||
`The header "${headerName}" of the MCP server "${name}" must be a string.`,
|
||||
},
|
||||
};
|
||||
const mcpServerNameAt = (issuePath: PropertyKey[] | undefined): string =>
|
||||
String(issuePath?.[1]);
|
||||
const mcpServerHeaderNameAt = (issuePath: PropertyKey[] | undefined): string =>
|
||||
String(issuePath?.[3]);
|
||||
const parsedInputs = z
|
||||
.object({
|
||||
agent_kind: z.enum(AGENT_KINDS, { error: inputErrors.agentKind }),
|
||||
@@ -55,12 +78,55 @@ export function createRunAgentBuildFunction(ctx: CustomBuildContext): BuildFunct
|
||||
.int({ error: inputErrors.maxDurationSeconds })
|
||||
.positive({ error: inputErrors.maxDurationSeconds }),
|
||||
prompt: z.string({ error: inputErrors.prompt }).min(1, { error: inputErrors.prompt }),
|
||||
mcp_servers: z
|
||||
.record(
|
||||
z
|
||||
.string()
|
||||
.regex(/^[a-zA-Z0-9-]+$/)
|
||||
.refine(name => name !== MCP_SERVER_NAME),
|
||||
z.object(
|
||||
{
|
||||
url: z.url({
|
||||
error: ({ path }) => inputErrors.mcpServers.url(mcpServerNameAt(path)),
|
||||
}),
|
||||
headers: z
|
||||
.record(
|
||||
z.string(),
|
||||
z.string({
|
||||
error: ({ path }) =>
|
||||
inputErrors.mcpServers.header(
|
||||
mcpServerNameAt(path),
|
||||
mcpServerHeaderNameAt(path)
|
||||
),
|
||||
}),
|
||||
{
|
||||
error: ({ path }) => inputErrors.mcpServers.headers(mcpServerNameAt(path)),
|
||||
}
|
||||
)
|
||||
.default({}),
|
||||
},
|
||||
{ error: ({ path }) => inputErrors.mcpServers.server(mcpServerNameAt(path)) }
|
||||
),
|
||||
{
|
||||
error: issue => {
|
||||
if (issue.code !== 'invalid_key') {
|
||||
return inputErrors.mcpServers.servers;
|
||||
}
|
||||
const name = mcpServerNameAt(issue.path);
|
||||
return name === MCP_SERVER_NAME
|
||||
? inputErrors.mcpServers.reservedName
|
||||
: inputErrors.mcpServers.name(name);
|
||||
},
|
||||
}
|
||||
)
|
||||
.default({}),
|
||||
})
|
||||
.safeParse({
|
||||
agent_kind: inputs.agent_kind.value,
|
||||
agent_run_id: inputs.agent_run_id.value,
|
||||
max_duration_seconds: inputs.max_duration_seconds.value,
|
||||
prompt: inputs.prompt.value,
|
||||
mcp_servers: inputs.mcp_servers.value,
|
||||
});
|
||||
if (!parsedInputs.success) {
|
||||
throw createValidationError(parsedInputs.error);
|
||||
@@ -70,6 +136,7 @@ export function createRunAgentBuildFunction(ctx: CustomBuildContext): BuildFunct
|
||||
agent_run_id: agentRunId,
|
||||
max_duration_seconds: maxDurationSeconds,
|
||||
prompt,
|
||||
mcp_servers: userMcpServers,
|
||||
} = parsedInputs.data;
|
||||
const parsedEnv = z
|
||||
.object({
|
||||
@@ -120,6 +187,7 @@ export function createRunAgentBuildFunction(ctx: CustomBuildContext): BuildFunct
|
||||
expoToken,
|
||||
expoApiV2BaseUrl: ctx.expoApiV2BaseUrl,
|
||||
mcpUrl: mcpUrl.toString(),
|
||||
userMcpServers,
|
||||
pathEnv,
|
||||
npmCacheUrl,
|
||||
logger: stepCtx.logger,
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -137,6 +137,7 @@ function createOptions(
|
||||
expoToken: 'expo-token',
|
||||
expoApiV2BaseUrl: 'https://staging-api.expo.test/v2/',
|
||||
mcpUrl: 'https://staging-mcp.expo.test/mcp',
|
||||
userMcpServers: {},
|
||||
pathEnv: '/usr/local/bin:/usr/bin',
|
||||
npmCacheUrl: 'https://npm-cache.expo.test',
|
||||
logger: createMockLogger(),
|
||||
@@ -217,11 +218,91 @@ describe(runAgentAsync, () => {
|
||||
LANG: 'C.UTF-8',
|
||||
CLAUDE_CODE_OAUTH_TOKEN: 'anthropic-access-token',
|
||||
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',
|
||||
MCP_CONNECTION_NONBLOCKING: '0',
|
||||
});
|
||||
expect(agent.cwd).toBe(path.join(runDirectory, 'cwd'));
|
||||
expect(agent.stdin).toHaveBeenCalledWith('Fix the failing test.');
|
||||
});
|
||||
|
||||
it('gives Claude Code the user MCP servers next to the Expo one and allows their tools', async () => {
|
||||
leaseMock.mockResolvedValue(anthropicLease);
|
||||
const invocations = mockSpawn({
|
||||
onAgent: agent => {
|
||||
expect(JSON.parse(agent.readHomeFile('mcp.json').content).mcpServers).toEqual({
|
||||
expo: expect.objectContaining({ type: 'http', url: 'https://staging-mcp.expo.test/mcp' }),
|
||||
linear: {
|
||||
type: 'http',
|
||||
url: 'https://mcp.linear.test/mcp',
|
||||
headers: { Authorization: 'Bearer linear-token' },
|
||||
},
|
||||
docs: { type: 'http', url: 'https://docs.example.test/mcp', headers: {} },
|
||||
});
|
||||
agent.exit(0);
|
||||
},
|
||||
});
|
||||
|
||||
await runAgentAsync(
|
||||
createOptions({
|
||||
userMcpServers: {
|
||||
linear: {
|
||||
url: 'https://mcp.linear.test/mcp',
|
||||
headers: { Authorization: 'Bearer linear-token' },
|
||||
},
|
||||
docs: { url: 'https://docs.example.test/mcp', headers: {} },
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
const { args } = invocations[0];
|
||||
expect(args.slice(args.indexOf('--allowedTools'), args.indexOf('--mcp-config'))).toEqual([
|
||||
'--allowedTools',
|
||||
'mcp__expo',
|
||||
'mcp__linear',
|
||||
'mcp__docs',
|
||||
]);
|
||||
});
|
||||
|
||||
it('stops Claude Code before the task when a user MCP server did not connect, whatever the Expo one did', async () => {
|
||||
leaseMock.mockResolvedValue(anthropicLease);
|
||||
const invocations = mockSpawn({
|
||||
onAgent: agent => {
|
||||
killProcessGroupMock.mockImplementationOnce((_child, signal) =>
|
||||
agent.exit(null, signal as NodeJS.Signals)
|
||||
);
|
||||
agent.child.stdout.write(
|
||||
`${JSON.stringify({
|
||||
type: 'system',
|
||||
subtype: 'init',
|
||||
mcp_servers: [
|
||||
{ name: 'expo', status: 'failed' },
|
||||
{ name: 'linear', status: 'connected' },
|
||||
{ name: 'jira', status: 'needs-auth' },
|
||||
],
|
||||
})}\n`
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
runAgentAsync(
|
||||
createOptions({
|
||||
userMcpServers: {
|
||||
linear: { url: 'https://mcp.linear.test/mcp', headers: {} },
|
||||
jira: { url: 'https://mcp.jira.test/mcp', headers: {} },
|
||||
docs: { url: 'https://docs.example.test/mcp', headers: {} },
|
||||
},
|
||||
})
|
||||
)
|
||||
).rejects.toMatchObject({
|
||||
errorCode: 'EAS_RUN_AGENT_MCP_SERVER_NOT_CONNECTED',
|
||||
message: expect.stringContaining(': jira (needs-auth), docs (not started).'),
|
||||
});
|
||||
|
||||
expect(killProcessGroupMock.mock.calls[0]).toEqual([invocations[0].child, 'SIGTERM']);
|
||||
expect(invocations).toHaveLength(1);
|
||||
expect(leaseMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('writes the agent output as log lines', async () => {
|
||||
leaseMock.mockResolvedValue(anthropicLease);
|
||||
const logger = createMockLogger();
|
||||
@@ -395,6 +476,48 @@ describe(runAgentAsync, () => {
|
||||
expect(agent.stdin).toHaveBeenCalledWith('Fix the failing test.');
|
||||
});
|
||||
|
||||
it('requires the user MCP servers of Codex but not the Expo one', async () => {
|
||||
leaseMock.mockResolvedValue(openaiLease);
|
||||
mockSpawn({
|
||||
onAgent: agent => {
|
||||
const config = agent.readHomeFile('.codex/config.toml').content;
|
||||
expect(config.slice(config.indexOf('[mcp_servers.'))).toBe(
|
||||
[
|
||||
'[mcp_servers.expo]',
|
||||
'url = "https://staging-mcp.expo.test/mcp"',
|
||||
'default_tools_approval_mode = "approve"',
|
||||
'',
|
||||
'[mcp_servers.expo.http_headers]',
|
||||
'"Authorization" = "Bearer expo-token"',
|
||||
`"X-Expo-Agent-Run-Id" = "${agentRunId}"`,
|
||||
'',
|
||||
'[mcp_servers.linear]',
|
||||
'url = "https://mcp.linear.test/mcp"',
|
||||
'default_tools_approval_mode = "approve"',
|
||||
'required = true',
|
||||
'',
|
||||
'[mcp_servers.linear.http_headers]',
|
||||
'"Authorization" = "Bearer \\"linear\\" token"',
|
||||
'',
|
||||
].join('\n')
|
||||
);
|
||||
agent.exit(0);
|
||||
},
|
||||
});
|
||||
|
||||
await runAgentAsync(
|
||||
createOptions({
|
||||
agentKind: 'codex',
|
||||
userMcpServers: {
|
||||
linear: {
|
||||
url: 'https://mcp.linear.test/mcp',
|
||||
headers: { Authorization: 'Bearer "linear" token' },
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('escalates to SIGKILL when the agent ignores the stop', async () => {
|
||||
jest.useFakeTimers({ doNotFake: ['nextTick', 'setImmediate', 'queueMicrotask'] });
|
||||
leaseMock.mockResolvedValue(anthropicLease);
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
+4
-1
@@ -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 }));
|
||||
}
|
||||
|
||||
+4
@@ -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 {
|
||||
|
||||
@@ -8,7 +8,12 @@ import path from 'node:path';
|
||||
import readline from 'node:readline';
|
||||
|
||||
import { leaseAgentRunProviderCredentialsAsync } from './agentRunLease';
|
||||
import { type AgentCli, type AgentInvocation, type AgentLogMessage } from './agents/agent';
|
||||
import {
|
||||
type AgentCli,
|
||||
type AgentInvocation,
|
||||
type AgentLogMessage,
|
||||
type McpServer,
|
||||
} from './agents/agent';
|
||||
import { CLAUDE_CODE_CLI, prepareClaudeCodeAsync } from './agents/claude';
|
||||
import { CODEX_CLI, prepareCodexAsync } from './agents/codex';
|
||||
import { Sentry } from '../../sentry';
|
||||
@@ -32,6 +37,7 @@ export async function runAgentAsync({
|
||||
expoToken,
|
||||
expoApiV2BaseUrl,
|
||||
mcpUrl,
|
||||
userMcpServers,
|
||||
pathEnv,
|
||||
npmCacheUrl,
|
||||
logger,
|
||||
@@ -45,6 +51,7 @@ export async function runAgentAsync({
|
||||
expoApiV2BaseUrl: string;
|
||||
/** The Expo MCP server's streamable HTTP endpoint. */
|
||||
mcpUrl: string;
|
||||
userMcpServers: Record<string, McpServer>;
|
||||
pathEnv: string;
|
||||
npmCacheUrl?: string;
|
||||
logger: bunyan;
|
||||
@@ -105,6 +112,7 @@ export async function runAgentAsync({
|
||||
homeDirectory,
|
||||
minimalEnv,
|
||||
mcpServer,
|
||||
userMcpServers,
|
||||
prompt,
|
||||
credentials,
|
||||
isResuming,
|
||||
@@ -115,6 +123,7 @@ export async function runAgentAsync({
|
||||
homeDirectory,
|
||||
minimalEnv,
|
||||
mcpServer,
|
||||
userMcpServers,
|
||||
prompt,
|
||||
credentials,
|
||||
isResuming,
|
||||
@@ -165,6 +174,7 @@ async function runAgentProcessAsync({
|
||||
env,
|
||||
cwd,
|
||||
stdin,
|
||||
findFatalError,
|
||||
formatOutputLine,
|
||||
logger,
|
||||
signal,
|
||||
@@ -174,6 +184,7 @@ async function runAgentProcessAsync({
|
||||
env: Record<string, string>;
|
||||
cwd: string;
|
||||
stdin: string;
|
||||
findFatalError?: AgentInvocation['findFatalError'];
|
||||
formatOutputLine: AgentCli['formatOutputLine'];
|
||||
logger: bunyan;
|
||||
signal: AbortSignal;
|
||||
@@ -182,11 +193,22 @@ async function runAgentProcessAsync({
|
||||
// Detached, so the agent leads a process group that can be signaled as a whole.
|
||||
const child = spawn(command, args, { cwd, env, detached: true });
|
||||
const outputClosed = new Promise<void>(resolve => child.once('close', () => resolve()));
|
||||
let killTimer: NodeJS.Timeout | undefined;
|
||||
const stop = (): void => {
|
||||
if (killTimer) {
|
||||
return;
|
||||
}
|
||||
killProcessGroup(child, 'SIGTERM');
|
||||
killTimer = setTimeout(() => killProcessGroup(child, 'SIGKILL'), KILL_GRACE_PERIOD_MS);
|
||||
};
|
||||
let fatalError: Error | undefined;
|
||||
const stdoutLogger = logger.child({ source: 'stdout' });
|
||||
readline.createInterface({ input: child.stdout }).on('line', line => {
|
||||
let messages: AgentLogMessage[];
|
||||
let lineFatalError: Error | undefined;
|
||||
try {
|
||||
messages = formatOutputLine(line);
|
||||
lineFatalError = findFatalError?.(line);
|
||||
} catch (error) {
|
||||
// An exception in a readline listener is uncaught and would end the worker process.
|
||||
Sentry.capture('Could not format a line of the agent output', error as Error);
|
||||
@@ -195,6 +217,10 @@ async function runAgentProcessAsync({
|
||||
for (const { level, message } of messages) {
|
||||
stdoutLogger[level](message.trimEnd());
|
||||
}
|
||||
if (lineFatalError && !fatalError) {
|
||||
fatalError = lineFatalError;
|
||||
stop();
|
||||
}
|
||||
});
|
||||
const stderrLogger = logger.child({ source: 'stderr' });
|
||||
readline.createInterface({ input: child.stderr }).on('line', line => {
|
||||
@@ -204,14 +230,6 @@ async function runAgentProcessAsync({
|
||||
child.stdin.on('error', () => {});
|
||||
child.stdin.end(stdin);
|
||||
|
||||
let killTimer: NodeJS.Timeout | undefined;
|
||||
const stop = (): void => {
|
||||
if (killTimer) {
|
||||
return;
|
||||
}
|
||||
killProcessGroup(child, 'SIGTERM');
|
||||
killTimer = setTimeout(() => killProcessGroup(child, 'SIGKILL'), KILL_GRACE_PERIOD_MS);
|
||||
};
|
||||
signal.addEventListener('abort', stop);
|
||||
let exitCode: number | null;
|
||||
let exitSignal: NodeJS.Signals | null;
|
||||
@@ -241,5 +259,8 @@ async function runAgentProcessAsync({
|
||||
clearTimeout(outputGraceTimer);
|
||||
|
||||
signal.throwIfAborted();
|
||||
if (fatalError) {
|
||||
throw fatalError;
|
||||
}
|
||||
return { exitCode, exitSignal };
|
||||
}
|
||||
@@ -15,6 +15,7 @@ export interface AgentInvocation {
|
||||
env: Record<string, string>;
|
||||
stdin: string;
|
||||
secrets: string[];
|
||||
findFatalError?(outputLine: string): Error | undefined;
|
||||
}
|
||||
|
||||
export interface AgentLogMessage {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { UserError } from '@expo/eas-build-job';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { z } from 'zod';
|
||||
@@ -28,6 +29,7 @@ export async function prepareClaudeCodeAsync({
|
||||
homeDirectory,
|
||||
minimalEnv,
|
||||
mcpServer,
|
||||
userMcpServers,
|
||||
prompt,
|
||||
credentials,
|
||||
isResuming,
|
||||
@@ -35,6 +37,7 @@ export async function prepareClaudeCodeAsync({
|
||||
homeDirectory: string;
|
||||
minimalEnv: Record<string, string>;
|
||||
mcpServer: McpServer;
|
||||
userMcpServers: Record<string, McpServer>;
|
||||
prompt: string;
|
||||
credentials: AgentRunProviderCredentials;
|
||||
isResuming: boolean;
|
||||
@@ -42,10 +45,15 @@ export async function prepareClaudeCodeAsync({
|
||||
if (credentials.provider !== 'anthropic') {
|
||||
throw createProviderMismatchError('Claude Code', credentials);
|
||||
}
|
||||
const mcpServers = { [MCP_SERVER_NAME]: mcpServer, ...userMcpServers };
|
||||
const mcpConfigPath = path.join(homeDirectory, 'mcp.json');
|
||||
await fs.writeFile(
|
||||
mcpConfigPath,
|
||||
JSON.stringify({ mcpServers: { [MCP_SERVER_NAME]: { type: 'http', ...mcpServer } } }),
|
||||
JSON.stringify({
|
||||
mcpServers: Object.fromEntries(
|
||||
Object.entries(mcpServers).map(([name, server]) => [name, { type: 'http', ...server }])
|
||||
),
|
||||
}),
|
||||
{ mode: 0o600 }
|
||||
);
|
||||
return {
|
||||
@@ -54,21 +62,45 @@ export async function prepareClaudeCodeAsync({
|
||||
...(isResuming ? ['--continue'] : []),
|
||||
// Print mode requires `--verbose` for `stream-json`.
|
||||
...['--output-format', 'stream-json', '--verbose'],
|
||||
// No built-in tools. Print mode denies any tool without an allow rule, so the MCP server
|
||||
// No built-in tools. Print mode denies any tool without an allow rule, so each MCP server
|
||||
// gets one.
|
||||
...['--tools', '', '--allowedTools', `mcp__${MCP_SERVER_NAME}`],
|
||||
...['--tools', '', '--allowedTools', ...Object.keys(mcpServers).map(name => `mcp__${name}`)],
|
||||
...['--mcp-config', mcpConfigPath, '--strict-mcp-config'],
|
||||
],
|
||||
env: {
|
||||
...minimalEnv,
|
||||
CLAUDE_CODE_OAUTH_TOKEN: credentials.accessToken,
|
||||
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',
|
||||
MCP_CONNECTION_NONBLOCKING: '0',
|
||||
},
|
||||
stdin: isResuming ? createContinuationPrompt(prompt) : prompt,
|
||||
secrets: [credentials.accessToken],
|
||||
findFatalError: outputLine =>
|
||||
findUnconnectedMcpServersError(outputLine, Object.keys(userMcpServers)),
|
||||
};
|
||||
}
|
||||
|
||||
function findUnconnectedMcpServersError(
|
||||
outputLine: string,
|
||||
requiredServerNames: string[]
|
||||
): UserError | undefined {
|
||||
const event = ClaudeCodeEventSchema.safeParse(parseJsonLine(outputLine));
|
||||
if (!event.success || event.data.type !== 'system') {
|
||||
return undefined;
|
||||
}
|
||||
const statusByName = new Map(event.data.mcp_servers.map(server => [server.name, server.status]));
|
||||
const unconnectedServers = requiredServerNames
|
||||
.filter(name => statusByName.get(name) !== 'connected')
|
||||
.map(name => `${name} (${statusByName.get(name) ?? 'not started'})`);
|
||||
if (unconnectedServers.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return new UserError(
|
||||
'EAS_RUN_AGENT_MCP_SERVER_NOT_CONNECTED',
|
||||
`The agent could not connect to these MCP servers from "mcp_servers": ${unconnectedServers.join(', ')}. It was stopped before it started the task. Check that each server's URL is reachable from EAS and that its headers authenticate the request, then start the agent run again.`
|
||||
);
|
||||
}
|
||||
|
||||
const AssistantBlockSchema = z.discriminatedUnion('type', [
|
||||
z.object({ type: z.literal('text'), text: z.string() }),
|
||||
z.object({
|
||||
|
||||
@@ -27,6 +27,7 @@ export async function prepareCodexAsync({
|
||||
homeDirectory,
|
||||
minimalEnv,
|
||||
mcpServer,
|
||||
userMcpServers,
|
||||
prompt,
|
||||
credentials,
|
||||
isResuming,
|
||||
@@ -34,6 +35,7 @@ export async function prepareCodexAsync({
|
||||
homeDirectory: string;
|
||||
minimalEnv: Record<string, string>;
|
||||
mcpServer: McpServer;
|
||||
userMcpServers: Record<string, McpServer>;
|
||||
prompt: string;
|
||||
credentials: AgentRunProviderCredentials;
|
||||
isResuming: boolean;
|
||||
@@ -67,17 +69,10 @@ export async function prepareCodexAsync({
|
||||
'[analytics]',
|
||||
'enabled = false',
|
||||
'',
|
||||
`[mcp_servers.${MCP_SERVER_NAME}]`,
|
||||
// JSON strings are valid TOML basic strings.
|
||||
`url = ${JSON.stringify(mcpServer.url)}`,
|
||||
// `approval_policy` would otherwise refuse the server's tools that are not read-only.
|
||||
'default_tools_approval_mode = "approve"',
|
||||
'',
|
||||
`[mcp_servers.${MCP_SERVER_NAME}.http_headers]`,
|
||||
...Object.entries(mcpServer.headers).map(
|
||||
([name, value]) => `${JSON.stringify(name)} = ${JSON.stringify(value)}`
|
||||
...createMcpServerConfigLines(MCP_SERVER_NAME, mcpServer, { isRequired: false }),
|
||||
...Object.entries(userMcpServers).flatMap(([name, server]) =>
|
||||
createMcpServerConfigLines(name, server, { isRequired: true })
|
||||
),
|
||||
'',
|
||||
].join('\n'),
|
||||
{ mode: 0o600 }
|
||||
);
|
||||
@@ -111,6 +106,27 @@ export async function prepareCodexAsync({
|
||||
};
|
||||
}
|
||||
|
||||
function createMcpServerConfigLines(
|
||||
name: string,
|
||||
server: McpServer,
|
||||
{ isRequired }: { isRequired: boolean }
|
||||
): string[] {
|
||||
return [
|
||||
`[mcp_servers.${name}]`,
|
||||
// JSON strings are valid TOML basic strings.
|
||||
`url = ${JSON.stringify(server.url)}`,
|
||||
// `approval_policy` would otherwise refuse the server's tools that are not read-only.
|
||||
'default_tools_approval_mode = "approve"',
|
||||
...(isRequired ? ['required = true'] : []),
|
||||
'',
|
||||
`[mcp_servers.${name}.http_headers]`,
|
||||
...Object.entries(server.headers).map(
|
||||
([headerName, value]) => `${JSON.stringify(headerName)} = ${JSON.stringify(value)}`
|
||||
),
|
||||
'',
|
||||
];
|
||||
}
|
||||
|
||||
const CodexItemSchema = z.discriminatedUnion('type', [
|
||||
z.object({ type: z.literal('agent_message'), text: z.string() }),
|
||||
z.object({
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 } : {}),
|
||||
|
||||
@@ -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,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<{
|
||||
|
||||
@@ -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,
|
||||
|
||||
+19
-19
@@ -15553,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 }
|
||||
@@ -15568,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 }
|
||||
@@ -15581,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 }
|
||||
@@ -15594,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 }
|
||||
@@ -15755,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 }
|
||||
@@ -16284,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 }
|
||||
@@ -16296,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 }
|
||||
@@ -16308,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 }
|
||||
@@ -16323,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 }
|
||||
@@ -16736,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 }
|
||||
@@ -16752,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 }
|
||||
@@ -16771,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'];
|
||||
@@ -16981,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 }
|
||||
@@ -17033,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 }
|
||||
@@ -17139,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 }
|
||||
@@ -17198,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 }
|
||||
@@ -17240,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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user