rename(547): the server is grimoire — package, image, DB defaults, backups
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 56s
CI & Build / integration (push) Successful in 1m4s
CI & Build / Python tests (push) Successful in 1m55s
CI & Build / Build & push image (push) Successful in 44s

Step 2 of the Scribe -> Grimoire rename.

- src/scribe -> src/grimoire, and every import, patch target, module path,
  hypercorn entry point and `python -m grimoire.restore` with it; pyproject,
  uv.lock and the frontend package are named grimoire.
- Image git.fabledsword.com/bvandeusen/fabledgrimoire; CI's Postgres service
  runs as grimoire / grimoire_test.
- Compose files default the DB user, database and (prod) volume to grimoire,
  each overridable from .env, so an install created as Scribe keeps its data
  by setting POSTGRES_USER, POSTGRES_DB and PGDATA_VOLUME.
- Backups are written as grimoire-<ts>.tar with format grimoire-backup-tar.
  Archives named scribe-* with the scribe-backup-tar manifest still restore
  and are still counted at the destination (folder and S3), with tests.
- Exports, the MCP auth realm, the ASGI scope key and the persistent logger
  carry the new name.

Kept on purpose: the secret-sealing key label stays "scribe.secrets.v1",
because every stored secret was derived under it.

Plugin identity (plugin name, hooks, env vars, .scribe marker, skills) is
step 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 10:50:45 -04:00
co-authored by Claude Opus 5.5
parent e99f1169f7
commit 0f5ef0be63
447 changed files with 3611 additions and 3558 deletions
+30 -30
View File
@@ -28,8 +28,8 @@ async def test_update_note_sets_started_at_on_in_progress():
mock_session.commit = AsyncMock()
mock_session.refresh = AsyncMock()
with patch("scribe.services.notes.async_session", return_value=mock_session):
from scribe.services.notes import update_note
with patch("grimoire.services.notes.async_session", return_value=mock_session):
from grimoire.services.notes import update_note
await update_note(1, 1, status="in_progress")
assert mock_note.started_at is not None
@@ -50,8 +50,8 @@ async def test_update_note_sets_completed_at_on_done():
mock_session.commit = AsyncMock()
mock_session.refresh = AsyncMock()
with patch("scribe.services.notes.async_session", return_value=mock_session):
from scribe.services.notes import update_note
with patch("grimoire.services.notes.async_session", return_value=mock_session):
from grimoire.services.notes import update_note
await update_note(1, 1, status="done")
assert mock_note.completed_at is not None
@@ -72,8 +72,8 @@ async def test_update_note_clears_timestamps_on_todo():
mock_session.commit = AsyncMock()
mock_session.refresh = AsyncMock()
with patch("scribe.services.notes.async_session", return_value=mock_session):
from scribe.services.notes import update_note
with patch("grimoire.services.notes.async_session", return_value=mock_session):
from grimoire.services.notes import update_note
await update_note(1, 1, status="todo")
assert mock_note.started_at is None
@@ -95,8 +95,8 @@ async def test_update_note_preserves_started_at_if_already_set():
mock_session.commit = AsyncMock()
mock_session.refresh = AsyncMock()
with patch("scribe.services.notes.async_session", return_value=mock_session):
from scribe.services.notes import update_note
with patch("grimoire.services.notes.async_session", return_value=mock_session):
from grimoire.services.notes import update_note
await update_note(1, 1, status="in_progress")
assert mock_note.started_at == original_start
@@ -108,42 +108,42 @@ import pytest
def test_validate_interval_rule_valid():
from scribe.services.recurrence import validate_recurrence_rule
from grimoire.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 scribe.services.recurrence import validate_recurrence_rule
from grimoire.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 scribe.services.recurrence import validate_recurrence_rule
from grimoire.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 scribe.services.recurrence import validate_recurrence_rule
from grimoire.services.recurrence import validate_recurrence_rule
validate_recurrence_rule({"type": "calendar", "unit": "month", "day_of_month": 1})
def test_validate_calendar_annual_valid():
from scribe.services.recurrence import validate_recurrence_rule
from grimoire.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 scribe.services.recurrence import validate_recurrence_rule
from grimoire.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 scribe.services.recurrence import validate_recurrence_rule
from grimoire.services.recurrence import validate_recurrence_rule
with pytest.raises(ValueError, match="month"):
validate_recurrence_rule(
{"type": "calendar", "unit": "year", "day_of_month": 15}
@@ -151,7 +151,7 @@ def test_validate_calendar_annual_missing_month():
def test_validate_unknown_type():
from scribe.services.recurrence import validate_recurrence_rule
from grimoire.services.recurrence import validate_recurrence_rule
with pytest.raises(ValueError, match="type"):
validate_recurrence_rule({"type": "cron", "every": 1, "unit": "day"})
@@ -159,60 +159,60 @@ def test_validate_unknown_type():
# ── calculate_next_due ────────────────────────────────────────────────────────
def test_calculate_next_due_interval_days():
from scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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 scribe.services.recurrence import calculate_next_due
from grimoire.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)
@@ -247,14 +247,14 @@ async def test_spawn_recurring_tasks_creates_child():
mock_child.body = ""
with (
patch("scribe.services.recurrence.async_session", return_value=mock_session),
patch("grimoire.services.recurrence.async_session", return_value=mock_session),
patch(
"scribe.services.notes.create_note",
"grimoire.services.notes.create_note",
new_callable=AsyncMock,
return_value=mock_child,
) as mock_create,
):
from scribe.services.recurrence import spawn_recurring_tasks
from grimoire.services.recurrence import spawn_recurring_tasks
count = await spawn_recurring_tasks()
assert count == 1
@@ -278,8 +278,8 @@ async def test_list_notes_multi_status_builds_in_clause():
mock_session.execute = AsyncMock(return_value=mock_result)
mock_session.scalar = AsyncMock(return_value=0)
with patch("scribe.services.notes.async_session", return_value=mock_session):
from scribe.services.notes import list_notes
with patch("grimoire.services.notes.async_session", return_value=mock_session):
from grimoire.services.notes import list_notes
notes, total = await list_notes(1, status=["todo", "in_progress"], is_task=True)
assert total == 0