Skip to content

Commit 32929fe

Browse files
fix: add null guard for markdown_processor in read_entity_content
Pyright flagged `self.markdown_processor.read_file()` as reportOptionalMemberAccess after markdown_processor was made Optional in the FileService refactor. Added a fail-fast ValueError if markdown_processor is None when read_entity_content is called — consistent with the project's fail-fast principle and allows Pyright to narrow the type for the subsequent call. Co-authored-by: jope-bm <jope-bm@users.noreply.github.com> Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
1 parent 4788436 commit 32929fe

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/basic_memory/services/file_service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ async def read_entity_content(self, entity: EntityModel) -> str:
7979
"""
8080
logger.debug(f"Reading entity content, entity_id={entity.id}, permalink={entity.permalink}")
8181

82+
# markdown_processor is required for entity content reads — fail fast if not configured
83+
if self.markdown_processor is None:
84+
raise ValueError("markdown_processor is required for read_entity_content")
85+
8286
file_path = self.get_entity_path(entity)
8387
markdown = await self.markdown_processor.read_file(file_path)
8488
return markdown.content or ""

0 commit comments

Comments
 (0)