* test(probe): add spec-driven AI-agent test harness (L1/L2/L4/L5 + report + triage) Introduces `tests/probe/`, a portable, mostly-deterministic test harness built on the Actor/Judge split: AI agents may drive and self-heal, but verdicts are always deterministic code + metrics — no LLM on the verdict path. Layers: - L1 API: Schemathesis property-fuzz over in-process ASGI (enable-on-demand). - L2 web: Playwright Driver + deterministic self-heal (id→test-id→text, loosened CSS) → pluggable Healer; LLMHealer/anthropic_healer for genuine agentic heal. Judges + self-heal logic unit-tested offline via FakePage; live browser skips. - L4 media: audio correctness — exists/decode/duration/not-silent/clipping/NaN, round-trip ASR WER (pure-python, faster-whisper backend), speaker similarity. No golden-WAV (device-stable metrics only); naturalness is advisory-only. - L5 env/first-run: fresh-data-dir backend boot in a SUBPROCESS (no session contamination), asserts health + DB init + endpoint reachability. Docker gated. Plus: hybrid YAML spec engine + JudgeResult/registry; self-contained HTML report that auto-opens (suppressed in CI/headless/PROBE_NO_OPEN); Triager that clusters failures and drafts a prefilled GitHub issue URL (sanitized, no auto-submit) with a one-click button in the report. Dependency-light: runs in the base venv; schemathesis/resemblyzer/playwright/ anthropic are enable-on-demand and skip cleanly. Generated reports gitignored. Full suite green (657 passed); no contamination of existing tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(probe): add L3 desktop layer (Tauri config-integrity + guarded launch) Per the architecture decision, desktop E2E is substituted by backend-over-HTTP (L5) + browser (L2) since Tauri has no official macOS WebDriver. L3 guards the packaging/shell contract a browser test can't see, against the real tauri.conf.json (with platform-override merge), running on any platform with no Tauri toolchain: - version parity between tauri.conf.json and pyproject (release integrity) - dev/build wiring (devUrl matches the Vite frontend, frontendDist, before* cmds) - bundled binaries first-run depends on (uv / ffmpeg / ffprobe in externalBin) - CSP actually permits the local backend origins (desktop-only failure mode: packaged app can't reach :3900 while the browser build works) Adds desktop.py (config load + platform deep-merge + bundle discovery + launch guard), judges/desktop.py (config_present/config_eq/config_contains/csp_allows), desktop_smoke.probe.yaml, and tests covering integrity, platform-merge replace semantics, and a live bundle launch that skips without a built bundle/display. Full suite green (662 passed). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50 lines
1.9 KiB
Python
50 lines
1.9 KiB
Python
"""L5 env/first-run — boots the real backend against an EMPTY data dir and runs
|
|
the first_run spec end-to-end (offline, model short-circuited). This exercises
|
|
the actual lifespan/DB-init path a brand-new user hits.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
from . import env
|
|
from . import spec as probe_spec
|
|
|
|
_SPEC = os.path.join(os.path.dirname(__file__), "specs", "first_run.probe.yaml")
|
|
|
|
|
|
def test_first_run_boot(probe_report):
|
|
spec = probe_spec.load_spec(_SPEC)
|
|
with env.fresh_data_dir() as data_dir:
|
|
context = env.capture_first_run(data_dir)
|
|
# Check the first-run DB while the temp data dir still exists
|
|
# (fresh_data_dir removes it on context exit).
|
|
db_created = bool(context["db_path"]) and os.path.exists(context["db_path"])
|
|
results = probe_spec.run_judges(spec, context)
|
|
probe_report.record(spec, results)
|
|
failures = probe_spec.blocking_failures(results)
|
|
assert failures == [], "\n".join(str(r) for r in results)
|
|
# The boot actually created the DB on first run (not just answered health).
|
|
assert db_created, f"no SQLite DB created under data dir; db_path={context['db_path']!r}"
|
|
|
|
|
|
def test_boot_does_not_pollute_parent():
|
|
"""The subprocess boot must leave the parent session's env and module table
|
|
untouched — the property that makes L5 safe to run alongside the suite."""
|
|
before_env = os.environ.get("OMNIVOICE_DATA_DIR")
|
|
before_main = "main" in sys.modules
|
|
with env.fresh_data_dir() as d:
|
|
env.capture_first_run(d)
|
|
assert os.environ.get("OMNIVOICE_DATA_DIR") == before_env
|
|
assert ("main" in sys.modules) == before_main
|
|
|
|
|
|
def test_docker_path_skips_without_daemon():
|
|
if not env.docker_available():
|
|
pytest.skip("no Docker daemon — L5 container boot is enable-on-demand")
|
|
# When a daemon IS present, the compose file the Actor targets must exist.
|
|
assert env.compose_file().exists(), f"missing {env.compose_file()}"
|