Skip to content

feat: Lens polish — Dashboard IA, 30d default, inbox clarity, drift lead (#654–#657) - #660

Merged
anilmurty merged 3 commits into
mainfrom
feat/lens-polish-654-657
Jul 30, 2026
Merged

anilmurty merged 3 commits into
mainfrom
feat/lens-polish-654-657

Conversation

@anilmurty

Copy link
Copy Markdown
Contributor

Four self-contained Lens web-UI polish fixes, all in the single-file offline SPA (tokenjam/ui/index.html), each closing an enhancement issue. No new external HTTP/deps (Rule #18) and no client-side re-implementation of framing/analysis — copy, markup, default-value, and nav-grouping changes only.

Summary

#654 — Dashboard nav + default landing

Closes #654

The Dashboard's waste tiles + spend pivot serve the Improve and Observe lenses equally, so it is now a persistent top-level sidebar entry (data-lens="all") seated above the Improve/Observe toggle and visible in either mode (the improve/observe hide rules only target those two values, so an "all" link is never hidden). The empty-hash default route now resolves to Dashboard in getRoute() (the single source of the default) instead of the Review inbox — no render-time location.hash redirect, which would race first paint (#132).

#655 — one shared 30d window default

Closes #655

Traces defaulted to 24h and Cost to 7d, while Optimize/Analytics already used 30d. A single DEFAULT_SINCE = '30d' constant now feeds every window-driven screen's DEFAULTS.since, resolved in the param layer when no since is in the URL. Alerts keeps its all-alerts empty default on purpose (its since is a filter, not a window; a 30d default would hide older unacknowledged alerts). Drift and Budget have no window selector, so nothing to standardize there.

#656 — Review inbox clarity

Closes #656

  • Appliable count. Added a count line ("N of M can be applied automatically — the rest are copy-and-apply") so "Open (6)" beside a single checkbox stops reading as five rows the user forgot to select. The bulk Select all control + action bar now render only when more than one row is auto-appliable (showBulkSelect = autoApplyCount > 1), instead of the old > 0 which showed a bulk control governing a single row.
  • Apply wording. Reworded the Approve note and the per-apply_kind hints/buttons to state the write is a file/config change effective on the next run — not live, in-path enforcement, and not a guaranteed saving (honesty Rule 14). The ambiguous single-word "Apply change" button became "Write change".

#657 — Drift empty-state

Closes #657

Led the no-baselines Drift screen with a scannable one-line headline ("Drift needs live SDK agents with 10+ completed sessions — Claude Code / Codex sessions and backfilled history aren't baselined."), keeping the existing grey detail lines below. Copy/markup only; no overclaiming.

Tests / Verification

  • New tests/unit/test_lens_ui_regression.py — static-grep guards for Dashboard persistence + default route, the shared 30d constant, the inbox count/Apply copy, and the Drift headline.
  • node --check on the extracted <script type="module"> block: passes.
  • tests/unit/test_ui_offline.py + the node-extraction behaviour tests (test_lens_select_all_behaviour.py, test_lens_dashboard_states.py): green.
  • Full unit suite: 4250 passed, 7 skipped. No Python source touched (Lens: default the time window to 30d everywhere (Traces defaults to 7d) #655 was JS-only), so no ruff/mypy delta.

Rebase note

This PR shares tokenjam/ui/index.html with #653 (trace-detail / waterfall). I deliberately stayed out of that component, but a rebase over #653 may still be needed on merge.

What's NOT in this PR

🤖 Generated with Claude Code

Batch of four self-contained Lens web-UI polish fixes (all in the
single-file offline SPA at tokenjam/ui/index.html), each closing an
enhancement issue. No new external HTTP/deps (Rule #18) and no
client-side re-implementation of framing/analysis — copy, markup,
default-value, and nav-grouping changes only.

#654 — Dashboard nav + default landing. The Dashboard's waste tiles +
spend pivot serve both the Improve and Observe lenses equally, so it is
now a persistent top-level sidebar entry (data-lens="all") seated ABOVE
the Improve/Observe toggle, visible in either mode. The empty-hash
default route now resolves to Dashboard in getRoute() (the single source
of the default) instead of the Review inbox — no render-time
location.hash redirect, which would race first paint (#132).

#655 — one shared 30d window default. Traces defaulted to 24h and Cost
to 7d while Optimize/Analytics already used 30d. A single DEFAULT_SINCE
constant now feeds every window-driven screen's DEFAULTS.since, resolved
in the param layer when no since is in the URL. Alerts keeps its
all-alerts empty default on purpose (it filters, not windows; a 30d
default would hide older unacknowledged alerts).

#656 — Review inbox clarity. Added an appliable-count line ("N of M can
be applied automatically — the rest are copy-and-apply") so "Open (6)"
beside a single checkbox stops reading as unselected rows, and gated the
bulk Select-all + action bar on more than one auto-appliable row. Reworded
the Approve/apply affordances to state the write is a file/config change
effective on the NEXT run — not live, in-path enforcement, and not a
guaranteed saving (honesty Rule 14).

#657 — Drift empty-state. Led the no-baselines screen with a scannable
one-line headline stating the requirement, keeping the existing grey
detail lines below.

Guarded by static-grep assertions in the new
tests/unit/test_lens_ui_regression.py (Dashboard persistence + default
route, the 30d constant, the inbox count/Apply copy, the Drift headline);
test_ui_offline.py and the node-extraction behaviour tests stay green.

Closes #654
Closes #655
Closes #656
Closes #657

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread tokenjam/ui/index.html Resolved
Comment thread tokenjam/ui/index.html Resolved
Comment thread tokenjam/ui/index.html Resolved
@greptile-apps

greptile-apps Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR polishes the Lens dashboard navigation, time-window defaults, review-inbox clarity, and Drift empty state.

  • Makes Dashboard the persistent, lens-neutral default route while keeping URL normalization and active-lens synchronization consistent.
  • Standardizes window-driven screens and drill-through links on a shared 30-day default.
  • Clarifies which review items can be written automatically and when written changes take effect.
  • Adds a scannable Drift eligibility headline and static regression coverage for the updated behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the default URL now agrees with Dashboard, 24-hour drill-throughs retain their window, and lens-neutral Dashboard navigation preserves the active lens.

Important Files Changed

Filename Overview
tokenjam/ui/index.html Updates SPA navigation, route synchronization, shared time-window defaults, review-inbox messaging and controls, and the Drift empty state; the three previously reported failures are corrected.
tests/unit/test_lens_ui_regression.py Adds static regression assertions covering the UI polish and the fixes for all three previous review threads.

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

The Lens polish batch (#654–#657) introduced three coupled regressions
around the new lens-neutral Dashboard and the moved 30d window default.
Greptile flagged all three as P1; all are pure routing/nav-sync logic in
the single-file offline SPA.

P1-1 — default route inconsistency. getRoute() defaults an empty hash to
Dashboard, but the URL-normalization effect still replaceState'd #/review
(the old Improve home), so the rendered page and the address bar
disagreed and a refresh or shared bare link opened Review. The
normalization now writes #/dashboard to match getRoute() — one default,
no render-time hash redirect (#132 preserved).

P1-2 — Traces drill-through dropped a non-default window. The default
moved to 30d, but tracesHrefForWindow() still omitted the window at the
retired 24h literal, so a Dashboard set to 24h drilled into Traces and
silently fell back to 30d. Both tracesHrefForWindow and optimizeFindingHref
now decide "omit since" against the shared DEFAULT_SINCE constant, so
drill-through preserves the window the tile was computed from and the
default can move again without dropping a real window.

P1-3 — Dashboard nav reset the active lens. Dashboard is data-lens="all"
(visible in both lenses) but was still mapped to 'improve' in VIEW_LENS,
so opening it from Observe flipped the sidebar to Improve and hid the
Observe nav. Dashboard is now absent from VIEW_LENS; the route-sync effect
falls back to the sidebar's current lens for an unmapped (lens-neutral)
view, so the active lens is preserved.

Extends tests/unit/test_lens_ui_regression.py with three static-grep
guards (default-route normalization agrees on dashboard;
DEFAULT_SINCE-driven drill-through omission; Dashboard lens-neutral +
lens-preserving fallback). node --check on the extracted module + lens
scripts passes; test_lens_ui_regression, test_ui_offline, and the JS
behaviour lens tests are green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@anilmurty

Copy link
Copy Markdown
Contributor Author

Fixed all three Greptile P1 findings (commit e665266) — all pure routing/nav-sync logic in tokenjam/ui/index.html.

P1-1 · Default route kept #/review → The URL-normalization effect on an empty hash now replaceStates #/dashboard to match getRoute()'s default, so the rendered page, the address bar, and a refresh/shared-link all agree on Dashboard. No render-time hash redirect (#132 preserved).

P1-2 · Traces drill-through dropped a non-default window → tracesHrefForWindow() (and optimizeFindingHref()) now decide "omit since" against the shared DEFAULT_SINCE constant instead of the retired 24h / a hardcoded 30d literal. A Dashboard set to 24h now carries ?since=24h into Traces instead of silently falling back to 30d — and the default can move again without dropping a real window.

P1-3 · Dashboard nav reset the active lens → Dashboard (data-lens="all") is now absent from VIEW_LENS, and the route-sync effect falls back to the sidebar's current lens for an unmapped (lens-neutral) view (VIEW_LENS[view] || (sidebar && sidebar.dataset.lens) || 'improve'). Opening the Dashboard from Observe stays in Observe; Improve stays Improve.

Tests / verification

  • Extended tests/unit/test_lens_ui_regression.py with three static-grep guards (default-route normalization agrees on dashboard; DEFAULT_SINCE-driven drill-through omission; Dashboard lens-neutral + lens-preserving fallback).
  • node --check on the extracted <script type="module"> + lens handler: clean.
  • pytest tests/unit/test_lens_ui_regression.py tests/unit/test_ui_offline.py and the JS-behaviour lens tests (test_lens_*) — all green (257 passed).

Not merging — leaving for review. (Note: this branch rebases over #659 at merge — separate concern.)

# Conflicts:
#	tests/unit/test_lens_ui_regression.py
@anilmurty
anilmurty merged commit 0364c1c into main Jul 30, 2026
5 checks passed
@anilmurty
anilmurty deleted the feat/lens-polish-654-657 branch July 30, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant