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:
@@ -3,7 +3,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from scribe.mcp.tools.notes import (
|
||||
from grimoire.mcp.tools.notes import (
|
||||
list_notes, get_note, create_note,
|
||||
update_note, delete_note,
|
||||
)
|
||||
@@ -23,19 +23,19 @@ def _no_supersession():
|
||||
relation's own behaviour is covered in test_services_supersession.py, and
|
||||
the attachment is covered explicitly below.
|
||||
"""
|
||||
with patch("scribe.mcp.tools.notes.supersession_svc.get_relations",
|
||||
with patch("grimoire.mcp.tools.notes.supersession_svc.get_relations",
|
||||
AsyncMock(return_value={"supersedes": [], "superseded_by": []})):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_note_blocked_by_duplicate_gate():
|
||||
from scribe.services.dedup import DuplicateMatch
|
||||
from grimoire.services.dedup import DuplicateMatch
|
||||
dup = DuplicateMatch(id=88, title="Embeddings notes", similarity=0.94, reason="semantic")
|
||||
create_mock = AsyncMock()
|
||||
with patch("scribe.mcp.tools.notes.dedup_svc.find_duplicate_note",
|
||||
with patch("grimoire.mcp.tools.notes.dedup_svc.find_duplicate_note",
|
||||
AsyncMock(return_value=dup)), \
|
||||
patch("scribe.mcp.tools.notes.notes_svc.create_note", create_mock):
|
||||
patch("grimoire.mcp.tools.notes.notes_svc.create_note", create_mock):
|
||||
out = await create_note(title="embeddings", body="notes about embeddings")
|
||||
assert out["duplicate"] is True
|
||||
assert out["existing_id"] == 88
|
||||
@@ -46,8 +46,8 @@ async def test_create_note_blocked_by_duplicate_gate():
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_note_force_bypasses_duplicate_gate():
|
||||
find_mock = AsyncMock()
|
||||
with patch("scribe.mcp.tools.notes.dedup_svc.find_duplicate_note", find_mock), \
|
||||
patch("scribe.mcp.tools.notes.notes_svc.create_note",
|
||||
with patch("grimoire.mcp.tools.notes.dedup_svc.find_duplicate_note", find_mock), \
|
||||
patch("grimoire.mcp.tools.notes.notes_svc.create_note",
|
||||
AsyncMock(return_value=fake_note(id=3))):
|
||||
out = await create_note(title="dup", force=True)
|
||||
assert out["id"] == 3
|
||||
@@ -58,7 +58,7 @@ async def test_create_note_force_bypasses_duplicate_gate():
|
||||
async def test_list_notes_repackages_tuple_into_dict():
|
||||
rows = [fake_note(id=1), fake_note(id=2)]
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.list_notes",
|
||||
"grimoire.mcp.tools.notes.notes_svc.list_notes",
|
||||
AsyncMock(return_value=(rows, 2)),
|
||||
):
|
||||
out = await list_notes()
|
||||
@@ -69,7 +69,7 @@ async def test_list_notes_repackages_tuple_into_dict():
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_notes_passes_is_task_false():
|
||||
mock = AsyncMock(return_value=([], 0))
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
await list_notes()
|
||||
assert mock.call_args.kwargs["is_task"] is False
|
||||
|
||||
@@ -78,7 +78,7 @@ async def test_list_notes_passes_is_task_false():
|
||||
async def test_list_notes_tag_filter_maps_to_list():
|
||||
"""The single-tag string param maps to a one-element list at the service layer."""
|
||||
mock = AsyncMock(return_value=([], 0))
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
await list_notes(tag="ops")
|
||||
assert mock.call_args.kwargs["tags"] == ["ops"]
|
||||
|
||||
@@ -86,7 +86,7 @@ async def test_list_notes_tag_filter_maps_to_list():
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_notes_empty_tag_means_no_filter():
|
||||
mock = AsyncMock(return_value=([], 0))
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
await list_notes(tag="")
|
||||
assert mock.call_args.kwargs["tags"] is None
|
||||
|
||||
@@ -94,7 +94,7 @@ async def test_list_notes_empty_tag_means_no_filter():
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_notes_search_text_maps_to_q():
|
||||
mock = AsyncMock(return_value=([], 0))
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
await list_notes(search_text="kafka")
|
||||
assert mock.call_args.kwargs["q"] == "kafka"
|
||||
|
||||
@@ -102,7 +102,7 @@ async def test_list_notes_search_text_maps_to_q():
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_notes_limit_clamped():
|
||||
mock = AsyncMock(return_value=([], 0))
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.list_notes", mock):
|
||||
await list_notes(limit=9999)
|
||||
assert mock.call_args.kwargs["limit"] == 100
|
||||
|
||||
@@ -111,7 +111,7 @@ async def test_list_notes_limit_clamped():
|
||||
async def test_get_note_returns_dict():
|
||||
fake = fake_note(id=5, title="found")
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
"grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(return_value=(fake, "owner")),
|
||||
):
|
||||
out = await get_note(note_id=5)
|
||||
@@ -135,9 +135,9 @@ async def test_get_note_warns_in_words_when_a_later_note_overtook_it():
|
||||
acts on it confidently either way.
|
||||
"""
|
||||
fake = fake_note(id=5, title="June's answer")
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(return_value=(fake, "owner"))), \
|
||||
patch("scribe.mcp.tools.notes.supersession_svc.get_relations",
|
||||
patch("grimoire.mcp.tools.notes.supersession_svc.get_relations",
|
||||
AsyncMock(return_value={"supersedes": [], "superseded_by": [9]})):
|
||||
out = await get_note(note_id=5)
|
||||
assert out["superseded_by"] == [9]
|
||||
@@ -153,10 +153,10 @@ async def test_get_note_opens_a_shared_record_and_says_whose_it_is():
|
||||
handed — and the web UI opens the same note fine."""
|
||||
theirs = fake_note(id=5, title="Their note", user_id=9)
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
"grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(return_value=(theirs, "viewer")),
|
||||
), patch(
|
||||
"scribe.services.access.describe_provenance",
|
||||
"grimoire.services.access.describe_provenance",
|
||||
AsyncMock(return_value={"shared": True, "owner": "alex",
|
||||
"permission": "viewer"}),
|
||||
):
|
||||
@@ -169,7 +169,7 @@ async def test_get_note_opens_a_shared_record_and_says_whose_it_is():
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_note_raises_when_not_found():
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
"grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(return_value=None),
|
||||
):
|
||||
with pytest.raises(ValueError, match="note 999 not found"):
|
||||
@@ -183,7 +183,7 @@ async def test_get_note_treats_a_trashed_note_as_missing():
|
||||
trashed = fake_note(id=5)
|
||||
trashed.deleted_at = "2026-07-01T00:00:00Z"
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
"grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(return_value=(trashed, "owner")),
|
||||
):
|
||||
with pytest.raises(ValueError, match="note 5 not found"):
|
||||
@@ -194,7 +194,7 @@ async def test_get_note_treats_a_trashed_note_as_missing():
|
||||
async def test_create_note_passes_through():
|
||||
fake = fake_note(id=10, title="new")
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.create_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.create_note", mock):
|
||||
out = await create_note(title="new", body="x", tags=["a"], project_id=5)
|
||||
assert out["id"] == 10
|
||||
assert mock.call_args.kwargs["title"] == "new"
|
||||
@@ -206,7 +206,7 @@ async def test_create_note_project_zero_becomes_none():
|
||||
"""project_id=0 sentinel must become None at the service layer (orphan note)."""
|
||||
fake = fake_note()
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.create_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.create_note", mock):
|
||||
await create_note(title="t", project_id=0)
|
||||
assert mock.call_args.kwargs["project_id"] is None
|
||||
|
||||
@@ -221,7 +221,7 @@ async def test_update_note_only_sends_non_default_fields():
|
||||
door takes, and the same test."""
|
||||
fake = fake_note()
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
await update_note(note_id=1, title="new title")
|
||||
args, kwargs = mock.call_args
|
||||
assert args == (7, 1)
|
||||
@@ -234,11 +234,11 @@ async def test_update_note_forwards_a_check_but_not_an_empty_one():
|
||||
""""" means "leave this alone" at this door — an agent updating a body must
|
||||
not wipe a check it was never asked about."""
|
||||
mock = AsyncMock(return_value=fake_note())
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
await update_note(note_id=1, verify_with="curl the docs")
|
||||
assert mock.call_args.kwargs["verify_with"] == "curl the docs"
|
||||
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
await update_note(note_id=1, title="t")
|
||||
assert "verify_with" not in mock.call_args.kwargs
|
||||
|
||||
@@ -247,7 +247,7 @@ async def test_update_note_forwards_a_check_but_not_an_empty_one():
|
||||
async def test_update_note_forwards_clear_so_a_check_can_be_removed():
|
||||
"""The only way to unset a field at a door where "" means "leave alone"."""
|
||||
mock = AsyncMock(return_value=fake_note())
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
await update_note(note_id=1, clear=["verify_with"])
|
||||
assert mock.call_args.kwargs["clear"] == ["verify_with"]
|
||||
|
||||
@@ -255,7 +255,7 @@ async def test_update_note_forwards_clear_so_a_check_can_be_removed():
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_note_forwards_the_check_fields():
|
||||
mock = AsyncMock(return_value=fake_note())
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.create_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.create_note", mock):
|
||||
await create_note(title="t", verify_with="curl", expires_when="AMO changes")
|
||||
assert mock.call_args.kwargs["verify_with"] == "curl"
|
||||
assert mock.call_args.kwargs["expires_when"] == "AMO changes"
|
||||
@@ -266,7 +266,7 @@ async def test_update_note_empty_tags_clears_explicitly():
|
||||
"""tags=[] is an explicit clear, distinct from tags=None (omit)."""
|
||||
fake = fake_note()
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
await update_note(note_id=1, tags=[])
|
||||
kwargs = dict(mock.call_args.kwargs)
|
||||
kwargs.pop("clear")
|
||||
@@ -277,7 +277,7 @@ async def test_update_note_empty_tags_clears_explicitly():
|
||||
async def test_update_note_tags_none_means_omit():
|
||||
fake = fake_note()
|
||||
mock = AsyncMock(return_value=fake)
|
||||
with patch("scribe.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
with patch("grimoire.mcp.tools.notes.notes_svc.update_note", mock):
|
||||
await update_note(note_id=1, tags=None)
|
||||
assert "tags" not in mock.call_args.kwargs
|
||||
|
||||
@@ -285,7 +285,7 @@ async def test_update_note_tags_none_means_omit():
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_note_raises_when_not_found():
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.update_note",
|
||||
"grimoire.mcp.tools.notes.notes_svc.update_note",
|
||||
AsyncMock(return_value=None),
|
||||
):
|
||||
with pytest.raises(ValueError, match="note 999 not found"):
|
||||
@@ -297,10 +297,10 @@ async def test_delete_note_soft_deletes_and_returns_batch():
|
||||
doomed = MagicMock()
|
||||
doomed.title = "the note that went"
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.trash_svc.delete",
|
||||
"grimoire.mcp.tools.notes.trash_svc.delete",
|
||||
AsyncMock(return_value="batch-1"),
|
||||
), patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
"grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(return_value=(doomed, "owner")),
|
||||
):
|
||||
result = await delete_note(note_id=7)
|
||||
@@ -316,10 +316,10 @@ async def test_delete_note_still_deletes_when_the_title_lookup_fails():
|
||||
"""The title is a courtesy on top of the delete, never a precondition for
|
||||
it. A lookup that errors costs the name, not the operation."""
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.trash_svc.delete",
|
||||
"grimoire.mcp.tools.notes.trash_svc.delete",
|
||||
AsyncMock(return_value="batch-1"),
|
||||
), patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
"grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(side_effect=RuntimeError("database down")),
|
||||
):
|
||||
result = await delete_note(note_id=7)
|
||||
@@ -330,10 +330,10 @@ async def test_delete_note_still_deletes_when_the_title_lookup_fails():
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_note_raises_when_not_found():
|
||||
with patch(
|
||||
"scribe.mcp.tools.notes.trash_svc.delete",
|
||||
"grimoire.mcp.tools.notes.trash_svc.delete",
|
||||
AsyncMock(return_value=None),
|
||||
), patch(
|
||||
"scribe.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
"grimoire.mcp.tools.notes.notes_svc.get_note_for_user",
|
||||
AsyncMock(return_value=None),
|
||||
):
|
||||
with pytest.raises(ValueError, match="note 999 not found"):
|
||||
|
||||
Reference in New Issue
Block a user