Skip to content

Commit 3fe2e69

Browse files
authored
refactor(apple): give snapshot and fold one native-build owner (#3018)
* refactor(apple): give snapshot and fold one native-build owner Move the shared native-build cache, toolchain identity, and build host out of snapshot-source into a domain-neutral packages/platform-apple/src /native-build module group, so the fold helper no longer imports the snapshot bridge's deadlines, errors, host construction, or host types to compile a binary that needs none of them. - native-build/{cache,deadline,host,toolchain-identity,errors}.ts carry the one cache implementation, one lock implementation, and one toolchain-identity read every runtime clang build in this package shares (#2796, #2712); NativeBuildHost exposes only file access, command execution, locking, and process identity, with no bridge socket start/connect and no target-process inspection. - NativeBuildError is domain-neutral (cancelled/timeout/unsupported); no shared build module imports SnapshotSourceError or emits bridge-specific error fields. snapshot-source/errors.ts and deadline.ts map it onto SnapshotSourceError at the boundary, and foldable/fold-helper-cache.ts maps it onto its own fold-helper-build-failed AppError, preserving both public error shapes byte for byte (see the moved and updated test suites). - fold-helper-cache.ts drops its whole-snapshot-host construction (building a full SnapshotSourceHost and overriding `run`) for createNativeBuildHost(runAppleToolCommand), the narrow host the compile actually needs. - snapshot-source/host.ts drops its own copy of the lock-acquisition implementation in favor of the shared one. - cache-identity.ts keeps only the bridge's simulatorRuntime addition; the toolchain retry/probe/cancellation logic it used to own moved to native-build/toolchain-identity.ts with its test coverage. Net production lines grow (+132 across the touched files, per `git diff --numstat -M`) because achieving actual decoupling needs a second, narrow error/deadline type and a translation boundary, not because anything was merely relocated: the whole-snapshot-host construction, the duplicate lock implementation, and the fold helper's dependency on the bridge's deadline/error/host types are all deleted, and NativeBuildHost's type now statically forbids a future build/cache change from reaching back into bridge-only capabilities. Live-validated on this Darwin host with the production code: a cache miss then a cache-key-stable cache hit for both the snapshot bridge (779ms build -> 127ms reuse) and the fold helper (2.9s build -> 2.2s reuse, dominated by the unchanged per-call toolchain probe) via ensureSnapshotBridgeBinary/ensureFoldHelperBinary directly. No Swift changes. * fix(apple): keep native-build cancellation typed as a canceled request Abort during fold-helper or toolchain-probe preparation lost reason: 'request_canceled' once native-build/cache errors stopped mapping onto SnapshotSourceError, so isRequestCanceledError no longer recognized a canceled fold or lock wait. NativeBuildError now stamps the same reason SnapshotSourceError already does; a lock wait with no abort signal now maps an expired deadline to a typed timeout instead of the raw lock error; and a mid-exec abort during a toolchain probe now maps through the module's cancelled contract instead of leaking the exec layer's raw cancellation. Also: fixes the cache-identity and toolchain-identity test title/ comment mismatches cubic flagged, relocates the shared exec-timeout test fixture out of snapshot-source so native-build's own tests stop depending on it, folds SnapshotSourceHost's file/exec/lock members into an intersection with NativeBuildHost instead of restating them, and extracts the toolchain-probe failure classification into its own function to keep runToolchainProbe under the complexity gate.
1 parent 798f839 commit 3fe2e69

18 files changed

Lines changed: 991 additions & 701 deletions

‎packages/platform-apple/src/foldable/fold-helper-cache.test.ts‎

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { readFile, rm, writeFile } from 'node:fs/promises';
33
import path from 'node:path';
44
import { beforeAll, describe, test } from 'vitest';
55
import { runCmd } from '@agent-device/host-kit/command';
6+
import { isRequestCanceledError } from '@agent-device/kernel/errors';
67
import { mkdtempForTest } from '../__tests__/tmp-dir.ts';
7-
import { execKillTimeoutError } from '../snapshot-source/__tests__/exec-timeout-fixture.ts';
8+
import { execKillTimeoutError } from '../native-build/__tests__/exec-timeout-fixture.ts';
89
import { createSnapshotSourceHost } from '../snapshot-source/host.ts';
910
import type { SnapshotSourceHost } from '../snapshot-source/types.ts';
1011
import {
@@ -156,6 +157,64 @@ test('a compile exec killed at its budget reports the fold-helper build, not the
156157
}
157158
});
158159

