from pathlib import Path ROOT = Path(__file__).resolve().parents[1] def test_pg_sync_service_remains_explicit_opt_in_legacy_tool(): source = (ROOT / "services" / "pg_sync_service.py").read_text(encoding="utf-8") assert "PG_SYNC_ENABLED', 'false'" in source assert "python services/pg_sync_service.py --full" in source assert "python services/pg_sync_service.py --verify" in source assert "python services/pg_sync_service.py --daemon" in source def test_runtime_paths_do_not_auto_wire_pg_sync_service(): active_paths = [ ROOT / "app.py", ROOT / "scheduler.py", ROOT / "run_scheduler.py", ROOT / "routes", ROOT / "services", ] forbidden = "services.pg_sync_service" offenders = [] for active_path in active_paths: paths = active_path.rglob("*.py") if active_path.is_dir() else [active_path] for path in paths: if path.name == "pg_sync_service.py" or "__pycache__" in path.parts: continue source = path.read_text(encoding="utf-8") if forbidden in source: offenders.append(str(path.relative_to(ROOT))) assert offenders == []