Skip to content

Commit 2d3838f

Browse files
committed
fix(daemon): own the appstate test owner's platform family and scope two doc claims (#3674)
The bare-udid pin built its runtime owner with `ios`, which is a public selector, not a Platform — typecheck TS2345 at the lint-package gate. The fixture device's own family, `apple`, is the value the owner takes. Alongside it, two docstrings said more than the code does: the manifest lane asks the host only for the manifest's device where the family has an identity flag (families without one keep the request's own selection, proven by the manifest assertion), and the admission-carried fact keeps the refusal stable once a device resolves — resolution itself can still fail first with the device's own error. Co-Authored-Worked-On-By: Claude
1 parent 633115a commit 2d3838f

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ test('appstate --udid with no --platform resolves the stated device and THEN ans
9999
sessionStore: makeSessionStore(),
100100
inspectFacts: async (inspectedDevice) => {
101101
inspected.push(inspectedDevice.id);
102-
return createUnavailableRuntimeFactsForTest(inspectedDevice, localRuntimeOwner('ios'), {
102+
return createUnavailableRuntimeFactsForTest(inspectedDevice, localRuntimeOwner('apple'), {
103103
available: false,
104104
reason: 'owner-capability-missing',
105105
});

‎packages/daemon/src/sessions/handlers/record-runtime.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ async function resolveRecordingSession(
175175
* the durable manifest the session address finds — never from an unconstrained sweep of the host,
176176
* which with several booted devices would answer `AMBIGUOUS_MATCH` (or, worse, silently pick a
177177
* different device) before the manifest is read. A decodable manifest names the exact device the
178-
* recording was started on; the stop recovery re-resolves that identity, so the host is asked
179-
* only for the device the manifest already specified. A start, or a stop with no decodable
180-
* manifest to recover from, refuses with the named-session error.
178+
* recording was started on; the stop recovery re-resolves that identity, so where its family has
179+
* an identity flag the host is asked only for the device the manifest already specified. A start,
180+
* or a stop with no decodable manifest to recover from, refuses with the named-session error.
181181
* `assertManifestBelongsToRequest` still proves the resolved device and the session address
182182
* against the manifest before anything is served, so a mismatch fails closed.
183183
*

‎packages/daemon/src/sessions/handlers/session-appstate-device-runtime.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ export async function queryDeviceRuntimeAppState(
3232
): Promise<DaemonResponse> {
3333
if (isIosFamily(device) || isMacOs(device)) {
3434
// A request admitted without the session it names (#3674) keeps the typed refusal whatever
35-
// flag routed it here — the fact comes from admission, so resolving the device cannot change
36-
// the error family. A request that named no session keeps the plain session-required refusal,
37-
// which is the right advice for it.
35+
// flag routed it here — the fact comes from admission, so once a device resolves, a store
36+
// change mid-await cannot move this refusal into another family. (Resolution itself can
37+
// still fail first, and that error is the device's.) A request that named no session keeps
38+
// the plain session-required refusal, which is the right advice for it.
3839
if (namedSessionMissing) {
3940
return appStateSessionNotFoundResponse(params.sessionName, device.platform);
4041
}

0 commit comments

Comments
 (0)