CI & Build / Python lint (push) Successful in 5s
CI & Build / Plugin hooks (push) Successful in 17s
CI & Build / TypeScript typecheck (push) Successful in 57s
CI & Build / integration (push) Successful in 1m19s
CI & Build / Python tests (push) Successful in 2m2s
CI & Build / Build & push image (push) Successful in 15s
Docstrings, section headers and assertion messages drop the record number, milestone or step that introduced the behaviour, and incident accounts are restated as the present-tense failure shape. A dead pointer to a design doc that is not in the repo is removed. Renamed to the property they check: test_the_old_shape_would_be_caught -> test_a_rank_then_scope_query_is_caught test_a_ledger_repeat_no_longer_produces_that_case_at_all -> test_a_ledger_repeat_is_counted_not_withheld test_the_header_no_longer_promises_once_per_session -> test_the_header_explains_the_seen_marker test_the_portal_case_no_longer_stamps_one_canon_onto_a_whole_file -> test_one_canon_is_not_stamped_onto_a_whole_file test_the_repos_own_prose_no_longer_defines_with -> test_the_repos_own_prose_does_not_define_with test_the_original_regression_create_note_with_content -> test_the_real_server_refuses_content_on_create_note Fixture and example ids stay: "note 5" in a supersession chain, "rule 156" in an illustrative question, `#2275` as the hex-versus-citation case, `#3244` as the example of a bare number, fixed dates in date-filter tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.8 KiB
Python
69 lines
2.8 KiB
Python
"""update_task closes a task with a one-line reminder of what the report needs.
|
|
|
|
This is the in-band half of reporting back: the skill and static context only
|
|
exist in the Claude Code plugin, and a tool response reaches every MCP client
|
|
at the moment a piece of work closes. Pinned on the response, not the wording.
|
|
|
|
The operator's own completion-report preferences do not ride here: they are
|
|
mounted on finishing work and arrive in `moment_rules` beside the delivered
|
|
reply shape, so this response carries no key of its own for them.
|
|
"""
|
|
from unittest.mock import AsyncMock, MagicMock, patch
|
|
|
|
import pytest
|
|
|
|
pytestmark = pytest.mark.usefixtures("_bind_user")
|
|
|
|
|
|
async def _update(owed=None, **kwargs):
|
|
from scribe.mcp.tools.tasks import update_task
|
|
|
|
note = MagicMock(id=5, user_id=7, project_id=3, started_at="2026-10-06T09:00:00+00:00")
|
|
note.to_dict.return_value = {"id": 5}
|
|
with patch("scribe.mcp.tools.tasks.notes_svc.update_note", AsyncMock(return_value=note)), \
|
|
patch("scribe.mcp.tools.tasks.systems_tools.attach_systems", AsyncMock()), \
|
|
patch("scribe.mcp.tools.tasks.placement_svc.attach_placement", AsyncMock()), \
|
|
patch("scribe.mcp.tools.tasks.family_adoption_svc.owed_since",
|
|
AsyncMock(return_value=list(owed or []))):
|
|
return await update_task(task_id=5, **kwargs)
|
|
|
|
|
|
@pytest.mark.parametrize("status", ["done", "cancelled"])
|
|
async def test_closing_a_task_carries_the_cue(status):
|
|
out = await _update(status=status)
|
|
assert "placement" in out["report_back"] and "needs them" in out["report_back"]
|
|
|
|
|
|
@pytest.mark.parametrize("kwargs", [{"status": "in_progress"}, {"status": "todo"}, {"body": "more notes"}])
|
|
async def test_other_updates_do_not(kwargs):
|
|
out = await _update(**kwargs)
|
|
assert "report_back" not in out
|
|
|
|
|
|
async def test_closing_carries_the_plain_cue_and_no_preference_key_of_its_own():
|
|
"""The retired key does not come back beside the moment delivery."""
|
|
from scribe.mcp.tools.tasks import REPORT_BACK_CUE
|
|
|
|
out = await _update(status="done")
|
|
assert "reply_preferences" not in out
|
|
assert out["report_back"] == REPORT_BACK_CUE
|
|
|
|
|
|
_OWED = {"idea_id": 9, "idea_title": "Signed APK lane", "project_id": 4,
|
|
"project_title": "android two", "owed_task_id": 77}
|
|
|
|
|
|
async def test_closing_names_the_owed_adoptions_filed_while_the_task_was_open():
|
|
"""The finishing moment of family canon: owed family work filed
|
|
into a project during this task comes back for the report to name."""
|
|
from scribe.services.family_adoption import OWED_CUE
|
|
|
|
out = await _update(owed=[_OWED], status="done")
|
|
assert out["family_owed"] == [_OWED]
|
|
assert out["report_back"].endswith(OWED_CUE) and "family_owed" in out["report_back"]
|
|
|
|
|
|
async def test_no_owed_adoptions_means_no_key():
|
|
out = await _update(owed=[], status="done")
|
|
assert "family_owed" not in out
|