Skip to content

[Intern] Audit hanzo start / hanzo up / hanzo down resource flags & prerequisite error messages #110

Done

Description

@zeekay

Track: Pod A — Runtime & CLI (Task #2)
Onboarding Guide: https://docs.hanzo.ai/docs/contributing/oss-onboarding
Bounty Program: https://hanzo.ai/bounty

Objective

Audit --cpus, --memory, --disk on hanzo start and --cloud-only / --vm on hanzo up/down. Ensure missing runtime prerequisites (KVM permissions, Virtualization.framework, stale kubeconfig) produce clear, actionable error messages instead of raw OS errors.

Getting Started

git clone https://github.com/hanzoai/cli.git && cd cli

Quick build / test command: cargo test --locked

Acceptance Criteria (Definition of Done)

  • Add unit tests covering flag parsing and validation for --cpus, --memory, --disk, --cloud-only, and --vm.
  • Ensure actionable remediation messages are returned when runtime prerequisites are absent.
  • All unit tests and cargo clippy --locked --all-targets -- -D warnings pass.
  • Paste reproducible build/test output in your PR description and reference this issue (Closes #<number>).
  • If you hit any broken setup step or unclear docs along the way, include a quick fix in README.md or open a companion PR on hanzoai/docs.

Activity

  1. added
    bounty
    intern
    on Nov 27, 2026
  2. linear commented on Nov 27, 2026

    @linear
  3. Jonesc2321601 commented on Nov 29, 2026

    @Jonesc2321601

    Taking this on: #128 — start/up/restart: validate --cpus/--memory/--disk before booting; down --vm no-ops when idle.

    What the PR does against the acceptance criteria:

    • Flag validation with tests. New src/commands/lifecycle/shape.rs: bounds for --cpus (2..=128), --memory (>= 2048 MiB), --disk (>= 8192 MiB), plus a host-capacity check (--cpus 16 on an 8-CPU host is rejected with --cloud-only named as the way out). Six unit tests cover each rejection and the host-probe-unknown case.
    • Actionable messages instead of raw OS errors. Every rejection names the flag, the bound that failed and a value that works, e.g. `--memory 1024` is below the 2048 MiB minimum Cloud needs to start (the API server is OOM-killed below it) — run with `--memory 4GiB`. The KVM / Virtualization.framework prerequisites already had messages in this tree (vm::require_kvm, vm::check_linux_x86_64_host); the missing half was the shape, which used to fail inside the guest as an OOM kill or a full root filesystem.
    • --cloud-only / --native are untouched by design: they never create the microVM whose shape is being validated, so the check is skipped for them.
    • hanzo down --vm on an idle machine now prints · no local runtime is running — nothing to stop (start it with hanzo start) instead of entering the stop path with no pid.
    • cargo clippy --locked --all-targets -- -D warnings passes on the branch. That needed one small extra commit: eight dead_code items under up/ and in vm.rs that are only reachable from unit tests already failed -D warnings on main; they now carry #[allow(dead_code)] with a one-line note. Nothing was deleted and no behaviour changed.
    • Reproducible output is pasted in the PR description: real cargo test --locked --bin hanzo shape:: and release-binary runs of each rejection message, plus the Windows note that ten sh/PATH-dependent tests in the suite fail identically on clean main (verified in a worktree).

    Also open from me: #127 for #111 (hanzo doctor self-checks).

  4. linhsama commented on Nov 29, 2026

    @linhsama

    Hi, I can audit the resource flags and prerequisite error messages in cmd/hanzo/flags.go and its associated unit test files. I will verify the changes locally by running the full test suite to ensure all flag validations and error paths pass successfully. Please confirm my assignment to this issue before I submit the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bountyintern

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions