Skip to content

Commit 4f299eb

Browse files
jope-bmclaude
andcommitted
fix: Fix type errors in entity_service and write_note
- Import SearchService directly instead of using string forward reference - Add null check for entity.permalink before passing to resolve_entity_id - Fixes pyright type errors reported by CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Joe P <joe@basicmemory.com>
1 parent eacefe1 commit 4f299eb

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/basic_memory/mcp/tools/write_note.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ async def write_note(
164164
if "409" in str(e) or "conflict" in str(e).lower() or "already exists" in str(e).lower():
165165
logger.debug(f"Entity exists, updating instead permalink={entity.permalink}")
166166
try:
167+
if not entity.permalink:
168+
raise ValueError("Entity permalink is required for updates")
167169
entity_id = await resolve_entity_id(client, active_project.id, entity.permalink)
168170
url = f"/v2/projects/{active_project.id}/knowledge/entities/{entity_id}"
169171
response = await call_put(client, url, json=entity.model_dump())

src/basic_memory/services/entity_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from basic_memory.services import BaseService, FileService
3030
from basic_memory.services.exceptions import EntityCreationError, EntityNotFoundError
3131
from basic_memory.services.link_resolver import LinkResolver
32+
from basic_memory.services.search_service import SearchService
3233
from basic_memory.utils import generate_permalink
3334

3435

@@ -43,7 +44,7 @@ def __init__(
4344
relation_repository: RelationRepository,
4445
file_service: FileService,
4546
link_resolver: LinkResolver,
46-
search_service: Optional["SearchService"] = None,
47+
search_service: Optional[SearchService] = None,
4748
app_config: Optional[BasicMemoryConfig] = None,
4849
):
4950
super().__init__(entity_repository)

0 commit comments

Comments
 (0)