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