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
+5 -8
View File
@@ -11,8 +11,8 @@ import type { RuleKind } from "@/api/rulebooks";
* another one fits. */
export type RuleJudgment = "linked" | "no_rule" | "unjudged";
/** A link's state (`models/lesson_rule_link.py` LINK_STATES). */
export type LinkState = "suggested" | "confirmed" | "rejected";
/** A judged link's state; the reads list only these two. */
export type LinkState = "confirmed" | "rejected";
/** One link from a lesson to a rule, in the reader's view: only rules the
* reader owns are listed (`rules_for_lessons`). */
@@ -20,14 +20,11 @@ export interface LessonRuleLink {
id: number;
title: string;
kind: RuleKind;
/** `suggested` carries nothing in retrieval until it is judged; only
* `confirmed` changes what surfaces; `rejected` is kept so the pair is
* never proposed again. */
/** `confirmed` changes what surfaces; `rejected` is kept so the reason
* stays readable. */
state: LinkState;
/** Why it was confirmed or rejected. */
note: string;
/** What a suggestion rests on — sent on suggested links only. */
evidence?: { situations: number; projects: number; co_surfaced: number };
}
/** A lesson: a transferable insight, retrievable by the SITUATION it applies
@@ -79,7 +76,7 @@ export interface Lesson {
updated_at: string | null;
systems?: { id: number; name: string }[];
usage?: RecordUsage;
/** The rules this lesson points at, confirmed first, then suggested, then
/** The rules this lesson was judged against, confirmed first, then
* rejected. Absent (with `rule_judgment`) when the links could not be read
* — which is "not attached", never "no rule". */
rules?: LessonRuleLink[];