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:
+10
-10
@@ -4,7 +4,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from fabledassistant.services.api_keys import (
|
||||
from scribe.services.api_keys import (
|
||||
_hash_key,
|
||||
_key_prefix,
|
||||
generate_key,
|
||||
@@ -44,7 +44,7 @@ async def test_create_api_key_returns_full_key():
|
||||
mock_key_obj.id = 1
|
||||
mock_key_obj.to_dict.return_value = {"id": 1, "name": "test", "scope": "read", "key_prefix": "fmcp_xxx"}
|
||||
|
||||
with patch("fabledassistant.services.api_keys.async_session") as mock_session_ctx:
|
||||
with patch("scribe.services.api_keys.async_session") as mock_session_ctx:
|
||||
mock_session = AsyncMock()
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock(return_value=False)
|
||||
@@ -57,7 +57,7 @@ async def test_create_api_key_returns_full_key():
|
||||
mock_session_ctx.return_value = mock_session
|
||||
|
||||
# Patch the select result
|
||||
with patch("fabledassistant.services.api_keys.ApiKey") as mock_model:
|
||||
with patch("scribe.services.api_keys.ApiKey") as mock_model:
|
||||
mock_model.return_value = mock_key_obj
|
||||
full_key, key_dict = await create_api_key(user_id=1, name="test", scope="read")
|
||||
|
||||
@@ -66,7 +66,7 @@ async def test_create_api_key_returns_full_key():
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_lookup_key_returns_none_for_unknown():
|
||||
with patch("fabledassistant.services.api_keys.async_session") as mock_session_ctx:
|
||||
with patch("scribe.services.api_keys.async_session") as mock_session_ctx:
|
||||
mock_session = AsyncMock()
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock(return_value=False)
|
||||
@@ -112,15 +112,15 @@ async def test_read_only_key_blocked_on_post():
|
||||
from quart import jsonify
|
||||
return jsonify({"ok": True})
|
||||
|
||||
from fabledassistant.auth import _check_auth
|
||||
from scribe.auth import _check_auth
|
||||
wrapped = _check_auth(dummy)
|
||||
|
||||
async with app.test_request_context(
|
||||
"/test", method="POST",
|
||||
headers={"Authorization": "Bearer fmcp_readonly"},
|
||||
):
|
||||
with patch("fabledassistant.auth.lookup_key", AsyncMock(return_value=fake_key)), \
|
||||
patch("fabledassistant.auth.get_user_by_id", AsyncMock(return_value=fake_user)):
|
||||
with patch("scribe.auth.lookup_key", AsyncMock(return_value=fake_key)), \
|
||||
patch("scribe.auth.get_user_by_id", AsyncMock(return_value=fake_user)):
|
||||
resp = await wrapped()
|
||||
assert resp[1] == 403
|
||||
|
||||
@@ -149,15 +149,15 @@ async def test_bearer_token_valid_write_key_passes():
|
||||
from quart import jsonify
|
||||
return jsonify({"ok": True})
|
||||
|
||||
from fabledassistant.auth import _check_auth
|
||||
from scribe.auth import _check_auth
|
||||
wrapped = _check_auth(dummy)
|
||||
|
||||
async with app.test_request_context(
|
||||
"/test", method="POST",
|
||||
headers={"Authorization": "Bearer fmcp_writekey"},
|
||||
):
|
||||
with patch("fabledassistant.auth.lookup_key", AsyncMock(return_value=fake_key)), \
|
||||
patch("fabledassistant.auth.get_user_by_id", AsyncMock(return_value=fake_user)):
|
||||
with patch("scribe.auth.lookup_key", AsyncMock(return_value=fake_key)), \
|
||||
patch("scribe.auth.get_user_by_id", AsyncMock(return_value=fake_user)):
|
||||
resp = await wrapped()
|
||||
|
||||
# Should not be a tuple (no error response)
|
||||
|
||||
Reference in New Issue
Block a user