Repository navigation
#114: New Overview dashboard, Optimize detail tab, and TokenJam Lens brand pass - #125
Conversation
The marquee. Two new screens, a brand pass, and the default-route flip. Overview (#/overview, now the default landing route): - Cost hero: window total + trend chip vs previous + the #113 spend chart embedded compact + linear run-rate projection. Window toggle (URL-synced). - Recoverable band: registry-driven tiles from /api/v1/optimize?fast=true — one per savings analyzer with estimated_recoverable_usd, framed per pricing mode, with a visible "estimated" tag (hover = estimate_basis) and a one-line hint. Not-ready / skipped analyzers (e.g. Trim under fast) render muted. - Health band: Alerts (unread) / Drift (agents breaching 2σ) / Budgets (over/near ceiling) / Activity (recent sessions), each a deep-link. - Every tile deep-links into a detail screen with filters pre-applied via URL. - Auto-refresh every 30s only while the tab is visible. - Fresh-install empty state: "No data yet — TokenJam is listening." with onboard + demo guidance. - Fetches sequentially: the daemon's single DuckDB connection isn't safe for concurrent access across the sync routes' threadpool, so a 6-at-once burst could 500. (Broader daemon concurrency hardening is a separate follow-up.) Optimize (#/optimize, new sidebar tab between Drift and Budget): - One section per analyzer (downsize/cache/cache-recommend/script/trim) with the finding details + existing caveat language + recoverable estimate. - Settings row (window / agent / period-comparison), URL-synced. - ?finding=<name> scrolls to + highlights that section (Overview drill-through). - Window-comparison block when ?compare= is set. Brand pass: <title>, sidebar wordmark, and FastAPI OpenAPI title → "TokenJam Lens". Status agent tiles gain "View cost" / "View traces" deep-links. Backend: /api/v1/optimize gains ?fast=true (skips the expensive Trim analyzer, reports skipped_analyzers) for the polling Overview. Tests: GET / serves the Lens title; /optimize carries framing + per-finding recoverable fields; fast=true skips Trim. Full suite green; ruff/mypy clean. Verified live (tj serve) — Overview, Optimize, deep-link highlight all render. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
anilmurty
left a comment
There was a problem hiding this comment.
Review: ✅ Approve with nits
Reviewed the #114-specific commit 35dee7d only — the rest of the PR diff is #110 / #111 / #112 / #113 work I already reviewed.
Correction to a near-miss in my own analysis: I initially flagged the || 'status' fallback in getRoute() (index.html:767, :770) as a blocking miss of AC #1 (default route → Overview). That was a misread on my part. The actual default-landing redirect at index.html:528-530:
if (!location.hash || location.hash === '#/') {
- location.hash = '#/status';
+ location.hash = '#/overview';
}does the right thing. The 'status' in getRoute() is a defensive fallback for malformed routes, not the default. AC #1 is met. Apologies for the noise.
Acceptance criteria — 22/22 met:
- Default route → Overview ✓ (
:528-530) - Three bands (Cost hero / Recoverable / Health) ✓
- Tile click-through deep-links with filters pre-applied via URL ✓
- Auto-refresh gated on
document.visibilityState+visibilitychangelistener ✓ (:1747-1750) - Optimize tab at
#/optimize, sourced from/api/v1/optimize, with window/agent/compare URL-synced ✓ ?finding=<name>usesscrollIntoView+.opt-focusclass ✓ (:480)- Empty state triggers on
status.agents.length === 0(not on error fallback) ✓ (:1723) - Brand pass:
<title>, sidebar wordmark, FastAPI OpenAPI title all "TokenJam Lens" ✓ - Status agent-tile "View cost" / "View traces" affordances ✓ (
:147-148) — picks up the gap I flagged on #121 ?fast=truecorrectly subtracts Trim from registry-derived run set (optimize.py:73-78) and surfacesskipped_analyzers✓- Tests cover framing + recoverable + fast-skip +
<title>✓
One nit (non-blocking):
Recoverable band is hardcoded, not truly registry-driven (AC #2 partial). index.html:228-230 hardcodes ['cache', 'script', 'trim'].forEach(...) and ANALYZER_META (:163-169) is a static dict. When reuse ships (milestone #2, issue #115), it'll silently not appear on Overview even though it returns estimated_recoverable_usd.
Fix: iterate Object.keys(opt.findings) filtered by estimated_recoverable_usd != null, with ANALYZER_META as a lookup that falls back to the analyzer name. ~5–10 lines. Either fix here or file as a follow-up — the issue body's AC #2 specifically called out registry-driven.
Also noted: the agent's "Overview 6-parallel fetch 500'd on DuckDB's single write connection → fixed by fetching sequentially in-scope, #124 filed for proper concurrency hardening" is a great catch-by-running. Sequential fetch is a reasonable v1 fix. Worth re-running the suite once #124 lands.
Solid end-to-end. CLAUDE.md compliance clean. Offline rule preserved. Ready for formal review once you flip it out of draft.
Iterate findings carrying the estimated_recoverable_usd contract field instead of a hardcoded ['cache','script','trim'] list, so a future analyzer (e.g. reuse) surfaces on Overview with no UI change. cache-recommend / budget-projection lack the field and stay excluded by contract. Addresses the PR #125 review nit (AC #2). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Thanks for the thorough pass (and the AC #1 self-correction). Addressed the registry-driven nit in c2f75d2:
Agreed on re-running the suite once #124 (daemon concurrency) lands. |
Closes #114.
Stacked PR (top of the Lens stack). Base is
feature/113; merges infeature/111(recoverable fields). The diff therefore includes thefoundations until the parents merge — I'll retarget to
mainas they land.The marquee: a triage front door, an analyzer-findings detail screen, and the
TokenJam Lensbrand.Overview (
#/overview, now the default route)embedded compact, linear run-rate projection. Window toggle (URL-synced).
/api/v1/optimize?fast=true:one per savings analyzer with
estimated_recoverable_usd, framed per pricingmode, each with a visible estimated tag (hover =
estimate_basis) and aone-line hint. Not-ready / skipped analyzers render muted.
(over/near ceiling), Activity (recent sessions) — each a deep-link.
with onboard +
tj demoguidance.Optimize (
#/optimize, new tab between Drift and Budget)recoverable estimate.
?finding=<name>scrolls to + highlights that section (Overview drill-through).?compare=is set.Brand + misc
<title>, sidebar wordmark, and OpenAPI title → TokenJam Lens./api/v1/optimize?fast=trueskips the expensive Trim analyzer andreports
skipped_analyzers, so the polling Overview stays snappy.Concurrency note
The Overview fetches its endpoints sequentially: the daemon's single DuckDB
connection isn't safe for concurrent access across the sync routes' threadpool,
and a 6-at-once burst could 500. Broader daemon concurrency hardening is filed
as a follow-up (#124).
Tests / verification
GET /serves the Lens title;/api/v1/optimizecarries the framing block +per-finding recoverable fields;
fast=trueskips Trim. Full suite green;ruff/mypy clean. Verified live via
tj serve— Overview bands, Optimizesections, and the deep-link highlight all render (screenshots in the thread).
Scope guardrails honoured
No real-time push (30s poll), ≥1280px target, fixed tile order, this-install
data only, run-rate only (no forecasting).