Add tests/: four suites, a runner, and a sandbox that can't escape

These grew one bug at a time in a scratch directory and were about to be thrown
away, having caught four real regressions between them. Move them in as they
are -- plain scripts, stdlib only, no test dependency -- behind a shared harness
and `python3 tests/run.py`.

The harness exists mostly for its guard. A suite testing the purge path once
sandboxed LLMHOST_CONFIG but not LLMHOST_HOME and deleted a live install's data
directory; BIN_DIR and SHIM have no env override at all, coming straight off
Path.home(). So the harness repoints those into the sandbox and then asserts
that every path llmhost could write or delete is inside it, aborting the run if
not -- verified by pointing it at a real path and watching it refuse.

The model plan the opencode suite needs is now a fixture rather than a file read
out of someone's home directory; it carries no key (the key lives in its own
file) and its machine-specific fields are pinned.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Neil Bantoc 2026-11-03 02:23:15 -08:00
parent ba7bd76af6
commit 51c2880a2e
8 changed files with 852 additions and 0 deletions

92
tests/fixtures/config.json vendored Normal file
View file

@ -0,0 +1,92 @@
{
"version": 1,
"kind": "apple",
"backend": "mlx",
"hardware_name": "Apple M-series, 128 GB unified memory",
"budget_gib": 96.0,
"tp": 1,
"prefer": "balanced",
"api_port": 1134,
"web_port": 11340,
"max_jobs": 10,
"models": [
{
"name": "qwen3.8-27b",
"title": "Qwen3.8 27B",
"about": "Dense 27B, hybrid attention, strong general coding and tool use.",
"context": 262144,
"reasoning": true,
"format": "mlx-6bit",
"repo": "lmstudio-community/Qwen3.8-27B-MLX-6bit",
"weights_gib": 21.2,
"util": 1.0,
"est_context": 262144,
"mtp": false,
"free_gib": 71.34,
"prompt_cache_gib": 52.74
},
{
"name": "ornith-1.5-35b",
"title": "Ornith 1.5 35B A3B",
"about": "35B mixture-of-experts with 3B active: very fast.",
"context": 262144,
"reasoning": true,
"format": "mlx-6bit",
"repo": "ornith-ai/Ornith-1.5-35B-A3B-MLX-6bit",
"weights_gib": 26.3,
"util": 1.0,
"est_context": 262144,
"mtp": false,
"free_gib": 66.21,
"prompt_cache_gib": 60.91
},
{
"name": "qwen3-coder",
"title": "Qwen3 Coder 30B A3B",
"about": "Coding-tuned mixture-of-experts, no reasoning phase.",
"context": 262144,
"reasoning": false,
"format": "mlx-6bit",
"repo": "lmstudio-community/Qwen3-Coder-30B-A3B-Instruct-MLX-6bit",
"weights_gib": 23.1,
"util": 1.0,
"est_context": 262144,
"mtp": false,
"free_gib": 69.44,
"prompt_cache_gib": 45.44
},
{
"name": "ornith-1.5-122b",
"title": "Ornith 1.5 122B",
"about": "Largest option; needs ~80 GB of GPU memory even at 4-bit.",
"context": 262144,
"reasoning": true,
"format": "mlx-4bit",
"repo": "ornith-ai/Ornith-1.5-122B-MLX-4bit",
"weights_gib": 64.8,
"util": 1.0,
"est_context": 262144,
"mtp": false,
"free_gib": 26.88,
"prompt_cache_gib": 20.28
},
{
"name": "ornith-1.5-9b",
"title": "Ornith 1.5 9B",
"about": "Small dense model for 16 GB Macs and 12-16 GB GPUs; noticeably weaker at multi-step agentic work.",
"context": 262144,
"reasoning": true,
"format": "mlx-6bit",
"repo": "ornith-ai/Ornith-1.5-9B-MLX-6bit",
"weights_gib": 6.8,
"util": 1.0,
"est_context": 262144,
"mtp": false,
"free_gib": 86.07,
"prompt_cache_gib": 77.27
}
],
"excluded": [],
"active": "ornith-1.5-9b",
"mlx": {}
}