Files
FabledGrimoire/tests/test_services_notes_task_kind.py
T
bvandeusenandClaude Opus 5.5 094089e374
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 2m23s
CI & Build / integration (push) Successful in 2m25s
CI & Build / Build & push image (push) Successful in 19s
test(8249): area groups, first pass: one file folded in, three readout checks merged, two copies removed
- test_mcp_tool_tasks_kind.py is folded into test_mcp_tool_tasks.py, the
  tool's own file: the two "kind passes through" cases are one table, the two
  list-filter cases one table; the minted_kind refusals move to the service's
  kind tests (test_services_notes_task_kind.py).
- A fresh install reads as empty, not failed: three database tests each ran
  retrieval_summary on an empty install and checked one block
  (usage, judged, system_usage). One test now checks all three.
- test_reply_shapes::test_the_tool_is_registered_as_a_read: everything it
  checked, test_moments::test_the_tools_are_registered_and_classified checks.
- test_shape_ledger::test_classify_and_list_are_mounted_as_mcp_tools: every
  classified tool name must be a registered tool
  (test_mcp_auth::test_every_registered_tool_is_classified_exactly_once).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 19:45:38 -05:00

46 lines
1.7 KiB
Python

"""create_note carries the task_kind it is given onto the row. The list
filter is proven against real Postgres in test_integration_task_kind_list."""
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from tests.helpers import make_mock_session
@pytest.mark.asyncio
async def test_create_note_passes_task_kind_to_model():
mock_session = make_mock_session()
captured = {}
def _capture_add(obj):
captured["task_kind"] = getattr(obj, "task_kind", "MISSING")
mock_session.add = MagicMock(side_effect=_capture_add)
with patch("grimoire.services.notes.async_session") as mock_cls, \
patch("grimoire.services.notes._maybe_reactivate_project", AsyncMock()):
mock_cls.return_value = mock_session
from grimoire.services.notes import create_note
await create_note(user_id=1, title="P", status="todo", task_kind="plan")
assert captured["task_kind"] == "plan"
def test_minting_a_plan_is_refused_at_both_doors():
"""`plan` is a valid stored value and NOT a mintable one.
Historical plan-tasks carry it and must stay writable, so the column
keeps accepting it — but plans became milestones in 0066, so no door
hands out a new one. The error names start_planning rather than just
refusing, because a caller reaching for kind='plan' wants a plan.
"""
from grimoire.services.notes import minted_kind
with pytest.raises(ValueError, match="start_planning"):
minted_kind("plan")
def test_an_unknown_kind_raises_rather_than_defaulting():
"""A silently-corrected kind is the defect this whole fix exists to end."""
from grimoire.services.notes import minted_kind
with pytest.raises(ValueError, match="kind must be one of"):
minted_kind("investigation")