"""TS-01 — every src module has a test mirror OR an allow-list entry."""

from __future__ import annotations

from pathlib import Path

_T = Path(__file__).resolve().parent
_PKG = _T.parent / "src" / "mgf" / "vm" / "firecracker"
_STEMS = {p.stem for p in _T.rglob("test_*.py")}


def test_every_source_module_has_mirror() -> None:
    missing = [
        p.name
        for p in _PKG.rglob("*.py")
        if "__pycache__" not in p.parts
        and p.name != "__init__.py"
        and not any(f"test_{s}" in _STEMS for s in {p.stem, p.stem.lstrip("_")})
    ]
    assert not missing, f"TS-01: modules with no test mirror: {missing}"
