docs(6206): retrieval, snippets, notes routes and rule_usage model drop citations
Corrected while reading: routes/notes.py said lessons and snippets pass the owner to set_record_systems, "a real inconsistency". Every door passes the caller; the comment now says so. rule_usage's model docstring states what an outcome measures and why the row cannot share the note table, without the measurement and record ids that motivated it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,16 +7,15 @@ from scribe.models.base import CreatedAtMixin, iso
|
||||
SURFACED = "surfaced"
|
||||
PULLED = "pulled"
|
||||
|
||||
# The outcome half (#4212, milestone 419). A rule that was read and then
|
||||
# ignored has always been indistinguishable from one that was read and
|
||||
# obeyed; these are the two events that can tell them apart.
|
||||
# The outcome half. Without these, a rule that was read and then ignored is
|
||||
# indistinguishable from one that was read and obeyed; these are the two
|
||||
# events that can tell them apart.
|
||||
#
|
||||
# There is deliberately NO third value for "read and ignored". That state is
|
||||
# real and is the whole point of the milestone, but it cannot be reported:
|
||||
# an agent that knew it was ignoring a rule would not be ignoring it. It is
|
||||
# real and is the point of measuring outcomes, but it cannot be reported: an
|
||||
# agent that knew it was ignoring a rule would not be ignoring it. It is
|
||||
# DERIVED — a pull with no outcome — and an enum member for it would collect
|
||||
# nothing while reading as though it had measured something, which is #3311's
|
||||
# failure exactly.
|
||||
# nothing while reading as though it had measured something.
|
||||
APPLIED = "applied"
|
||||
DEPARTED = "departed"
|
||||
OUTCOMES = (APPLIED, DEPARTED)
|
||||
@@ -26,15 +25,14 @@ class RuleUsageEvent(Base, CreatedAtMixin):
|
||||
"""One row per time a rule was SURFACED to the agent, PULLED in full, or
|
||||
ACTED ON — applied, or departed from with a stated reason.
|
||||
|
||||
The sibling `note_usage_events` has had since 2026-07, third in the line
|
||||
after `rule_embeddings` and `rule_versions` — and, like those, it exists
|
||||
because the rule side kept inheriting machinery built for notes and
|
||||
quietly getting the weaker version of it.
|
||||
The rule-side sibling of `note_usage_events`, beside `rule_embeddings`
|
||||
and `rule_versions` — each exists because machinery built for notes gives
|
||||
rules the weaker version of it.
|
||||
|
||||
WHY RULES NEED THEIR OWN AND CANNOT SHARE THE NOTE TABLE. Not squeamishness
|
||||
about a polymorphic column — the row shares no note-specific fields and the
|
||||
aggregate readout is the same shape, which is the strongest case for
|
||||
sharing that note #3163 admits. What decides it is IDENTITY AT RESTORE. A
|
||||
sharing there is. What decides it is IDENTITY AT RESTORE. A
|
||||
note id and a rule id are different namespaces resolved through different
|
||||
maps, and `note_usage_events`'s importer maps `note_id` through
|
||||
`note_id_map` and drops what does not resolve. A rule id parked in that
|
||||
@@ -42,11 +40,10 @@ class RuleUsageEvent(Base, CreatedAtMixin):
|
||||
happened to take that number — telemetry that is not merely lost but wrong,
|
||||
and wrong in a way nothing downstream could detect.
|
||||
|
||||
WHAT THIS MEASURES, AND WHY IT DID NOT EXIST. The write-path standing-rule
|
||||
arm is the only retrieval surface in Scribe whose usefulness cannot be
|
||||
observed — and, not coincidentally, the only one that has never declined to
|
||||
fire (#3311: 296 calls, zero zero-result, 100% clearing its threshold).
|
||||
`retrieval_logs` gives it scores; scores say what the ranker thought, never
|
||||
WHAT THIS MEASURES. A standing-rule arm's usefulness cannot be observed
|
||||
from its scores: an arm can fire on every call, clearing its threshold
|
||||
every time, and say nothing about whether it helped. `retrieval_logs`
|
||||
gives it scores; scores say what the ranker thought, never
|
||||
whether the hint landed. Without a pull counter no install can tune the arm
|
||||
from evidence, only from the shape of a histogram.
|
||||
|
||||
@@ -58,7 +55,7 @@ class RuleUsageEvent(Base, CreatedAtMixin):
|
||||
forty times and opened never, because that evidence is precisely the case
|
||||
for having deleted it.
|
||||
|
||||
Cells left deliberately empty (note #3163's step 3): no share ACL — rules
|
||||
Cells left deliberately empty: no share ACL — rules
|
||||
have none of their own; no soft delete — nothing restores a telemetry row,
|
||||
and the table is append-only; no embedding — an event is not a document.
|
||||
"""
|
||||
@@ -76,7 +73,7 @@ class RuleUsageEvent(Base, CreatedAtMixin):
|
||||
# 'surfaced' | 'pulled' | 'applied' | 'departed'
|
||||
#
|
||||
# Plain Text with no CHECK, as created in 0094 — which is why 0106 added
|
||||
# the outcome pair without a DROP/ADD migration. Rule 36 governs
|
||||
# the outcome pair without a DROP/ADD migration — that step is for
|
||||
# CHECK-whitelisted columns and this is not one. Said here as well as in
|
||||
# the migration because this is where the next person adding a value will
|
||||
# look first.
|
||||
@@ -84,9 +81,9 @@ class RuleUsageEvent(Base, CreatedAtMixin):
|
||||
|
||||
# Which surface produced it. A CONVENTION, not a fixed vocabulary, and the
|
||||
# note twin's comment explains why this one deliberately does not enumerate
|
||||
# its members: the previous such list went stale, naming a source nothing
|
||||
# wrote while omitting ones that existed, and a half-true enumeration reads
|
||||
# as authoritative in exactly the way that misleads (#2476).
|
||||
# its members: such a list goes stale, naming a source nothing writes while
|
||||
# omitting ones that exist, and a half-true enumeration reads as
|
||||
# authoritative in exactly the way that misleads.
|
||||
# `grep -rn record_rule_pulled\|record_rule_surfaced src/` is the
|
||||
# authoritative list, and unlike a comment it cannot drift.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user