async def test_sync_service_error_recovery(
        self,
        mock_db,
        mock_user,
        complete_uow,
        mock_sync,
        mock_sync_job,
        mock_sync_dag,
        mock_collection,
        mock_source_connection
    ):
        """Test error recovery during a sync run."""
        # Arrange - simulate an error during sync
        test_error = Exception("Integration test error")

        # Mock required components
        with (
            patch("airweave.core.sync_service.get_db_context") as mock_get_db_context,
            patch("airweave.platform.sync.factory.SyncFactory.create_orchestrator", new_callable=AsyncMock) as mock_create_orchestrator,
            patch("airweave.core.sync_service.logger.error") as mock_logger_error,
            patch("airweave.core.sync_service.sync_job_service.update_status", new_callable=AsyncMock) as mock_update_status,
        ):
            mock_db_context = AsyncMock()
            mock_db_context.__aenter__.return_value = mock_db
            mock_get_db_context.return_value = mock_db_context

            mock_update_status.return_value = None

            # Simulate error during orchestrator creation
            mock_create_orchestrator.side_effect = test_error

            # Act & Assert
            service = SyncService()
            with pytest.raises(Exception) as excinfo:
                await service.run(
                    sync=mock_sync,
                    sync_job=mock_sync_job,
                    dag=mock_sync_dag,
                    collection=mock_collection,
                    source_connection=mock_source_connection,
                    current_user=mock_user,
                )

            # Verify the exception was logged and re-raised
            assert excinfo.value == test_error
            mock_logger_error.assert_called_once()
            assert "Error during sync orchestrator creation" in mock_logger_error.call_args[0][0]
            mock_update_status.assert_called_once()
Test error recovery during a sync run.
backend/tests/unit/platform/sync/test_service_integration.py