160+
test('an abort while a second caller waits on the fold-helper lock reports a canceled request', async () => {
161+
const root = await mkdtempForTest('agent-device-fold-helper-cache-lock-wait-');
162+
const sourceRoot = path.join(root, 'source');
163+
const cacheRoot = path.join(root, 'cache');
164+
await (await import('@agent-device/host-kit/host-file')).ensureHostDirectory(sourceRoot);
165+
await writeFile(path.join(sourceRoot, 'Fold.m'), 'fold source');
166+
167+
let releaseClang!: () => void;
168+
const clangGate = new Promise<void>((resolve) => {
169+
releaseClang = resolve;
170+
});
171+
let clangStarted!: () => void;
172+
const clangStartedSignal = new Promise<void>((resolve) => {
173+
clangStarted = resolve;
174+
});
175+
const host = fakeFoldHelperHost(() => 'binary');
176+
const holdingHost: SnapshotSourceHost = {
177+
...host,
178+
run: async (command, args, options) => {
179+
if (command === 'xcrun' && args.includes('clang')) {
180+
clangStarted();
181+
await clangGate;
182+
return await host.run(command, args, options);
183+
}
184+
return await host.run(command, args, options);
185+
},
186+
};
187+
188+
try {
189+
// The first call acquires the fold-helper lock and holds it in its build step (gated on
190+
// `clangGate`) until this test releases it, so the second call below is guaranteed to find
191+
// the lock already held rather than racing for it.
192+
const holder = ensureFoldHelperBinary({ host: holdingHost, sourceRoot, cacheRoot });
193+
await clangStartedSignal;
194+
195+
const controller = new AbortController();
196+
const waiter = ensureFoldHelperBinary({
197+
host,
198+
sourceRoot,
199+
cacheRoot,
200+
signal: controller.signal,
201+
});
202+
// Give the waiter time to reach the lock's poll loop before aborting it.
203+
await new Promise((resolve) => setTimeout(resolve, 50));
204+
controller.abort();
205+
206+
await assert.rejects(waiter, (error: unknown) => {
207+
assert.ok(isRequestCanceledError(error), 'expected a canceled-request error');
208+
return true;
209+
});
210+
211+
releaseClang();
212+
await holder;
213+
} finally {
214+
await rm(root, { recursive: true, force: true });
215+
}
216+
});
217+
159218
// #2796: the production compile drops -Werror so a stale toolchain warning cannot fail a build;
160219
// this is the gate that keeps a new Fold.m warning from passing CI unnoticed. It runs the
161220
// production argv (`buildFoldHelperCompileArgv`) against the real iphonesimulator SDK with

‎packages/platform-apple/src/foldable/fold-helper-cache.ts‎

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import path from 'node:path';
22
import { AppError } from '@agent-device/kernel/errors';
33
import { execFailureDetails } from '@agent-device/host-kit/command';
4+
import { hostHomeDirectory } from '@agent-device/host-kit/host-file';
5+
import { findProjectRoot } from '@agent-device/host-kit/version';
46
import { runAppleToolCommand } from '../core/tool-provider.ts';
57
import { COLD_TOOLCHAIN_PROBE_TIMEOUT_MS } from '../runner/apple-runner-platform.ts';
6-
import { readHostToolchainIdentity } from '../snapshot-source/cache-identity.ts';
7-
import {
8-
createSnapshotSourceDeadline,
9-
type SnapshotSourceDeadline,
10-
} from '../snapshot-source/deadline.ts';
11-
import { SnapshotSourceError } from '../snapshot-source/errors.ts';
12-
import { createSnapshotSourceHost } from '../snapshot-source/host.ts';
8+
import { createNativeBuildDeadline, type NativeBuildDeadline } from '../native-build/deadline.ts';
9+
import { NativeBuildError } from '../native-build/errors.ts';
10+
import { createNativeBuildHost, type NativeBuildHost } from '../native-build/host.ts';
11+
import { readHostToolchainIdentity } from '../native-build/toolchain-identity.ts';
1312
import {
1413
ensureNativeBuildCacheEntry,
1514
execNativeBuildClang,
1615
fingerprintNativeBuildSource,
17-
} from '../snapshot-source/native-build-cache.ts';
18-
import type { SnapshotSourceHost } from '../snapshot-source/types.ts';
16+
} from '../native-build/cache.ts';
1917

