"""Production / HF Spaces AI profile disables ingest LLM sanitisation only.""" from __future__ import annotations import pytest from app.config import Settings def test_space_id_disables_rag_llm_sanitisation(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("SPACE_ID", "StormShadow308/RICS") monkeypatch.setenv("ENABLE_RAG_UPLOAD_SANITISATION", "true") monkeypatch.setenv("RAG_SANITISATION_USE_LLM", "true") s = Settings() assert s.enable_rag_upload_sanitisation is True assert s.rag_sanitisation_use_llm is False def test_production_ai_profile_flag(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.delenv("SPACE_ID", raising=False) monkeypatch.setenv("PRODUCTION_AI_PROFILE", "true") monkeypatch.setenv("ENABLE_RAG_UPLOAD_SANITISATION", "false") monkeypatch.setenv("RAG_SANITISATION_USE_LLM", "true") s = Settings() assert s.enable_rag_upload_sanitisation is True assert s.rag_sanitisation_use_llm is False def test_space_id_enables_async_parallel_for_sla(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("SPACE_ID", "StormShadow308/RICS") monkeypatch.setenv("ENABLE_ASYNC_PIPELINE", "false") s = Settings() assert s.enable_async_pipeline is True assert s.allow_sqlite_parallel_sections is True assert s.generation_sla_seconds == 600 assert s.generation_timeout_seconds >= 660 def test_personalised_rag_forces_sanitisation(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.delenv("SPACE_ID", raising=False) monkeypatch.setenv("PERSONALISED_STYLE_RAG_ENABLED", "true") monkeypatch.setenv("ENABLE_RAG_UPLOAD_SANITISATION", "false") s = Settings() assert s.enable_rag_upload_sanitisation is True