docs(6209): seventeen more test files — lesson shape and round trip, rule scope/moments/kind/surfacing, drift, deadlock race, backup, inception, backfill, claims, supersession, ledgers, family shapes
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 1m7s
CI & Build / Python tests (push) Successful in 1m54s
CI & Build / Build & push image (push) Successful in 12s

Docstrings and comments state the property and its reason in the present
tense. The session-context ledger test no longer describes the decision it
"used to pin"; the supersession tests state demote-not-filter without the
quote; one-row measurements become the general shape with their figures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 21:37:15 -04:00
co-authored by Claude Opus 5.5
parent ba0b56018e
commit 63e97a6f0f
17 changed files with 95 additions and 123 deletions
+6 -8
View File
@@ -1,4 +1,4 @@
"""Reading a lesson's insight back and re-composing it returns the same body (#4272).
"""Reading a lesson's insight back and re-composing it returns the same body.
THE PROPERTY. `update_lesson` is field-wise: an edit that touches only
`system_ids`, or only `what`, passes `insight=None`, and the service then
@@ -24,11 +24,9 @@ insight", the full trigger was prepended again, and the stored lesson gained
(n-1) paragraphs per update — silently, compounding, and in the half of the
document that does the retrieving.
Measured on the one real row this damaged (lesson #4207, a three-paragraph
trigger): the body grew by exactly 607 characters per edit — the length of
paragraphs 2 and 3 with their separators — taking it from 1291 characters to
7361 over ten edits, at which point the trigger appears eleven times and the
insight is 17% of the record.
On a three-paragraph trigger the body grows by the length of paragraphs 2 and
3 with their separators on every edit — after ten edits the trigger appears
eleven times and the insight is a sixth of the record.
WHY A MARKER COULD NOT HAVE FIXED IT. There is no end-of-trigger marker in
the body and adding one would not repair a row already written without it.
@@ -99,7 +97,7 @@ def _stored(trigger: str, insight: str, sources: list[int]):
MagicMock auto-creates truthy and coerces to `1`. A no-sources shape then
recomposes with `**Learned from:** #1` and the round trip fails for a
reason that has nothing to do with the trigger. `fake_lesson` pins that
field to None — note #2109's point, which is why the fixture exists.
field to None, which is why the fixture exists.
"""
title, body = lessons_svc.lesson_document(WHAT, trigger, insight, sources)
data = lessons_svc.compose_data(WHAT, trigger, sources)
@@ -137,7 +135,7 @@ def test_an_edit_that_changes_nothing_changes_nothing(_name, trigger, insight, s
# Reported as a size delta rather than left to a diff of two multi-kilobyte
# strings: the failure this catches is duplication, and the number of
# characters gained says which paragraph came back far faster than an
# equality dump does (rule 167 — a guard has to name what broke).
# equality dump does (a guard has to name what broke).
assert (title, body) == (note.title, note.body), (
f"a no-op edit rewrote the lesson: title {len(title) - len(note.title):+d} "
f"chars, body {len(body) - len(note.body):+d} chars"