From 2e39dca9cf61397792af863b6a0dea6e34f60a43 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 27 Aug 2026 15:57:06 -0400 Subject: [PATCH] =?UTF-8?q?fix(tasks):=20import=20minted=5Fkind=20by=20nam?= =?UTF-8?q?e=20=E2=80=94=20a=20stubbed=20service=20must=20not=20stub=20the?= =?UTF-8?q?=20guard=20(#3129)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI 4682: test_create_task_issue_sets_kind_provenance_and_systems asserted task_kind == "issue" and got a MagicMock. That test patches the whole notes_svc module to keep the database out, so reaching validation through `notes_svc.minted_kind(...)` handed back a mock — the guard approved anything and returned nothing real. The product was wrong, not the test. minted_kind is pure validation, not a service call, so it is imported by name. A test that stubs the service to avoid I/O now keeps the guard intact, which is the behaviour you want from a guard: the only way to disable it should be to say so explicitly. That test now exercises the real validation, so it doubles as the guard against this recurring. Co-Authored-By: Claude Opus 5 (1M context) --- src/scribe/mcp/tools/tasks.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scribe/mcp/tools/tasks.py b/src/scribe/mcp/tools/tasks.py index c1b3dcc..c0221e1 100644 --- a/src/scribe/mcp/tools/tasks.py +++ b/src/scribe/mcp/tools/tasks.py @@ -23,6 +23,11 @@ from scribe.mcp.tools import systems as systems_tools from scribe.services import access as access_svc from scribe.services import dedup as dedup_svc from scribe.services import notes as notes_svc +# Imported by NAME, not reached through notes_svc: minted_kind is pure +# validation, not a service call, and a test that stubs the service module to +# avoid the database would otherwise stub the validation too — turning a +# guard into a MagicMock that approves anything. +from scribe.services.notes import minted_kind from scribe.services import planning as planning_svc from scribe.services import rulebooks as rulebooks_svc from scribe.services import systems as systems_svc @@ -194,7 +199,7 @@ async def create_task( milestone_id=milestone_id or None, parent_id=parent_id or None, tags=tags, - task_kind=notes_svc.minted_kind(kind), + task_kind=minted_kind(kind), arose_from_id=arose_from_id or None, ) if system_ids: @@ -266,7 +271,7 @@ async def update_task( elif arose_from_id: fields["arose_from_id"] = arose_from_id if kind: - fields["task_kind"] = notes_svc.minted_kind(kind) + fields["task_kind"] = minted_kind(kind) note = await notes_svc.update_note(uid, task_id, **fields) if note is None: raise ValueError(f"task {task_id} not found")