Skip to content

test: add coverage for dream-doctor Darwin RAM/disk and dream gpu Apple branches #403

@yasinBursali

Description

@yasinBursali

Summary

fix/dream-cli-apple-silicon-coverage adds five new GPU_BACKEND=apple code paths (_gpu_status, _gpu_topology, _gpu_validate, _gpu_reassign, cmd_status_json) plus a Darwin branch in scripts/dream-doctor.sh (RAM via sysctl hw.memsize, POSIX df -k). All paths were verified manually on an Apple M4 host, but no automated regression test locks the behavior in. A future refactor could silently re-break them.

Suggested additions

  1. tests/contracts/test-dream-doctor.sh — add a Darwin fixture:

    • Assert .preflight.inputs.ram_gb is non-zero on Darwin when sysctl hw.memsize works.
    • Assert .preflight.inputs.ram_gb falls back to .env's HOST_RAM_GB when detection yields 0.
    • Assert .preflight.inputs.disk_gb is non-zero on Darwin when df -k "$HOME" succeeds.
    • Assert .autofix_hints contains zero incompatible with current GPU backend entries on Apple backend.
  2. New tests/test-gpu-apple.sh — mock-based regression coverage:

    • GPU_BACKEND=apple dream gpu status: header renders, body contains "Chip:" / "Unified memory:" / "GPU cores:" / Apple footer line. Exit 0.
    • GPU_BACKEND=apple dream gpu topology: "Single integrated GPU" line. Exit 0.
    • GPU_BACKEND=apple dream gpu validate: "Result: 0 check(s) passed, 0 failed". Exit 0.
    • GPU_BACKEND=apple dream gpu reassign: "not applicable on Apple Silicon". Exit 1.
    • GPU_BACKEND=apple dream status-json: .gpu is an object with backend/chip/unified_memory_gb/gpu_cores keys. Exit 0.
  3. Negative assertion — with GPU_BACKEND=nvidia or GPU_BACKEND=amd, the Apple branches do NOT fire (falls through to nvidia-smi-missing fallback on this macOS host).

The contract tests already gate on uname in fixtures, so the Darwin assertions should be skipped on Linux CI with a clean SKIP and fully run on any macOS runner.

Priority

Medium. Silent regressions on macOS install are user-facing.

Origin

Surfaced by the Critique Guardian during the PR fix/dream-cli-apple-silicon-coverage review (W4 in the verdict).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions