feat(8118,8119): telemetry reads take a closed window, and every enter_project records whether it carried the family line
CI & Build / TypeScript typecheck (push) Successful in 37s
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 17s
CI & Build / integration (push) Failing after 2m15s
CI & Build / Python tests (push) Successful in 2m23s
CI & Build / Build & push image (push) Skipped

#8119: retrieval_telemetry and list_rules(with_usage) take `since` and
`until` (ISO date or datetime) besides `days`. Every windowed count is
bounded at both ends: sources, note/rule/system/moment usage, record
reach, judged lines and the floor-moved check. A review read after its
period can now keep a later deploy out of its counts. A bad bound is
refused rather than widened.

#8118: enter_project writes one AppLog row (family / enter_project) per
entry: the project, whether the family line was shown, its counts, and
whether the readout failed. It is spawned, so the handshake does not wait.
retrieval_telemetry gains a `family_line` block: per project, entries,
entries that carried the line, first and last shown, and the latest
counts. Review #5132's "did the project's sessions see the line" is now
answerable from this deploy on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 00:01:19 -05:00
co-authored by Claude Opus 5.5
parent 0e946ffac8
commit 577a8e8621
12 changed files with 389 additions and 29 deletions
+27 -2
View File
@@ -361,7 +361,7 @@ async def search(
async def retrieval_telemetry(
days: int = 30, near_miss_samples: int = 0,
days: int = 30, near_miss_samples: int = 0, since: str = "", until: str = "",
) -> dict:
"""What the retrieval telemetry says about YOUR surfaces, over a window.
@@ -659,16 +659,41 @@ async def retrieval_telemetry(
from an empty window, which would otherwise read as every counter at
zero.
`family_line` — how often each project was entered and how often the
entry carried the family line, from the `enter_project` rows: per
project, `entries`, `entries_with_line`, the first and last time the line
was shown, and the counts it showed most recently. It answers "did this
project's sessions see the family canon it owes", which no other block
can.
A CLOSED WINDOW FOR A REVIEW READ LATE. `days` counts back from now, so
a review read two weeks after its period also counts whatever shipped
since. Pass `since` and `until` to fix both ends to the period under
review; the response's `since` and `until` name the window that was used.
Args:
days: window size, default 30. Clamped to at least 1.
days: window size, default 30. Clamped to at least 1. Ignored when
`since` is given.
near_miss_samples: 0-20, default 0. How many of each source's highest
scoring DECLINES to list by record, with the query that asked.
Pass it when you are about to move a threshold; leave it off
otherwise. See the near-miss section above for why a percentile
alone cannot settle a bar.
since: start of the window, an ISO date or datetime (UTC when no
zone is given). Empty = `days` before `until`.
until: end of the window, exclusive. A bare date covers that whole
day. Empty = now. An unparseable bound, or `since` not before
`until`, is refused with `error`.
"""
from grimoire.services.retrieval_telemetry import resolve_window
try:
start, end = resolve_window(days, since or None, until or None)
except ValueError as exc:
return {"error": str(exc)}
return await retrieval_summary(
current_user_id(), days=days, near_miss_samples=near_miss_samples,
since=start, until=end,
)