feat(7836): lessons and rules are no longer paired by arriving together
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Failing after 1m40s
CI & Build / integration (push) Successful in 2m7s
CI & Build / Build & push image (push) Skipped

The co-arrival recorder counted a lesson and a rule shown in one response
as evidence that the lesson is an instance of the rule, and asked the
reader to judge the pair once three situations had gathered. Two records
that resemble the same prompts arrive together whether or not one is an
instance of the other, and the outcome bore that out (2,317 pairs
suggested, 23 confirmed). It no longer runs:

- neither the prompt door nor the write path records co-arrivals or
  carries a proposal line;
- a rule read lists the lessons judged against it, confirmed first, and a
  lesson read the rules it was judged against: suggested rows stay in the
  table and no read shows them;
- the lesson page and the rule editor drop the suggested section.

The situation-counting helpers stay; rule moment judgments use them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 06:02:10 -05:00
co-authored by Claude Opus 5.5
parent 2f93a4f7b5
commit 1a8c02bfe5
13 changed files with 69 additions and 358 deletions
-24
View File
@@ -9,7 +9,6 @@ is tested against Postgres in tests/test_integration_lesson_rule_links.py.
"""
from __future__ import annotations
import inspect
from datetime import datetime, timedelta, timezone
from grimoire.services import lesson_rules as links_svc
@@ -76,28 +75,5 @@ def test_a_passed_over_proposal_waits_out_the_cooldown():
assert links_svc.proposal_due(ev, NOW + links_svc.PROPOSE_COOLDOWN)
def test_the_proposal_names_the_call_that_answers_it():
line = links_svc._proposal_line(
41, "An overrun run usually failed early", 7, "Read the job log first",
"rule", {"situations": ["p:1", "p:2", "p:3"], "projects": [2, 5]},
)
assert 'judge_lesson_link(41, 7, "confirm"' in line
assert '"reject"' in line
assert "3 distinct situations across 2 projects" in line
def test_evidence_summary_reads_nothing_as_zero_not_an_error():
assert links_svc.evidence_summary(None) == {"situations": 0, "projects": 0, "co_surfaced": 0}
def test_both_hook_doors_count_the_pair_on_their_own_arm():
"""The two responses that carry lessons and rules together. A door that
renders both and does not record the pair is the miss this step exists
to close, and it would produce no error anywhere — only an empty table."""
from grimoire.routes import plugin as plugin_routes
from grimoire.services import plugin_context
prompt_door = inspect.getsource(plugin_routes.autoinject_retrieve)
assert "co_surfaced(" in prompt_door and 'arm="p"' in prompt_door
write_door = inspect.getsource(plugin_context.build_write_path_hint)
assert "co_surfaced(" in write_door and 'arm="w"' in write_door