"""EH-09 — actionable error-message hints are pinned by substring so they can't
silently rot. Each substring lies within a single f-string literal at the misuse
boundary; a reword must update both the source and this pin deliberately.
"""

from __future__ import annotations

import inspect

import mgf.sqlalchemy._engine as _engine
import mgf.sqlalchemy._pagination as _pagination
import mgf.sqlalchemy._session as _session

_REQUIRED = [
    (_engine, "parameter for documented kwargs"),  # create_engine **extra collision
    (_session, "parameter for documented kwargs"),  # create_sessionmaker **extra collision
    (_session, "async with session.begin()"),  # tenant_session not-in-transaction
    (_pagination, "An empty page is expressed by an empty"),  # paginate_cursor bad limit
]


def test_actionable_hints_are_stable() -> None:
    missing = [
        f"{mod.__name__}: {sub!r}" for mod, sub in _REQUIRED if sub not in inspect.getsource(mod)
    ]
    assert not missing, (
        f"EH-09: actionable hint(s) changed/removed without updating the pin: {missing}"
    )
