Skip to content

Commit 709c4f2

Browse files
committed
fix(deployment): keep readiness conditional for provider-owned installs
1 parent 1712afc commit 709c4f2

5 files changed

Lines changed: 145 additions & 11 deletions

File tree

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Install timeout verification — 2026-10-30
2+
3+
Live source SHA: `9eea80f2a583e7b6b05d187114922506ee1fa3d0`. Subsequent changes simplify the test fake and preserve provider deployments that do not expose a separate readiness operation. Install subprocess bounds are unchanged.
4+
5+
Devices: Android 15 emulator `ReactNative_API_35B` (`emulator-5554`) and iOS 27.0 simulator `iPhone 17 Pro` (`BC54AC11-CD86-4C10-8C4E-5101C773FFEB`). The fixtures use `com.callstack.installtimeoutproof`.
6+
7+
The device-panel CLI sent install, reinstall, and URL-source commands to an isolated daemon built from this checkout. The Node API sent path-source commands because the CLI accepts only URL and CI sources. URL payloads were served through a temporary public HTTPS tunnel. Android AAB commands used the local bundletool fallback, with its two subprocesses bounded independently.
8+
9+
All 12 matrix cases succeeded. Each source case started after uninstalling the fixture. The final cleanup uninstalled it. `AGENT_DEVICE_EXEC_TRACE=true` saved subprocess bounds to each request log.
10+
11+
## Request evidence
12+
13+
### android-apk: install
14+
15+
Exit 0, success true. Request `2315096768d37af3`.
16+
17+
```json
18+
[{"command":"unzip","timeoutMs":15000},{"command":"adb","timeoutMs":120000}]
19+
```
20+
21+
### android-apk: reinstall
22+
23+
Exit 0, success true. Request `2f017324c2745848`.
24+
25+
```json
26+
[{"command":"adb","timeoutMs":15000},{"command":"adb","timeoutMs":15000},{"command":"adb","timeoutMs":120000},{"command":"adb","timeoutMs":15000}]
27+
```
28+
29+
### android-apk: source-path
30+
31+
Exit 0, success true. Request `a85ed6f4e7cfc7bf`.
32+
33+
```json
34+
[{"command":"unzip","timeoutMs":15000},{"command":"adb","timeoutMs":120000}]
35+
```
36+
37+
### android-apk: source-url
38+
39+
Exit 0, success true. Request `8dc8f16f9eb99abe`.
40+
41+
```json
42+
[{"command":"unzip","timeoutMs":15000},{"command":"adb","timeoutMs":120000}]
43+
```
44+
45+
### android-aab: install
46+
47+
Exit 0, success true. Request `7a2adfa89e465908`.
48+
49+
```json
50+
[{"command":"unzip","timeoutMs":15000},{"command":"unzip","timeoutMs":15000},{"command":"aapt","timeoutMs":15000},{"command":"adb","timeoutMs":15000},{"command":"bundletool","timeoutMs":120000},{"command":"bundletool","timeoutMs":120000},{"command":"adb","timeoutMs":15000}]
51+
```
52+
53+
### android-aab: reinstall
54+
55+
Exit 0, success true. Request `6af1acfe3ea0871b`.
56+
57+
```json
58+
[{"command":"adb","timeoutMs":15000},{"command":"adb","timeoutMs":15000},{"command":"bundletool","timeoutMs":120000},{"command":"bundletool","timeoutMs":120000},{"command":"adb","timeoutMs":15000}]
59+
```
60+
61+
### android-aab: source-path
62+
63+
Exit 0, success true. Request `bb9b953af572935e`.
64+
65+
```json
66+
[{"command":"unzip","timeoutMs":15000},{"command":"unzip","timeoutMs":15000},{"command":"aapt","timeoutMs":15000},{"command":"adb","timeoutMs":15000},{"command":"bundletool","timeoutMs":120000},{"command":"bundletool","timeoutMs":120000},{"command":"adb","timeoutMs":15000}]
67+
```
68+
69+
### android-aab: source-url
70+
71+
Exit 0, success true. Request `6b54c958085fee22`.
72+
73+
```json
74+
[{"command":"unzip","timeoutMs":15000},{"command":"unzip","timeoutMs":15000},{"command":"aapt","timeoutMs":15000},{"command":"adb","timeoutMs":15000},{"command":"bundletool","timeoutMs":120000},{"command":"bundletool","timeoutMs":120000},{"command":"adb","timeoutMs":15000}]
75+
```
76+
77+
### ios-simulator: install
78+
79+
Exit 0, success true. Request `47d1332d8f86ea45`.
80+
81+
```json
82+
[{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"xcrun","timeoutMs":120000}]
83+
```
84+
85+
### ios-simulator: reinstall
86+
87+
Exit 0, success true. Request `c99b595555fed5bc`.
88+
89+
```json
90+
[{"command":"xcrun","timeoutMs":20000},{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"xcrun","timeoutMs":120000}]
91+
```
92+
93+
### ios-simulator: source-path
94+
95+
Exit 0, success true. Request `edc59a0093f390e8`.
96+
97+
```json
98+
[{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"xcrun","timeoutMs":120000}]
99+
```
100+
101+
### ios-simulator: source-url
102+
103+
Exit 0, success true. Request `fe50368be865a97a`.
104+
105+
```json
106+
[{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"plutil","timeoutMs":15000},{"command":"xcrun","timeoutMs":120000}]
107+
```
108+
109+
## Ledger regression proof
110+
111+
At `9eea80f2a583e7b6b05d187114922506ee1fa3d0`, the same focused provider suite ran in a disposable checkout:
112+
113+
- Unmodified head: 19 passed.
114+
- Restore the PR’s 330s/420s envelopes: 9 failed, 10 passed; failures report the missing daemon-result margin.
115+
- Raise the real Android install/bundletool bound from 120s to 200s: 4 failed, 15 passed; the ledger captures the changed production call bounds.
116+
117+
Command: `pnpm exec vitest run --project provider-integration test/integration/provider-scenarios/install-timeout-ledger.test.ts --reporter verbose`. The disposable checkout was removed.
118+
119+
The ledger covers shutdown Android AVD discovery, boot polling, the changed serial, foreign device claims, metadata inspection, uninstall, APK install, both bundletool phases, simulator boot, CoreDevice readiness, and URL download. Archive extraction remains bounded by size, not wall-clock time. Provider-owned install implementations remain responsible for honoring the supplied timeout.
120+
121+
## Limits
122+
123+
No physical iOS device was available; its route has provider integration coverage. A separate live shutdown-AVD attempt stopped at selector validation: the device-panel CLI pins a running serial, does not select a stopped AVD by serial, and rejects clearing it. The 12 successful matrix cases used already booted targets.
124+
125+
No app session was opened. The temporary daemon, file server, and HTTPS tunnel are stopped after validation.

