From b89866541e5ea4fb6dbd9bdfe732a04de8b99441 Mon Sep 17 00:00:00 2001 From: "DESKTOP-RTLN3BA\\$punk" Date: Wed, 17 Jun 2026 20:50:07 -0700 Subject: [PATCH] chore: linting --- .../versions/164_remove_inactive_users.py | 1 + .../versions/165_add_chunk_position.py | 1 + .../integration/test_connector_index_authz.py | 43 ++++++++++--------- surfsense_web/app/sitemap.ts | 2 +- .../tabs/all-connectors-tab.tsx | 2 +- .../layout/ui/sidebar/DocumentsSidebar.tsx | 2 +- .../tool-ui/podcast/brief-review.tsx | 20 +++------ .../contracts/types/podcast.types.ts | 21 ++------- surfsense_web/lib/env-config.ts | 5 +-- surfsense_web/lib/supported-extensions.ts | 4 +- 10 files changed, 42 insertions(+), 59 deletions(-) diff --git a/surfsense_backend/alembic/versions/164_remove_inactive_users.py b/surfsense_backend/alembic/versions/164_remove_inactive_users.py index 71490db90..bacac7f4a 100644 --- a/surfsense_backend/alembic/versions/164_remove_inactive_users.py +++ b/surfsense_backend/alembic/versions/164_remove_inactive_users.py @@ -23,6 +23,7 @@ import time from collections.abc import Sequence import sqlalchemy as sa + from alembic import op revision: str = "164" diff --git a/surfsense_backend/alembic/versions/165_add_chunk_position.py b/surfsense_backend/alembic/versions/165_add_chunk_position.py index 239c454d5..933663de8 100644 --- a/surfsense_backend/alembic/versions/165_add_chunk_position.py +++ b/surfsense_backend/alembic/versions/165_add_chunk_position.py @@ -16,6 +16,7 @@ import time from collections.abc import Sequence import sqlalchemy as sa + from alembic import op revision: str = "165" diff --git a/surfsense_backend/tests/integration/test_connector_index_authz.py b/surfsense_backend/tests/integration/test_connector_index_authz.py index 039a42760..906dea8f9 100644 --- a/surfsense_backend/tests/integration/test_connector_index_authz.py +++ b/surfsense_backend/tests/integration/test_connector_index_authz.py @@ -15,6 +15,7 @@ boundary. from __future__ import annotations +import contextlib import uuid from unittest.mock import AsyncMock, patch @@ -97,14 +98,16 @@ class TestConnectorIndexCrossSpaceAuthz: db_session, victim, space_a, SearchSourceConnectorType.GITHUB_CONNECTOR ) - with patch(_CHECK_PERMISSION, new=AsyncMock()) as check_permission_mock: - with pytest.raises(HTTPException) as exc_info: - await index_connector_content( - connector_id=connector_a.id, - search_space_id=space_b.id, # the attacker's own space - session=db_session, - user=attacker, - ) + with ( + patch(_CHECK_PERMISSION, new=AsyncMock()) as check_permission_mock, + pytest.raises(HTTPException) as exc_info, + ): + await index_connector_content( + connector_id=connector_a.id, + search_space_id=space_b.id, # the attacker's own space + session=db_session, + user=attacker, + ) assert exc_info.value.status_code == 404 # Rejected at the search-space reconciliation, never reaching (or relying @@ -124,18 +127,18 @@ class TestConnectorIndexCrossSpaceAuthz: db_session, owner, space, SearchSourceConnectorType.CLICKUP_CONNECTOR ) - with patch(_CHECK_PERMISSION, new=AsyncMock()) as check_permission_mock: - try: - await index_connector_content( - connector_id=connector.id, - search_space_id=space.id, # the connector's own space - session=db_session, - user=owner, - ) - except Exception: - # Any downstream indexing behaviour is irrelevant to the authz - # contract under test; we only assert what space was authorized. - pass + # Any downstream indexing behaviour is irrelevant to the authz contract + # under test; we only assert what space was authorized. + with ( + patch(_CHECK_PERMISSION, new=AsyncMock()) as check_permission_mock, + contextlib.suppress(Exception), + ): + await index_connector_content( + connector_id=connector.id, + search_space_id=space.id, # the connector's own space + session=db_session, + user=owner, + ) check_permission_mock.assert_awaited_once() # The space passed to check_permission must be the connector's own space. diff --git a/surfsense_web/app/sitemap.ts b/surfsense_web/app/sitemap.ts index d18d0440f..d0de9fb3e 100644 --- a/surfsense_web/app/sitemap.ts +++ b/surfsense_web/app/sitemap.ts @@ -1,8 +1,8 @@ import { loader } from "fumadocs-core/source"; import type { MetadataRoute } from "next"; import { blog, changelog } from "@/.source/server"; -import { source as docsSource } from "@/lib/source"; import { SERVER_BACKEND_URL } from "@/lib/env-config"; +import { source as docsSource } from "@/lib/source"; const blogSource = loader({ baseUrl: "/blog", diff --git a/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx b/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx index 4084144cf..f7b27441b 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx +++ b/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx @@ -2,10 +2,10 @@ import { Search } from "lucide-react"; import type { FC } from "react"; +import { useIsSelfHosted } from "@/components/providers/runtime-config"; import { EnumConnectorName } from "@/contracts/enums/connector"; import type { SearchSourceConnector } from "@/contracts/types/connector.types"; import { usePlatform } from "@/hooks/use-platform"; -import { useIsSelfHosted } from "@/components/providers/runtime-config"; import { ConnectorCard } from "../components/connector-card"; import { COMPOSIO_CONNECTORS, diff --git a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx index bc5b9ac13..44cc56ab0 100644 --- a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx @@ -43,6 +43,7 @@ import type { FolderDisplay } from "@/components/documents/FolderNode"; import { FolderPickerDialog } from "@/components/documents/FolderPickerDialog"; import { FolderTreeView } from "@/components/documents/FolderTreeView"; import { VersionHistoryDialog } from "@/components/documents/version-history"; +import { useRuntimeConfig } from "@/components/providers/runtime-config"; import { EXPORT_FILE_EXTENSIONS } from "@/components/shared/ExportMenuItems"; import { DEFAULT_EXCLUDE_PATTERNS, @@ -72,7 +73,6 @@ import type { DocumentTypeEnum } from "@/contracts/types/document.types"; import { useDebouncedValue } from "@/hooks/use-debounced-value"; import { useMediaQuery } from "@/hooks/use-media-query"; import { useElectronAPI, usePlatform } from "@/hooks/use-platform"; -import { useRuntimeConfig } from "@/components/providers/runtime-config"; import { anonymousChatApiService } from "@/lib/apis/anonymous-chat-api.service"; import { documentsApiService } from "@/lib/apis/documents-api.service"; import { foldersApiService } from "@/lib/apis/folders-api.service"; diff --git a/surfsense_web/components/tool-ui/podcast/brief-review.tsx b/surfsense_web/components/tool-ui/podcast/brief-review.tsx index 98616643a..d982d6f85 100644 --- a/surfsense_web/components/tool-ui/podcast/brief-review.tsx +++ b/surfsense_web/components/tool-ui/podcast/brief-review.tsx @@ -24,8 +24,8 @@ import { } from "@/components/ui/select"; import { Textarea } from "@/components/ui/textarea"; import { - MAX_DURATION_SECONDS, type LanguageOptions, + MAX_DURATION_SECONDS, MAX_SPEAKERS, MIN_DURATION_SECONDS, type PodcastSpec, @@ -68,7 +68,7 @@ interface BriefReviewProps { export function BriefReview({ podcast, spec }: BriefReviewProps) { const [draft, setDraft] = useState(spec); const [durationUnit, setDurationUnit] = useState(() => - defaultDurationUnit(spec.duration.max_seconds), + defaultDurationUnit(spec.duration.max_seconds) ); const [voices, setVoices] = useState(null); const [offering, setOffering] = useState(null); @@ -361,7 +361,7 @@ export function BriefReview({ podcast, spec }: BriefReviewProps) { value={formatDurationForUnit(draft.duration.min_seconds, durationUnit)} onChange={(e) => { const seconds = clampDurationSeconds( - fromUnitValue(Number(e.target.value), durationUnit), + fromUnitValue(Number(e.target.value), durationUnit) ); setDraft((current) => ({ ...current, @@ -381,15 +381,9 @@ export function BriefReview({ podcast, spec }: BriefReviewProps) { value={formatDurationForUnit(draft.duration.max_seconds, durationUnit)} onChange={(e) => { const parsed = Number(e.target.value); - const fallback = secondsToUnitValue( - draft.duration.min_seconds, - durationUnit, - ); + const fallback = secondsToUnitValue(draft.duration.min_seconds, durationUnit); const seconds = clampDurationSeconds( - fromUnitValue( - Number.isFinite(parsed) ? parsed : fallback, - durationUnit, - ), + fromUnitValue(Number.isFinite(parsed) ? parsed : fallback, durationUnit) ); setDraft((current) => ({ ...current, @@ -426,9 +420,7 @@ export function BriefReview({ podcast, spec }: BriefReviewProps) {