chore(dead-code): fix prod image, drop orphaned code, correct delete_rule doc
Drift-audit Group 7 (renamed/removed lingers) + Group 5 #9: - docker-compose.prod.yml pulled fabledassistant:latest, a tag CI stopped publishing after the rename. Point it at fabledscribe:latest (the name CI and quickstart use). The internal DB name stays fabledassistant by design. - Remove the unused hard-delete delete_note imports from the notes and tasks route modules (they delete via trash; the import was an attractive nuisance that bypassed soft-delete). - delete_rule MCP tool: docstring/warning said 'permanently delete' but the body moves the rule to recoverable trash. Corrected to match. - Delete services/calendar_sync.py: fully orphaned (zero importers) and it read Config attrs that no longer exist, so any re-wiring would crash. - Remove dead services: notes.search_notes_for_context and logging.log_generation (zero callers; log_generation wrote a 'generation' category no stats/UI surface). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -409,37 +409,6 @@ async def convert_task_to_note(user_id: int, note_id: int) -> Note:
|
||||
return note
|
||||
|
||||
|
||||
async def search_notes_for_context(
|
||||
user_id: int,
|
||||
keywords: list[str],
|
||||
exclude_ids: set[int] | None = None,
|
||||
limit: int = 3,
|
||||
project_id: int | None = None,
|
||||
orphan_only: bool = False,
|
||||
) -> list[Note]:
|
||||
"""Search notes by keywords with OR logic. Optimized for context building — no count query."""
|
||||
async with async_session() as session:
|
||||
keyword_filters = []
|
||||
for kw in keywords:
|
||||
escaped = kw.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_")
|
||||
pattern = f"%{escaped}%"
|
||||
keyword_filters.append(or_(Note.title.ilike(pattern), Note.body.ilike(pattern)))
|
||||
|
||||
query = select(Note).where(
|
||||
Note.user_id == user_id, or_(*keyword_filters), Note.deleted_at.is_(None)
|
||||
)
|
||||
if orphan_only:
|
||||
query = query.where(Note.project_id.is_(None))
|
||||
elif project_id is not None:
|
||||
query = query.where(Note.project_id == project_id)
|
||||
if exclude_ids:
|
||||
query = query.where(Note.id.notin_(exclude_ids))
|
||||
query = query.order_by(Note.updated_at.desc()).limit(limit)
|
||||
|
||||
result = await session.execute(query)
|
||||
return list(result.scalars().all())
|
||||
|
||||
|
||||
async def get_notes_by_ids(user_id: int, note_ids: list[int]) -> dict[int, Note]:
|
||||
"""Batch fetch notes by ID list. Returns {note_id: Note}."""
|
||||
if not note_ids:
|
||||
|
||||
Reference in New Issue
Block a user