‎packages/command-registry/src/descriptors/session-operations.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from '../descriptor-traits.ts';
2121
import { INSTALL_TIMEOUT_POLICY } from '../descriptor-timeout-policies.ts';
2222
import {
23-
readyDeployAppUse,
23+
deployAppUse,
2424
readyMaterializeAndDeployAppUse,
2525
readySendPushNotificationUse,
2626
uninstallAppUse,
@@ -50,7 +50,7 @@ const DEPLOY_APP_COMMAND_DESCRIPTOR = {
5050
recordsSessionAction: true,
5151
recordingEffect: 'mutates-app',
5252
daemon: { route: 'session', refFrameEffect: 'may-invalidate' },
53-
platformExecution: { kind: 'device-runtime', use: readyDeployAppUse },
53+
platformExecution: { kind: 'device-runtime', use: deployAppUse },
5454
timeoutPolicy: INSTALL_TIMEOUT_POLICY,
5555
batchable: true,
5656
compositeResource: 'none',

‎packages/contracts/src/app-deployment-runtime-plan.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { defineUse } from './platform-runtime-operations.ts';
22

3+
export const deployAppUse = defineUse({ required: ['deployApp'], conditional: ['ensureReady'] });
4+
35
export const readyDeployAppUse = defineUse({ required: ['ensureReady', 'deployApp'] });
46

57
export const uninstallAppUse = defineUse({ required: ['uninstallApp'] });

‎packages/daemon/src/sessions/handlers/__tests__/session-reinstall.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ test('install binds the deployment use exactly once after one facts admission',
167167
expect(mockInspectDeviceRuntimeFacts).toHaveBeenCalledOnce();
168168
expect(mockBindDeviceRuntime).toHaveBeenCalledOnce();
169169
expect(mockBindDeviceRuntime.mock.calls[0]?.[1]).toMatchObject({
170-
required: ['ensureReady', 'deployApp'],
170+
required: ['deployApp'],
171+
conditional: ['ensureReady'],
171172
});
172173
});
173174

‎packages/daemon/src/sessions/handlers/session-app-deployment.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { expandSessionPath } from '@agent-device/host-kit/session-paths';
55
import fs from 'node:fs';
66
import type { AppDeploymentResult } from '@agent-device/contracts/app-deployment-runtime';
77
import {
8+
deployAppUse,
89
readyDeployAppUse,
910
readySendPushNotificationUse,
1011
uninstallAppUse,
@@ -89,17 +90,22 @@ export async function handleAppDeploymentCommand(params: {
8990
platformServices: params.platformServices,
9091
});
9192
const facts = await requireRuntimeFacts(params.inspectFacts)(device);
92-
const unsupported =
93-
unavailableRuntimeOperationResponse(command, facts.operations.ensureReady) ??
94-
unavailableRuntimeOperationResponse(command, facts.operations.deployApp);
93+
const unsupported = unavailableRuntimeOperationResponse(command, facts.operations.deployApp);
9594
if (unsupported) return unsupported;
9695

97-
let runtime = await requireRuntimeBinding(params.bindDevice)(device, readyDeployAppUse);
98-
const ready = await runtime.operations.ensureReady({});
99-
if (ready.id !== device.id) {
100-
runtime = await requireRuntimeBinding(params.bindDevice)(ready, readyDeployAppUse);
96+
let runtime = await requireRuntimeBinding(params.bindDevice)(device, deployAppUse);
97+
if (
98+
runtime.owner.kind === 'local-family' &&
99+
device.platform === 'android' &&
100+
device.booted !== true
101+
) {
102+
const readyRuntime = await requireRuntimeBinding(params.bindDevice)(
103+
device,
104+
readyDeployAppUse,
105+
);
106+
device = await readyRuntime.operations.ensureReady({});
107+
runtime = await requireRuntimeBinding(params.bindDevice)(device, deployAppUse);
101108
}
102-
device = ready;
103109
// ADR 0014: deployment can replace the visible surface. Do this immediately before the
104110
// bound operation so an admission failure never discards a still-valid reference frame.
105111
if (ref) expireRefFrame(sessionStore.requireCurrent(ref));

0 commit comments

Comments
 (0)