feat: add AppleOS discriminant to the device model (additive)#896
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Sequencing note: this PR is clean against current main, but it conflicts with sibling #895 in |
thymikee
left a comment
There was a problem hiding this comment.
Reviewed end-to-end. The discriminant is genuinely additive: appleOs is optional, and for every record discovery actually produces, resolveRunnerPlatformName returns the same value as the old target-only inference (iPad → iPadOS → iOS profile, iPhone/iPod → iOS, tvOS → tvOS, host Mac short-circuits on platform === 'macos'), so runner SDK/destination selection is unchanged — confirmed by trace and by the byte-identical iPad test. Locally tsc -p tsconfig.json --noEmit is clean and the targeted suites pass (62). Only non-test caller of resolveApplePlatformName is resolveRunnerPlatformName, which now threads appleOs, so no caller is left inconsistent.
One actionable note — src/daemon/handlers/session-inventory.ts:91-93: the publicDevices projection strips only simulatorSetPath, so appleOs now rides into the public devices inventory returned to clients/agents. That's additive and ADR-0006-safe (a "new optional response field older clients can ignore" — no rpcProtocolVersion bump), and it's arguably useful (an agent can now tell iPad from iPhone). But the PR frames appleOs as internal-only groundwork, and nothing pins the devices output shape, so this surfaces silently. Worth a deliberate call: keep it and treat the richer output as intended, or strip it here like simulatorSetPath if it should stay internal for now.
Two minor, non-blocking nits:
- The simctl simulator path derives
appleOsfrom the device name only (resolveAppleOs(target, [device.name])), so a user-renamed iPad sim (name without "iPad") tags asios. No functional impact today since iOS/iPadOS share the iOS runner profile;deviceTypeIdentifierwould be more robust if the discriminant ever drives behavior. resolveRunnerPlatformNameForAppleOs'sdefault:silently routes the reservedwatchos/visionosto the iOS profile. Fine as documented groundwork, but that's the spot to make exhaustive when those OSes actually get discovered.
Sequencing: agree with your own note — land #895 first, then rebase keeping both. The device.ts / device.test.ts overlap is purely textual/co-located; isPlatform (leaf-platform guard) and AppleOS (Apple-OS discriminant) are orthogonal, so it's a mechanical keep-both with no logic to reconcile. Merge-ready after that rebase.
|
Thanks @thymikee. Addressed: (a) Done — kept (b) Fixed via (c) Acknowledged — Sequencing: agree — merge #895 first, then rebase this keeping both changes. Verified: |
Add an explicit, stored AppleOS ('ios' | 'ipados' | 'tvos' | 'watchos' |
'visionos' | 'macos') and an optional appleOs field on DeviceInfo so Apple
operating systems are first-class instead of inferred late from DeviceTarget.
- device.ts: add AppleOS type, optional DeviceInfo.appleOs, and make
resolveApplePlatformName prefer device.appleOs while falling back to the
existing target-based inference for legacy records. iOS and iPadOS both map
to the single iOS runner profile; tvOS -> tvOS; macOS -> macOS.
- Populate appleOs at discovery only (no widened filters): iPhone/iPod -> ios,
iPad -> ipados, tvOS -> tvos, host Mac -> macos.
- resolveRunnerPlatformName threads device.appleOs through.
Non-breaking groundwork for the platforms/apple consolidation: records without
appleOs resolve byte-identically, and no runner SDK/destination selection
changes (iPad still resolves to the iOS runner profile).
fe1450f to
a74be4b
Compare
|
…on) (#905) Locks the two axis decisions and starts retiring plans/ into ADRs. ADR 0008 (Proposed) records the command-descriptor registry composing domain-owned facets and deriving the ~10 tables, bound by ADR 0003's four invariants; ADR 0009 (Accepted, groundwork shipped in #896) records the AppleOS leaf axis under one 'apple' Platform. perfect-shape.md links both and marks Phase 0 + Tier-A dedup as merged.
What
Adds an explicit, stored Apple operating-system discriminant to the device model:
device.ts: newexport type AppleOS = 'ios' | 'ipados' | 'tvos' | 'watchos' | 'visionos' | 'macos'(all six literals reserved) and an optionalappleOs?: AppleOSfield onDeviceInfo.resolveApplePlatformNamenow accepts an optionalappleOsand prefers it, falling back to the existingDeviceTarget-based inference when it is absent. Mapping:ios/ipados-> the single iOS runner profile (iOS),tvos->tvOS,macos->macOS.resolveRunnerPlatformNamethreadsdevice.appleOsthrough.appleOs(no widened filters; watchOS/visionOS stay dropped as today):ios/ipad/) ->ipadostvosbuildHostMacDevice) ->macosWhy
Today an Apple device's OS is inferred late and lossily from
DeviceTarget. Storing it makes iOS/iPadOS/tvOS/macOS first-class and unambiguous. This is non-breaking groundwork for theplatforms/appleconsolidation.Non-breaking
DeviceInforecords withoutappleOsresolve byte-identically through the existing target inference.Validation
All commands run from the worktree and passed:
node_modules/.bin/tsc -p tsconfig.json --noEmit(exit 0)node ./node_modules/oxfmt/bin/oxfmt --write <changed .ts files>node_modules/.bin/oxlint <changed .ts files> --deny-warnings(exit 0)node_modules/.bin/vitest run devices apple-runner-platform capabilities dispatch-resolve runner-xctestrun(66 passed)vitest run platforms/ios/__tests__/index platforms/macos session-device-utils session-open-target(91 passed)