"""AP-10 / AP-11 / DOC-09 — PUBLIC_API.md lists every public __all__ name (name-existence lint)."""

from __future__ import annotations

import importlib
from pathlib import Path

_MODS = (
    "records",
    "tiers",
    "selection",
    "quarantine",
    "perf",
    "supervisor",
    "diagnostics",
    "self_check",
)


def test_public_api_md_lists_every_all_name() -> None:
    md = (Path(__file__).resolve().parents[2] / "PUBLIC_API.md").read_text(encoding="utf-8")
    missing = []
    for m in _MODS:
        mod = importlib.import_module(f"mgf.test_supervisor.{m}")
        for n in getattr(mod, "__all__", []):
            if f"`{n}`" not in md:
                missing.append(f"{m}.{n}")
    assert not missing, f"PUBLIC_API.md missing public names (AP-10/DOC-09): {missing}"
