feat(8191): knowledge reaches a session from every project, ranked below its own and labelled
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Plugin hooks (push) Successful in 17s
CI & Build / Python lint (push) Successful in 3s
CI & Build / Python tests (push) Failing after 2m0s
CI & Build / Build & push image (push) Canceled after 0s
CI & Build / integration (push) Canceled after 2m7s

A per-kind reach beside the kind-by-moment table (setting record_reach,
default snippet/note/process/lesson) widens the passive note arms and their
slots to the user's other projects. A record from elsewhere gives up 0.05
before the floor and the ranking, and its line names the project. Work kinds
stay in their project, the visibility clause is unchanged, and an explicit
project search still means that project. Settings > Moments edits the reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 17:20:31 -05:00
co-authored by Claude Opus 5.5
parent 163d32859f
commit 30aa5cf1c6
14 changed files with 491 additions and 13 deletions
+42 -1
View File
@@ -20,7 +20,8 @@ async def _user(name: str = "record_kinds_owner") -> int:
async with async_session() as s:
uid = (await ensure_user(s, name)).id
await s.execute(delete(Setting).where(
Setting.user_id == uid, Setting.key == record_kinds.SETTING_KEY))
Setting.user_id == uid,
Setting.key.in_([record_kinds.SETTING_KEY, record_kinds.REACH_SETTING_KEY])))
await s.execute(delete(RecordDelivery).where(RecordDelivery.user_id == uid))
await s.commit()
return uid
@@ -94,3 +95,43 @@ async def test_each_cell_carries_the_lines_its_door_pushed_and_the_opens():
assert cells["work.change"] == {}
assert cells["message"] == {"task:issue": {"delivered": 1, "opened": 0}}
assert table["evidence_failed"] is False
async def _reach_rows(uid: int) -> list[str]:
async with async_session() as s:
return list((await s.execute(select(Setting.value).where(
Setting.user_id == uid, Setting.key == record_kinds.REACH_SETTING_KEY,
))).scalars())
async def test_the_reach_follows_its_default_until_the_user_changes_it():
uid = await _user("record_reach_owner")
assert await record_kinds.reach_for(uid) == record_kinds.REACH_DEFAULT
# Knowledge crosses by default; no task kind does.
assert not any(k.startswith(record_kinds.TASK_PREFIX) for k in record_kinds.REACH_DEFAULT)
table = await record_kinds.set_reach(uid, ["snippet", "task:issue"])
assert table["reach"] == {
"kinds": ["snippet", "task:issue"],
"default": sorted(record_kinds.REACH_DEFAULT, key=record_kinds.KINDS.index),
"changed": True,
}
assert await record_kinds.reach_for(uid) == {"snippet", "task:issue"}
# Nothing crossing is a real setting, not a reset.
await record_kinds.set_reach(uid, [])
assert await record_kinds.reach_for(uid) == frozenset()
table = await record_kinds.set_reach(uid, None)
assert table["reach"]["changed"] is False
assert await _reach_rows(uid) == []
async def test_a_reach_equal_to_the_default_stores_no_change():
uid = await _user("record_reach_owner")
await record_kinds.set_reach(uid, sorted(record_kinds.REACH_DEFAULT))
assert await _reach_rows(uid) == []
async def test_an_unknown_kind_in_the_reach_is_refused_and_nothing_is_stored():
uid = await _user("record_reach_owner")
with pytest.raises(ValueError, match="unknown kind"):
await record_kinds.set_reach(uid, ["snippet", "dossier"])
assert await _reach_rows(uid) == []