2018
const FOLD_HELPER_SOURCE_FILENAME = 'Fold.m';
2119
const FOLD_HELPER_BINARY_FILENAME = 'fold-helper';
@@ -33,9 +31,9 @@ const FOLD_HELPER_PREPARATION_DEADLINE_MS =
3331

3432
/**
3533
* The fold helper binary for the host's active toolchain, building and caching it if needed. Shares
36-
* the snapshot bridge's content+toolchain-keyed build cache (`native-build-cache.ts`), so a fold
34+
* the snapshot bridge's content+toolchain-keyed build cache (`native-build/cache.ts`), so a fold
3735
* call after the first serves a cached binary instead of recompiling `Fold.m`, and a `DEVELOPER_DIR`
38-
* switch busts the cache instead of serving a binary built against a different SDK (#2796).
36+
* switch busts the cache instead of serving a binary built against a different SDK (#2796, #2970).
3937
*
4038
* Build and cache failures surface as `AppError('COMMAND_FAILED', ..., {reason:
4139
* 'fold-helper-build-failed'})`, the error shape `sendSimulatorFoldPose` reported before this cache
@@ -44,15 +42,15 @@ const FOLD_HELPER_PREPARATION_DEADLINE_MS =
4442
export async function ensureFoldHelperBinary(
4543
input: Readonly<{
4644
signal?: AbortSignal;
47-
host?: SnapshotSourceHost;
45+
host?: NativeBuildHost;
4846
cacheRoot?: string;
4947
sourceRoot?: string;
5048
}> = {},
5149
): Promise<Readonly<{ path: string }>> {
5250
const host = input.host ?? createFoldHelperCacheHost();
53-
const deadline = createSnapshotSourceDeadline(FOLD_HELPER_PREPARATION_DEADLINE_MS, input.signal);
51+
const deadline = createNativeBuildDeadline(FOLD_HELPER_PREPARATION_DEADLINE_MS, input.signal);
5452
try {
55-
const sourceRoot = input.sourceRoot ?? path.join(host.projectRoot(), 'apple', 'fold-helper');
53+
const sourceRoot = input.sourceRoot ?? path.join(findProjectRoot(), 'apple', 'fold-helper');
5654
const sourceHash = await fingerprintNativeBuildSource(
5755
host,
5856
sourceRoot,
@@ -61,7 +59,7 @@ export async function ensureFoldHelperBinary(
6159
);
6260
const toolchain = await readHostToolchainIdentity(host, deadline);
6361
const cacheRoot =
64-
input.cacheRoot ?? path.join(host.homeDirectory(), '.agent-device', 'fold-helper');
62+
input.cacheRoot ?? path.join(hostHomeDirectory(), '.agent-device', 'fold-helper');
6563
return await ensureNativeBuildCacheEntry({
6664
host,
6765
deadline,
@@ -82,14 +80,12 @@ export async function ensureFoldHelperBinary(
8280
}
8381
}
8482

85-
function createFoldHelperCacheHost(): SnapshotSourceHost {
86-
const real = createSnapshotSourceHost();
87-
return {
88-
...real,
89-
// Routed through the Apple tool-provider scope, not `run`'s default `runCmd`, so a fold test
90-
// can fake every exec this cache makes the same way it fakes the simctl dispatch (#2796).
91-
run: (command, args, options) => runAppleToolCommand(command, args, options),
92-
};
83+
function createFoldHelperCacheHost(): NativeBuildHost {
84+
// Routed through the Apple tool-provider scope, not `run`'s default `runCmd`, so a fold test can
85+
// fake every exec this cache makes the same way it fakes the simctl dispatch (#2796). A narrow
86+
// build host, not the full snapshot-bridge host: compilation needs no bridge socket and no
87+
// target-process inspection (#2970).
88+
return createNativeBuildHost(runAppleToolCommand);
9389
}
9490

9591
/**
@@ -119,8 +115,8 @@ export function buildFoldHelperCompileArgv(
119115
}
120116

121117
async function compileFoldHelper(
122-
host: SnapshotSourceHost,
123-
deadline: SnapshotSourceDeadline,
118+
host: NativeBuildHost,
119+
deadline: NativeBuildDeadline,
124120
sourceRoot: string,
125121
outputPath: string,
126122
): Promise<void> {
@@ -137,13 +133,13 @@ async function compileFoldHelper(
137133
}
138134

139135
/**
140-
* Rewraps a cache failure as the fold helper's build error, keeping its hint and typed details; a
141-
* cancellation, and any error that is not a snapshot-source failure, passes through unchanged.
136+
* Rewraps a native-build cache failure as the fold helper's build error, keeping its hint and typed
137+
* details; a cancellation, and any error that is not a native-build failure (including the fold
138+
* helper's own `foldHelperBuildFailed`, already in its public shape), passes through unchanged.
142139
*/
143140
function asFoldHelperCacheError(error: unknown): unknown {
144-
if (!(error instanceof SnapshotSourceError) || error.failureKind === 'cancelled') return error;
145-
const { bridgeFailure: _kind, bridgeFailureCode: cause, ...details } = error.details ?? {};
146-
return foldHelperBuildFailed({ ...details, cause }, error);
141+
if (!(error instanceof NativeBuildError) || error.buildFailureKind === 'cancelled') return error;
142+
return foldHelperBuildFailed({ ...error.buildDetails, cause: error.buildFailureCode }, error);
147143
}
148144

