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
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:
@@ -14,7 +14,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from scribe.services import supersession
|
||||
from grimoire.services import supersession
|
||||
from tests.helpers import make_mock_session
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ def _live_note(note_id=1):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_a_caller_who_cannot_write_the_note_gets_none():
|
||||
with patch("scribe.services.supersession.access.can_write_note",
|
||||
with patch("grimoire.services.supersession.access.can_write_note",
|
||||
AsyncMock(return_value=False)):
|
||||
assert await supersession.set_supersedes(7, 1, [2]) is None
|
||||
|
||||
@@ -58,8 +58,8 @@ async def test_superseding_a_note_you_can_only_READ_is_refused_not_dropped():
|
||||
# writable for the superseder (id 1), not for the target (id 2)
|
||||
writable = AsyncMock(side_effect=lambda uid, nid: nid == 1)
|
||||
session = _session(get_returns=[_live_note(2)])
|
||||
with patch("scribe.services.supersession.access.can_write_note", writable), \
|
||||
patch("scribe.services.supersession.async_session", return_value=session):
|
||||
with patch("grimoire.services.supersession.access.can_write_note", writable), \
|
||||
patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
with pytest.raises(PermissionError, match="not yours to supersede"):
|
||||
await supersession.set_supersedes(7, 1, [2])
|
||||
|
||||
@@ -69,9 +69,9 @@ async def test_self_supersession_is_dropped_silently():
|
||||
"""Meaningless rather than dangerous, and the DB CHECK refuses it anyway —
|
||||
so it is a drop, not an error the caller has to handle."""
|
||||
session = _session(scalars_sequence=[[]])
|
||||
with patch("scribe.services.supersession.access.can_write_note",
|
||||
with patch("grimoire.services.supersession.access.can_write_note",
|
||||
AsyncMock(return_value=True)), \
|
||||
patch("scribe.services.supersession.async_session", return_value=session):
|
||||
patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
assert await supersession.set_supersedes(7, 5, [5]) == []
|
||||
session.add.assert_not_called()
|
||||
|
||||
@@ -83,9 +83,9 @@ async def test_a_trashed_target_is_dropped():
|
||||
trashed = MagicMock()
|
||||
trashed.deleted_at = "2026-08-08"
|
||||
session = _session(scalars_sequence=[[]], get_returns=[trashed])
|
||||
with patch("scribe.services.supersession.access.can_write_note",
|
||||
with patch("grimoire.services.supersession.access.can_write_note",
|
||||
AsyncMock(return_value=True)), \
|
||||
patch("scribe.services.supersession.async_session", return_value=session):
|
||||
patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
assert await supersession.set_supersedes(7, 1, [2]) == []
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ async def test_a_direct_cycle_is_refused():
|
||||
(A). It does — B -> A — so the edge would close a ring.
|
||||
"""
|
||||
session = _session(scalars_sequence=[[1]]) # B supersedes A(=1)
|
||||
with patch("scribe.services.supersession.async_session", return_value=session):
|
||||
with patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
assert await supersession._closes_a_cycle(session, 1, 2) is True
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ async def test_an_indirect_cycle_is_refused():
|
||||
proposer. Here the proposer is C and the target is A, so: A -> B -> C.
|
||||
"""
|
||||
session = _session(scalars_sequence=[[2], [3]]) # A->B, B->C
|
||||
with patch("scribe.services.supersession.async_session", return_value=session):
|
||||
with patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
assert await supersession._closes_a_cycle(session, 3, 1) is True
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ async def test_an_indirect_cycle_is_refused():
|
||||
async def test_a_chain_that_does_not_loop_is_allowed():
|
||||
"""A -> B exists; C may supersede A. Walking from A reaches only B."""
|
||||
session = _session(scalars_sequence=[[2], []])
|
||||
with patch("scribe.services.supersession.async_session", return_value=session):
|
||||
with patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
assert await supersession._closes_a_cycle(session, 3, 1) is False
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ async def test_the_cycle_walk_terminates_on_an_existing_ring():
|
||||
that guarantee rather than trusting it."""
|
||||
# 1 -> 2, 2 -> 1: a ring that does not contain the proposer (99).
|
||||
session = _session(scalars_sequence=[[2], [1], []])
|
||||
with patch("scribe.services.supersession.async_session", return_value=session):
|
||||
with patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
assert await supersession._closes_a_cycle(session, 99, 1) is False
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ async def test_superseded_ids_is_empty_for_an_empty_candidate_set():
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_reads_are_empty_when_the_caller_cannot_read_the_note():
|
||||
with patch("scribe.services.supersession.access.can_read_note",
|
||||
with patch("grimoire.services.supersession.access.can_read_note",
|
||||
AsyncMock(return_value=False)):
|
||||
assert await supersession.get_relations(7, 1) == {
|
||||
"supersedes": [], "superseded_by": []
|
||||
@@ -160,9 +160,9 @@ async def test_get_relations_partitions_both_directions_from_one_query():
|
||||
result.all.return_value = [(5, 3), (5, 2), (9, 5)] # (superseder, superseded)
|
||||
session.execute = AsyncMock(return_value=result)
|
||||
|
||||
with patch("scribe.services.supersession.access.can_read_note",
|
||||
with patch("grimoire.services.supersession.access.can_read_note",
|
||||
AsyncMock(return_value=True)), \
|
||||
patch("scribe.services.supersession.async_session", return_value=session):
|
||||
patch("grimoire.services.supersession.async_session", return_value=session):
|
||||
rel = await supersession.get_relations(7, 5)
|
||||
|
||||
assert rel == {"supersedes": [2, 3], "superseded_by": [9]}
|
||||
|
||||
Reference in New Issue
Block a user