refactor: remove unused COMPOSIO_CONNECTOR migration and linting

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-01-22 16:43:08 -08:00
parent eb509810f1
commit 8b81507739
24 changed files with 401 additions and 251 deletions

View file

@ -10,7 +10,6 @@ Endpoints:
- GET /auth/composio/connector/callback - Handle OAuth callback
"""
import asyncio
import logging
from uuid import UUID
@ -85,7 +84,9 @@ async def list_composio_toolkits(user: User = Depends(current_active_user)):
@router.get("/auth/composio/connector/add")
async def initiate_composio_auth(
space_id: int,
toolkit_id: str = Query(..., description="Composio toolkit ID (e.g., 'googledrive', 'gmail')"),
toolkit_id: str = Query(
..., description="Composio toolkit ID (e.g., 'googledrive', 'gmail')"
),
user: User = Depends(current_active_user),
):
"""
@ -166,7 +167,9 @@ async def initiate_composio_auth(
@router.get("/auth/composio/connector/callback")
async def composio_callback(
state: str | None = None,
connectedAccountId: str | None = None, # Composio sends camelCase
composio_connected_account_id: str | None = Query(
None, alias="connectedAccountId"
), # Composio sends camelCase
connected_account_id: str | None = None, # Fallback snake_case
error: str | None = None,
session: AsyncSession = Depends(get_async_session),
@ -233,15 +236,18 @@ async def composio_callback(
)
# Initialize Composio service
service = ComposioService()
entity_id = f"surfsense_{user_id}"
ComposioService()
# Use camelCase param if provided (Composio's format), fallback to snake_case
final_connected_account_id = connectedAccountId or connected_account_id
final_connected_account_id = (
composio_connected_account_id or connected_account_id
)
# DEBUG: Log all query parameters received
logger.info(f"DEBUG: Callback received - connectedAccountId: {connectedAccountId}, connected_account_id: {connected_account_id}, using: {final_connected_account_id}")
logger.info(
f"DEBUG: Callback received - connectedAccountId: {composio_connected_account_id}, connected_account_id: {connected_account_id}, using: {final_connected_account_id}"
)
# If we still don't have a connected_account_id, warn but continue
# (the connector will be created but indexing won't work until updated)
if not final_connected_account_id:
@ -250,7 +256,9 @@ async def composio_callback(
"The connector will be created but indexing may not work."
)
else:
logger.info(f"Successfully got connected_account_id: {final_connected_account_id}")
logger.info(
f"Successfully got connected_account_id: {final_connected_account_id}"
)
# Build connector config
connector_config = {