149145
function foldHelperBuildFailed(details: Readonly<Record<string, unknown>>, cause?: unknown) {

packages/platform-apple/src/snapshot-source/__tests__/exec-timeout-fixture.ts renamed to packages/platform-apple/src/native-build/__tests__/exec-timeout-fixture.ts

File renamed without changes.

packages/platform-apple/src/snapshot-source/native-build-cache.test.ts renamed to packages/platform-apple/src/native-build/cache.test.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@ import assert from 'node:assert/strict';
22
import { readdir, readFile, writeFile } from 'node:fs/promises';
33
import path from 'node:path';
44
import { test } from 'vitest';
5+
import { runCmd } from '@agent-device/host-kit/command';
56
import { mkdtempForTest } from '../__tests__/tmp-dir.ts';
6-
import { createSnapshotSourceDeadline } from './deadline.ts';
7-
import { createSnapshotSourceHost } from './host.ts';
8-
import { ensureNativeBuildCacheEntry, fingerprintNativeBuildSource } from './native-build-cache.ts';
9-
import type { SnapshotSourceHost } from './types.ts';
7+
import { createNativeBuildDeadline } from './deadline.ts';
8+
import { createNativeBuildHost, type NativeBuildHost } from './host.ts';
9+
import { ensureNativeBuildCacheEntry, fingerprintNativeBuildSource } from './cache.ts';
1010

1111
function testDeadline() {
12-
return createSnapshotSourceDeadline(30_000, undefined);
12+
return createNativeBuildDeadline(30_000, undefined);
13+
}
14+
15+
function testHost(): NativeBuildHost {
16+
return createNativeBuildHost(
17+
async (command, args, options) => await runCmd(command, args, options),
18+
);
1319
}
1420

1521
test('a cache hit skips the build, and a key-input or binary change rebuilds', async () => {
1622
const root = await mkdtempForTest('agent-device-native-build-cache-');
1723
const cacheRoot = path.join(root, 'cache');
18-
const host = createSnapshotSourceHost();
24+
const host = testHost();
1925
let builds = 0;
2026

2127
const ensure = (keyInputs: Readonly<Record<string, unknown>> = { sourceHash: 'abc' }) =>
@@ -57,7 +63,7 @@ test('a cache hit skips the build, and a key-input or binary change rebuilds', a
5763
test('a failed build leaves no cache entry, and a later call can retry', async () => {
5864
const root = await mkdtempForTest('agent-device-native-build-cache-failure-');
5965
const cacheRoot = path.join(root, 'cache');
60-
const host = createSnapshotSourceHost();
66+
const host = testHost();
6167
let attempts = 0;
6268

6369
const ensure = () =>
@@ -89,7 +95,7 @@ test('a failed build leaves no cache entry, and a later call can retry', async (
8995

9096
test('fingerprintNativeBuildSource keys on filename as well as content, so a rename busts the cache', async () => {
9197
const root = await mkdtempForTest('agent-device-native-fingerprint-');
92-
const host: SnapshotSourceHost = createSnapshotSourceHost();
98+
const host = testHost();
9399
await (await import('@agent-device/host-kit/host-file')).ensureHostDirectory(root);
94100
await writeFile(path.join(root, 'A.m'), 'same content');
95101
await writeFile(path.join(root, 'B.m'), 'same content');

packages/platform-apple/src/snapshot-source/native-build-cache.ts renamed to packages/platform-apple/src/native-build/cache.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { createHash } from 'node:crypto';
22
import path from 'node:path';
33
import { withProcessLock } from '@agent-device/host-kit/file';
44
import { isCommandTimeoutError, type ExecResult } from '@agent-device/host-kit/command';
5-
import { remainingSnapshotSourceMs, type SnapshotSourceDeadline } from './deadline.ts';
6-
import { SnapshotSourceError, snapshotSourceError } from './errors.ts';
7-
import type { SnapshotSourceHost } from './types.ts';
5+
import { remainingNativeBuildMs, type NativeBuildDeadline } from './deadline.ts';
6+
import { NativeBuildError, nativeBuildError } from './errors.ts';
7+
import type { NativeBuildHost } from './host.ts';
88

99
const MANIFEST_FILENAME = 'manifest.json';
1010

@@ -15,12 +15,12 @@ export type NativeBuildCacheEntry = Readonly<{ path: string; cacheKey: string }>
1515
* against its manifest's key and binary hash, a miss builds into a temp directory and publishes it
1616
* with an atomic rename, and a build that fails leaves no partial entry behind. Every runtime clang
1717
* build in this package shares this mechanism so a stale entry, a corrupt cache, or a
18-
* `DEVELOPER_DIR` switch is handled once (#2796).
18+
* `DEVELOPER_DIR` switch is handled once (#2796, #2970).
1919
*/
2020
export async function ensureNativeBuildCacheEntry(
2121
input: Readonly<{
22-
host: SnapshotSourceHost;
23-
deadline: SnapshotSourceDeadline;
22+
host: NativeBuildHost;
23+
deadline: NativeBuildDeadline;
2424
cacheRoot: string;
2525
binaryFilename: string;
2626
/** Names the contended resource in a lock-stall diagnostic; every caller states its own. */
@@ -46,27 +46,27 @@ export async function ensureNativeBuildCacheEntry(
4646
task: async () => {
4747
const cached = await readValidCacheEntry(host, entryPath, binaryFilename, cacheKey, deadline);
4848
if (cached) return { path: cached, cacheKey };
49-
remainingSnapshotSourceMs(deadline, 'native-build-deadline');
49+
remainingNativeBuildMs(deadline, 'native-build-deadline');
5050
if (host.exists(entryPath)) await host.remove(entryPath);
51-
remainingSnapshotSourceMs(deadline, 'native-build-deadline');
51+
remainingNativeBuildMs(deadline, 'native-build-deadline');
5252
await host.ensureDirectory(cacheRoot);
5353
const temporaryPath = path.join(cacheRoot, `.${cacheKey}.${host.processId()}.tmp`);
54-
remainingSnapshotSourceMs(deadline, 'native-build-deadline');
54+
remainingNativeBuildMs(deadline, 'native-build-deadline');
5555
await host.remove(temporaryPath);
5656
try {
57-
remainingSnapshotSourceMs(deadline, 'native-build-deadline');
57+
remainingNativeBuildMs(deadline, 'native-build-deadline');
5858
await host.ensureDirectory(temporaryPath);
5959
const outputPath = path.join(temporaryPath, binaryFilename);
6060
await input.build(outputPath);
61-
remainingSnapshotSourceMs(deadline, 'native-build-deadline');
61+
remainingNativeBuildMs(deadline, 'native-build-deadline');
6262
await host.chmod(outputPath, 0o755);
6363
const binarySha256 = await sha256File(host, outputPath);
6464
const manifest = { ...input.keyInputs, cacheKey, binarySha256 };
6565
await host.writeText(
6666
path.join(temporaryPath, MANIFEST_FILENAME),
6767
`${JSON.stringify(manifest, null, 2)}\n`,
6868
);
69-
remainingSnapshotSourceMs(deadline, 'native-build-deadline');
69+
remainingNativeBuildMs(deadline, 'native-build-deadline');
7070
await host.rename(temporaryPath, entryPath);
7171
return { path: path.join(entryPath, binaryFilename), cacheKey };
7272
} catch (error) {
@@ -78,11 +78,11 @@ export async function ensureNativeBuildCacheEntry(
7878
}
7979

8080
async function readValidCacheEntry(
81-
host: SnapshotSourceHost,
81+
host: NativeBuildHost,
8282
entryPath: string,
8383
binaryFilename: string,
8484
cacheKey: string,
85-
deadline: SnapshotSourceDeadline,
85+
deadline: NativeBuildDeadline,
8686
): Promise<string | undefined> {
8787
const binaryPath = path.join(entryPath, binaryFilename);
8888
const manifestPath = path.join(entryPath, MANIFEST_FILENAME);
@@ -92,7 +92,7 @@ async function readValidCacheEntry(
9292
if (manifest.cacheKey !== cacheKey || typeof manifest.binarySha256 !== 'string') {
9393
return undefined;
9494
}
95-
remainingSnapshotSourceMs(deadline, 'native-cache-hash-deadline');
95+
remainingNativeBuildMs(deadline, 'native-cache-hash-deadline');
9696
const matchesBinary = (await sha256File(host, binaryPath)) === manifest.binarySha256;
9797
return matchesBinary ? binaryPath : undefined;
9898
} catch (error) {
@@ -104,12 +104,12 @@ async function readValidCacheEntry(
104104
/** Distinguishes a real cache-read failure (corrupt entry, stale manifest) from a caller cancellation or deadline. */
105105
function isCacheReadCancellationOrTimeout(error: unknown): boolean {
106106
return (
107-
error instanceof SnapshotSourceError &&
108-
(error.failureKind === 'cancelled' || error.failureKind === 'timeout')
107+
error instanceof NativeBuildError &&
108+
(error.buildFailureKind === 'cancelled' || error.buildFailureKind === 'timeout')
109109
);
110110
}
111111

112-
async function sha256File(host: SnapshotSourceHost, filePath: string): Promise<string> {
112+
async function sha256File(host: NativeBuildHost, filePath: string): Promise<string> {
113113
return createHash('sha256')
114114
.update(await host.readBinary(filePath))
115115
.digest('hex');
@@ -121,17 +121,17 @@ async function sha256File(host: SnapshotSourceHost, filePath: string): Promise<s
121121
* way, over its own filename list (#2796).
122122
*/
123123
export async function fingerprintNativeBuildSource(
124-
host: SnapshotSourceHost,
124+
host: NativeBuildHost,
125125
root: string,
126126
sourceFilenames: readonly string[],
127-
deadline: SnapshotSourceDeadline,
127+
deadline: NativeBuildDeadline,
128128
): Promise<string> {
129129
const hash = createHash('sha256');
130130
for (const sourceFile of sourceFilenames) {
131131
const filePath = path.join(root, sourceFile);
132-
remainingSnapshotSourceMs(deadline, 'native-source-fingerprint-deadline');
132+
remainingNativeBuildMs(deadline, 'native-source-fingerprint-deadline');
133133
if (!host.exists(filePath)) {
134-
throw snapshotSourceError('unsupported', 'native-source-missing', { filePath });
134+
throw nativeBuildError('unsupported', 'native-source-missing', { filePath });
135135
}
136136
hash.update(sourceFile);
137137
hash.update('\0');
@@ -148,8 +148,8 @@ export async function fingerprintNativeBuildSource(
148148
*/
149149
export async function execNativeBuildClang(
150150
input: Readonly<{
151-
host: SnapshotSourceHost;
152-
deadline: SnapshotSourceDeadline;
151+
host: NativeBuildHost;
152+
deadline: NativeBuildDeadline;
153153
argv: readonly string[];
154154
budgetMs: number;
155155
/** Names the build in the stall hint, e.g. "bridge" or "fold helper". */
@@ -158,7 +158,7 @@ export async function execNativeBuildClang(
158158
): Promise<ExecResult> {
159159
const timeoutMs = Math.min(
160160
input.budgetMs,
161-
remainingSnapshotSourceMs(input.deadline, 'native-build-deadline'),
161+
remainingNativeBuildMs(input.deadline, 'native-build-deadline'),
162162
);
163163
try {
164164
return await input.host.run('xcrun', [...input.argv], {
@@ -168,7 +168,7 @@ export async function execNativeBuildClang(
168168
});
169169
} catch (error) {
170170
if (!isCommandTimeoutError(error)) throw error;
171-
throw snapshotSourceError(
171+
throw nativeBuildError(
172172
'timeout',
173173
'native-build-stalled',
174174
{

0 commit comments

Comments
 (0)