Skip to content

Commit 2aa0399

Browse files
committed
fix: project platform to the public leaf at open/perf response sites (#979)
The Platform collapse left two daemon response builders emitting the raw internal `device.platform` ('apple'), which the client normalizer rejects (isPublicPlatform excludes 'apple') — dropping the resolved device from the response: - session-open-surface.ts: `open` result `platform`/device projection. - session-perf.ts: the perf/frames/memory base response builders. Both now go through `publicPlatformString(device)`, so output stays the leaf `ios`/`macos` per approach (b). (The android/non-apple perf branches were already leaf-safe.) Also update macos-desktop provider test: the lifecycle mock observes the INTERNAL DeviceInfo, which is now `platform:'apple'` (+ appleOs:'macos'), so the recorded tag is `prepare:apple:desktop`. Fixes the provider-integration assertions that blocked both the Integration Tests and Coverage CI jobs (both run the provider-integration project). Verified: provider-integration 82/82, coverage passes, tsc/oxlint/oxfmt/layering/ fallow green.
1 parent 41089c5 commit 2aa0399

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎src/daemon/handlers/session-open-surface.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { parseSessionSurface, type SessionSurface } from '../../core/session-surface.ts';
22
import { resolveFrontmostMacOsApp } from '../../platforms/apple/os/macos/helper.ts';
3-
import { isIosFamily, isMacOs, type DeviceInfo } from '../../kernel/device.ts';
3+
import {
4+
isIosFamily,
5+
isMacOs,
6+
publicPlatformString,
7+
type DeviceInfo,
8+
} from '../../kernel/device.ts';
49
import type { SessionRuntimeHints, SessionState } from '../types.ts';
510
import { AppError } from '../../kernel/errors.ts';
611
import { successText } from '../../utils/success-text.ts';
@@ -49,7 +54,7 @@ export function buildOpenResult(params: {
4954
result.runtime = runtime;
5055
}
5156
if (device) {
52-
result.platform = device.platform;
57+
result.platform = publicPlatformString(device);
5358
result.target = device.target ?? 'mobile';
5459
result.device = device.name;
5560
result.id = device.id;

‎src/daemon/handlers/session-perf.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'node:path';
22
import type { SessionAction, SessionState } from '../types.ts';
33
import { AppError, normalizeError } from '../../kernel/errors.ts';
4-
import { isApplePlatform } from '../../kernel/device.ts';
4+
import { isApplePlatform, publicPlatformString } from '../../kernel/device.ts';
55
import { tryGetPlugin } from '../../core/platform-plugin/plugin.ts';
66
import { registerBuiltinPlatformPlugins } from '../../core/interactors/register-builtins.ts';
77
import type { AndroidAdbExecutor } from '../../platforms/android/adb-executor.ts';
@@ -207,7 +207,7 @@ function buildBasePerfResponse(session: SessionState): PerfResponseData {
207207
};
208208
return {
209209
session: session.name,
210-
platform: session.device.platform,
210+
platform: publicPlatformString(session.device),
211211
device: session.device.name,
212212
deviceId: session.device.id,
213213
metrics: {
@@ -244,7 +244,7 @@ function buildDefaultUnavailableFrameMetric(): Record<string, unknown> {
244244
function buildBasePerfFramesResponse(session: SessionState): PerfFramesResponseData {
245245
return {
246246
session: session.name,
247-
platform: session.device.platform,
247+
platform: publicPlatformString(session.device),
248248
device: session.device.name,
249249
deviceId: session.device.id,
250250
metrics: {
@@ -259,7 +259,7 @@ function buildBasePerfFramesResponse(session: SessionState): PerfFramesResponseD
259259
function buildBasePerfMemoryResponse(session: SessionState): PerfMemoryResponseData {
260260
return {
261261
session: session.name,
262-
platform: session.device.platform,
262+
platform: publicPlatformString(session.device),
263263
device: session.device.name,
264264
deviceId: session.device.id,
265265
sampling: {

‎test/integration/provider-scenarios/macos-desktop.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ test('Provider-backed integration prepare uses the Apple runner lifecycle provid
5151
},
5252
);
5353

54-
assert.deepEqual(lifecycleCalls, ['prepare:macos:desktop']);
54+
// The provider receives the internal collapsed DeviceInfo (platform:'apple',
55+
// appleOs:'macos'); the macOS distinction is carried by appleOs/target.
56+
assert.deepEqual(lifecycleCalls, ['prepare:apple:desktop']);
5557
});
5658

5759
test('Provider-backed integration macOS desktop flow uses semantic host and helper providers', async () => {

0 commit comments

Comments
 (0)