Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

1.0 KB
Raw Blame
from __future__ import annotations

import ast
import re
from pathlib import Path

ROOT = Path(__file__).resolve().parents[2]
DOC = ROOT / "docs" / "architecture" / "language-support.md"
MODELS = ROOT / "packages" / "core" / "src" / "repowise" / "core" / "ingestion" / "models.py"


def test_language_support_edge_type_sets_are_real_model_symbols() -> None:
    text = DOC.read_text(encoding="utf-8")
    names = sorted(set(re.findall(r"`([A-Z][A-Z0-9_]*_EDGE_TYPES)`", text)))
    assert names, "language-support.md documents no *_EDGE_TYPES identifiers"

    tree = ast.parse(MODELS.read_text(encoding="utf-8"))
    attributes = {
        target.id
        for node in tree.body
        if isinstance(node, (ast.Assign, ast.AnnAssign))
        for target in (
            [node.target] if isinstance(node, ast.AnnAssign) else node.targets
        )
        if isinstance(target, ast.Name)
    }
    missing = sorted(set(names) - attributes)
    assert not missing, f"docs reference missing ingestion.models symbols: {missing}"