chore: ran linting

This commit is contained in:
Anish Sarkar 2026-05-20 12:55:10 +05:30
parent 78a3c71bb5
commit fe07de3f9c
7 changed files with 21 additions and 11 deletions

View file

@ -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)

View file

@ -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 = {

View file

@ -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()

View file

@ -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()

View file

@ -216,10 +216,7 @@ export const DocumentNode = React.memo(function DocumentNode({
return (
<>
{isMemoryDocument ? (
<span
aria-disabled="true"
className="h-3.5 w-3.5 shrink-0 cursor-default"
>
<span aria-disabled="true" className="h-3.5 w-3.5 shrink-0 cursor-default">
<Checkbox
checked={false}
disabled

View file

@ -16,13 +16,13 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { toast } from "sonner";
import { closeEditorPanelAtom, editorPanelAtom } from "@/atoms/editor/editor-panel.atom";
import { VersionHistoryButton } from "@/components/documents/version-history";
import { SourceCodeEditor } from "@/components/editor/source-code-editor";
import {
fetchMemoryEditorDocument,
getMemoryLimitState,
type MemoryLimits,
saveMemoryMarkdown,
} from "@/components/editor-panel/memory";
import { SourceCodeEditor } from "@/components/editor/source-code-editor";
import { MarkdownViewer } from "@/components/markdown-viewer";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";

View file

@ -832,7 +832,10 @@ function AuthenticatedDocumentsSidebarBase({
throw new Error(errorData.detail || "Export failed");
}
const data = (await response.json()) as { memory_md?: string };
downloadTextFile(data.memory_md ?? "", doc.title.endsWith(".md") ? doc.title : `${doc.title}.md`);
downloadTextFile(
data.memory_md ?? "",
doc.title.endsWith(".md") ? doc.title : `${doc.title}.md`
);
return;
} catch (err) {
console.error("Memory export failed:", err);