iOS seed: the make waits for the first boot's language settings

Abierto
#2,107 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend, testing

Línea de trabajo

Start with the iOS driver seam at src/drivers/ios/test-index.ts:217 and model unit cases on src/drivers/ios/index-seed-sources.test.ts; read the referenced seed, source data, clock, and filesystem port code plus ADRs 0090, 0076, and 0036. Implement and verify B12–B14 across the listed unit and slow lane tests, including the default device set and older runtime cases. Done means the specified seed state, timeout logs, simulator database checks, and driver guidance all pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

platform:ios task:ready

Part of #2070.

Scope

After this PR a seed is saved only once its first boot's language settings are on disk, so a copy of it does not redo the first boot's language step: its app database stays, and its boot is not 10 to 20 s longer. When the settings do not appear within 20 s the seed is used as it is, the daemon log says so, and the next lease of its kind makes the seed again, once.

If this goes wrong, the first lease of a kind waits up to 20 s more for nothing, or a seed is made again when it need not be.

Technical spec

Commit 4d3c176fb.

Rows
  • Behaviours: B12, B13, B14
  • Stored state: S6
  • Interfaces: I5
  • Existing code: X20, X21, X22, X23, X24, X25
Facts
# Fact Source
F1 A slow-lane test finds the sources set beside the device set, or under <home>/devices/ios-sources for Xcode's own set, and lists its simulators. e2e/slow-baseline.test.ts:75 to :80
F2 A slow-lane test reads a line of the driver's log from the daemon log file (env.logPath). e2e/slow-ios-source-isolation.test.ts:120 to :130
F3 FakeClock counts its pending timers, so a test can tell that a make set none. src/ports/clock.ts:65
Modules touched

drivers/ios: seeds.ts, source-data.ts, testing.ts, test-index.ts, the ten test files of X23, a new test file for B12 to B14, AGENTS.md. e2e: e2e/slow-ios-app-database.test.ts. Searches: rg -n "throwawaySeedSteps" src (10 files); rg -n '"listapps", throwawayUdid' src (4 files, one of them index-device-set.test.ts); rg -n "seedIsStale|findReadySeed|markReady|promoteSettled" src/drivers/ios; rg -n "GlobalPreferences" src e2e (0).

Rules in play
  • ADR 0090 §1 and its first rejected alternative: the seed's make still boots a throwaway once and saves it at once, and the first lease is served by the same call. The wait is not the fixed wait that ADR rejected: it ends when the file holds the key and is cut off at 20,000 ms.
  • ADR 0076 §1: the throwaway is still booted once and cloned unbooted; the reads happen while it is booted, before the shutdown.
  • ADR 0036 §2: only IosSourceTable reads or writes ios_source_data; S6 is one more migration step of its owner, after #2077's.
  • Safety rule 1: the seed B14 makes again is destroyed through its row, as a stale seed is today.
  • src/ports/AGENTS.md: no fs import and no setTimeout in the driver; the file is read through the Filesystem port and the 250 ms waits use the Clock port, as #waitUntilIdle does.
Tests

Seam: the iOS driver built by createDriver (src/drivers/ios/test-index.ts:217); model the cases on src/drivers/ios/index-seed-sources.test.ts.

  • B12: Core provisions a kind that has no ready seed (a lease, or simlock seed). After the throwaway's boot is ready the driver reads I5 at once and then every 250 ms, and shuts the throwaway down as soon as the file holds the key. The seed's row turns ready with S6 = 1. Nothing is logged.: the key is there at the first read: shutdown follows with no timer set; the file is missing, then there with the key at the fourth read (750 ms): shutdown follows that read; the file is there without the key, then with it; the file is empty; one read throws and the next succeeds
  • B13: As B12, but the file does not hold the key 20,000 ms after the first read. The driver shuts the throwaway down and saves the seed as today, and the provision succeeds. The row turns ready with S6 = 0, and the log gets one warn line: the first boot of seed <sourceId> did not save its language settings in 20000 ms; its copies boot slower, and the next lease of its kind makes the seed again.: the file never appears; the file is there without the key for the whole 20,000 ms; every read throws; the key appears only after the 20,000 ms
  • B14: Core provisions a kind whose ready seed is quick and has S6 = 0. The seed is destroyed as a stale seed is today and made again as B12; the copy is made from the new one. When the new make also ends without the key, its row turns ready with S6 = 2 and the warn line is the first boot of seed <sourceId> did not save its language settings in 20000 ms; its copies boot slower. A seed with S6 = 2 is copied and never made again for this reason.: quick, S6 = 0, the new make finds the key: made again, S6 = 1; quick, S6 = 0, the new make does not: made again, S6 = 2, the second line; quick, S6 = 2: copied; quick, S6 = 1: copied; quick, S6 null: copied; settled, S6 null: copied; a baseline, S6 null: copied

Done when

  • Every unit case of B12 to B14 passes.
  • The tests of X23 pass with the helper that plants the settings file, and none of them advances the clock for the wait.
  • Slow lane (real simulator): e2e/slow-ios-app-database.test.ts, after its first lease, finds one simulator in the sources set whose data/Library/Preferences/.GlobalPreferences.plist holds the text AppleLanguagesSchemaVersion, or else finds B13's line in the daemon log.
  • Slow lane (real simulator): in every case of e2e/slow-ios-app-database.test.ts a line that the simulator rebuilt the app database fails the test unless the daemon log holds B13's or B14's line; the kept side of its checksum case leases once.
  • Slow lane (real simulator): in the cases of e2e/slow-ios-app-database.test.ts that change the seed's database (the checksum case and the timing case), a daemon whose log holds B13's line takes one more lease before the test reads the seed's database path, so the seed B14 made is the one it changes.
  • Slow lane (real simulator): e2e/slow-ios-app-database.test.ts makes the same two checks on a worker set up with drivers: { ios: { deviceSet: "default" } }, and with --os naming an older installed iOS runtime when the Mac has one beside the newest.
  • Slow lane (real simulator): e2e/slow-ios-smoke.test.ts, e2e/slow-ios-source-isolation.test.ts and e2e/slow-baseline.test.ts pass.
  • src/drivers/ios/AGENTS.md says a seed's make waits for the language settings, and stays within 8,000 characters.

Out of scope

The words of B11's line. A settled seed's row key (#2102). Any other setting a first boot writes late. A check after ready for a database replaced later. Making a settled seed or a baseline again.

Depends on

  • #2078 because: src/drivers/ios/seeds.ts (#makeSeed, #findOrMakeSeed, seedIsStale) and src/drivers/ios/test-index.ts (throwawaySeedSteps)
  • #2077 because: src/drivers/ios/source-data.ts (S1's migration comes first), the exported readRange, and e2e/slow-ios-app-database.test.ts

Written by an agent.

Lenguaje dominante
TypeScript
Estrellas
730
Forks
44
Merge medio
15 h 44 min
PR fusionados (30 d)
378

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de callstackincubator/simlock

Todos los issues de callstackincubator/simlock

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.