"""L0 source boundary for DAX control-plane and persistence code.""" from __future__ import annotations from pathlib import Path import pytest _SERVER_ROOT = Path(__file__).resolve().parents[2] _CONTROL_AND_PERSISTENCE_FILES = ( _SERVER_ROOT / "app/approval/router.py", _SERVER_ROOT / "app/approval/service.py", _SERVER_ROOT / "app/domains/data_access/models.py", _SERVER_ROOT / "app/domains/data_access/router.py", _SERVER_ROOT / "app/domains/data_access/service.py", _SERVER_ROOT / "app/integrations/drivers/feishu_chat_approval.py", _SERVER_ROOT / "alembic/versions/333_data_access_requests.py", _SERVER_ROOT / "alembic/versions/334_data_access_bindings.py", _SERVER_ROOT / "alembic/versions/335_data_access_compiled_effects.py", _SERVER_ROOT / "alembic/versions/336_data_access_effect_runs.py", ) _PROVIDER_MUTATION_TOKENS = ( "bigquery.Client", "gcp_cloud", "google.cloud", "lifecycle_service", "providers.gcp", "setIamPolicy", "set_iam_policy", ) @pytest.mark.parametrize("path", _CONTROL_AND_PERSISTENCE_FILES) def test_control_and_persistence_code_has_no_provider_mutation_path(path: Path) -> None: source = path.read_text(encoding="utf-8") for token in _PROVIDER_MUTATION_TOKENS: assert token not in source, f"{path} must not use {token}"