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

未关闭
#2,049 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
android, typescript

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
730
派生
44
平均合并
15 小时 28 分钟
30 天内合并 PR
387

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/simlock 的其他 Issue

查看 callstackincubator/simlock 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。