iOS copy: simctl create and one clone of the source's data

Ouverte
#2,078 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
18/100
Type d'issue
Fonctionnalité
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript

Piste de recherche

Start with the iOS driver seam in src/drivers/ios/test-index.ts and the filesystem port in src/ports/filesystem.ts; read the referenced port and iOS driver manuals and ADRs first. Implement and verify behaviors B7–B10 across the listed adapters, fakes, driver tests, and slow lane tests. Done means all specified unit cases pass, both real simulator scenarios show the fast-copy log without fallback, and the baseline slow lane passes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

platform:ios task:ready

Part of #2070.

Scope

After this PR the copy of an iOS lease is made by simctl create and one clone of the source's data folder, not by simctl clone, so the copy step takes a few seconds less. Where the clone cannot be made, the copy is made as before and the daemon log says so once.

If this goes wrong, an iOS lease fails at the copy, or a simulator with no lease is left in the device set.

Technical spec

Commit 4d3c176fb.

Rows
  • Behaviours: B7, B8, B9, B10
  • Stored state: S4, S5
  • Interfaces: I2, I3, I4
  • Existing code: X1, X6, X9, X10, X11, X14, X16, X19, X15
Facts
# Fact Source
F1 The in-memory filesystem's copyTree rejects when the target exists. src/ports/filesystem.ts:580
F2 NodeFilesystem runs cp for copyTree through its process runner and kills it at the limit; I2's adapter is modelled on it. src/ports/filesystem.ts:226 to :256
F3 The ports manual asks for a bound on every wait an adapter makes and for a fake beside every adapter. src/ports/AGENTS.md:15
F4 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
F5 A slow-lane test reads a debug line of the driver from the daemon log file (env.logPath). e2e/slow-ios-source-isolation.test.ts:120 to :130
F6 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
F7 #2045 and PR #2063 each add a verb to the Filesystem port and to the same two fakes (X16). Whichever lands after another adds its lines beside the other's. #2045 Modules touched; gh pr view 2063 --json files lists src/ports/filesystem.ts and src/auth/admin-secret.test.ts
Modules touched

ports: filesystem.ts (the interface, NodeFilesystem, MemoryFilesystem), filesystem.test.ts, AGENTS.md. drivers/ios: seeds.ts, source-data.ts (ReadySeed), index.ts or simctl.ts (only Simctl holds ios.simulator.createTimeoutMs today, src/drivers/ios/simctl.ts:23, and Seeds needs it for I2), testing.ts, test-index.ts (plantSeedClone), the thirteen test files of X19, AGENTS.md. auth: admin-secret.test.ts (X16). e2e: e2e/slow-ios-app-database.test.ts, the file #2077 adds. Searches: rg -n "copyTree" src, rg -n "Filesystem = \{" src, rg -n '"clone"' src/drivers/ios, rg -n "ReadySeed" src/drivers/ios.

Rules in play
  • ADR 0104 §3 (Accepted — not yet implemented): the parent's rows hold the shapes.
  • ADR 0061 §2, as narrowed by ADR 0104: the copy still gets both marks, the overrides and the swap in today's order; copyTree stays as it is for Android.
  • ADR 0076 §3: a copy whose step fails is deleted.
  • src/ports/AGENTS.md: a new call to a program is a port verb with a Node adapter and a fake, and its wait is bounded by timeoutMs.
  • Safety rules 1 and 8: the driver deletes only the simulator whose UDID its own simctl create printed.
  • Documentation rule 7: the manuals of ports and of the iOS driver say what the code cannot: the perl call and the fallback.
Tests

Seam: the iOS driver built by createDriver (src/drivers/ios/test-index.ts:217), modelled on src/drivers/ios/index-seed-provision.test.ts; I2's adapter in src/ports/filesystem.test.ts with a scripted process runner.

  • B7: Core provisions a copy. The driver runs I4 with the source's device type and runtime, removes the new simulator's data folder, clones the source's data in its place with I2, then goes on as today: marks, overrides, B1 or B2, swap. No simctl clone runs. The debug log says copied <udid> in <ms> ms by fast copy.: a seed; a baseline (the baseline row's device type and runtime, not the request's); a settle's copy; the source's seed turn is held from I4 to the end of I2
  • B8: The new simulator's data folder is not there yet when I4 returns and appears a moment later, so I2 is refused. Seen on 2026-12-02: 2 of 5 clones failed with [Errno 17] clonefile failed though the folder was absent when simctl create returned. After I2 rejects, the driver looks at data: when it exists, it is removed and I2 runs again, three I2 calls at most; when it does not exist, the failure is B9 at once.: data there when I4 returns: removed, one I2; data absent when I4 returns and there at the first I2: one retry; I2 rejects and data is absent: B9, no retry; refused three times with data there each time: B9
  • B9: The fast copy fails. The created simulator is deleted with simctl delete, the copy is made with simctl clone as today, and the provision succeeds. The log gets one warn line: fast copy failed (<reason>); copying with simctl clone until the daemon restarts, where <reason> is I2's error message. Later provisions of this driver run simctl clone and no I4. The debug log says copied <udid> in <ms> ms by simctl clone.: I2 rejects once it was refused three times; I2 rejects with a time limit; I2 rejects because perl cannot start; the delete of the created simulator fails too: logged with its UDID, the provision still succeeds; a second provision after a failure: clone, no create
  • B10: I4 itself fails or passes its limit. The provision throws as a failed simctl clone does today, and a UDID printed late is deleted.: I4 exits non-zero; I4 prints no UDID; I4 passes ios.simulator.createTimeoutMs

Done when

  • Every unit case of B7 to B10 passes.
  • src/ports/filesystem.test.ts proves I2's adapter: the command and arguments of I3 word for word, each error message of I2, and the rejection off macOS.
  • Slow lane (real simulator): e2e/slow-ios-app-database.test.ts leases an iPhone and finds in the daemon log, at debug level, copied <udid> in <ms> ms by fast copy for the lease's UDID and no B9 line; simctl listapps and an app install work on that lease.
  • Slow lane (real simulator): e2e/slow-ios-app-database.test.ts finds the same fast copy line for a lease on a worker set up with drivers: { ios: { deviceSet: "default" } }.
  • Slow lane (real simulator): e2e/slow-baseline.test.ts passes with the copy made this way.
  • The PR description holds the copy times the slow-lane run printed.

Out of scope

Making a seed, a settle and a baseline save still use simctl clone. Setting the group and folder times of a cloned folder back. A compiled helper for the clone.

Depends on

  • #2077 because: #cloneCopy in src/drivers/ios/seeds.ts

Written by an agent.

Langage dominant
TypeScript
Étoiles
730
Forks
44
Merge moyen
15 h 28 min
PR mergées (30 j)
387

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de callstackincubator/simlock

Toutes les issues de callstackincubator/simlock

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.