From fe07de3f9c027cad75493ce8e0670d347d497fc3 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 12:55:10 +0530 Subject: [PATCH] chore: ran linting --- surfsense_backend/app/services/memory/service.py | 8 ++++++-- surfsense_backend/app/services/memory/validation.py | 4 +++- .../agents/new_chat/tools/test_update_memory_scope.py | 4 +++- .../tests/unit/services/test_memory_service.py | 4 +++- surfsense_web/components/documents/DocumentNode.tsx | 5 +---- surfsense_web/components/editor-panel/editor-panel.tsx | 2 +- .../components/layout/ui/sidebar/DocumentsSidebar.tsx | 5 ++++- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/surfsense_backend/app/services/memory/service.py b/surfsense_backend/app/services/memory/service.py index 8159977a7..d4a7d0974 100644 --- a/surfsense_backend/app/services/memory/service.py +++ b/surfsense_backend/app/services/memory/service.py @@ -92,7 +92,9 @@ async def _load_target( select(User).where(User.id == _normalize_user_id(target_id)) # type: ignore[arg-type] ) return result.scalars().first() - result = await session.execute(select(SearchSpace).where(SearchSpace.id == int(target_id))) + result = await session.execute( + select(SearchSpace).where(SearchSpace.id == int(target_id)) + ) return result.scalars().first() @@ -141,7 +143,9 @@ async def save_memory( if target is None: return SaveResult( status="error", - message="User not found." if normalized is MemoryScope.USER else "Search space not found.", + message="User not found." + if normalized is MemoryScope.USER + else "Search space not found.", ) old_memory = _get_memory(target, normalized) diff --git a/surfsense_backend/app/services/memory/validation.py b/surfsense_backend/app/services/memory/validation.py index 0e856943b..f9c5007d9 100644 --- a/surfsense_backend/app/services/memory/validation.py +++ b/surfsense_backend/app/services/memory/validation.py @@ -11,7 +11,9 @@ MEMORY_HARD_LIMIT = 25_000 _SECTION_HEADING_RE = re.compile(r"^##\s+(.+)$", re.MULTILINE) _HEADING_LINE_RE = re.compile(r"^##\s+\S+", re.MULTILINE) _HEADING_NORMALIZE_RE = re.compile(r"[^a-z0-9]+") -_LEGACY_BULLET_RE = re.compile(r"^-\s+\(\d{4}-\d{2}-\d{2}\)\s+\[(fact|pref|instr)\]\s+.+$") +_LEGACY_BULLET_RE = re.compile( + r"^-\s+\(\d{4}-\d{2}-\d{2}\)\s+\[(fact|pref|instr)\]\s+.+$" +) _NEW_BULLET_RE = re.compile(r"^-\s+\d{4}-\d{2}-\d{2}:\s+.+$") _FORBIDDEN_TEAM_HEADINGS = { diff --git a/surfsense_backend/tests/unit/agents/new_chat/tools/test_update_memory_scope.py b/surfsense_backend/tests/unit/agents/new_chat/tools/test_update_memory_scope.py index 60310d907..f1a0f97f0 100644 --- a/surfsense_backend/tests/unit/agents/new_chat/tools/test_update_memory_scope.py +++ b/surfsense_backend/tests/unit/agents/new_chat/tools/test_update_memory_scope.py @@ -88,7 +88,9 @@ async def test_save_memory_blocks_new_personal_heading_in_team_before_commit( @pytest.mark.asyncio -async def test_save_memory_allows_grandfathered_personal_heading_in_team(monkeypatch) -> None: +async def test_save_memory_allows_grandfathered_personal_heading_in_team( + monkeypatch, +) -> None: content = "## Preferences\n- 2026-04-10: Prefers dark mode\n" target = type("Target", (), {"shared_memory_md": content})() session = _FakeSession() diff --git a/surfsense_backend/tests/unit/services/test_memory_service.py b/surfsense_backend/tests/unit/services/test_memory_service.py index c16e34062..e7fef2cac 100644 --- a/surfsense_backend/tests/unit/services/test_memory_service.py +++ b/surfsense_backend/tests/unit/services/test_memory_service.py @@ -108,7 +108,9 @@ async def test_save_memory_rejects_long_no_heading_payload(monkeypatch) -> None: @pytest.mark.asyncio -async def test_save_memory_grandfathers_existing_team_personal_heading(monkeypatch) -> None: +async def test_save_memory_grandfathers_existing_team_personal_heading( + monkeypatch, +) -> None: content = "## Preferences\n- 2026-05-19: Existing legacy heading\n" target = SimpleNamespace(shared_memory_md=content) session = _FakeSession() diff --git a/surfsense_web/components/documents/DocumentNode.tsx b/surfsense_web/components/documents/DocumentNode.tsx index 86c9b899a..a13bd0079 100644 --- a/surfsense_web/components/documents/DocumentNode.tsx +++ b/surfsense_web/components/documents/DocumentNode.tsx @@ -216,10 +216,7 @@ export const DocumentNode = React.memo(function DocumentNode({ return ( <> {isMemoryDocument ? ( - +