mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
Signed-off-by: Claude <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
@@ -360,11 +360,15 @@ class ProjectService:
|
||||
}
|
||||
await self.repository.create(project_data)
|
||||
|
||||
# Add projects that exist in DB but not in config to config
|
||||
# Remove projects that exist in DB but not in config
|
||||
# Config is the source of truth - if a project was deleted from config,
|
||||
# it should be deleted from DB too (fixes issue #193)
|
||||
for name, project in db_projects_by_permalink.items():
|
||||
if name not in config_projects:
|
||||
logger.info(f"Adding project '{name}' to configuration")
|
||||
self.config_manager.add_project(name, project.path)
|
||||
logger.info(
|
||||
f"Removing project '{name}' from database (deleted from config, source of truth)"
|
||||
)
|
||||
await self.repository.delete(project.id)
|
||||
|
||||
# Ensure database default project state is consistent
|
||||
await self._ensure_single_default_project()
|
||||
|
||||
@@ -236,6 +236,17 @@ class WatchService:
|
||||
# avoid circular imports
|
||||
from basic_memory.sync.sync_service import get_sync_service
|
||||
|
||||
# Check if project still exists in configuration before processing
|
||||
# This prevents deleted projects from being recreated by background sync
|
||||
from basic_memory.config import ConfigManager
|
||||
config_manager = ConfigManager()
|
||||
if project.name not in config_manager.projects and project.permalink not in config_manager.projects:
|
||||
logger.info(
|
||||
f"Skipping sync for deleted project: {project.name}, "
|
||||
f"change_count={len(changes)}"
|
||||
)
|
||||
return
|
||||
|
||||
sync_service = await get_sync_service(project)
|
||||
file_service = sync_service.file_service
|
||||
|
||||
|
||||
Reference in New Issue
Block a user