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

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:
2026-11-27 09:41:09 -05:00
co-authored by Claude Opus 5.5
parent 55f53de92d
commit de55b73075
7 changed files with 224 additions and 11 deletions
@@ -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