Skip to content

fix(android): size owned AVD data partitions - #97

Merged
janicduplessis merged 1 commit into
mainfrom
codex/issue-83-data-partition
Aug 29, 2026
Merged

fix(android): size owned AVD data partitions#97
janicduplessis merged 1 commit into
mainfrom
codex/issue-83-data-partition

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Description

Closes #83. Newly created owned Android AVDs use a measured 8 GiB userdata partition instead of the 10 GiB setting observed on the selected API 36 profile. The 8 GiB candidate retained about 6.24 GiB free after five real dev-client install/relaunch/Metro reload cycles plus a snapshot-disabled cold restart; the 6 GiB emulator floor worked but was deliberately not selected because repeated-install headroom matters.

This does not claim a large reduction in fresh sparse-file du or a proven near-full-disk preflight improvement: measured initial host allocation was nearly identical between 8 GiB and 10 GiB, and no near-full-disk experiment was attempted. It establishes a lower logical userdata growth ceiling while retaining measured development headroom.

Solution

  • Add layered android.dataPartitionSizeGb (integer GiB, default 8, range 6–16384).
  • Validate invalid values as STIM_CLI_BAD_ARG before device mutation.
  • Atomically replace and read back disk.dataPartition.size after avdmanager create and before first boot, using the canonical owned AVD content-directory resolver.
  • Mark the device setup incomplete before configuration. Roll back failures through centralized owned-device teardown; if deletion fails, retain the ownership record and require successful cleanup before any retry can recover or boot that AVD.
  • Keep creation-collision recovery isolated from post-create configuration failures. Re-read the current same-workspace device record after a collision and refuse recovery when another concurrent run registered it, so stale snapshots cannot boot an incompletely configured AVD.
  • Leave recorded and recovered existing AVDs unchanged because Android userdata grows but does not shrink; recreation adopts a changed value.
  • Update README, shipped skill, guide output, and contract/unit tests.

A broader safe AVD settings surface is tracked separately in #96; unrestricted replacement config files are intentionally out of scope because they can redirect storage/image paths outside the owned device.

Test plan

  • pnpm run format:check
  • pnpm run lint
  • pnpm run build
  • pnpm run typecheck
  • pnpm run knip
  • pnpm test (2,291 tests)
  • pnpm run test:e2e (12 tests)
  • Real Android Emulator 36.4.9 / API 36 arm64 16 KB-page image:
    • 10 GiB baseline: first boot 18.962s; about 8.50 GiB free after the representative workflow.
    • 6 GiB boundary: install, launch, navigation, and reload passed; about 4.61 GiB free afterward.
    • 8 GiB candidate: first boot 18.302s; 75 MB Expo dev-client install/launch/navigation/reload passed; five total adb install -r + relaunch + Metro reload cycles passed with about 6.61 GiB free.
    • Snapshot-disabled cold restart took 13.070s; the app persisted, real UI and Metro reload passed, about 6.24 GiB remained free, and host du reached 2,482,948 KiB.
    • All three owned measurement AVDs were centrally deleted; the unrelated user AVD on port 5554 was untouched.

@janicduplessis
janicduplessis force-pushed the codex/issue-83-data-partition branch from c417119 to ae27f6a Compare August 29, 2026 10:53
@janicduplessis
janicduplessis force-pushed the codex/issue-83-data-partition branch from ae27f6a to f90a704 Compare August 29, 2026 10:59
@janicduplessis
janicduplessis marked this pull request as ready for review August 29, 2026 11:01
@janicduplessis
janicduplessis merged commit 147818d into main Aug 29, 2026
5 checks passed
@janicduplessis
janicduplessis deleted the codex/issue-83-data-partition branch August 29, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shrink what an owned AVD costs on disk (partition size, no snapshot on exit), and report device footprint in gc

1 participant