fix(8140): family triggers open only records that can carry an idea, and enter_project names a project's unevaluated candidates
CI & Build / Python lint (push) Successful in 7s
CI & Build / TypeScript typecheck (push) Successful in 43s
CI & Build / Plugin hooks (push) Successful in 49s
CI & Build / Python tests (push) Failing after 2m12s
CI & Build / integration (push) Successful in 2m41s
CI & Build / Build & push image (push) Skipped
CI & Build / Python lint (push) Successful in 7s
CI & Build / TypeScript typecheck (push) Successful in 43s
CI & Build / Plugin hooks (push) Successful in 49s
CI & Build / Python tests (push) Failing after 2m12s
CI & Build / integration (push) Successful in 2m41s
CI & Build / Build & push image (push) Skipped
Tasks, non-knowledge kinds and records titled for their own project are never opened as candidates by the citation or repeat trigger; a lineage word inside a quoted title no longer reads as lineage. The family line counts and names this project's own candidates that only the system has decided on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,3 +161,39 @@ async def test_re_saving_a_closed_milestone_asks_nothing():
|
||||
out = await update_milestone(project_id=3, milestone_id=5, status="done")
|
||||
assert "family_hint" not in out
|
||||
trigger.assert_not_awaited()
|
||||
|
||||
|
||||
def test_a_lineage_word_inside_a_quoted_title_is_not_lineage():
|
||||
"""Records are cited with their titles beside them; a title's words
|
||||
describe THAT record, so they cannot claim the next citation's lineage."""
|
||||
text = ('- Tasks: #3510 "Release parsing and matching, verified", #7407 "Downloads", '
|
||||
'#20 “mirrors the old flow”, #30')
|
||||
assert lineage_citations(text) == []
|
||||
# The convention itself still reads: a lineage word outside the quotes.
|
||||
assert lineage_citations('Ported from #12 "Signed APK lane".') == [12]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("title", "project", "about"), [
|
||||
("Storehouse: start here", "Storehouse", True),
|
||||
("Torn Stars — Economy System", "Torn Stars", True),
|
||||
("storehouse", "Storehouse", True),
|
||||
("Syncthing relay", "Sync", False),
|
||||
("Signed APK lane", "Storehouse", False),
|
||||
("Storehouse: start here", "", False),
|
||||
])
|
||||
def test_a_record_named_for_its_own_project_is_about_that_project(title, project, about):
|
||||
from grimoire.services.family import about_its_own_project
|
||||
|
||||
assert about_its_own_project(title, project) is about
|
||||
|
||||
|
||||
def test_only_knowledge_and_shapes_not_about_one_project_can_carry_an_idea():
|
||||
from grimoire.services.family import can_carry_idea
|
||||
|
||||
kw = dict(title="Signed APK lane", project_title="android one")
|
||||
assert can_carry_idea(is_task=False, note_type="note", **kw)
|
||||
assert can_carry_idea(is_task=False, note_type="snippet", **kw)
|
||||
assert not can_carry_idea(is_task=True, note_type="note", **kw)
|
||||
assert not can_carry_idea(is_task=False, note_type="lesson", **kw)
|
||||
assert not can_carry_idea(is_task=False, note_type="note",
|
||||
title="android one: start here", project_title="android one")
|
||||
|
||||
@@ -97,3 +97,15 @@ def test_every_surface_that_meets_family_canon_points_at_the_skill():
|
||||
assert "`family`" in tool_doc("grimoire.mcp.tools.projects", "enter_project")
|
||||
assert "family_owed" in tool_doc("grimoire.mcp.tools.tasks", "update_task")
|
||||
assert "family_owed" in skill_text("reporting-back")
|
||||
|
||||
|
||||
def test_the_line_names_this_projects_own_unevaluated_candidates():
|
||||
cand = {"count": 3, "ideas": [{"id": 7, "title": "Signed APK lane"},
|
||||
{"id": 9, "title": "Outbox"}]}
|
||||
line = family_line(5, [], cand)
|
||||
assert line["candidates"] == 3
|
||||
assert line["line"].endswith("3 of this project's own records proposed as family ideas, never evaluated")
|
||||
call = line["calls"]["candidates"]
|
||||
assert '#7 "Signed APK lane", #9 "Outbox"' in call and "and 1 more" in call
|
||||
assert "promote_family_idea" in call and "retire_family_idea" in call
|
||||
assert family_line(5, [], {"count": 0, "ideas": []}) is None
|
||||
|
||||
@@ -396,3 +396,49 @@ async def test_someone_who_cannot_write_the_idea_cannot_link_it(family, topics):
|
||||
await _promote(family)
|
||||
with pytest.raises(ValueError, match="no write access"):
|
||||
await family_svc.set_topic(family["outsider"], family["note"], topics["spare"])
|
||||
|
||||
|
||||
async def test_a_citation_of_a_task_or_of_a_projects_own_overview_is_silent(family):
|
||||
"""A task is work in one project and an overview describes one project:
|
||||
neither carries a shared idea, so citing either with a lineage word opens
|
||||
nothing."""
|
||||
async with async_session() as s:
|
||||
task = Note(user_id=family["owner"], project_id=family["a"], status="todo",
|
||||
title="Ship the signed lane", body="do it")
|
||||
overview = Note(user_id=family["owner"], project_id=family["a"],
|
||||
title="android one: start here", body="what the project is")
|
||||
s.add_all([task, overview])
|
||||
await s.commit()
|
||||
ids = (task.id, overview.id)
|
||||
for source in ids:
|
||||
citing = await _note_in(family["b"], family["owner"], f"Matching #{source}.")
|
||||
assert await family_svc.citation_trigger(family["owner"], citing) is None
|
||||
assert await _idea(source) is None
|
||||
|
||||
|
||||
async def test_a_repeat_of_a_projects_own_overview_is_silent(family):
|
||||
async with async_session() as s:
|
||||
overview = Note(user_id=family["owner"], project_id=family["a"],
|
||||
title="android one: start here", body="One keystore, two channels.")
|
||||
s.add(overview)
|
||||
await s.commit()
|
||||
await s.refresh(overview)
|
||||
repeat = await _note_in(family["b"], family["owner"], "One keystore, two channels.")
|
||||
with patch("grimoire.services.embeddings.semantic_search_notes",
|
||||
AsyncMock(return_value=[(0.9, overview)])):
|
||||
assert await family_svc.repeat_trigger(family["owner"], repeat) is None
|
||||
assert await _idea(overview.id) is None
|
||||
|
||||
|
||||
async def test_a_candidate_counts_as_unevaluated_until_someone_other_than_the_system_decides(family):
|
||||
await family_svc.propose(family["owner"], family["note"], reason="opened by a trigger",
|
||||
trigger="repeat", decided_via="system")
|
||||
got = await family_svc.unevaluated_candidates(family["owner"], family["a"])
|
||||
assert got == {"count": 1, "ideas": [{"id": family["note"], "title": "Signed APK lane"}]}
|
||||
assert (await family_svc.unevaluated_candidates(family["owner"], family["b"]))["count"] == 0
|
||||
# An agent's evaluation that holds it as a candidate is an evaluation.
|
||||
await family_svc.promote(family["owner"], family["note"], applies_when="",
|
||||
platforms=["android-app"], criteria={}, evidence=[],
|
||||
reason="held: not stated for the platform")
|
||||
assert (await _idea(family["note"])).status == "candidate"
|
||||
assert (await family_svc.unevaluated_candidates(family["owner"], family["a"]))["count"] == 0
|
||||
|
||||
Reference in New Issue
Block a user