Skip to content

Add phone profile and state files (P1-04) - #7

Merged
Axoineo merged 1 commit into
mainfrom
p1/04-phone-profile
Nov 15, 2026
Merged

Axoineo merged 1 commit into
mainfrom
p1/04-phone-profile

Conversation

@Axoineo

@Axoineo Axoineo commented Nov 15, 2026

Copy link
Copy Markdown
Owner

What changed

Task P1-04 from docs/phases/phase-1.md. One new module, crates/verone-core/src/profile.rs:

  • Profile (phone.toml): what the user chose: id, name, engine, Android version, creation time, display size and density, graphics mode, adb port. Defaults match the example in the plan.
  • State (state.toml): what Verone observed, currently the graphics mode of the last successful boot. A phone that has never started has no such file and gets the default state.
  • Validation: name (not empty, at most 64 characters, no control characters), Android version shape, screen sides 240 to 4096 pixels, density 72 to 640 dpi, adb port 0 or at least 1024. Problems are usage errors with a hint.
  • Schema check: the schema value is read first. A newer file is refused with "Upgrade Verone" before the rest is interpreted; schema 0 or a missing schema is refused too.
  • Atomic writes: text goes to <file>.tmp, which then replaces the target.

Also: PhoneId gains serde support (storage.rs); CHANGELOG.md updated; serde and toml added to verone-core (both on the allow-list).

Why

create, start, info and the container spec all read the profile, so its format and rules must be fixed and tested before the engine tasks begin.

Acceptance test ("Done when")

Run on the reference laptop (Arch Linux, Rust 1.99.1):

$ cargo fmt --check
(no output, exit 0)

$ cargo clippy --all-targets -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo]

$ cargo test
test result: ok. 8 passed   (verone-cli unit tests)
test result: ok. 5 passed   (verone-cli binary tests)
test result: ok. 60 passed; 1 ignored  (verone-core)

Coverage the plan asked for:

  • Round trip: a modified profile, including non-ASCII characters in the name, reads back equal; save and load through a phone folder; state save and load.
  • Each validation failure: 14 invalid values, and the edge values that must be accepted.
  • A file with a higher schema number: refused with an upgrade hint, including when its other settings are unknown to this build.

Notes for the reviewer

  • Files use deny_unknown_fields, so a typo in a hand-edited phone.toml is reported rather than ignored. The cost is that adding a setting later requires a schema bump or a default; that is intended.
  • The Android version is checked only for shape here. Whether an image exists for it is decided by the image table in P1-08.
  • Profile::load refuses a file whose id differs from its folder name.
  • A broken state.toml error says the file is safe to delete, since it records observations only.
  • The one ignored test is the lock helper process from P1-03.
  • No command uses the profile yet; the first is create in P1-11.

🤖 Generated with Claude Code

Add the profile module to verone-core. A Profile (phone.toml) holds
what the user chose: id, name, engine, Android version, creation time,
display, graphics mode and adb port. A State (state.toml) holds what
Verone observed, currently the graphics mode of the last successful
boot.

Both are read and written as TOML. Values are validated, unknown
settings are rejected, and a file whose schema number is newer than
this build understands is refused with an upgrade hint before the rest
of it is interpreted. Files are written through a temporary file so a
crash cannot leave a partial one.

Phone ids can now be read from and written to files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Axoineo
Axoineo merged commit c57e3d1 into main Nov 15, 2026
1 check passed
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.

1 participant