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:
@@ -4,8 +4,8 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from fabledassistant.mcp._context import _user_id_ctx
|
||||
from fabledassistant.mcp.tools.events import (
|
||||
from scribe.mcp._context import _user_id_ctx
|
||||
from scribe.mcp.tools.events import (
|
||||
list_events, create_event, get_event,
|
||||
update_event, delete_event,
|
||||
)
|
||||
@@ -38,7 +38,7 @@ async def test_list_events_passes_timezone_aware_range():
|
||||
mock = AsyncMock(return_value=[
|
||||
{"id": 1, "title": "morning standup"},
|
||||
])
|
||||
with patch("fabledassistant.mcp.tools.events.events_svc.list_events", mock):
|
||||
with patch("scribe.mcp.tools.events.events_svc.list_events", mock):
|
||||
out = await list_events(date_from="2026-06-01", date_to="2026-06-08")
|
||||
args, _ = mock.call_args
|
||||
assert args[0] == 7 # user_id
|
||||
@@ -52,7 +52,7 @@ async def test_list_events_passes_timezone_aware_range():
|
||||
async def test_create_event_combines_date_and_time():
|
||||
e = _fake_event()
|
||||
mock = AsyncMock(return_value=e)
|
||||
with patch("fabledassistant.mcp.tools.events.events_svc.create_event", mock):
|
||||
with patch("scribe.mcp.tools.events.events_svc.create_event", mock):
|
||||
await create_event(
|
||||
title="standup", start_date="2026-06-01", start_time="09:30",
|
||||
duration_minutes=15,
|
||||
@@ -67,7 +67,7 @@ async def test_create_event_zero_duration_means_point_event():
|
||||
"""duration_minutes=0 must map to None at the service layer (NULL = point)."""
|
||||
e = _fake_event()
|
||||
mock = AsyncMock(return_value=e)
|
||||
with patch("fabledassistant.mcp.tools.events.events_svc.create_event", mock):
|
||||
with patch("scribe.mcp.tools.events.events_svc.create_event", mock):
|
||||
await create_event(title="x", start_date="2026-06-01")
|
||||
assert mock.call_args.kwargs["duration_minutes"] is None
|
||||
|
||||
@@ -75,7 +75,7 @@ async def test_create_event_zero_duration_means_point_event():
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_event_raises_when_not_found():
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.events.events_svc.get_event",
|
||||
"scribe.mcp.tools.events.events_svc.get_event",
|
||||
AsyncMock(return_value=None),
|
||||
):
|
||||
with pytest.raises(ValueError, match="event 999 not found"):
|
||||
@@ -86,7 +86,7 @@ async def test_get_event_raises_when_not_found():
|
||||
async def test_update_event_only_sends_non_default_fields():
|
||||
e = _fake_event()
|
||||
mock = AsyncMock(return_value=e)
|
||||
with patch("fabledassistant.mcp.tools.events.events_svc.update_event", mock):
|
||||
with patch("scribe.mcp.tools.events.events_svc.update_event", mock):
|
||||
await update_event(event_id=1, title="new title")
|
||||
args, kwargs = mock.call_args
|
||||
assert args == (7, 1)
|
||||
@@ -97,7 +97,7 @@ async def test_update_event_only_sends_non_default_fields():
|
||||
async def test_update_event_duration_minus_one_means_unchanged():
|
||||
e = _fake_event()
|
||||
mock = AsyncMock(return_value=e)
|
||||
with patch("fabledassistant.mcp.tools.events.events_svc.update_event", mock):
|
||||
with patch("scribe.mcp.tools.events.events_svc.update_event", mock):
|
||||
await update_event(event_id=1, duration_minutes=-1)
|
||||
assert "duration_minutes" not in mock.call_args.kwargs
|
||||
|
||||
@@ -107,7 +107,7 @@ async def test_update_event_duration_zero_clears_to_point():
|
||||
"""duration_minutes=0 means "set to point event" (NULL)."""
|
||||
e = _fake_event()
|
||||
mock = AsyncMock(return_value=e)
|
||||
with patch("fabledassistant.mcp.tools.events.events_svc.update_event", mock):
|
||||
with patch("scribe.mcp.tools.events.events_svc.update_event", mock):
|
||||
await update_event(event_id=1, duration_minutes=0)
|
||||
assert mock.call_args.kwargs["duration_minutes"] is None
|
||||
|
||||
@@ -116,7 +116,7 @@ async def test_update_event_duration_zero_clears_to_point():
|
||||
async def test_update_event_requires_both_date_and_time_to_move():
|
||||
e = _fake_event()
|
||||
mock = AsyncMock(return_value=e)
|
||||
with patch("fabledassistant.mcp.tools.events.events_svc.update_event", mock):
|
||||
with patch("scribe.mcp.tools.events.events_svc.update_event", mock):
|
||||
await update_event(event_id=1, start_date="2026-06-02")
|
||||
# Only start_date, no start_time → start_dt NOT in fields
|
||||
assert "start_dt" not in mock.call_args.kwargs
|
||||
@@ -131,7 +131,7 @@ async def test_update_event_requires_both_date_and_time_to_move():
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_event_raises_when_not_found():
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.events.events_svc.update_event",
|
||||
"scribe.mcp.tools.events.events_svc.update_event",
|
||||
AsyncMock(return_value=None),
|
||||
):
|
||||
with pytest.raises(ValueError, match="event 999 not found"):
|
||||
@@ -141,7 +141,7 @@ async def test_update_event_raises_when_not_found():
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_event_soft_deletes_and_returns_batch():
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.events.trash_svc.delete",
|
||||
"scribe.mcp.tools.events.trash_svc.delete",
|
||||
AsyncMock(return_value="batch-1"),
|
||||
):
|
||||
result = await delete_event(event_id=7)
|
||||
@@ -151,7 +151,7 @@ async def test_delete_event_soft_deletes_and_returns_batch():
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_event_raises_when_not_found():
|
||||
with patch(
|
||||
"fabledassistant.mcp.tools.events.trash_svc.delete",
|
||||
"scribe.mcp.tools.events.trash_svc.delete",
|
||||
AsyncMock(return_value=None),
|
||||
):
|
||||
with pytest.raises(ValueError, match="event 999 not found"):
|
||||
|
||||
Reference in New Issue
Block a user