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:
+31
-31
@@ -21,8 +21,8 @@ async def test_update_note_sets_started_at_on_in_progress():
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock(return_value=False)
|
||||
|
||||
with patch("fabledassistant.services.notes.async_session", return_value=mock_session):
|
||||
from fabledassistant.services.notes import update_note
|
||||
with patch("scribe.services.notes.async_session", return_value=mock_session):
|
||||
from scribe.services.notes import update_note
|
||||
await update_note(1, 1, status="in_progress")
|
||||
|
||||
assert mock_note.started_at is not None
|
||||
@@ -45,8 +45,8 @@ async def test_update_note_sets_completed_at_on_done():
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock(return_value=False)
|
||||
|
||||
with patch("fabledassistant.services.notes.async_session", return_value=mock_session):
|
||||
from fabledassistant.services.notes import update_note
|
||||
with patch("scribe.services.notes.async_session", return_value=mock_session):
|
||||
from scribe.services.notes import update_note
|
||||
await update_note(1, 1, status="done")
|
||||
|
||||
assert mock_note.completed_at is not None
|
||||
@@ -69,8 +69,8 @@ async def test_update_note_clears_timestamps_on_todo():
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock(return_value=False)
|
||||
|
||||
with patch("fabledassistant.services.notes.async_session", return_value=mock_session):
|
||||
from fabledassistant.services.notes import update_note
|
||||
with patch("scribe.services.notes.async_session", return_value=mock_session):
|
||||
from scribe.services.notes import update_note
|
||||
await update_note(1, 1, status="todo")
|
||||
|
||||
assert mock_note.started_at is None
|
||||
@@ -94,8 +94,8 @@ async def test_update_note_preserves_started_at_if_already_set():
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock(return_value=False)
|
||||
|
||||
with patch("fabledassistant.services.notes.async_session", return_value=mock_session):
|
||||
from fabledassistant.services.notes import update_note
|
||||
with patch("scribe.services.notes.async_session", return_value=mock_session):
|
||||
from scribe.services.notes import update_note
|
||||
await update_note(1, 1, status="in_progress")
|
||||
|
||||
assert mock_note.started_at == original_start
|
||||
@@ -107,42 +107,42 @@ import pytest
|
||||
|
||||
|
||||
def test_validate_interval_rule_valid():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
validate_recurrence_rule({"type": "interval", "every": 3, "unit": "month"}) # no error
|
||||
|
||||
|
||||
def test_validate_interval_rule_bad_unit():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
with pytest.raises(ValueError, match="unit"):
|
||||
validate_recurrence_rule({"type": "interval", "every": 3, "unit": "fortnight"})
|
||||
|
||||
|
||||
def test_validate_interval_rule_bad_every():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
with pytest.raises(ValueError, match="every"):
|
||||
validate_recurrence_rule({"type": "interval", "every": 0, "unit": "week"})
|
||||
|
||||
|
||||
def test_validate_calendar_monthly_valid():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
validate_recurrence_rule({"type": "calendar", "unit": "month", "day_of_month": 1})
|
||||
|
||||
|
||||
def test_validate_calendar_annual_valid():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
validate_recurrence_rule(
|
||||
{"type": "calendar", "unit": "year", "day_of_month": 15, "month": 6}
|
||||
)
|
||||
|
||||
|
||||
def test_validate_calendar_bad_day():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
with pytest.raises(ValueError, match="day_of_month"):
|
||||
validate_recurrence_rule({"type": "calendar", "unit": "month", "day_of_month": 32})
|
||||
|
||||
|
||||
def test_validate_calendar_annual_missing_month():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
with pytest.raises(ValueError, match="month"):
|
||||
validate_recurrence_rule(
|
||||
{"type": "calendar", "unit": "year", "day_of_month": 15}
|
||||
@@ -150,7 +150,7 @@ def test_validate_calendar_annual_missing_month():
|
||||
|
||||
|
||||
def test_validate_unknown_type():
|
||||
from fabledassistant.services.recurrence import validate_recurrence_rule
|
||||
from scribe.services.recurrence import validate_recurrence_rule
|
||||
with pytest.raises(ValueError, match="type"):
|
||||
validate_recurrence_rule({"type": "cron", "every": 1, "unit": "day"})
|
||||
|
||||
@@ -158,60 +158,60 @@ def test_validate_unknown_type():
|
||||
# ── calculate_next_due ────────────────────────────────────────────────────────
|
||||
|
||||
def test_calculate_next_due_interval_days():
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "interval", "every": 7, "unit": "day"}
|
||||
assert calculate_next_due(rule, date(2026, 3, 27)) == date(2026, 4, 3)
|
||||
|
||||
|
||||
def test_calculate_next_due_interval_weeks():
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "interval", "every": 2, "unit": "week"}
|
||||
assert calculate_next_due(rule, date(2026, 3, 27)) == date(2026, 4, 10)
|
||||
|
||||
|
||||
def test_calculate_next_due_interval_months():
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "interval", "every": 3, "unit": "month"}
|
||||
assert calculate_next_due(rule, date(2026, 3, 1)) == date(2026, 6, 1)
|
||||
|
||||
|
||||
def test_calculate_next_due_interval_months_end_of_month():
|
||||
"""Month addition clamps to last day when target month is shorter."""
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "interval", "every": 1, "unit": "month"}
|
||||
assert calculate_next_due(rule, date(2026, 1, 31)) == date(2026, 2, 28)
|
||||
|
||||
|
||||
def test_calculate_next_due_interval_years():
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "interval", "every": 1, "unit": "year"}
|
||||
assert calculate_next_due(rule, date(2026, 3, 27)) == date(2027, 3, 27)
|
||||
|
||||
|
||||
def test_calculate_next_due_calendar_monthly_future_day():
|
||||
"""If day_of_month is later this month, return that date."""
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "calendar", "unit": "month", "day_of_month": 28}
|
||||
assert calculate_next_due(rule, date(2026, 3, 1)) == date(2026, 3, 28)
|
||||
|
||||
|
||||
def test_calculate_next_due_calendar_monthly_same_or_past_day():
|
||||
"""If day_of_month is today or earlier, advance to next month."""
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "calendar", "unit": "month", "day_of_month": 1}
|
||||
assert calculate_next_due(rule, date(2026, 3, 1)) == date(2026, 4, 1)
|
||||
|
||||
|
||||
def test_calculate_next_due_calendar_annual_future():
|
||||
"""Annual date later this year is returned."""
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "calendar", "unit": "year", "day_of_month": 15, "month": 6}
|
||||
assert calculate_next_due(rule, date(2026, 3, 27)) == date(2026, 6, 15)
|
||||
|
||||
|
||||
def test_calculate_next_due_calendar_annual_past():
|
||||
"""Annual date already passed this year → next year."""
|
||||
from fabledassistant.services.recurrence import calculate_next_due
|
||||
from scribe.services.recurrence import calculate_next_due
|
||||
rule = {"type": "calendar", "unit": "year", "day_of_month": 15, "month": 1}
|
||||
assert calculate_next_due(rule, date(2026, 3, 27)) == date(2027, 1, 15)
|
||||
|
||||
@@ -248,15 +248,15 @@ async def test_spawn_recurring_tasks_creates_child():
|
||||
mock_child.body = ""
|
||||
|
||||
with (
|
||||
patch("fabledassistant.services.recurrence.async_session", return_value=mock_session),
|
||||
patch("scribe.services.recurrence.async_session", return_value=mock_session),
|
||||
patch(
|
||||
"fabledassistant.services.notes.create_note",
|
||||
"scribe.services.notes.create_note",
|
||||
new_callable=AsyncMock,
|
||||
return_value=mock_child,
|
||||
) as mock_create,
|
||||
patch("fabledassistant.services.embeddings.upsert_note_embedding"),
|
||||
patch("scribe.services.embeddings.upsert_note_embedding"),
|
||||
):
|
||||
from fabledassistant.services.recurrence import spawn_recurring_tasks
|
||||
from scribe.services.recurrence import spawn_recurring_tasks
|
||||
count = await spawn_recurring_tasks()
|
||||
|
||||
assert count == 1
|
||||
@@ -282,8 +282,8 @@ async def test_list_notes_multi_status_builds_in_clause():
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock(return_value=False)
|
||||
|
||||
with patch("fabledassistant.services.notes.async_session", return_value=mock_session):
|
||||
from fabledassistant.services.notes import list_notes
|
||||
with patch("scribe.services.notes.async_session", return_value=mock_session):
|
||||
from scribe.services.notes import list_notes
|
||||
notes, total = await list_notes(1, status=["todo", "in_progress"], is_task=True)
|
||||
|
||||
assert total == 0
|
||||
|
||||
Reference in New Issue
Block a user