Fix: Beta testing fixes (#16)

Co-authored-by: phernandez <phernandez@basicmachines.co>
This commit is contained in:
Paul Hernandez
2025-02-28 20:23:53 -06:00
committed by GitHub
parent 4bcbeacdd2
commit f8078cdd46
49 changed files with 1075 additions and 1215 deletions
+14 -10
View File
@@ -10,6 +10,7 @@ from typing import Tuple
import logfire
from loguru import logger
from sqlalchemy.exc import IntegrityError
from basic_memory.markdown import EntityParser
from basic_memory.models import Entity
@@ -178,11 +179,11 @@ class SyncService:
return entity, checksum
except Exception as e: # pragma: no cover
logger.error(f"Failed to sync {path}: {e}")
raise
logger.exception(f"Failed to sync {path}: {e}")
return None, None # pyright: ignore
async def sync_markdown_file(self, path: str, new: bool = True) -> Tuple[Entity, str]:
"""Sync a markdown file with full processing."""
"""Sync a markdown file with full proces sing."""
# Parse markdown first to get any existing permalink
entity_markdown = await self.entity_parser.parse_file(path)
@@ -301,13 +302,16 @@ class SyncService:
logger.debug(
f"Resolved forward reference: {relation.to_name} -> {resolved_entity.title}"
)
await self.relation_repository.update(
relation.id,
{
"to_id": resolved_entity.id,
"to_name": resolved_entity.title,
},
)
try:
await self.relation_repository.update(
relation.id,
{
"to_id": resolved_entity.id,
"to_name": resolved_entity.title,
},
)
except IntegrityError: # pragma: no cover
logger.debug(f"Ignoring duplicate relation {relation}")
# update search index
await self.search_service.index_entity(resolved_entity)
+9 -4
View File
@@ -192,9 +192,14 @@ class WatchService:
for path in adds:
if path not in processed:
_, checksum = await self.sync_service.sync_file(path, new=True)
self.state.add_event(path=path, action="new", status="success", checksum=checksum)
self.console.print(f"[green]✓[/green] Added: {path}")
processed.add(path)
if checksum:
self.state.add_event(
path=path, action="new", status="success", checksum=checksum
)
self.console.print(f"[green]✓[/green] Added: {path}")
processed.add(path)
else:
self.console.print(f"[orange]?[/orange] Error syncing: {path}")
for path in modifies:
if path not in processed:
@@ -207,7 +212,7 @@ class WatchService:
# Add a divider if we processed any files
if processed:
self.console.print("" * 50, style="dim")
self.console.print("" * 80, style="dim")
self.state.last_scan = datetime.now()
self.state.synced_files += len(processed)