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
+2 -11
View File
@@ -15,7 +15,6 @@ from quart import Blueprint, g, jsonify, request
from grimoire.auth import admin_required, get_current_user_id, login_required
from grimoire.config import Config
from grimoire.services import hook_payload as hook_payload_svc
from grimoire.services import lesson_rules as lesson_rules_svc
from grimoire.services import moment_delivery as moment_delivery_svc
from grimoire.services import plugin_context as plugin_ctx_svc
from grimoire.services import reply_shapes as reply_shapes_svc
@@ -215,13 +214,6 @@ async def autoinject_retrieve():
result = await plugin_ctx_svc.build_autoinject_hint(
g.user.id, q, project_id=project_id, exclude_ids=exclude_ids, context=ctx,
)
# The one place both arms' lines meet, so the one place a lesson and a
# rule arriving TOGETHER can be counted. Keyed on the operator's
# prompt — the situation — and fails open to "".
proposal = await lesson_rules_svc.co_surfaced(
g.user.id, result.get("lesson_ids") or [], rules.get("shown_rule_ids") or [],
arm="p", situation=q, project_id=project_id or None,
)
# The reply mounts go through the same rule ledger; a rule the prompt arm
# just named is not quoted a second time by the turn's delivery.
turn = await moment_delivery_svc.deliver_for_turn(
@@ -232,8 +224,8 @@ async def autoinject_retrieve():
record=False,
)
# One payload, in the one order: the rules, then the reply shape, then
# what the last turn left unjudged, then the records menu, then the
# lesson-rule proposal, fitted to the budget.
# what the last turn left unjudged, then the records menu, fitted to the
# budget.
carry = (request.args.get("carry") or "").strip()[:_CARRY_CHARS]
turn_parts = (
[*turn["rule_parts"], *turn["shape_parts"]] if "shape_parts" in turn
@@ -247,7 +239,6 @@ async def autoinject_retrieve():
*turn_parts,
*([hook_payload_svc.Part(text=carry)] if carry else []),
*hook_payload_svc.parts_of(result, {hook_payload_svc.NOTE: "note_ids"}),
*([hook_payload_svc.Part(text=proposal)] if proposal else []),
])
shapes = set(fitted.ids(hook_payload_svc.SHAPE))
forms = {k: f for k, f in turn["shape_forms"].items() if k in shapes}