from pathlib import Path def test_webcrumbs_loader_has_safe_fallback_response(): source = Path("routes/system_public_routes.py").read_text(encoding="utf-8") assert "WEBCRUMBS_COMPATIBLE_LOADER_PATH = 'loader/webcrumbs-compatible-loader.js'" in source assert "WEBCRUMBS_FALLBACK_LOADER" in source assert "status=200, mimetype='application/javascript'" in source assert "X-Webcrumbs-Fallback" in source assert "upstream-unavailable" in source assert "Loader upstream unavailable; serving local fallback" in source