feat(7832): records reach an edit and a message by structure first; resemblance offers notes
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Failing after 12s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Failing after 1m39s
CI & Build / integration (push) Successful in 2m17s
CI & Build / Build & push image (push) Skipped
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Failing after 12s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Failing after 1m39s
CI & Build / integration (push) Successful in 2m17s
CI & Build / Build & push image (push) Skipped
The kind×moment table's first measured defaults (baseline note #7892): - The edit door splits in two rows. work.change is what is recorded where the edit is (snippets beside the file, issues naming it or open in its area); work.change.similar is what the code resembles, notes by default. Issues and snippets no longer reach an edit by resemblance. - Snippets recorded beside the file are named by id in an "Also recorded beside this file" pointer line instead of taking menu lines. - The message door leaves lessons and issues out by default: a lesson arrives at its confirmed situation, an issue through its area or its id. Its lesson slot runs only for a user who turns lessons back on. - The static context teaches the new pointer line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from grimoire.services import record_kinds
|
||||
from grimoire.services import retrieval_pipeline as rp
|
||||
from grimoire.services.lessons import LESSON_NOTE_TYPE
|
||||
from grimoire.services.retrieval_registry import FAN_OUT_SITES, POINTS
|
||||
@@ -43,6 +44,10 @@ def _note(nid, score=None, **kw):
|
||||
return (score, note) if score is not None else note
|
||||
|
||||
|
||||
# Every kind on at a door, as a user may set it in the record-kinds table.
|
||||
EVERY_KIND = frozenset(record_kinds.KINDS)
|
||||
|
||||
|
||||
async def _run(arm, route, *, budget=3, **moment):
|
||||
io, calls = _io(route)
|
||||
result = await rp.run_note_arm(
|
||||
@@ -193,8 +198,9 @@ async def test_reuse_evicts_the_last_line_and_the_lesson_extends():
|
||||
main = [_note(1, 0.70), _note(2, 0.69), _note(3, 0.68)]
|
||||
reuse = [_note(9, 0.60, note_type="snippet")]
|
||||
lesson = [_note(42, 0.58, note_type=LESSON_NOTE_TYPE)]
|
||||
# A user who has turned lessons on at the message door (off by default).
|
||||
result, io, calls = await _run(
|
||||
rp.AUTO_INJECT, _routed(main, reuse, lesson), budget=3,
|
||||
rp.AUTO_INJECT, _routed(main, reuse, lesson), budget=3, kinds=EVERY_KIND,
|
||||
)
|
||||
# Reuse took the last of three; the lesson was added as a fourth.
|
||||
assert [int(n.id) for _s, n in result.menu] == [1, 2, 9, 42]
|
||||
@@ -228,7 +234,7 @@ async def test_a_slot_spends_itself_on_a_repeat_without_booking_it_again():
|
||||
main = [_note(1, 0.70)]
|
||||
lesson = [_note(42, 0.58, note_type=LESSON_NOTE_TYPE)]
|
||||
result, io, _ = await _run(
|
||||
rp.AUTO_INJECT, _routed(main, lesson=lesson), seen=frozenset({42}),
|
||||
rp.AUTO_INJECT, _routed(main, lesson=lesson), seen=frozenset({42}), kinds=EVERY_KIND,
|
||||
)
|
||||
assert 42 in [int(n.id) for _s, n in result.menu]
|
||||
assert not _rows(io.record_surfaced, "lesson_slot")
|
||||
@@ -271,17 +277,20 @@ def test_the_pipelines_fan_out_sites_declare_every_notes_source():
|
||||
def test_the_filters_say_whose_records_and_the_table_says_which_kinds():
|
||||
for arm in (rp.AUTO_INJECT, rp.WRITE_PATH):
|
||||
assert rp.note_search_filters(arm) == {"include_global_kinds": True, "scope": "browse"}
|
||||
assert rp.AUTO_INJECT.door == "message" and rp.WRITE_PATH.door == "work.change"
|
||||
assert rp.AUTO_INJECT.door == "message" and rp.WRITE_PATH.door == "work.change.similar"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_an_arm_searches_only_the_kinds_its_door_allows():
|
||||
# The shipped defaults: the message door considers every kind, so its
|
||||
# search is unfiltered; the write path narrows to its row.
|
||||
# The shipped defaults: the message door leaves out the kinds that reach
|
||||
# the work through their structure (lessons, issues); the write path's
|
||||
# search by resemblance considers notes only.
|
||||
_r, _io_, calls = await _run(rp.AUTO_INJECT, lambda kw: [])
|
||||
assert calls[0]["record_kinds"] is None
|
||||
assert "lesson" not in calls[0]["record_kinds"]
|
||||
assert "task:issue" not in calls[0]["record_kinds"]
|
||||
assert {"note", "snippet", "task:work"} <= set(calls[0]["record_kinds"])
|
||||
_r, _io_, calls = await _run(rp.WRITE_PATH, lambda kw: [])
|
||||
assert calls[0]["record_kinds"] == ["note", "snippet", "task:issue"]
|
||||
assert calls[0]["record_kinds"] == ["note"]
|
||||
# A user's own row replaces the default.
|
||||
_r, _io_, calls = await _run(rp.WRITE_PATH, lambda kw: [], kinds=frozenset({"snippet"}))
|
||||
assert calls[0]["record_kinds"] == ["snippet"]
|
||||
|
||||
Reference in New Issue
Block a user