Android backends: device records and baselines name the backend that made them

Aperta
#2,049 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, typescript

Direzione di ricerca

Start with the cited modules in src/core/ and src/leasing/, then read the example tests in src/core/registry-component-records.test.ts, src/core/component-installer-remove.test.ts and src/core/startup-converger.test.ts. The change spans stored records, protocol, capacity, leasing and startup behavior, with dependencies on several other issues. Done means the listed behavior cases pass, the protocol bump check passes, and the website documents spec.backend.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

platform:android task:ready

Part of #2041.

Scope

Every Android virtual device and baseline records the backend that made it (avd for every one today), and core and leasing respect it: a spec of one backend never matches another's device, the RAM budget, component in-use checks and the provision claim go by backend, and a device whose backend is not running is left alone by startup, reclaim, quarantine, the health monitor and doctor. Only the avd backend exists, so nothing a user does changes; status, lease and list show spec.backend on Android virtual devices.

If it goes wrong, an upgraded worker loses or mislabels its devices and baselines, or a device is quarantined and stranded where it should have waited.

Technical spec

Commit b037ae2a0.

Rows
  • Behaviours: B1, B4, B9, B20, B24, B26, B38
  • Stored state: S1, S2
  • Interfaces: I1, I5, I11, I12, I14, I17
  • Existing code: X2, X3, X4, X5, X8, X9, X10, X11, X12, X13, X15, X16, X17, X18, X53, X54, X55, X56, X57
Facts
# Fact Source
F1 The protocol range is { min: 110, max: 110 } today; I5 adds spec.backend to the device view, a contract shape src/contract/protocol.ts:13
F2 origin/main moved from the design's commit 447cc5bbc to b037ae2a0; only src/ports/process-runner.test.ts changed under src/ and e2e/, so the parent's citations hold git diff --stat 447cc5bbc b037ae2a0 -- src e2e
Modules touched

src/core/registry-schema.ts, src/core/baselines-schema.ts, src/core/registry-rows.ts, src/core/domain.ts, src/core/driver.ts, src/core/component-installer.ts, src/core/capacity/devices.ts, src/core/capacity/strategies/resource/index.ts, src/core/create-core.ts, src/core/startup-converger.ts, src/core/startup-read.ts, src/core/reclaim-coordinator.ts, src/core/quarantine-coordinator.ts, src/core/doctor.ts, src/leasing/lease-reconciler.ts, src/leasing/lease-health-monitor.ts, src/contract/device-schemas.ts, src/contract/status-schemas.ts, src/contract/protocol.ts, src/core/driver-catalog.ts (I1), src/core/capacity/strategies/index.ts (createCapacityStrategy, :47), src/core/fake-driver.ts, src/leasing/acquisition-spec-resolver.ts and src/core/warm-pool/converger.ts, learned.ts (X57), src/drivers/android/ (records and components name avd), src/drivers/ios/index.ts, components.ts, runtime-images.ts (componentFootprint as a function, serves, I12), e2e/fake-driver/fake-driver.ts. Searches: the parent's Existing code searches, plus rg "componentFootprint|isReadable\(" src e2e.

Rules in play
  • ADR 0102 §2 (a device record and a baseline name their backend) and the not-running rule: Accepted — not yet implemented; the parent's rows hold the shapes.
  • ADR 0036: registry and baselines tables change only through their owners' next migration (S1, S2: +1).
  • ADR 0061 §2 and §4: a used virtual device is never granted again; baselines keep their versions; the backend joins the spec, not the version.
  • ADR 0010: ComponentInstaller stays the only caller of install and remove; in-use matching moves to what a component serves (I12).
  • src/core/AGENTS.md "Unreadable is not gone": extended from a platform to a backend (I14, I17).
  • src/contract/AGENTS.md protocol rule: I5 bumps the protocol by one in this PR.
Tests

