Repository navigation
Add a total tile to the optimize row, and stop wide Lens tables overflowing the page - #697
Conversation
Every OptimizeFinding detail table (.opt-table) was rendered without a .table-wrap container, so a long unbreakable string (an absolute repo path in the resend finding's recurring-inclusions column, or a provider/model id) forced the table, the card, and the whole page wider than the viewport. Because the sidebar is position:fixed, the resulting page-level horizontal scroll made content appear to bleed past both the left and right edges of the content column. Wraps every .opt-table (and the Drift metrics table) in a .table-wrap div so wide tables scroll inside their own container instead of the page. Adds overflow-x:auto to .cur-listbox (Summarize/Rules file pickers), which had the same untruncated-path defect. Truncates long paths with the existing shortPath() helper (last two segments, full path in a hover title) in the recurring-inclusions label and both file pickers. Adds overflow-x:hidden on body as a backstop so no future unwrapped wide element can push the page itself into horizontal scroll. Co-Authored-By: Claude <[email protected]>
Adds a 7th tile, first in the "Opportunities to optimize token efficiency" row, summing the six per-analyzer figures (Subagent, Context resend, Downsize, Summarize, Relearn, Deadweight). The sum is a deliberate PLAIN SUM of the actionable figures, not the netted cross-analyzer rollup that already exists in core/optimize. Product decision: the MVP audience is SDK/Claude-Code users, and the one analyzer whose claims can overlap another's (script) is persona-disabled for them, so the double-count the rollup guards against is not in play for the shipped persona today. A comment at the summing site (totalOpportunityFigure) records this so a future change knows the netted rollup is the eventual source of truth. totalOpportunityFigure() gates on each tile's own state, not a page-wide flag: a tile with no candidates or already at ceiling is excluded from the sum structurally (by state), never coerced to a zero contribution, and an unresolved tile is tracked separately so the tile can disclose partial coverage instead of publishing a total that claims to cover every analyzer in the row. Three render states: unknown (nothing resolved -- a skeleton, never a number), empty (every resolved analyzer found nothing), populated (a real sum, with a coverage note when some analyzers are still resolving). The tile is visually distinct from its six siblings via weight and a heavier border, not the accent colour, since it links to no single detail page and accent means "typeable/clickable" elsewhere in this app. Co-Authored-By: Claude <[email protected]>
…/row Two founder-decided tweaks to the total opportunity tile from the prior commit. Reconciliation: the total must equal the sum of the SIX BREAKDOWN TILES' DISPLAYED figures, not a sum of raw values rounded once at the end -- those two disagree whenever more than one contributor's raw cents round independently (measured: displayed total read $2,395.95, hand-adding the six visible tiles gave $2,395.96). Extracts a shared roundToCents() helper that fmtDashUsd now uses to format a tile's own figure, and totalOpportunityFigure rounds each contributor with that SAME helper before summing (then rounds the sum once more to clear any float drift the additions reintroduce), so the two can never drift apart. A new node-extracted test pins the reconciliation property with a fixture (three 1.004 contributors) picked so sum-then-round-once (3.01) and round-then-sum (3.00) provably disagree; confirmed red against the prior raw-sum implementation before applying the fix, green after. Layout: the Total tile made the opportunities row 7 tiles, which orphaned the 7th (Deadweight) onto a second row at the shared .tile-grid.compact minmax, detaching the total from what it sums. A new .opp-grid class narrows just this row's minmax (128px vs the shared 140px) so all seven fit across at the normal content width, applied to both the answered-tiles grid and its loading skeleton (also bumped from 6 to 7 placeholders) so neither reflows against the other. Scoped narrowly: the health-glance row (a separate 5-tile grid reusing .tile-grid.compact) is untouched. Verified narrower viewports still wrap to a second row rather than squashing, and page overflow measures 0 at both widths with all seven tiles rendered. Co-Authored-By: Claude <[email protected]>
|
| Filename | Overview |
|---|---|
| tokenjam/ui/index.html | Adds the total tile and overflow containment; one recurring-inclusion display now incorrectly treats heterogeneous explanatory labels as filesystem paths. |
| tests/unit/test_lens_ui_regression.py | Adds broad regression tests for table containment, truncation, total-tile arithmetic, state handling, grid layout, and skeleton count. |
| tests/unit/test_lens_dashboard_states.py | Updates extracted JavaScript test dependencies to include the shared cent-rounding helper. |
Prompt To Fix All With AI
### Issue 1
tokenjam/ui/index.html:8421
**Avoid path-truncating explanatory labels**
`r.label` also contains search queries, prompt excerpts, and tool-output excerpts, so applying `shortPath` to every slash-containing label can discard the tool name and leading context. This leaves the recurring-inclusion explanation misleading unless the user hovers for the full value.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(ui): reconcile the total tile with d..." | Re-trigger Greptile
| <table class="opt-table"><thead><tr><th>What's re-included</th><th>Sessions</th><th>Occurrences</th><th>Fix</th></tr></thead> | ||
| <tbody>${fd.recurring_examples.slice(0, 8).map((r, i) => html`<tr key=${i}><td class="mono">${r.label}</td><td>${r.sessions}</td><td>${r.occurrences}</td><td class="dim">${r.fix}</td></tr>`)}</tbody></table>` | ||
| <div class="table-wrap"><table class="opt-table"><thead><tr><th>What's re-included</th><th>Sessions</th><th>Occurrences</th><th>Fix</th></tr></thead> | ||
| <tbody>${fd.recurring_examples.slice(0, 8).map((r, i) => html`<tr key=${i}><td class="mono" title=${r.label}>${shortPath(r.label)}</td><td>${r.sessions}</td><td>${r.occurrences}</td><td class="dim">${r.fix}</td></tr>`)}</tbody></table></div>` |
There was a problem hiding this comment.
Avoid path-truncating explanatory labels
r.label also contains search queries, prompt excerpts, and tool-output excerpts, so applying shortPath to every slash-containing label can discard the tool name and leading context. This leaves the recurring-inclusion explanation misleading unless the user hovers for the full value.
Knowledge Base Used: Demo Mode and the Dashboard UI
Prompt To Fix With AI
This is a comment left during a code review.
Path: tokenjam/ui/index.html
Line: 8421
Comment:
**Avoid path-truncating explanatory labels**
`r.label` also contains search queries, prompt excerpts, and tool-output excerpts, so applying `shortPath` to every slash-containing label can discard the tool name and leading context. This leaves the recurring-inclusion explanation misleading unless the user hovers for the full value.
**Knowledge Base Used:** [Demo Mode and the Dashboard UI](https://app.greptile.com/metabldr/-/custom-context/knowledge-base/metabuilder-labs/tokenjam/-/docs/demo-ui.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Two Lens UI changes to the Dashboard's optimize row.
Wide tables no longer overflow the page
Every
opt-tabledetail table (about 13 render sites: downsize, placement, cache, resend, script, reuse, subagent, verbosity, deadweight, recommendations) was rendered without a.table-wrapcontainer, even though that class already existed and was used elsewhere in the app. Cells holding unbreakable content, absolute filesystem paths in the resend finding's recurring-inclusions table and long provider/model strings elsewhere, forced the table, its card and the whole page wider than the viewport.bodyhad nooverflow-xrule, so the page itself scrolled sideways, and because the sidebar is fixed the result was content bleeding past both edges of the content column: the leading part of each path was cut off on the left while the fix column clipped on the right.Now the page body cannot scroll horizontally, wide tables scroll inside their own container, and long paths truncate with the full value available on hover. The two file-picker listboxes had the same untruncated-path defect and are fixed the same way.
New total tile on the opportunities row
Adds a total as the first tile in the row, so the per-analyzer figures roll up to one number.
The figure is a plain sum of the per-analyzer opportunities. That is deliberate and scoped: the netted cross-analyzer rollup is the more defensible number in general, but the overlapping-claim double-count it corrects is not in play for the persona this ships to. A comment at the summing site records the decision, and switching the tile to the netted rollup is tracked separately.
Three details worth calling out, since this row is exactly the kind of surface that tends to assert more than its data supports:
$0.00. A zero there would read as "no waste", which is the worst possible placeholder.The total also reconciles with what is on screen. Each contributor is rounded to the cent before summing, using the same helper that renders an individual tile, so adding the visible figures by hand always matches the total. Summing raw values first produced a one-cent mismatch.
All seven tiles now fit on one row, and the loading skeleton renders seven placeholders so the row does not reflow when real data arrives.
Testing
tests/unit/test_lens_ui_regression.py,test_lens_dashboard_states.pyandtest_lens_select_all_behaviour.py: 102 passed.New coverage pins the behaviour rather than the markup. The total's arithmetic is tested by extracting the pure function from the served HTML and running it, so wrong arithmetic cannot pass a string grep: an absent analyzer is excluded rather than zeroed, an at-ceiling analyzer contributes nothing, a fully unresolved row is the unknown state and never zero, a partially resolved row discloses its coverage, and the total equals the sum of the displayed figures. That last test was confirmed failing against the previous sum-raw implementation before the fix, so it is not a tautology. The overflow fix is pinned by asserting
bodycannot scroll horizontally and that everyopt-tablerender site is wrapped.Verified in a headless browser against a local build: measured page overflow is 0 with all seven tiles rendered, all seven share one row at full width, and the row wraps rather than squashing at a narrower viewport. Viewports below 900px were not checked; the Lens UI is desktop-only with a fixed sidebar and no mobile layout on this page.