Android backends: one Android driver runs several backends, picked by tags and the operator's order
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
- 30/100
- Type d'issue
- Fonctionnalité
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
- Domaine
- backend-api-design
Piste de recherche
Start with the listed modules and the seam tests in #2041, especially src/drivers/android/index.ts, src/core/driver-catalog.test.ts, and src/daemon/driver-discovery.test.ts. Read the referenced ADRs and existing driver and catalog behavior, then run the specified tests, pnpm typecheck, and the contract and gateway checks. Done means every listed behavior and test case passes, existing android.virtualDevices configs still load, and the documented events and configuration are updated.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Part of #2041.
Scope
An operator lists Android backends in android.virtualDevices (true = ["avd"], false = phones only, or a list in routing order), and the one Android driver runs them side by side with the phones: a lease picks a backend by requires (--requires avd), else the first listed backend that can make it; catalog.get shows one merged Android entry with each backend's id as a tag; the gateway routes on those tags; seeds stay on avd; a backend taken off the list drains. Only avd and test backends exist, so a worker's behaviour changes only when its config lists more than one.
If it goes wrong, a plain Android lease lands on the wrong backend or is refused, phones stop being served, or an existing config stops loading.
Technical spec
Commit b037ae2a0.
Rows
- Behaviours: B2, B3, B5, B6, B35, B37, B30, B7, B34, B8, B27, B11, B28
- Interfaces: I2, I3, I4, I6, I16
- Existing code: X1, X2, X16, X18, X19, X20, X22, X23, X24, X25, X26, X27, X28, X29, X30, X31, X32, X34, X35, X36, X37, X41, X45, X46, X47, X48, X49, X50, X51
Facts
none
Modules touched
src/drivers/android/index.ts (becomes the platform driver), new src/drivers/android/backend.ts and src/drivers/android/backends.ts, src/drivers/android/definition.ts, src/driver-registry/index.ts, src/core/driver-catalog.ts, src/core/config-validators.ts, src/core/doctor.ts (B37), src/daemon/dispatcher-capabilities.ts (I4 messages), src/drivers/android/sdk-paths.ts (X23), src/core/config-types.ts, src/core/startup-converger.ts, src/core/create-core.ts, src/core/physical-enrollment.ts, src/core/physical-auto-enrollment.ts, src/core/seed-settle/settler.ts, src/core/baselines.ts, src/core/warm-pool/learned.ts, src/leasing/acquisition-spec-resolver.ts, src/leasing/lease-acquisition-coordinator.ts, src/leasing/physical-device-watcher.ts, src/daemon/driver-discovery.ts, src/daemon/worker-composition.ts, src/daemon/dispatcher-leases.ts, src/daemon/dispatcher-status.ts, src/bus/index.ts (I6), src/contract/worker-view.ts, src/gateway/worker-link.ts, src/gateway/routing/stages/has-capabilities.ts, docs/internal/EVENTS.md. Searches: the parent's (drivers.get(, catalog.get(, listCatalog(, virtualDevices, virtualTags).
Rules in play
- ADR 0102 §1, §3, §4, §5 and the drain and tag rules: Accepted — not yet implemented; the parent's rows hold the shapes.
- ADR 0084 §1 (narrowed):
android.virtualDeviceswidens;trueandfalsekeep their meaning, so existing configs load. - ADR 0092 §2 and §3 (narrowed): a backend id is a device tag;
requiresmatching is unchanged. - ADR 0015 §5: a class or range request never installs (B34).
- ADR 0065: backend settings are driver keys under
android.*; core takes only the sections it reads. - ADR 0009 and 0026: the gateway's capability stage routes on the catalog's tags (B27).
src/drivers/AGENTS.md: the platform driver still imports only core, ports andshared; facts reach the bus through callbacks (I6).docs/internal/EVENTS.md:driver.backend-rejectedanddriver.backend-startedget their rows.
Retired words
android.virtualDevicesas a boolean: it istrue,falseor a list of backend ids;truemeans["avd"].- "the Android driver" as one emulator driver: the Android driver is the platform driver, holding phones and the listed backends.
Tests
Seam: each row's Seam cell in #2041, with fake backend definitions (a backend fake) and the real-discovery tests at src/daemon/driver-discovery.test.ts:133; model on src/core/driver-catalog.test.ts and src/daemon/driver-discovery.test.ts.
- B2: The Android platform driver sends every virtual verb of a device to the backend its spec names, and every phone verb to its phone part; phones are served whatever the list holds.: provision, makeReady, shutdown, destroy, estimate, screen, input, device TCP and passthrough on an emulator device reach the
avdbackend only; the same on the fake backend; enrolment, presence, physical lease and inspect reach the phone part with["redroid"], withfalseand with theavdbackend skipped; a device of a backend not running →BackendNotRunningError(I17), neverNoDriverError - B3: The platform driver's listing and catalog survive one backend failing:
listManagedlists the others and names the failed one unreadable (I14); the catalog leaves the failed backend out.: both list; one throws → its devices absent, backend inunreadableBackends; a backend not running (retrying, or its engine stopped) → unreadable; a drained backend whose engine is unreachable → unreadable; catalog with one throwing → the other's entry; all throw → the read throws as today - B5: An operator sets
android.virtualDevices(I3) or a tag list, and the config loads or is refused with the message in I3.: every row of the first Examples table withfakein place ofredroid - B6: The daemon starts the Android platform driver when
adbis found, with each listed backend in list order; a listed backend that cannot start is skipped withdriver.backend-rejected(I6) and the others and the phones run.:true;false(no backend, phones served);["avd"]with no emulator binary → emulator skippedsdk-incomplete, phones served; no adb → no Android driver, as today; owned root refused →driver.root-rejected, platform skipped as today; adb server occupied →driver.adb-server-rejectedas today;createCoregetsbackendBytesPerDevicefrom the listed and drained backends'bytesPerDevice(settings)(fakeat 1 GiB → its devices count 1 GiB); seam for this case: a helperbackendRamFigures(definitions, settings)exported fromsrc/daemon/worker-composition.ts, unit-tested in a newsrc/daemon/worker-composition.test.ts, whose result is passed tocreateCoreatsrc/daemon/worker-composition.ts:274(discoverDriversbuilds no core) - B35: A backend taken off
android.virtualDeviceswhile records name it is drained (I16): loaded for cleanup only, it makes no devices, is in neither the catalog norvirtualTags; its free devices are deleted at start as undervirtualDevices: false(src/core/startup-converger.ts:69), leased ones when their lease ends.:["avd", "redroid"]→["avd"], one free and one leased Redroid device: free deleted at start (virtual-devices-off), leased served to its end then deleted,--requires redroid→CAPABILITY_MISSING; engine down at start → both kept, unreadable, no driver call (B38);core.resumeBackendfor it (engine back) → free one deleted then (B38);["redroid"]from both → free emulators deleted, sources and baselines untouched; no record names it → not loaded - B37: A configured worker tag or
android.virtualTagsentry equal to a backend id loads and names that backend: only its devices carry it; doctor warnstag-names-absent-backend(I16) when the worker does not run it.:android.virtualTags: ["redroid"], Redroid running →--requires redroidgets only Redroid, no finding; Redroid not listed → loads, finding,CAPABILITY_MISSING; workertags: ["avd"]on["redroid"]→ finding;["emulator"]→ an ordinary tag, as today - B30:
catalog.getanswers oneandroidentry made from every running backend's catalog: models, runtimes, model runtimes, details and custom models in union, the first backend's default runtime and images from the backends that have them (I1).: two backends with overlapping models; a model only one backend has; one backend's catalog throws → the other's; class defaults computed on the merged entry; no running backend → the entry a platform with no virtual devices has today (phonesOnlyEntry,src/core/driver-catalog.ts:54), so phones still route - B7: An agent's virtual lease is routed to a backend by its
requiresand the operator's order (I4), class and range requests included.: every row of the second Examples table but the baseline and physical rows;--requires redroid --image-tag google_apiswith no model →BAD_REQUESTbefore the class path (src/leasing/acquisition-requests.ts:65would else answerRUNTIME_MISSING); plain lease with["redroid"]and its engine down, ortruewithavdskipped →NO_DRIVER;--requires avd --image-tag google_apisnot installed →RUNTIME_MISSINGas today; tag, only Redroid running →BAD_REQUEST - B34: A class or ranged request walks the backends and never installs: with no installed pairing anywhere it answers the first candidate's
RUNTIME_MISSING,downloadable: false(ADR 0015 §5).:--requires redroid --os 35, no 35 →RUNTIME_MISSING, no install;--os 36, order["redroid", "avd"], neither has it → the same;--os ">=34", onlyavdhas 35 →avd, 35; downloads on → no change - B8: A lease naming a baseline goes to the backend that saved it, and is refused when
requiresnames another backend.: baseline of backend A, no requires → A; requires A → A; requires B →CAPABILITY_MISSING(I4) - B27:
catalog.getlists the running backends' ids in the platform'svirtualTags, after the configured tags (a configured tag equal to a backend id: listed once, left out while that backend is not listed or running, so the gateway refuses up front); the gateway routes--requires redroidonly to workers whose catalog has it, rereading a catalog at once ondriver.backend-startedanddriver.backend-rejected.: one backend; two;["redroid"]→ noavd;false→ none, as today; 8 configured tags plus 2 ids → 10 accepted;redroidconfigured and running → once;android.virtualTags: ["redroid"]with Redroid not listed, or listed but not running →redroidleft out, gatewayCAPABILITY_MISSING; gateway: worker withredroidpicked, worker without passed over;driver.backend-rejectedpushed → catalog read again before the next pick; no event → the 30 s refresh - B11: The warm pool learns a kind only from a grant on the platform's first running backend, and its targets resolve as plain leases.: a grant on the second backend learns nothing; a grant on the first learns as today; a target with order
["redroid", "avd"]makes the first backend's devices - B28: Seeds, settles and baselines stay with the
avdbackend:listSources,destroySource,settleSeed,ensureSeedandsimlock seedreach it whatever the order, andresolveSeedSpecresolves onavdalone, with no backend walk.: order["redroid", "avd"]:simlock seed --platform androidresolves anavdspec and settles an emulator seed; baseline list, stale check, remove and nuke reach the emulator's sources; with noavdbackend → no sources,simlock seedrefused as for a platform with no settle
Done when
pnpm test:changedandpnpm typecheckpass; each Tests line above is a case table in one test.node .agents/scripts/protocol-bump-check.mjspasses: if a contract file changes (the catalog's tags, a worker view),PROTOCOL_VERSION_RANGEis one abovemain's.- A config from
mainwithandroid.virtualDevices: true,falseor unset loads, andsimlock config get android.virtualDevicesprints what was written. pnpm test:e2e e2e/contract-surface.test.ts e2e/gateway-component-install.test.tspass (catalog and gateway routing on the fake driver).docs/internal/EVENTS.mdlists the two new events, and the website pages updated in this PR (documentation rule 9):website/src/content/docs/docs/reference/configuration.mdx(android.virtualDevices),.../reference/events.mdx,.../using-devices/lease-a-specific-device.mdx(--requires avd).- No real-device test in this task: only
avdruns on hardware, and its path is unchanged; #2051 adds the Redroid one.
Out of scope
The Redroid backend and its settings (#2051), Redroid components and doctor checks (#2052).
Depends on
- #2049
- #2037 because:
src/leasing/acquisition (the planner andacquisition-spec-resolver.ts) it changes - #2038 because: the warm pool (
src/core/warm-pool/) B11 changes - #2043 because:
IdleDeviceDeletionanddeleteIdle(src/core/create-core.ts:425), andEventMapinsrc/bus/index.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
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de callstackincubator/simlock
-
bug:new
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
callstackincubator/simlock#2088 ·
Les mainteneurs répondent en général sous 1 jour
-
bug:new
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
callstackincubator/simlock#2080 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
task:ready
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
callstackincubator/simlock#2079 ·
Les mainteneurs répondent en général sous 1 jour
-
platform:ios task:ready
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 18/100
callstackincubator/simlock#2078 ·
Les mainteneurs répondent en général sous 1 jour
-
iOS copy: keep the app database at the copy's own UDIDPeut-être pris @V3RON l’a pris aujourd’hui. Ouverteplatform:ios task:ready
callstackincubator/simlock#2077 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de callstackincubator/simlock
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
earendil-works/gondolin#222 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
endora-commerce/endora-commerce#2203 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement priority:medium ready-for-human
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
wondermoney/wondermoney#1079 ·
Les mainteneurs répondent en général sous 1 jour