feat(lessons): convergence is named at the write — no-rule lessons that keep landing in one situation suggest a rule (milestone 440 step 5, #4634)
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / integration (push) Successful in 59s
CI & Build / Python tests (push) Successful in 1m45s
CI & Build / Build & push image (push) Successful in 27s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / integration (push) Successful in 59s
CI & Build / Python tests (push) Successful in 1m45s
CI & Build / Build & push image (push) Successful in 27s
When a lesson is answered "no rule fits" (create_lesson / update_lesson on both doors), the response looks for other no-rule lessons it resembles and, once there are CONVERGENCE_LESSONS (3) of them, carries `convergence`: the members, their incidents and projects, and a hint to draft the missing rule with create_rule (operator approval as always) and point each lesson at it — or to leave them as lessons when no single choice is right every time. - convergence_group is the pure bar: distinct LESSONS count, incidents never stand in for them (one broad lesson cannot trigger it), and a group whose sources all point at one incident is one event written up several times. - convergence_for searches lessons by the new one's claim + trigger (trigger_title) at CONVERGENCE_THRESHOLD 0.65 — above the menu's "worth showing", below the duplicate gate's "same record" — then keeps the ones with a lesson_no_rule answer. Fail-open. No sweep, no timer (#4183). - Defaults stated as defaults (rules 32, 115). - Tests: the bar (pure), the search with stubs, the door, and the no-rule filter against Postgres; conftest stubs convergence_for for unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -160,7 +160,9 @@ def _no_lesson_rule_links(request):
|
||||
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.
|
||||
real function at import time, before this patch runs. The convergence
|
||||
check a "no rule fits" answer runs (#4634) is stubbed to "no group" for
|
||||
the same reason; tests/test_lesson_convergence.py binds the real one.
|
||||
|
||||
Skipped for integration tests, which exercise the real links against
|
||||
Postgres (tests/test_integration_lesson_rule_links.py).
|
||||
@@ -173,7 +175,8 @@ def _no_lesson_rule_links(request):
|
||||
patch("scribe.services.lesson_rules.rule_candidates", AsyncMock(return_value=[])), \
|
||||
patch("scribe.services.lesson_rules.co_surfaced", AsyncMock(return_value="")), \
|
||||
patch("scribe.services.plugin_context._rules_via_lessons",
|
||||
AsyncMock(return_value=([], []))):
|
||||
AsyncMock(return_value=([], []))), \
|
||||
patch("scribe.services.lesson_rules.convergence_for", AsyncMock(return_value=None)):
|
||||
yield
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user