feat(orchestrator): show token and commit rates in the header

rates.py folds the token, commit and score journals into per-hour and per-day rates for the header chips and the rates page; /api/rates drops from about 1950 ms to 380-830 ms on a year of data. Tests run once on unify/skills-20261114 after the merge (operator order 2026-11-14).

🎯 Fix: 75 %
💥 Break: 10 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 95 %
🏆 Score: 64
🚦 Gate: ⛔ fix 75 % < 90, break 10 % > 5; security 95 % < 100: ask the operator before the commit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-14 21:33:22 +00:00
1 parent a2a03995cb
commit 652bc817c1
28 files changed
+1449 -102

No files matched your search

+11 -1
View File
@@ -12,6 +12,16 @@ FILE_LIMIT = 64 << 20
def rows_between(path: Path, begin: float, end: float, width: float) -> list[dict]:
"""Args:
path: a JSON lines file of rows with t in epoch seconds.
begin: the earliest time a row may reach to.
end: the latest t a row may have.
width: the seconds a row reaches past its t unless it names its own
width.
Returns:
The rows from begin to end in file order.
"""
try:
lines = read_regular(path, FILE_LIMIT).splitlines()
except (OSError, ValueError):
@@ -19,7 +29,7 @@ def rows_between(path: Path, begin: float, end: float, width: float) -> list[dic
found = []
for row in map(parse_line, lines):
t = None if row is None else epoch(row.get("t"))
if t is not None and begin <= t + width and t <= end:
if t is not None and t <= end and (begin <= t + width or begin <= t + (epoch(row.get("width")) or 0)):
found.append(row)
return found