fix(perplexity-tools): sanitize unexpected search exception handling (#15633)
DU
1d ago+178+178+012345678901234567890123456789-1-1-0123456789
Closes #15633
Failure-Class: none
Summary
Rebases and completes the unexpected search exception sanitization in backend/utils/retrieval/tools/perplexity_tools.py:
- Replaces f-string exception interpolation (
f"... {e}") in_perplexity_gateway_searchwith lazy%slogging oftype(e).__name__(exc_info=True) while returning the sanitized user-facing error message ("Error: An unexpected error occurred while searching. Please try again later."). - Adds hermetic unit tests in
backend/tests/unit/test_perplexity_tools_sanitization.pywithsetUpClass/tearDownClasssys.modulesrestoration so no module-scope stubs leak across test files. - Registers
perplexity-tools-sanitization-testsin.github/checks-manifest.yaml.
Verification
python3 backend/tests/unit/test_perplexity_tools_sanitization.py -v(2/2 passing)python3 backend/scripts/check_module_stub_pollution.py --files backend/tests/unit/test_perplexity_tools_sanitization.py(0 violations)