diff --git a/surfsense_backend/app/agents/new_chat/tools/gmail/create_draft.py b/surfsense_backend/app/agents/new_chat/tools/gmail/create_draft.py
index 26de5d394..a812f621a 100644
--- a/surfsense_backend/app/agents/new_chat/tools/gmail/create_draft.py
+++ b/surfsense_backend/app/agents/new_chat/tools/gmail/create_draft.py
@@ -144,7 +144,7 @@ def create_create_gmail_draft_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _GMAIL_TYPES = [
+ _gmail_types = [
SearchSourceConnectorType.GOOGLE_GMAIL_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GMAIL_CONNECTOR,
]
@@ -155,7 +155,7 @@ def create_create_gmail_draft_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_GMAIL_TYPES),
+ SearchSourceConnector.connector_type.in_(_gmail_types),
)
)
connector = result.scalars().first()
@@ -170,7 +170,7 @@ def create_create_gmail_draft_tool(
select(SearchSourceConnector).filter(
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_GMAIL_TYPES),
+ SearchSourceConnector.connector_type.in_(_gmail_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/gmail/send_email.py b/surfsense_backend/app/agents/new_chat/tools/gmail/send_email.py
index 1b46d405a..2599578bd 100644
--- a/surfsense_backend/app/agents/new_chat/tools/gmail/send_email.py
+++ b/surfsense_backend/app/agents/new_chat/tools/gmail/send_email.py
@@ -145,7 +145,7 @@ def create_send_gmail_email_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _GMAIL_TYPES = [
+ _gmail_types = [
SearchSourceConnectorType.GOOGLE_GMAIL_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GMAIL_CONNECTOR,
]
@@ -156,7 +156,7 @@ def create_send_gmail_email_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_GMAIL_TYPES),
+ SearchSourceConnector.connector_type.in_(_gmail_types),
)
)
connector = result.scalars().first()
@@ -171,7 +171,7 @@ def create_send_gmail_email_tool(
select(SearchSourceConnector).filter(
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_GMAIL_TYPES),
+ SearchSourceConnector.connector_type.in_(_gmail_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/gmail/trash_email.py b/surfsense_backend/app/agents/new_chat/tools/gmail/trash_email.py
index 25b669c7d..146020845 100644
--- a/surfsense_backend/app/agents/new_chat/tools/gmail/trash_email.py
+++ b/surfsense_backend/app/agents/new_chat/tools/gmail/trash_email.py
@@ -162,7 +162,7 @@ def create_trash_gmail_email_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _GMAIL_TYPES = [
+ _gmail_types = [
SearchSourceConnectorType.GOOGLE_GMAIL_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GMAIL_CONNECTOR,
]
@@ -172,7 +172,7 @@ def create_trash_gmail_email_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_GMAIL_TYPES),
+ SearchSourceConnector.connector_type.in_(_gmail_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/gmail/update_draft.py b/surfsense_backend/app/agents/new_chat/tools/gmail/update_draft.py
index bcc884e8d..28deec2b4 100644
--- a/surfsense_backend/app/agents/new_chat/tools/gmail/update_draft.py
+++ b/surfsense_backend/app/agents/new_chat/tools/gmail/update_draft.py
@@ -192,7 +192,7 @@ def create_update_gmail_draft_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _GMAIL_TYPES = [
+ _gmail_types = [
SearchSourceConnectorType.GOOGLE_GMAIL_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GMAIL_CONNECTOR,
]
@@ -202,7 +202,7 @@ def create_update_gmail_draft_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_GMAIL_TYPES),
+ SearchSourceConnector.connector_type.in_(_gmail_types),
)
)
connector = result.scalars().first()
@@ -419,7 +419,9 @@ async def _find_draft_id_by_message(gmail_service: Any, message_id: str) -> str
response = await asyncio.get_event_loop().run_in_executor(
None,
- lambda: gmail_service.users().drafts().list(**kwargs).execute(),
+ lambda kwargs=kwargs: (
+ gmail_service.users().drafts().list(**kwargs).execute()
+ ),
)
for draft in response.get("drafts", []):
diff --git a/surfsense_backend/app/agents/new_chat/tools/google_calendar/create_event.py b/surfsense_backend/app/agents/new_chat/tools/google_calendar/create_event.py
index 1ac51df0e..592ced5ec 100644
--- a/surfsense_backend/app/agents/new_chat/tools/google_calendar/create_event.py
+++ b/surfsense_backend/app/agents/new_chat/tools/google_calendar/create_event.py
@@ -155,7 +155,7 @@ def create_create_calendar_event_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _CALENDAR_TYPES = [
+ _calendar_types = [
SearchSourceConnectorType.GOOGLE_CALENDAR_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GOOGLE_CALENDAR_CONNECTOR,
]
@@ -166,7 +166,7 @@ def create_create_calendar_event_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_CALENDAR_TYPES),
+ SearchSourceConnector.connector_type.in_(_calendar_types),
)
)
connector = result.scalars().first()
@@ -181,7 +181,7 @@ def create_create_calendar_event_tool(
select(SearchSourceConnector).filter(
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_CALENDAR_TYPES),
+ SearchSourceConnector.connector_type.in_(_calendar_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/google_calendar/delete_event.py b/surfsense_backend/app/agents/new_chat/tools/google_calendar/delete_event.py
index 7dcfec213..8b088487c 100644
--- a/surfsense_backend/app/agents/new_chat/tools/google_calendar/delete_event.py
+++ b/surfsense_backend/app/agents/new_chat/tools/google_calendar/delete_event.py
@@ -161,7 +161,7 @@ def create_delete_calendar_event_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _CALENDAR_TYPES = [
+ _calendar_types = [
SearchSourceConnectorType.GOOGLE_CALENDAR_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GOOGLE_CALENDAR_CONNECTOR,
]
@@ -171,7 +171,7 @@ def create_delete_calendar_event_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_CALENDAR_TYPES),
+ SearchSourceConnector.connector_type.in_(_calendar_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/google_calendar/update_event.py b/surfsense_backend/app/agents/new_chat/tools/google_calendar/update_event.py
index bc9707fb5..4b57cf2e3 100644
--- a/surfsense_backend/app/agents/new_chat/tools/google_calendar/update_event.py
+++ b/surfsense_backend/app/agents/new_chat/tools/google_calendar/update_event.py
@@ -178,7 +178,7 @@ def create_update_calendar_event_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _CALENDAR_TYPES = [
+ _calendar_types = [
SearchSourceConnectorType.GOOGLE_CALENDAR_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GOOGLE_CALENDAR_CONNECTOR,
]
@@ -188,7 +188,7 @@ def create_update_calendar_event_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_CALENDAR_TYPES),
+ SearchSourceConnector.connector_type.in_(_calendar_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/google_drive/create_file.py b/surfsense_backend/app/agents/new_chat/tools/google_drive/create_file.py
index 20c34aafd..a4fee0965 100644
--- a/surfsense_backend/app/agents/new_chat/tools/google_drive/create_file.py
+++ b/surfsense_backend/app/agents/new_chat/tools/google_drive/create_file.py
@@ -166,7 +166,7 @@ def create_create_google_drive_file_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _DRIVE_TYPES = [
+ _drive_types = [
SearchSourceConnectorType.GOOGLE_DRIVE_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GOOGLE_DRIVE_CONNECTOR,
]
@@ -177,7 +177,7 @@ def create_create_google_drive_file_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_DRIVE_TYPES),
+ SearchSourceConnector.connector_type.in_(_drive_types),
)
)
connector = result.scalars().first()
@@ -192,7 +192,7 @@ def create_create_google_drive_file_tool(
select(SearchSourceConnector).filter(
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_DRIVE_TYPES),
+ SearchSourceConnector.connector_type.in_(_drive_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/google_drive/trash_file.py b/surfsense_backend/app/agents/new_chat/tools/google_drive/trash_file.py
index 206f2e2fd..fdf7f9cd3 100644
--- a/surfsense_backend/app/agents/new_chat/tools/google_drive/trash_file.py
+++ b/surfsense_backend/app/agents/new_chat/tools/google_drive/trash_file.py
@@ -162,7 +162,7 @@ def create_delete_google_drive_file_tool(
from app.db import SearchSourceConnector, SearchSourceConnectorType
- _DRIVE_TYPES = [
+ _drive_types = [
SearchSourceConnectorType.GOOGLE_DRIVE_CONNECTOR,
SearchSourceConnectorType.COMPOSIO_GOOGLE_DRIVE_CONNECTOR,
]
@@ -172,7 +172,7 @@ def create_delete_google_drive_file_tool(
SearchSourceConnector.id == final_connector_id,
SearchSourceConnector.search_space_id == search_space_id,
SearchSourceConnector.user_id == user_id,
- SearchSourceConnector.connector_type.in_(_DRIVE_TYPES),
+ SearchSourceConnector.connector_type.in_(_drive_types),
)
)
connector = result.scalars().first()
diff --git a/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py b/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
index 12b8d5749..f8dba1b8f 100644
--- a/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
+++ b/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
@@ -9,6 +9,7 @@ This module provides:
"""
import asyncio
+import contextlib
import json
import re
import time
@@ -89,10 +90,8 @@ async def _browse_recent_documents(
doc_type_enums = []
for dt in type_list:
if isinstance(dt, str):
- try:
+ with contextlib.suppress(KeyError):
doc_type_enums.append(DocumentType[dt])
- except KeyError:
- pass
else:
doc_type_enums.append(dt)
if not doc_type_enums:
diff --git a/surfsense_backend/app/connectors/google_calendar_connector.py b/surfsense_backend/app/connectors/google_calendar_connector.py
index 6150562c5..56b6766f4 100644
--- a/surfsense_backend/app/connectors/google_calendar_connector.py
+++ b/surfsense_backend/app/connectors/google_calendar_connector.py
@@ -59,11 +59,12 @@ class GoogleCalendarConnector:
"""
has_standard_refresh = bool(self._credentials.refresh_token)
- if has_standard_refresh:
- if not all([self._credentials.client_id, self._credentials.client_secret]):
- raise ValueError(
- "Google OAuth credentials (client_id, client_secret) must be set"
- )
+ if has_standard_refresh and not all(
+ [self._credentials.client_id, self._credentials.client_secret]
+ ):
+ raise ValueError(
+ "Google OAuth credentials (client_id, client_secret) must be set"
+ )
if self._credentials and not self._credentials.expired:
return self._credentials
diff --git a/surfsense_backend/app/connectors/google_drive/client.py b/surfsense_backend/app/connectors/google_drive/client.py
index 4bb01b84c..8cba34d19 100644
--- a/surfsense_backend/app/connectors/google_drive/client.py
+++ b/surfsense_backend/app/connectors/google_drive/client.py
@@ -3,6 +3,7 @@
import io
from typing import Any
+from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from googleapiclient.http import MediaIoBaseUpload
diff --git a/surfsense_backend/app/connectors/google_gmail_connector.py b/surfsense_backend/app/connectors/google_gmail_connector.py
index d116fb5d6..bd4f78bc2 100644
--- a/surfsense_backend/app/connectors/google_gmail_connector.py
+++ b/surfsense_backend/app/connectors/google_gmail_connector.py
@@ -88,11 +88,12 @@ class GoogleGmailConnector:
"""
has_standard_refresh = bool(self._credentials.refresh_token)
- if has_standard_refresh:
- if not all([self._credentials.client_id, self._credentials.client_secret]):
- raise ValueError(
- "Google OAuth credentials (client_id, client_secret) must be set"
- )
+ if has_standard_refresh and not all(
+ [self._credentials.client_id, self._credentials.client_secret]
+ ):
+ raise ValueError(
+ "Google OAuth credentials (client_id, client_secret) must be set"
+ )
if self._credentials and not self._credentials.expired:
return self._credentials
diff --git a/surfsense_backend/app/retriever/chunks_hybrid_search.py b/surfsense_backend/app/retriever/chunks_hybrid_search.py
index daac2069b..5750e9dfa 100644
--- a/surfsense_backend/app/retriever/chunks_hybrid_search.py
+++ b/surfsense_backend/app/retriever/chunks_hybrid_search.py
@@ -1,4 +1,5 @@
import asyncio
+import contextlib
import time
from datetime import datetime
@@ -225,10 +226,8 @@ class ChucksHybridSearchRetriever:
doc_type_enums = []
for dt in type_list:
if isinstance(dt, str):
- try:
+ with contextlib.suppress(KeyError):
doc_type_enums.append(DocumentType[dt])
- except KeyError:
- pass
else:
doc_type_enums.append(dt)
if not doc_type_enums:
diff --git a/surfsense_backend/app/retriever/documents_hybrid_search.py b/surfsense_backend/app/retriever/documents_hybrid_search.py
index 12fc55659..7dab4b62e 100644
--- a/surfsense_backend/app/retriever/documents_hybrid_search.py
+++ b/surfsense_backend/app/retriever/documents_hybrid_search.py
@@ -1,3 +1,4 @@
+import contextlib
import time
from datetime import datetime
@@ -205,10 +206,8 @@ class DocumentHybridSearchRetriever:
doc_type_enums = []
for dt in type_list:
if isinstance(dt, str):
- try:
+ with contextlib.suppress(KeyError):
doc_type_enums.append(DocumentType[dt])
- except KeyError:
- pass
else:
doc_type_enums.append(dt)
if not doc_type_enums:
diff --git a/surfsense_backend/app/services/gmail/tool_metadata_service.py b/surfsense_backend/app/services/gmail/tool_metadata_service.py
index 524e682cf..c903e24af 100644
--- a/surfsense_backend/app/services/gmail/tool_metadata_service.py
+++ b/surfsense_backend/app/services/gmail/tool_metadata_service.py
@@ -225,7 +225,9 @@ class GmailToolMetadataService:
service = build("gmail", "v1", credentials=creds)
profile = await asyncio.get_event_loop().run_in_executor(
None,
- lambda: service.users().getProfile(userId="me").execute(),
+ lambda service=service: (
+ service.users().getProfile(userId="me").execute()
+ ),
)
acc_dict["email"] = profile.get("emailAddress", "")
except Exception:
@@ -334,7 +336,9 @@ class GmailToolMetadataService:
kwargs["pageToken"] = page_token
response = await asyncio.get_event_loop().run_in_executor(
None,
- lambda: service.users().drafts().list(**kwargs).execute(),
+ lambda kwargs=kwargs: (
+ service.users().drafts().list(**kwargs).execute()
+ ),
)
for draft in response.get("drafts", []):
if draft.get("message", {}).get("id") == message_id:
diff --git a/surfsense_backend/app/tasks/connector_indexers/google_calendar_indexer.py b/surfsense_backend/app/tasks/connector_indexers/google_calendar_indexer.py
index c558fb38a..99fc666fa 100644
--- a/surfsense_backend/app/tasks/connector_indexers/google_calendar_indexer.py
+++ b/surfsense_backend/app/tasks/connector_indexers/google_calendar_indexer.py
@@ -16,15 +16,6 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.connectors.google_calendar_connector import GoogleCalendarConnector
from app.db import Document, DocumentStatus, DocumentType, SearchSourceConnectorType
-from app.utils.google_credentials import (
- COMPOSIO_GOOGLE_CONNECTOR_TYPES,
- build_composio_credentials,
-)
-
-ACCEPTED_CALENDAR_CONNECTOR_TYPES = {
- SearchSourceConnectorType.GOOGLE_CALENDAR_CONNECTOR,
- SearchSourceConnectorType.COMPOSIO_GOOGLE_CALENDAR_CONNECTOR,
-}
from app.services.llm_service import get_user_long_context_llm
from app.services.task_logging_service import TaskLoggingService
from app.utils.document_converters import (
@@ -34,6 +25,10 @@ from app.utils.document_converters import (
generate_document_summary,
generate_unique_identifier_hash,
)
+from app.utils.google_credentials import (
+ COMPOSIO_GOOGLE_CONNECTOR_TYPES,
+ build_composio_credentials,
+)
from .base import (
check_document_by_unique_identifier,
@@ -46,6 +41,11 @@ from .base import (
update_connector_last_indexed,
)
+ACCEPTED_CALENDAR_CONNECTOR_TYPES = {
+ SearchSourceConnectorType.GOOGLE_CALENDAR_CONNECTOR,
+ SearchSourceConnectorType.COMPOSIO_GOOGLE_CALENDAR_CONNECTOR,
+}
+
# Type hint for heartbeat callback
HeartbeatCallbackType = Callable[[int], Awaitable[None]]
diff --git a/surfsense_backend/app/tasks/connector_indexers/google_gmail_indexer.py b/surfsense_backend/app/tasks/connector_indexers/google_gmail_indexer.py
index e7e4a8615..30f806c19 100644
--- a/surfsense_backend/app/tasks/connector_indexers/google_gmail_indexer.py
+++ b/surfsense_backend/app/tasks/connector_indexers/google_gmail_indexer.py
@@ -21,15 +21,6 @@ from app.db import (
DocumentType,
SearchSourceConnectorType,
)
-from app.utils.google_credentials import (
- COMPOSIO_GOOGLE_CONNECTOR_TYPES,
- build_composio_credentials,
-)
-
-ACCEPTED_GMAIL_CONNECTOR_TYPES = {
- SearchSourceConnectorType.GOOGLE_GMAIL_CONNECTOR,
- SearchSourceConnectorType.COMPOSIO_GMAIL_CONNECTOR,
-}
from app.services.llm_service import get_user_long_context_llm
from app.services.task_logging_service import TaskLoggingService
from app.utils.document_converters import (
@@ -39,6 +30,10 @@ from app.utils.document_converters import (
generate_document_summary,
generate_unique_identifier_hash,
)
+from app.utils.google_credentials import (
+ COMPOSIO_GOOGLE_CONNECTOR_TYPES,
+ build_composio_credentials,
+)
from .base import (
calculate_date_range,
@@ -51,6 +46,11 @@ from .base import (
update_connector_last_indexed,
)
+ACCEPTED_GMAIL_CONNECTOR_TYPES = {
+ SearchSourceConnectorType.GOOGLE_GMAIL_CONNECTOR,
+ SearchSourceConnectorType.COMPOSIO_GMAIL_CONNECTOR,
+}
+
# Type hint for heartbeat callback
HeartbeatCallbackType = Callable[[int], Awaitable[None]]
diff --git a/surfsense_backend/tests/integration/google_unification/test_search_includes_legacy_docs.py b/surfsense_backend/tests/integration/google_unification/test_search_includes_legacy_docs.py
index a05ff04d0..d9b089c12 100644
--- a/surfsense_backend/tests/integration/google_unification/test_search_includes_legacy_docs.py
+++ b/surfsense_backend/tests/integration/google_unification/test_search_includes_legacy_docs.py
@@ -23,7 +23,7 @@ async def test_search_google_drive_includes_legacy_composio_docs(
async with patched_session_factory() as session:
service = ConnectorService(session, search_space_id=space_id)
- result_object, raw_docs = await service.search_google_drive(
+ _, raw_docs = await service.search_google_drive(
user_query="quarterly budget",
search_space_id=space_id,
top_k=10,
@@ -55,7 +55,7 @@ async def test_search_files_does_not_include_google_types(
async with patched_session_factory() as session:
service = ConnectorService(session, search_space_id=space_id)
- result_object, raw_docs = await service.search_files(
+ _, raw_docs = await service.search_files(
user_query="quarterly budget",
search_space_id=space_id,
top_k=10,
diff --git a/surfsense_backend/tests/unit/google_unification/test_composio_credentials.py b/surfsense_backend/tests/unit/google_unification/test_composio_credentials.py
index 589b5c8b6..9ab618aa3 100644
--- a/surfsense_backend/tests/unit/google_unification/test_composio_credentials.py
+++ b/surfsense_backend/tests/unit/google_unification/test_composio_credentials.py
@@ -15,11 +15,11 @@ pytestmark = pytest.mark.unit
@patch("app.services.composio_service.ComposioService")
-def test_returns_credentials_with_token_and_expiry(MockComposioService):
+def test_returns_credentials_with_token_and_expiry(mock_composio_service):
"""build_composio_credentials returns a Credentials object with the Composio access token."""
mock_service = MagicMock()
mock_service.get_access_token.return_value = "fake-access-token"
- MockComposioService.return_value = mock_service
+ mock_composio_service.return_value = mock_service
from app.utils.google_credentials import build_composio_credentials
@@ -32,14 +32,14 @@ def test_returns_credentials_with_token_and_expiry(MockComposioService):
@patch("app.services.composio_service.ComposioService")
-def test_refresh_handler_fetches_fresh_token(MockComposioService):
+def test_refresh_handler_fetches_fresh_token(mock_composio_service):
"""The refresh_handler on the returned Credentials fetches a new token from Composio."""
mock_service = MagicMock()
mock_service.get_access_token.side_effect = [
"initial-token",
"refreshed-token",
]
- MockComposioService.return_value = mock_service
+ mock_composio_service.return_value = mock_service
from app.utils.google_credentials import build_composio_credentials
diff --git a/surfsense_backend/tests/unit/google_unification/test_connector_credential_acceptance.py b/surfsense_backend/tests/unit/google_unification/test_connector_credential_acceptance.py
index da7548cc2..db14a1a34 100644
--- a/surfsense_backend/tests/unit/google_unification/test_connector_credential_acceptance.py
+++ b/surfsense_backend/tests/unit/google_unification/test_connector_credential_acceptance.py
@@ -208,7 +208,7 @@ async def test_drive_client_uses_prebuilt_composio_credentials(mock_build):
credentials=creds,
)
- files, next_token, error = await client.list_files()
+ files, _next_token, error = await client.list_files()
assert error is None
assert files == []
diff --git a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx
index 28c2a0bc7..babd287e4 100644
--- a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx
+++ b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx
@@ -204,8 +204,8 @@ export function LayoutShell({
onChatArchive={onChatArchive}
onViewAllSharedChats={onViewAllSharedChats}
onViewAllPrivateChats={onViewAllPrivateChats}
- isSharedChatsPanelOpen={activeSlideoutPanel === "shared"}
- isPrivateChatsPanelOpen={activeSlideoutPanel === "private"}
+ isSharedChatsPanelOpen={activeSlideoutPanel === "shared"}
+ isPrivateChatsPanelOpen={activeSlideoutPanel === "private"}
user={user}
onSettings={onSettings}
onManageMembers={onManageMembers}
@@ -217,92 +217,92 @@ export function LayoutShell({
isLoadingChats={isLoadingChats}
/>
-
- {children}
-
+
+ {children}
+
- {/* Mobile unified slide-out panel */}
-
-
- {activeSlideoutPanel === "inbox" && inbox && (
-
- closeSlideout(open)}
- comments={inbox.comments}
- status={inbox.status}
- totalUnreadCount={inbox.totalUnreadCount}
- onCloseMobileSidebar={() => setMobileMenuOpen(false)}
- />
-
- )}
- {activeSlideoutPanel === "announcements" && (
-
- closeSlideout(open)}
- onCloseMobileSidebar={() => setMobileMenuOpen(false)}
- />
-
- )}
- {activeSlideoutPanel === "shared" && allSharedChatsPanel && (
-
- closeSlideout(open)}
- searchSpaceId={allSharedChatsPanel.searchSpaceId}
- onCloseMobileSidebar={() => setMobileMenuOpen(false)}
- />
-
- )}
- {activeSlideoutPanel === "private" && allPrivateChatsPanel && (
-
- closeSlideout(open)}
- searchSpaceId={allPrivateChatsPanel.searchSpaceId}
- onCloseMobileSidebar={() => setMobileMenuOpen(false)}
- />
-
- )}
-
-
+ {/* Mobile unified slide-out panel */}
+
+
+ {activeSlideoutPanel === "inbox" && inbox && (
+
+ closeSlideout(open)}
+ comments={inbox.comments}
+ status={inbox.status}
+ totalUnreadCount={inbox.totalUnreadCount}
+ onCloseMobileSidebar={() => setMobileMenuOpen(false)}
+ />
+
+ )}
+ {activeSlideoutPanel === "announcements" && (
+
+ closeSlideout(open)}
+ onCloseMobileSidebar={() => setMobileMenuOpen(false)}
+ />
+
+ )}
+ {activeSlideoutPanel === "shared" && allSharedChatsPanel && (
+
+ closeSlideout(open)}
+ searchSpaceId={allSharedChatsPanel.searchSpaceId}
+ onCloseMobileSidebar={() => setMobileMenuOpen(false)}
+ />
+
+ )}
+ {activeSlideoutPanel === "private" && allPrivateChatsPanel && (
+
+ closeSlideout(open)}
+ searchSpaceId={allPrivateChatsPanel.searchSpaceId}
+ onCloseMobileSidebar={() => setMobileMenuOpen(false)}
+ />
+
+ )}
+
+
- {/* Mobile Documents Sidebar - separate (not part of slide-out group) */}
- {documentsPanel && (
-
- )}
+ {/* Mobile Documents Sidebar - separate (not part of slide-out group) */}
+ {documentsPanel && (
+
+ )}
@@ -402,9 +402,7 @@ export function LayoutShell({
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
>
- closeSlideout(open)}
- />
+ closeSlideout(open)} />
)}
{activeSlideoutPanel === "shared" && allSharedChatsPanel && (
diff --git a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
index 2d9820bf1..e4194c863 100644
--- a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
@@ -24,6 +24,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { getDocumentTypeLabel } from "@/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentTypeIcon";
import { setTargetCommentIdAtom } from "@/atoms/chat/current-thread.atom";
import { convertRenderedToDisplay } from "@/components/chat-comments/comment-item/comment-item";
+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/animated-tabs";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import {
@@ -43,7 +44,6 @@ import {
import { Input } from "@/components/ui/input";
import { Skeleton } from "@/components/ui/skeleton";
import { Spinner } from "@/components/ui/spinner";
-import { Tabs, TabsList, TabsTrigger } from "@/components/ui/animated-tabs";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
import {
diff --git a/surfsense_web/components/ui/hero-carousel.tsx b/surfsense_web/components/ui/hero-carousel.tsx
index 6bd5fbcf8..2552b4928 100644
--- a/surfsense_web/components/ui/hero-carousel.tsx
+++ b/surfsense_web/components/ui/hero-carousel.tsx
@@ -88,7 +88,9 @@ function HeroCarouselCard({
return (
<>
-