..............................FF.                                        [100%]
=================================== FAILURES ===================================
_ TestHybridSearchVecDegradation.test_vec_unavailable_degrades_to_bm25_results _

self = <tests.unit.mcp.test_backend.TestHybridSearchVecDegradation object at 0x107cdbc50>
tmp_path = PosixPath('/private/var/folders/1q/2qhztsp1673fnqgrpblxnpd40000gn/T/pytest-of-forrest/pytest-603/test_vec_unavailable_degrades_0')

    @pytest.mark.asyncio
    async def test_vec_unavailable_degrades_to_bm25_results(self, tmp_path: Path) -> None:
        """Construction failure yields real BM25 rows with full boundary metadata."""
        db_path, settings = _seed_suggestion_db(tmp_path)
        backend = _suggestion_backend(db_path, settings)
    
        with patch(
            "sif.mcp.backend.SearchPipeline",
            side_effect=RuntimeError(
                "sqlite-vec extension is not available. Install sqlite-vec to use vector search."
            ),
        ):
>           results = await backend.hybrid_search("quantum")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/unit/mcp/test_backend.py:673: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/sif/mcp/backend.py:186: in hybrid_search
    return await self._run_in_db(_search)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sif/mcp/backend.py:116: in _run_in_db
    return await asyncio.to_thread(_run)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../miniconda3/lib/python3.13/asyncio/threads.py:25: in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../miniconda3/lib/python3.13/concurrent/futures/thread.py:59: in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sif/mcp/backend.py:114: in _run
    return callback(conn)
           ^^^^^^^^^^^^^^
src/sif/mcp/backend.py:155: in _search
    pipeline = SearchPipeline(
../../miniconda3/lib/python3.13/unittest/mock.py:1169: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../miniconda3/lib/python3.13/unittest/mock.py:1173: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='SearchPipeline' id='4573230960'>
args = (<sqlite3.Connection object at 0x1106be4d0>,)
kwargs = {'embedder': None, 'embedding_dim': 8}

    def _execute_mock_call(self, /, *args, **kwargs):
        # separate from _increment_mock_call so that awaited functions are
        # executed separately from their call, also AsyncMock overrides this method
    
        effect = self.side_effect
        if effect is not None:
            if _is_exception(effect):
>               raise effect
E               RuntimeError: sqlite-vec extension is not available. Install sqlite-vec to use vector search.

../../miniconda3/lib/python3.13/unittest/mock.py:1228: RuntimeError
------------------------------ Captured log call -------------------------------
WARNING  sif.sif.mcp.backend:backend.py:107 Failed to load embedder; vector search will be unavailable
___ TestHybridSearchVecDegradation.test_vec_unavailable_warning_emitted_once ___

self = <tests.unit.mcp.test_backend.TestHybridSearchVecDegradation object at 0x1107f6210>
tmp_path = PosixPath('/private/var/folders/1q/2qhztsp1673fnqgrpblxnpd40000gn/T/pytest-of-forrest/pytest-603/test_vec_unavailable_warning_e0')
caplog = <_pytest.logging.LogCaptureFixture object at 0x11095f4d0>

    @pytest.mark.asyncio
    async def test_vec_unavailable_warning_emitted_once(self, tmp_path: Path, caplog) -> None:
        """Repeated degraded queries warn exactly once per backend instance."""
        db_path, settings = _seed_suggestion_db(tmp_path)
        # Built before capture: the __init__ embedder warning is unrelated.
        backend = _suggestion_backend(db_path, settings)
    
        with (
            patch(
                "sif.mcp.backend.SearchPipeline",
                side_effect=RuntimeError(
                    "sqlite-vec extension is not available. Install sqlite-vec to use vector search."
                ),
            ),
            caplog.at_level(logging.WARNING, logger=backend_module.logger.name),
        ):
>           first = await backend.hybrid_search("quantum")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/unit/mcp/test_backend.py:699: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/sif/mcp/backend.py:186: in hybrid_search
    return await self._run_in_db(_search)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sif/mcp/backend.py:116: in _run_in_db
    return await asyncio.to_thread(_run)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../miniconda3/lib/python3.13/asyncio/threads.py:25: in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../miniconda3/lib/python3.13/concurrent/futures/thread.py:59: in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sif/mcp/backend.py:114: in _run
    return callback(conn)
           ^^^^^^^^^^^^^^
src/sif/mcp/backend.py:155: in _search
    pipeline = SearchPipeline(
../../miniconda3/lib/python3.13/unittest/mock.py:1169: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../miniconda3/lib/python3.13/unittest/mock.py:1173: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='SearchPipeline' id='4573226592'>
args = (<sqlite3.Connection object at 0x1106bf6a0>,)
kwargs = {'embedder': None, 'embedding_dim': 8}

    def _execute_mock_call(self, /, *args, **kwargs):
        # separate from _increment_mock_call so that awaited functions are
        # executed separately from their call, also AsyncMock overrides this method
    
        effect = self.side_effect
        if effect is not None:
            if _is_exception(effect):
>               raise effect
E               RuntimeError: sqlite-vec extension is not available. Install sqlite-vec to use vector search.

../../miniconda3/lib/python3.13/unittest/mock.py:1228: RuntimeError
------------------------------ Captured log call -------------------------------
WARNING  sif.sif.mcp.backend:backend.py:107 Failed to load embedder; vector search will be unavailable
=========================== short test summary info ============================
FAILED tests/unit/mcp/test_backend.py::TestHybridSearchVecDegradation::test_vec_unavailable_degrades_to_bm25_results
FAILED tests/unit/mcp/test_backend.py::TestHybridSearchVecDegradation::test_vec_unavailable_warning_emitted_once
2 failed, 31 passed in 0.43s
