iOS: a warm simulator is leased without a restart, and renamed to the lease's label

未关闭
#2,079 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

Read src/leasing/AGENTS.md, src/core/AGENTS.md, and src/drivers/ios/AGENTS.md, then trace the leasing flow and IosSimctlDriver through the named tests. Start with the createLeasing coordinator harness and src/drivers/ios/index-rename.test.ts; run the changed tests and typecheck. Done means cases B1–B6 pass, the retired identifiers are absent, the website checks pass, and the slow iOS lane verifies B7 on real hardware.

由索引模型根据 Issue 内容生成。

描述

task:ready

Part of #2075.

Scope

A lease that takes a warm iOS simulator under Xcode's set is granted with no shutdown and no boot, and its lease.granted says source: warm. A labelled lease of a warm simulator shows the label as the simulator's name, in both device sets. A simulator found already booted at a lease's boot is no longer restarted.

If it goes wrong, a user would see the Mac clipboard reach a warm lease's simulator, or a labelled warm lease keep the simulator's old name.

Technical spec

Commit 4d3c176f.

Rows
  • Behaviours: B1, B2, B3, B4, B5, B6, B7
  • Stored state: S1
  • Interfaces: I1, I2, I3
  • Existing code: X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16
Facts
# Fact Source
F1 The slow-lane file has a cold and a warm case that lease on a real DeviceHub and call expectClipboardIsolated e2e/slow-ios-window.test.ts:38, :117
F2 An e2e test waits for named events with env.expectEvents e2e/helpers/env.ts:171, e2e/helpers/events.ts:32
F3 simlock lease takes --label and sends it as given src/cli/index-lease-label.test.ts:35
F4 src/drivers/ios/AGENTS.md is 7991 characters wc -c src/drivers/ios/AGENTS.md printed 7991
Modules touched

src/leasing, src/core, src/drivers/ios, e2e, the website docs and docs/internal/flows. Searches: rg rebootReadyBeforeGrant src e2e, rg refreshBooted src, rg 'reboot-ready|rebootsBeforeGrant' src/leasing, rg rebootForLease src.

flowchart LR
  leasing[leasing: planner, workflow, waiter, ports] --> core[core: lifecycle, Driver, FakeDriver]
  core --> ios[drivers/ios: index, simulator-boot]
Rules in play
  • src/leasing/AGENTS.md, the lock: the plan and the claim are taken under the lock; the rename runs outside it.
  • src/core/AGENTS.md: every driver verb on a registered device goes through ManagedDeviceLifecycle; nothing acts on a leased device, so the rename ends before the grant commit.
  • src/drivers/AGENTS.md: the driver imports only core, ports and shared; the rename is scoped to the root under the simlock set.
  • events.md: no event or payload changes; both catalogs already say only except makes a ready device booted, so neither is edited.
  • documentation.md rule 9: the pages in X14 change in this PR.
  • testing.md rule 7: the tests in X11 are extended or rewritten in place, none added beside them.
Retired words
  • rebootReadyBeforeGrant: no driver asks for a reboot before a grant; only a request's except does.
  • refreshBooted: a simulator already booted at its boot is left running.
  • reboot under the claim (of a ready default-set simulator): a warm simulator is granted as it is, after a rename when the lease has a label.
Tests

Seams: createLeasing and the coordinator harness for B1 and B2, modelled on src/leasing/create-leasing-label.test.ts; IosSimctlDriver for B3 to B6, modelled on src/drivers/ios/index-rename.test.ts; the slow lane for B7.

  • B1: A requester leases a ready virtual device with no except and no label: the driver is not called and lease.granted carries source: warm, whatever the device set.: ready iOS device, plain request: no shutdown, makeReady or nameForLease call, source warm; ready slim device, request with except: one shutdown and one makeReady, source booted
  • B2: A requester leases a ready virtual device with a label: the driver's nameForLease (I1) runs once with the label before the grant, nothing is booted, and lease.granted carries source: warm.: label, driver has nameForLease: one call with the label, then the grant, source warm; label, driver has none (Android): plain grant, no call; nameForLease rejects: one warning naming a warm device for a waiter failed with step name, lease granted; label with except: the reboot with the label in makeReady, no nameForLease; device no longer ready when the claim is checked: no call, the claim is released and the request plans again
  • B3: The leasing engine calls the iOS driver's nameForLease: it runs simctl rename <udid> <label> once and resolves.: simlock set: the command carries --set <root>; Xcode's set: it does not; exit non-zero: resolves, warns could not rename <udid> to <label>: <stderr>; no answer in 5 s: resolves, warns could not rename <udid> to <label>: timed out after 5000ms
  • B4: The leasing engine prepares an iOS simulator that simctl boot reports already booted: the driver goes on to bootstatus and listapps with no shutdown and no second boot.: Xcode's set, purpose prepare: calls are rename, the setting's write, boot, bootstatus, listapps; purpose recover: the same without rename
  • B5: The iOS driver under Xcode's set no longer asks for a reboot before a grant.: deviceSet: default and simlock: the driver has no rebootReadyBeforeGrant
  • B6: Under Xcode's set the clipboard setting is written before every boot the driver starts, as today.: prepare and recover of a shut-down simulator: the write, then boot, as that test proves today; prepare of one already booted (hub.warm, :227-233): the write, then one boot, no shutdown and no second boot
  • B7: On real hardware with DeviceHub running, a warm lease under Xcode's set is granted source: warm, is clipboard-isolated, and a labelled one shows its label in simctl list.: warm lease with a label: source is warm, expectClipboardIsolated passes, simctl list devices -j names the simulator by the label; cold lease: as today

Done when

  • pnpm test:changed passes with the cases of B1 to B6.
  • pnpm typecheck passes.
  • rg 'rebootReadyBeforeGrant|refreshBooted' src e2e prints nothing.
  • The website builds: pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs.
  • Slow lane, needs a real simulator and DeviceHub on Xcode 27.2: e2e/slow-ios-window.test.ts passes with its warm case leasing with a label, expecting lease.granted with source: warm, the label in simctl list devices -j, and expectClipboardIsolated (B7).

Out of scope

  • A config key for clipboard sync.
  • The device-to-Mac half of expectClipboardIsolated.
  • How a failed write of the clipboard setting is handled (#2066).

Depends on

  • #2037 because: AcquisitionWorkflow.decide in src/leasing/acquisition-workflow.ts, and the planning list in docs/internal/flows/device-selection.md
  • #2077 because: the bootAndWait call in IosSimctlDriver.makeReady, src/drivers/ios/index.ts

Written by an agent.

主要语言
TypeScript
星标
730
派生
44
平均合并
15 小时 28 分钟
30 天内合并 PR
387

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/simlock 的其他 Issue

查看 callstackincubator/simlock 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。