feat(rules): a rule surfaces through the lessons confirmed as its instances (milestone 440 step 4, #4633)
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 18s
CI & Build / TypeScript typecheck (push) Successful in 54s
CI & Build / integration (push) Successful in 55s
CI & Build / Python tests (push) Failing after 1m16s
CI & Build / Build & push image (push) Skipped
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 18s
CI & Build / TypeScript typecheck (push) Successful in 54s
CI & Build / integration (push) Successful in 55s
CI & Build / Python tests (push) Failing after 1m16s
CI & Build / Build & push image (push) Skipped
On all three rule arms (prompt_rule, pre_tool_rule, write_path_rule), after the direct match, a lesson matching the moment at the notes menu's own bar brings the rule(s) it is CONFIRMED to be an instance of, rendered in rule voice with "Reached through lesson #N “…”, a recorded instance of it." - Confirmed links only (lesson_rules.confirmed_lessons / confirmed_rules_in_scope). A suggested link carrying its rule would manufacture the co-arrival #4637 counts and prove itself. - Scope kept: a lesson surfaces everywhere, but the rule it brings must be global or this project's own — milestone 414's boundary, not reopened through a side door. - Suppression is by RULE: anything the direct band named or the session ledger holds is skipped, whichever lesson reached it. - Its own slot (VIA_LESSON_LIMIT = 1), not a rule slot — a stated default, since the plan's "decide by measurement" has nothing to measure until links are confirmed (#4632). Its own source, rule_via_lesson: registered, RANKED for pull-through, logged whenever it searches. - Nothing searched at all while no lesson carries a confirmed link, which is every install until one is judged. - build_prompt_rule_hint / build_tool_rule_hint are now thin wrappers over the direct arms (_prompt_rule_hint / _tool_rule_hint); the arm leaves its query in `_via_query` only when it ran, so a disabled arm or a blank prompt brings no rule in either, and the key never leaves the server. - Via-lesson rules are not fed to the #4637 co-surfacing recorder: only direct matches are evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+7
-2
@@ -157,7 +157,10 @@ def _no_lesson_rule_links(request):
|
||||
otherwise ride along with every unit test that creates a lesson. The
|
||||
co-surfacing recorder (#4637) is stubbed to "no proposal": every hook
|
||||
builder test that renders a lesson beside a rule would otherwise reach
|
||||
for the database to count the pair.
|
||||
for the database to count the pair. And the via-lesson rule step (#4633)
|
||||
is stubbed to "no lesson brought a rule": all three rule arms run it, and
|
||||
its first act is a database read. tests/test_rule_via_lesson.py binds the
|
||||
real function at import time, before this patch runs.
|
||||
|
||||
Skipped for integration tests, which exercise the real links against
|
||||
Postgres (tests/test_integration_lesson_rule_links.py).
|
||||
@@ -168,7 +171,9 @@ def _no_lesson_rule_links(request):
|
||||
with patch("scribe.services.lesson_rules.attach_lesson_rules", AsyncMock()), \
|
||||
patch("scribe.services.lesson_rules.attach_rule_lessons", AsyncMock()), \
|
||||
patch("scribe.services.lesson_rules.rule_candidates", AsyncMock(return_value=[])), \
|
||||
patch("scribe.services.lesson_rules.co_surfaced", AsyncMock(return_value="")):
|
||||
patch("scribe.services.lesson_rules.co_surfaced", AsyncMock(return_value="")), \
|
||||
patch("scribe.services.plugin_context._rules_via_lessons",
|
||||
AsyncMock(return_value=([], []))):
|
||||
yield
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user