Files
Lap Tran bc7daf8590 Restore archived tasks, fix dashboard scroll-reset, bind ornith, add Playwright smoke test
- **Restore 82 completed tasks** from tasks/complete/ back to tasks/ top
  level (all <7 days old per the cleanup policy; premature bulk archive
  was fixed).
- **Dashboard: fix scroll-reset on auto-refresh** — renderBoard rebuilds
  the board via innerHTML every 2s, destroying each column-body's
  scrollTop. Now snapshots column-body scrollTop + board.scrollLeft +
  view.scrollTop before rebuild and restores after (matched by
  PHASE_GROUPS index).
- **Dashboard UI additions** (pre-existing unstaged work): approval
  section cards, transition buttons, inline artifact editor (textarea for
  writing missing SPEC/VERDICT/etc from the detail modal).
- **Bind ornith as Implement model** — config.md: Model explicit to
  omlx/Ornith-1.0-35B-4bit-mlx, context window 32768. Interactive
  autopilot already used ornith via opencode default; now explicit.
- **Fix cleanup stub** — automaton-cleanup.sh had a stale --project arg
  pointing at a pytest temp dir (test isolation leak). Rewired to point
  at ~/.automaton.
- **Fix plist-isolation test** — test asserted host plist doesn't exist,
  but a real install creates it. Now snapshots mtime before run, asserts
  unchanged after (only a write during the test counts as bleed).
- **New Playwright smoke test** (tests/test_dashboard_ui.py) — 2 tests:
  board renders tasks, column scroll survives auto-refresh tick.
  Verified the test fails without the scroll fix (scrollTop resets to 0).
  Skipped via importorskip when playwright is absent (main CI stays
  green).
- **Clarify SI loop scope in README** — new-project onboarding section
  documents the framework-scoped self-improvement loop and options
  (leave/pause/create project loop).
- **CHANGELOG** documents all changes including the known model-divergence
  gap (mde tasks marked complete but per-role model binding was never
  implemented).
2026-06-26 10:05:18 -04:00

4.7 KiB

IMPLEMENTATION — vram-detect-cross-platform-tests

Parent: runnable-test-suite (see PARENT_SPEC.md). SPEC: tasks/runnable-test-suite/subtasks/vram-detect-cross-platform-tests/SPEC.md.

File touched

  • tests/test_vram_detect.py — extended with 11 new test functions + helpers. No other file was modified.

Test functions added (11)

# Function What it verifies
1 test_detect_ram_linux /proc/meminfo parse → (16_384_000, 8_192_000) via detect_ram() with platform.system() patched to Linux.
2 test_detect_ram_macos sysctl -n hw.memsize → "34359738368" → total_kb 33_554_432, available == total.
3 test_detect_ram_windows wmic ComputerSystem → TotalPhysicalMemory=34359738368 → total_kb 33_554_432.
4 test_detect_gpu_vram_nvidia_linux nvidia-smi → "24576\n" → (25_165_824, 25_165_824, 1).
5 test_detect_gpu_vram_apple_silicon system_profiler Apple M2 snippet + sysctl hw.memsize=17179869184 → total > 0, num >= 1.
6 test_detect_gpu_vram_windows_wmic wmic win32_VideoController → AdapterRAM=8589934592 → total_vram_kb 8_388_608.
7 test_lookup_model_context_unknown_returns_zero _lookup_model_context("completely-unknown-model") → 0.
8 test_lookup_model_context_prefix_match deepseek-r1:7b → 64_000; llama-3.1-8b-instruct → 128_000.
9 test_detect_model_context_ollama_probe No config model; ollama list returns llama-3.1-8b → context 128_000.
10 test_run_command_windows_powershell_wrapper On Windows, Get-CimInstance ... is routed through powershell -NoProfile -NoLogo -Command "...".
11 test_detect_ram_linux_regression (LOCKED) Exact match (32_768_000, 16_384_000) for a 32GB /proc/meminfo fixture via _detect_ram_linux().

Counting parametrize cases: 11 new tests (no parametrization used; each function is a single case).

Existing tests modified

None. All 9 pre-existing test functions (test_lookup_model_context, test_parse_token_value, test_extract_value, test_parse_config_model, test_parse_config_model_skips_code_blocks, test_parse_vram_config_manual, test_recommend_context_api_model, test_recommend_context_manual_mode, test_extract_model_from_file_respects_10kb_limit) were preserved byte-for-byte. No diffs to existing code.

Mocking strategy

Every external call is mocked via monkeypatch.setattr — no live subprocess, system_profiler, nvidia-smi, or wmic invocation:

  • vram.platform.system → lambda returning the target OS string.
  • vram.subprocess.run → _make_fake_run(responses) mapping cmd[0] (or the joined PowerShell string) to a canned _FakeResult(stdout, returncode=0).
  • vram.shutil.which → lambda returning a truthy name (or None for non-ollama in the ollama probe test).
  • Path.exists / Path.read_text → _patch_meminfo serves the fixture only for /proc/meminfo and falls through to the original for any other path (keeps tmp_path and pytest internals working during the test).
  • vram.Path.home → tmp_path in the ollama probe test so the real ~/.automaton/config.md is never consulted.

Module-level multiline string fixtures: MEMINFO_LINUX_16GB, MEMINFO_LINUX_32GB, APPLE_M2_PROFILER, WMIC_VIDEOCONTROLLER, WMIC_COMPUTERSYSTEM, OLLAMA_LIST.

Acceptance criteria

Criterion Result
pytest tests/test_vram_detect.py -v exits 0, all new tests pass PASS — 20/20 (9 existing + 11 new)
pytest tests/ -v exits 0 PASS — 235 passed, 0 errors
Streak: 10 consecutive clean pytest tests/ -v runs PASS — STREAK_COMPLETE attempt=1 clean=10/10
No live subprocess against real hardware PASS — every subprocess.run / shutil.which / Path I/O patched
Every new test < 500ms PASS — entire file 0.01s; slowest 60 durations < 0.005s
No pytest.mark.skip PASS — none used
No new deps PASS — stdlib + pytest only
Did NOT touch scripts/vram_detect.py CONFIRMED — only tests/test_vram_detect.py edited

Final pass counts

  • Baseline (tests/test_vram_detect.py): 9 passed.
  • After implementation (tests/test_vram_detect.py): 20 passed (+11).
  • Full suite baseline: 224 passed.
  • Full suite after: 235 passed (+11), 0 errors, 0 skipped.

Streak result

STREAK_COMPLETE attempt=1 clean=10/10

STOP-and-report triggers hit

None. All 11 SPEC-required tests passed against subtask-2's vram_detect.py without any signature mismatch. No edits to scripts/vram_detect.py were required or made. The ollama list probe (SPEC test 9) is present in vram_detect.py:525-539 and works as specified.