Skip to content

Add error type, process runner and output helpers (P1-02) - #5

Merged
Axoineo merged 1 commit into
mainfrom
p1/02-errors-process-output
Nov 15, 2026
Merged

Axoineo merged 1 commit into
mainfrom
p1/02-errors-process-output

Conversation

@Axoineo

@Axoineo Axoineo commented Nov 15, 2026

Copy link
Copy Markdown
Owner

What changed

Task P1-02 from docs/phases/phase-1.md.

  • crates/verone-core/src/error.rs: error type with a message, an optional "what to do" hint, and a kind that maps to the command's exit code (1 failed, 2 usage, 3 host check, 4 not found, 5 busy).
  • crates/verone-core/src/process.rs: runs external programs with an argument list (never a shell string), a time limit, and captured or pass-through output. Logs each command to standard error when verbose.
  • crates/verone-cli/src/output.rs: prints results as text or JSON, and errors as error: … then hint: ….
  • crates/verone-cli/src/main.rs: global --json and -v/--verbose options; errors set the exit code.
  • docs/phases/phase-1.md: P1-02 text corrected (see below).
  • CHANGELOG.md updated.

Why

Every later task runs the container runtime, adb or scrcpy through the process runner and reports failures through this error type, so both need to exist and be tested first.

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. 18 passed  (verone-core)

$ target/release/verone nonsense; echo $?
error: unexpected argument 'nonsense' found
2

The process runner tests cover the cases the plan lists (time limit, non-zero exit, program not found, output capture) and four more: large output, a program ended by a signal, a background child holding the output open, and arguments with shell characters passed literally.

Notes for the reviewer

  • Plan correction: the plan placed the printing helpers in verone-core. They are in verone-cli, because the desktop app and server will reuse the core and should not inherit terminal printing. The plan text is updated in this pull request.
  • Crates added, all on the allow-list: thiserror, serde, serde_json.
  • emit and two Context fields carry expect(dead_code) with the task that will first use them, so the attribute must be removed when that task lands.
  • When a program exits but a background child keeps its output open, the runner waits at most 2 seconds for the rest of the output, then returns what arrived.
  • On a time limit the runner kills the program it started, not that program's own children.

🤖 Generated with Claude Code

verone-core gains an error type that carries a message, an optional
hint and a kind that maps to the command's exit code, and a process
module that runs external programs with an argument list, a time limit
and captured or pass-through output.

verone-cli gains the global --json and --verbose options, helpers that
print results as text or JSON, and error printing that sets the exit
code from the error kind.

The printing helpers live in verone-cli rather than verone-core, so
the plan text for P1-02 is corrected to match.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Axoineo
Axoineo merged commit 0adaccb 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