refactor: rename package fabledassistant -> scribe (code-only)
Renames src/fabledassistant -> src/scribe and all imports, plus the default DB name and DB user/password (fabled -> scribe) in config + compose. 952 refs / 154 files. Reverses the old 'internal name stays fabledassistant' convention. Code-only: live databases are still physically named 'fabledassistant'. Deployed environments must set POSTGRES_DB / POSTGRES_USER (or rename the DB) since the defaults now resolve to 'scribe'. Repo (FabledScribe), git host (fabledsword), MCP (fabled-git) and the image name (fabledscribe) are intentionally unchanged. ruff check src/ clean locally; CI (typecheck + pytest) is the gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,8 +6,8 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from fabledassistant.mcp._context import _user_id_ctx
|
||||
from fabledassistant.mcp.tools.entities import (
|
||||
from scribe.mcp._context import _user_id_ctx
|
||||
from scribe.mcp.tools.entities import (
|
||||
list_persons, create_person, update_person,
|
||||
create_place, update_place,
|
||||
create_list, update_list,
|
||||
@@ -38,7 +38,7 @@ def _fake_note(*, note_type="note", entity_meta=None, **overrides) -> MagicMock:
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_persons_calls_knowledge_with_person_type():
|
||||
mock = AsyncMock(return_value=([{"id": 1, "title": "alice"}], 1))
|
||||
with patch("fabledassistant.mcp.tools.entities.knowledge_svc.query_knowledge", mock):
|
||||
with patch("scribe.mcp.tools.entities.knowledge_svc.query_knowledge", mock):
|
||||
out = await list_persons(tag="work")
|
||||
kwargs = mock.call_args.kwargs
|
||||
assert kwargs["note_type"] == "person"
|
||||
@@ -55,7 +55,7 @@ async def test_create_person_only_includes_provided_fields_in_meta():
|
||||
"""Empty-string fields must NOT pollute entity_meta."""
|
||||
fake = _fake_note(note_type="person")
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
with patch("scribe.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
await create_person(name="Alice", email="a@x.com")
|
||||
kwargs = mock.call_args.kwargs
|
||||
assert kwargs["title"] == "Alice"
|
||||
@@ -68,7 +68,7 @@ async def test_create_person_all_empty_meta_is_none():
|
||||
"""Service is called with entity_meta=None when no typed fields were given."""
|
||||
fake = _fake_note(note_type="person")
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
with patch("scribe.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
await create_person(name="Bob")
|
||||
assert mock.call_args.kwargs["entity_meta"] is None
|
||||
|
||||
@@ -77,7 +77,7 @@ async def test_create_person_all_empty_meta_is_none():
|
||||
async def test_create_place_categories_into_meta():
|
||||
fake = _fake_note(note_type="place")
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
with patch("scribe.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
await create_place(name="Cafe X", address="123 Main", category="coffee")
|
||||
meta = mock.call_args.kwargs["entity_meta"]
|
||||
assert meta == {"address": "123 Main", "category": "coffee"}
|
||||
@@ -87,7 +87,7 @@ async def test_create_place_categories_into_meta():
|
||||
async def test_create_list_translates_strings_to_unchecked_items():
|
||||
fake = _fake_note(note_type="list")
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
with patch("scribe.mcp.tools.entities.notes_svc.create_note", mock):
|
||||
await create_list(name="shopping", items=["milk", "bread"])
|
||||
meta = mock.call_args.kwargs["entity_meta"]
|
||||
assert meta["list_items"] == [
|
||||
@@ -110,9 +110,9 @@ async def test_update_person_merges_meta_preserving_other_fields():
|
||||
updated = _fake_note(note_type="person")
|
||||
update_mock = AsyncMock(return_value=updated)
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.get_note", get_mock,
|
||||
"scribe.mcp.tools.entities.notes_svc.get_note", get_mock,
|
||||
), patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.update_note", update_mock,
|
||||
"scribe.mcp.tools.entities.notes_svc.update_note", update_mock,
|
||||
):
|
||||
await update_person(person_id=5, email="new@x.com")
|
||||
new_meta = update_mock.call_args.kwargs["entity_meta"]
|
||||
@@ -127,10 +127,10 @@ async def test_update_person_no_typed_fields_keeps_meta_unchanged():
|
||||
)
|
||||
updated = _fake_note(note_type="person")
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.get_note",
|
||||
"scribe.mcp.tools.entities.notes_svc.get_note",
|
||||
AsyncMock(return_value=existing),
|
||||
), patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.update_note",
|
||||
"scribe.mcp.tools.entities.notes_svc.update_note",
|
||||
AsyncMock(return_value=updated),
|
||||
) as update_mock:
|
||||
await update_person(person_id=5, name="New Name")
|
||||
@@ -144,7 +144,7 @@ async def test_update_person_rejects_wrong_type():
|
||||
"""Trying to update a 'place' as a 'person' must fail."""
|
||||
wrong_type = _fake_note(id=5, note_type="place")
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.get_note",
|
||||
"scribe.mcp.tools.entities.notes_svc.get_note",
|
||||
AsyncMock(return_value=wrong_type),
|
||||
):
|
||||
with pytest.raises(ValueError, match="person 5 not found"):
|
||||
@@ -160,10 +160,10 @@ async def test_update_list_items_empty_list_clears_items():
|
||||
)
|
||||
updated = _fake_note(note_type="list")
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.get_note",
|
||||
"scribe.mcp.tools.entities.notes_svc.get_note",
|
||||
AsyncMock(return_value=existing),
|
||||
), patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.update_note",
|
||||
"scribe.mcp.tools.entities.notes_svc.update_note",
|
||||
AsyncMock(return_value=updated),
|
||||
) as update_mock:
|
||||
await update_list(list_id=5, items=[])
|
||||
@@ -178,10 +178,10 @@ async def test_update_list_items_none_leaves_items_unchanged():
|
||||
)
|
||||
updated = _fake_note(note_type="list")
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.get_note",
|
||||
"scribe.mcp.tools.entities.notes_svc.get_note",
|
||||
AsyncMock(return_value=existing),
|
||||
), patch(
|
||||
"fabledassistant.mcp.tools.entities.notes_svc.update_note",
|
||||
"scribe.mcp.tools.entities.notes_svc.update_note",
|
||||
AsyncMock(return_value=updated),
|
||||
) as update_mock:
|
||||
await update_list(list_id=5, name="renamed")
|
||||
|
||||
Reference in New Issue
Block a user