Skip to content

#114: New Overview dashboard, Optimize detail tab, and TokenJam Lens brand pass - #125

Merged
anilmurty merged 6 commits into
mainfrom
feature/114-overview-optimize-brand
Jun 18, 2026
Merged

anilmurty merged 6 commits into
mainfrom
feature/114-overview-optimize-brand

Conversation

@anilmurty

Copy link
Copy Markdown
Contributor

Closes #114.

Stacked PR (top of the Lens stack). Base is feature/113; merges in
feature/111 (recoverable fields). The diff therefore includes the
foundations until the parents merge — I'll retarget to main as they land.

The marquee: a triage front door, an analyzer-findings detail screen, and the
TokenJam Lens brand.

Overview (#/overview, now the default route)

  • Cost hero — window total, trend chip vs previous, the [feature] Cost screen — replace the table-only view with a real chart #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, each with a visible estimated tag (hover = estimate_basis) and a
    one-line hint. Not-ready / skipped analyzers 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.
  • Empty state for a fresh install: "No data yet — TokenJam is listening."
    with onboard + tj demo guidance.

Optimize (#/optimize, new tab between Drift and Budget)

  • One section per analyzer with 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 + misc

  • <title>, sidebar wordmark, and OpenAPI title → TokenJam Lens.
  • Status agent tiles gain "View cost" / "View traces" deep-links.
  • Backend: /api/v1/optimize?fast=true skips the expensive Trim analyzer and
    reports 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/optimize carries the framing block +
per-finding recoverable fields; fast=true skips Trim. Full suite green;
ruff/mypy clean. Verified live via tj serve — Overview bands, Optimize
sections, 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).

anilmurty and others added 2 commits June 17, 2026 16:50
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 anilmurty left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + visibilitychange listener ✓ (:1747-1750)
  • Optimize tab at #/optimize, sourced from /api/v1/optimize, with window/agent/compare URL-synced ✓
  • ?finding=<name> uses scrollIntoView + .opt-focus class ✓ (: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=true correctly subtracts Trim from registry-derived run set (optimize.py:73-78) and surfaces skipped_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.

anilmurty and others added 2 commits June 17, 2026 21:56
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]>
@anilmurty

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough pass (and the AC #1 self-correction). Addressed the registry-driven nit in c2f75d2:

recoverableTiles now iterates opt.findings for any finding carrying the estimated_recoverable_usd contract field (plus the typed downgrade slot), instead of the hardcoded ['cache','script','trim']. cache-recommend / budget-projection lack the field and stay excluded by contract; ANALYZER_META is a lookup that falls back to the analyzer name — so when reuse (#115) ships, it surfaces on Overview with no UI change. Re-verified live: the band still renders Downsize/Cache/Script + muted Trim.

Agreed on re-running the suite once #124 (daemon concurrency) lands.

@anilmurty
anilmurty changed the base branch from feature/113-cost-chart to main June 18, 2026 05:18
@anilmurty
anilmurty marked this pull request as ready for review June 18, 2026 05:21
@anilmurty
anilmurty merged commit 8cbb3a4 into main Jun 18, 2026
4 checks passed
@anilmurty
anilmurty deleted the feature/114-overview-optimize-brand branch June 18, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] New Overview dashboard, Optimize detail tab, and TokenJam Lens brand pass

1 participant