fix(perplexity-tools): sanitize unexpected search exception handling (#15633)

DU
1d ago
+178-1

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_search with lazy %s logging of type(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.py with setUpClass/tearDownClass sys.modules restoration so no module-scope stubs leak across test files.
  • Registers perplexity-tools-sanitization-tests in .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)