Seam: each row's Seam cell in #2041; model on src/core/registry-component-records.test.ts, src/core/component-installer-remove.test.ts and src/core/startup-converger.test.ts.

  • B1: A daemon starts on a state.db from before this feature: every Android virtual device row and Android baseline gets backend avd, and leases, devices and baselines go on as before.: android virtual row → avd; android physical row → none; ios rows → none; android baseline → avd; ios baseline → none; a database already at the new version is unchanged
  • B4: Devices of two backends never share a pool: a ready device of one backend is never granted for a spec of another.: same model, OS and tag, different backend → not the same spec; same backend → same; both without backend (iOS) → same; Android baselineSpec, warm-pool newest version and learned kind → backend: "avd" (X57)
  • B9: status, lease and list show a virtual device's backend in its spec (I5).: Android virtual device → spec.backend; iOS device → no field; phone → no field
  • B20: A device of a backend with its own RAM figure counts that figure against the RAM budget; every other device counts its platform's (I11).: backend in the map → its figure; a backend skipped at start and started on a retry → its own figure (the map holds it from start); backend not in the map → platform figure; no backend → platform figure; slim iOS unchanged
  • B24: A backend the platform driver reports unreadable (I14) leaves its devices alone: startup ends none of their leases, resumes none of their reclaims, deletes none of them and re-arms none of their quarantines (B38), the health monitor skips them that tick, and doctor reports no drift for them. Devices of the other backends are judged as usual.: device of the unreadable backend → wait / skipped / no finding; its reclaiming, spent shutdown or quarantined device at start → untouched, no driver call; device of another backend missing → missing as today; no backend unreadable → as today
  • B26: A component's in-use count, its removal's block on new devices and the provision claim match devices by the backend and API level the component serves (I12), not by its version string.: remove redroid-34 with a Redroid API-34 device → COMPONENT_IN_USE; the same with only an emulator API-34 device → removed; remove emulator 34 with only a Redroid API-34 device → removed; a Redroid provision during a redroid-34 removal → ComponentBeingRemovedError; an emulator provision during it → goes on; a component with no footprint → no disk reservation
  • B38: Core leaves a device of a backend not running alone: a lease-end reclaim meeting BackendNotRunningError (I17) leaves it reclaiming, no quarantine, no event; a quarantine retry meeting it waits health.probeIntervalMs, uncounted, as for an absent phone (src/core/quarantine-coordinator.ts:222); startup's four steps skip it (StartupRead.isDeviceReadable, I17). It keeps its capacity slot.: lease ends, shutdown throws it → reclaiming, no device.quarantined; destroy throws it after shutdown → shutdown, kept; quarantined device, retry throws it → attempts unchanged, re-armed, never stranded; any other error → quarantine as today; startup with the backend unreadable → none of the four steps calls the driver; capacity counts the device; core.resumeBackend(platform, backend) → the four steps for that backend's devices only: lease ended during the outage → reclaimed, deleted; quarantined → retried, attempts as before; another backend's → untouched; a second call → nothing more

Done when

  • pnpm test:changed and pnpm typecheck pass; each Tests line above is a case table in one test.
  • node .agents/scripts/protocol-bump-check.mjs passes: PROTOCOL_VERSION_RANGE is one above main's in this PR (I5).
  • A state.db from main opens: the migration test of B1 loads a fixture written by today's schema and finds avd on Android virtual rows and baselines only.
  • The website names spec.backend (documentation rule 9): website/src/content/docs/docs/getting-started/first-lease.mdx, after the lease JSON at :55 (an iOS spec, which gains no field), says an Android virtual device's spec carries backend.
  • No slow-lane test: the emulator path is unchanged, and the fast e2e suite (pnpm test:e2e) still passes on the fake driver.

Out of scope

Several backends, routing and the merged catalog (#2050), the Redroid backend (#2051), Redroid components and doctor checks (#2052).

Depends on

  • #1905 because: PROTOCOL_VERSION_RANGE (src/contract/protocol.ts); its PR #1976 bumps it and is ready first
  • #1904 because: PROTOCOL_VERSION_RANGE; PR #1972 bumps it
  • #1154 because: src/core/create-core.ts and PROTOCOL_VERSION_RANGE; PR #2016
  • #1155 because: PROTOCOL_VERSION_RANGE; PR #2028
  • #1907 because: PROTOCOL_VERSION_RANGE
  • #2005 because: PROTOCOL_VERSION_RANGE
  • #2006 because: PROTOCOL_VERSION_RANGE
  • #2045 because: PROTOCOL_VERSION_RANGE
  • #2043 because: src/core/startup-converger.ts, src/leasing/lease-health-monitor.ts and the converger's ports at src/core/create-core.ts:423
  • #2044 because: src/drivers/ios/index.ts
  • #2046 because: src/drivers/ios/index.ts

Written by an agent.

Lingua principale
TypeScript
Stelle
730
Fork
44
Merge medio
15h 28m
PR unite (30g)
387

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstackincubator/simlock

Tutte le issue di callstackincubator/simlock

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.