b49efdcb11
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 11s
CI & Build / integration (push) Successful in 30s
CI & Build / Python tests (push) Failing after 31s
CI & Build / Build & push image (push) Has been skipped
Narrow Scribe to a Claude-Code work system-of-record (milestone #194, decision note #1759). Wholesale removal per rule #22 — backend + schema half. Calendar/events + CalDAV: delete models/event, services/{events,caldav, caldav_sync}, routes/events, mcp/tools/events; strip event branches from backup (bump v3->v4), dashboard (upcoming_events), trash, recent, and the mcp server read-only allowlist + instructions. Typed entities (person/place/list): delete mcp/tools/entities; drop the notes.metadata (entity_meta) column from model/service/routes and the knowledge browse service. note_type STAYS — it also marks 'process' notes. Scheduler: event_scheduler -> recurrence_scheduler, keeping only the recurring-task spawn job (drops event reminders + CalDAV sync). Schema: migration 0069 drops the events table + notes.metadata column + orphan caldav settings rows (faithful downgrade recreates them). KEEP: recurrence.py (task recurrence), notifications task reminders, graph view, and every work surface. Frontend + plugin/docs true-up follow next. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BPtbSzA4JLMAKgFZ8VTg7Q
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
"""get_knowledge_counts includes the 'process' type and counts it in total."""
|
|
from unittest.mock import AsyncMock, MagicMock, patch
|
|
|
|
import pytest
|
|
|
|
|
|
def _make_mock_session():
|
|
s = AsyncMock()
|
|
s.__aenter__ = AsyncMock(return_value=s)
|
|
s.__aexit__ = AsyncMock(return_value=False)
|
|
return s
|
|
|
|
|
|
def _grouped(rows):
|
|
r = MagicMock()
|
|
r.all.return_value = rows
|
|
return r
|
|
|
|
|
|
def _scalar(n):
|
|
r = MagicMock()
|
|
r.scalar_one.return_value = n
|
|
return r
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_counts_include_process_in_facet_and_total():
|
|
session = _make_mock_session()
|
|
# 1) grouped non-task counts, 2) task count, 3) plan count
|
|
session.execute = AsyncMock(side_effect=[
|
|
_grouped([("note", 3), ("process", 2)]),
|
|
_scalar(1), # tasks
|
|
_scalar(0), # plans
|
|
])
|
|
with patch("scribe.services.knowledge.async_session") as cls:
|
|
cls.return_value = session
|
|
from scribe.services.knowledge import get_knowledge_counts
|
|
counts = await get_knowledge_counts(user_id=1)
|
|
|
|
assert counts["process"] == 2
|
|
# facet keys all present (setdefault)
|
|
for key in ("note", "task", "plan", "process"):
|
|
assert key in counts
|
|
# total = note(3) + task(1) + process(2)
|
|
assert counts["total"] == 6
|