iOS copy: keep the app database at the copy's own UDID
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Part of #2070.
Scope
After this PR an iOS simulator no longer rebuilds its app database when a lease boots it. Seeds, settled seeds and baselines keep the database, and each copy has it rewritten for its own UDID before the first boot. The copy itself is still made with simctl clone.
If this goes wrong, a lease's simulator misses an app or opens one the wrong way, or leases stay as slow as before.
Technical spec
Commit 4d3c176fb.
Rows
- Behaviours: B1, B2, B3, B4, B5, B6, B11
- Stored state: S1, S2, S3
- Interfaces: I1
- Existing code: X1, X2, X3, X4, X5, X6, X7, X8, X17, X18, X14
Facts
| # | Fact | Source |
|---|---|---|
| F1 | A lease's grant holds the simulator's UDID in device.driverDeviceId and the device set in environment.SIMLOCK_IOS_DEVICE_SET. On a worker in Xcode's own set the grant's environment is empty, and the set's folder is ~/Library/Developer/CoreSimulator/Devices. |
e2e/slow-baseline.test.ts:48 to :53; src/drivers/ios/index.ts:607 |
| F2 | The sources set is <device set>/sources, or <home>/devices/ios-sources under Xcode's own set. |
e2e/slow-baseline.test.ts:76 |
| F3 | e2e/slow-baseline.test.ts installs and launches an app before the save, and on a lease from the baseline checks that get_app_container answers a path under the copy's UDID and that the app launches. |
e2e/slow-baseline.test.ts:59, :136 to :147 |
| F4 | lsdiagnose run inside a booted simulator exits 0 and prints a gzip stream, not text. Unpacked it is about 368 MB: a csviz header, then property lists as XML text. One "string" of the comparison is the content of one <string> element; each dump of the measurement held 28,784 distinct ones. |
xcrun simctl --set <set> spawn <udid> lsdiagnose > kept-1-lsdiagnose.bin, then file kept-1-lsdiagnose.bin printed gzip compressed data, max compression, original size modulo 2^32 368287091; gzip -dc kept-1-lsdiagnose.bin | head -c 400 | strings printed csviz0jgtm and <plist version="1.0"> (2026-12-03, iOS 27.2) |
| F5 | A filesystem fake that fails chosen writes exists. | src/drivers/ios/test-slim.ts:152 FaultyFilesystem |
| F6 | simlock lease takes --mode <slim|full>. |
src/cli/commands/lease.ts:97 |
| F7 | A slow-lane test reads a line of the driver's log, debug level included, from the daemon log file (env.logPath). |
e2e/slow-ios-source-isolation.test.ts:120 to :130 |
| F8 | The iOS driver's manual is 7,991 characters and a repository test caps a manual at 8,000, so a line added to it needs another one shortened. | wc -c src/drivers/ios/AGENTS.md printed 7991; src/docs-manuals.repo.test.ts:10 |
| F9 | A slow-lane test sets a worker up in Xcode's own device set with drivers: { ios: { deviceSet: "default" } }, and another lists the installed iOS runtimes. |
e2e/slow-ios-window.test.ts:60; e2e/slow-ios-os-range.test.ts:11 |
Modules touched
drivers/ios: seeds.ts, source-data.ts, new app-database.ts, index.ts (makeReady), testing.ts, test-index.ts, the four test files of X8, AGENTS.md. e2e: new e2e/slow-ios-app-database.test.ts, e2e/slow-baseline.test.ts, e2e/slow-ios-smoke.test.ts (a comment). Searches: rg -n "dropLaunchServicesDatabase|LAUNCH_SERVICES" src/drivers/ios, rg -n "seedIsStale|findReadySeed|markReady|promoteSettled" src/drivers/ios, rg -n "plantSource|seededDatabase" src.
Rules in play
- ADR 0104 §1, §2, §4 and §5 (Accepted — not yet implemented): the parent's rows hold the shapes.
- ADR 0076 §3: the swap stays byte for byte and keeps each file's length; the app database joins the files it covers.
- ADR 0061 §2, as narrowed by ADR 0104: a database that does not fit the rule is still deleted before the copy's first boot.
- ADR 0036 §2: only
IosSourceTablereads or writesios_source_data; S1 is one more migration step of its owner. - Safety rule 1: the seed that B6 makes again is destroyed through its row, as a stale seed is today.
src/ports/AGENTS.md: nofsimport in the driver; the file is read and written through theFilesystemport.crc32ofnode:zlibis a computation, as insrc/drivers/android/sdk-device-definitions.ts:2.
Tests
Seam: the iOS driver built by createDriver (src/drivers/ios/test-index.ts:217); model the cases on src/drivers/ios/index-seed-swap.test.ts.
- B1: Core provisions a copy of a source that recorded its app database, and the database fits I1. Before the boot the copy's database is still there, holds the copy's UDID wherever a lineage UDID stood, has its old length, and its stored checksum is the one I1 gives for its new bytes.: lineage of one UDID; lineage of two UDIDs, both in the file; a UDID stored as UTF-16; a database longer than 1,048,576 bytes with a UDID across that boundary; a body whose CRC's low 16 bits are 0, 1 or 2
- B2: Core provisions a copy whose database cannot be kept. The database is deleted before the boot and the provision succeeds. The first time for a source in a daemon run, the log gets one warn line:
app database of source <sourceId> is not kept (<reason>); its copies rebuild it at boot.: reasonunknown format: the stored checksum is not the computed one; bytes 0 to 3 are notbdsl; the file is shorter than 100 bytes; the recorded length is under 100 or over the file's size; the stored checksum is 0, 1 or 2. Reasonnot recorded by its source: the source's files do not list it; they list it asunreadable. No line and nothing deleted: the copy has no database file. A second provision from the same source: no second line. - B3: A step on the copy fails after the copy was made: the copy is deleted with
simctl deleteand the provision throws that step's error, as today.: the swap throws; the checksum cannot be read or written; the delete of a database that cannot be kept throws - B4: An operator saves a baseline from a lease. The baseline's simulator keeps its app database, and the source's recorded files list it when it holds a lineage UDID. A lease from that baseline then meets B1.: the lease's simulator has a database; it has none (nothing recorded, the save succeeds)
- B5: Core settles a quick seed. The settled seed keeps its app database and records it. The settle's own copy is made as B1 or B2.: the settle's copy has a database; it has none
- B6: Core provisions a kind whose ready seed is settled and was saved before S1 existed. The seed is destroyed and made again as a quick seed, and the copy is made from the new one.: settled, S1 null: made again; settled, S1 = 1: copied; quick, S1 null: copied, not made again; a baseline, S1 null: copied, not stale
- B11: Core boots a simulator for a lease (
makeReadywith purposeprepare; a recovery boot is not checked, because only first boots were measured). The driver reads the identity of each app database file before the boot and again after the boot succeeded. When a file that was there before is gone or has another identity, the simulator rebuilt it, and the first time for a runtime in a daemon run the log gets one warn line:the simulator rebuilt the app database of <udid> (<runtimeId>); a boot on this runtime takes as long as before. The boot's result never changes.: same identity: no line; another identity: the line; a recovery boot: nothing read, no line; the file gone after the boot: the line; no database before the boot (B2 deleted it): no line; a second simulator of the same runtime: no second line;statthrows before or after the boot: no line, the boot succeeds. Slow lane: a B11 line on a lease does not faile2e/slow-ios-app-database.test.ts; the test prints it, and its checksum case fails only when three leases in a row logged it (decided in delivery, pending the maintainer)
Done when
- Every unit case of B1 to B6 and B11 passes.
- Slow lane (real simulator):
e2e/slow-ios-app-database.test.tsleases an iPhone, finds that in every pathsimctl listappsprints under the device set's folder the folder right after it is the lease's own UDID (a system app's bundle path is in the runtime's folder, outside the set; a deleted throwaway's UDID there is a failure), and finds no B2 line in the daemon log. A B11 line for the lease is allowed and the test prints it: about one cold boot in three rebuilt the kept database in the trial runs of 2026-12-03, cause unknown (decided in delivery, pending the maintainer). - Slow lane (real simulator):
e2e/slow-ios-app-database.test.tsmakes the same check on a worker set up withdrivers: { ios: { deviceSet: "default" } }, and with--osnaming an older installed iOS runtime when the Mac has one beside the newest. - Slow lane (real simulator):
e2e/slow-ios-app-database.test.tschanges the stored checksum in the ready seed's database, leases again, finds B2's line withunknown formatin the daemon log, and finds that thelsdiagnosedumps of the kept and of the rebuilt simulator hold the same set of strings once each UDID, everyx-csstore-vis-unit:address and every_CSbr<n>index is masked. The kept side is a lease that logged no B11 line; the test leases up to three times to get one and fails when none kept its database (decided in delivery, pending the maintainer). - Slow lane (real simulator):
e2e/slow-ios-app-database.test.tstakes three leases with the database kept and three with it deleted, in turn, for--mode fulland again for--mode slim, prints the time from request to grant of each, and for each mode the three kept leases take less time together than the three others. - Slow lane (real simulator):
e2e/slow-baseline.test.tspasses, and the daemon log of its run has no B2 line for the baseline it saved. - Slow lane (real simulator):
e2e/slow-ios-smoke.test.tsande2e/slow-ios-source-isolation.test.tspass. - The PR description holds the printed times of one slow-lane run, as the measurement #2040 asked for.
Out of scope
The copy step (simctl create and the one-call clone, the next task). The log folder a leased simulator leaves in ~/Library/Logs/CoreSimulator. Push notifications, which no run tested.
Depends on
None. Issue 2043 (PR 2058) also changes makeReady in src/drivers/ios/index.ts, where B11 adds its check. The maintainer decided on 2026-12-03 that this task does not wait for it: whichever of the two lands second resolves the conflict.
Written by an agent.
- 主要语言
- TypeScript
- 星标
- 730
- 派生
- 44
- 平均合并
- 15 小时 28 分钟
- 30 天内合并 PR
- 387
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstackincubator/simlock 的其他 Issue
-
bug:new
难度 2/5 1-3 小时 新手友好度 73/100
callstackincubator/simlock#2088 ·
维护者通常 1 天内回复
-
bug:new
难度 2/5 1-3 小时 新手友好度 64/100
callstackincubator/simlock#2080 · 1 条评论 ·
维护者通常 1 天内回复
-
task:ready
难度 4/5 3-5 天 新手友好度 52/100
callstackincubator/simlock#2079 ·
维护者通常 1 天内回复
-
platform:ios task:ready
难度 5/5 一周以上 新手友好度 18/100
callstackincubator/simlock#2078 ·
维护者通常 1 天内回复
-
feature:planned
难度 4/5 3-5 天 新手友好度 52/100
callstackincubator/simlock#2075 · 5 条评论 ·
维护者通常 1 天内回复
查看 callstackincubator/simlock 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
simstudioai/sim#10710 ·
维护者通常 1 天内回复
-
Make the HTTP server's keep-alive and headers timeouts configurable可能已有人在做 @mattgodbolt 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
compiler-explorer/compiler-explorer#9902 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复