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
+26 -15
View File
@@ -15,11 +15,11 @@ from unittest.mock import patch
import httpx
import pytest
from scribe.services import backup, backup_destination, secrets
from scribe.services.backup_destination import (
from grimoire.services import backup, backup_destination, secrets
from grimoire.services.backup_destination import (
BackupConfig, DestinationError, check_destination, deliver,
)
from scribe.services.backup_file import read_archive
from grimoire.services.backup_file import read_archive
AT = datetime(2026, 10, 15, 2, 0, 0, tzinfo=timezone.utc)
PAYLOAD = {
@@ -27,7 +27,7 @@ PAYLOAD = {
"users": [{"id": 1, "username": "ada"}], "notes": [],
}
S3 = BackupConfig(
destination="s3", s3_endpoint="http://archives:8081", s3_bucket="scribe",
destination="s3", s3_endpoint="http://archives:8081", s3_bucket="grimoire",
s3_access_key="AKIA", s3_region="us-east-1",
)
@@ -81,12 +81,12 @@ def test_config_round_trips_and_defaults_to_off():
def test_a_damaged_config_still_loads():
config = BackupConfig.from_dict({
"hour": "25", "destination": "ftp", "enabled": "yes", "unknown": 1,
"s3_bucket": " scribe ",
"s3_bucket": " grimoire ",
})
assert config.hour == backup_destination.DEFAULT_HOUR
assert config.destination == "folder"
assert config.enabled is False
assert config.s3_bucket == "scribe"
assert config.s3_bucket == "grimoire"
def test_an_incomplete_s3_config_names_what_is_missing():
@@ -109,7 +109,7 @@ def test_a_relative_folder_is_refused():
def test_deliver_to_a_folder_adds_one_dated_file(tmp_path):
config = BackupConfig(folder_path=str(tmp_path))
got = asyncio.run(deliver(PAYLOAD, config, None, AT, app_version="v"))
assert got.name == "scribe-20261015T020000Z.tar"
assert got.name == "grimoire-20261015T020000Z.tar"
assert [p.name for p in tmp_path.iterdir()] == [got.name]
assert got.size_bytes == (tmp_path / got.name).stat().st_size
with open(tmp_path / got.name, "rb") as f:
@@ -123,11 +123,19 @@ def test_a_folder_that_isnt_mounted_says_so(tmp_path):
def test_checking_a_folder_leaves_nothing_behind(tmp_path):
(tmp_path / "scribe-20261014T020000Z.tar").write_bytes(b"x")
(tmp_path / "grimoire-20261015T020000Z.tar").write_bytes(b"x")
config = BackupConfig(folder_path=str(tmp_path))
said = asyncio.run(check_destination(config, None))
assert "holds 1 Grimoire backup" in said
assert [p.name for p in tmp_path.iterdir()] == ["scribe-20261014T020000Z.tar"]
assert [p.name for p in tmp_path.iterdir()] == ["grimoire-20261015T020000Z.tar"]
def test_a_folder_counts_backups_written_under_the_name_scribe(tmp_path):
"""Grimoire was called Scribe; the destination still holds those files."""
for name in ("scribe-20261014T020000Z.tar", "grimoire-20261015T020000Z.tar", "notes.txt"):
(tmp_path / name).write_bytes(b"x")
said = asyncio.run(check_destination(BackupConfig(folder_path=str(tmp_path)), None))
assert "holds 2 Grimoire backup" in said
# ── S3 ───────────────────────────────────────────────────────────────────────
@@ -143,7 +151,7 @@ def test_deliver_to_s3_puts_the_dated_file_and_keeps_no_copy():
got = asyncio.run(deliver(PAYLOAD, S3, "secret", AT, app_version="v",
transport=httpx.MockTransport(handler)))
assert seen["method"] == "PUT"
assert seen["url"] == "http://archives:8081/scribe/scribe-20261015T020000Z.tar"
assert seen["url"] == "http://archives:8081/grimoire/grimoire-20261015T020000Z.tar"
assert read_archive(io.BytesIO(seen["body"])) == PAYLOAD
assert got.size_bytes == len(seen["body"])
@@ -165,15 +173,18 @@ def test_s3_without_its_secret_sends_nothing():
def test_checking_s3_only_lists():
xml = (b'<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">'
b"<Contents><Key>scribe-20261014T020000Z.tar</Key><Size>9</Size>"
b"<LastModified>x</LastModified></Contents></ListBucketResult>")
"""One listing per name the backups have carried: Grimoire was called
Scribe, and the bucket still holds those objects."""
methods = []
def handler(request):
methods.append(request.method)
key = request.url.params["prefix"] + "20261014T020000Z.tar"
xml = (b'<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">'
b"<Contents><Key>" + key.encode() + b"</Key><Size>9</Size>"
b"<LastModified>x</LastModified></Contents></ListBucketResult>")
return httpx.Response(200, content=xml)
said = asyncio.run(check_destination(S3, "secret", transport=httpx.MockTransport(handler)))
assert methods == ["GET"]
assert "holds 1 Grimoire backup" in said
assert methods == ["GET", "GET"]
assert "holds 2 Grimoire backup" in said