Skip to content

Commit 0fe45ea

Browse files
anshssclaude
andcommitted
feat(inbox): overspend as a tile beside Fixes applied, and a $5 noise floor
Three founder calls from reviewing the page live. 1. THE FULL-WIDTH BAND IS GONE, from both the Dashboard and the Review inbox. It led each page with a large figure, three paragraphs of prose and a derivation accordion, and read as heavy. The figure now occupies the compact tile slot the old forward-looking 'est. savings' tile used to hold, beside 'Fixes applied' — which is the shape the page was asked for. What did NOT change, because it is honesty discipline and not layout: the number is still the server's own past_overspend block read verbatim (never reduced over rendered cards); it is still past tense, observed, and carries no recovery vocabulary; the total observed COST is still disclosed and still worded as cost rather than waste (rule 30). The long-form derivation moved into the figure's hover text rather than being dropped. The excluded-waste cross-reference moved BELOW the tile row: it used to hang off the band's note slot and would have disappeared with it, and leaving it unstated reads as 'the biggest figure the product computes doesn't exist'. 2. A $5 NOISE FLOOR on both tabs. A card worth less than that is not worth a row — acting on it costs more attention than the fix returns. Measured on a real corpus the effect is the whole complaint: 51 recurring mistakes -> 5, 15 cost advisories -> 5. Two rules keep it a display filter and not a quiet write-off. ONLY A KNOWN FIGURE CAN BE JUDGED SMALL — an unpriced item is not a cheap one, so the floor never hides it. And WHAT IS HIDDEN IS STATED: each tab renders a line naming how many rows went and what they cost combined ('46 smaller recurring mistakes under $5.00 are hidden'). The headline is untouched and still counts them. 3. The floor is declared ABOVE the selection helpers so the tab count, 'select all' and 'dismiss checked' all operate on exactly the rows a reader can see. A bulk action that can reach a row nobody was shown is the failure mode that ordering exists to prevent. An analyzer-focused deep link skips the floor, or an Optimize page's 'review it ->' would land on an empty tab. Tests moved with the decisions rather than being deleted: the band tests now target the tile and additionally assert it sits IN the tile row, that the cost disclosure survived the shrink, and that the excluded note is not nested inside the tile that can disappear. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 77d1ff3 commit 0fe45ea

3 files changed

Lines changed: 171 additions & 77 deletions

File tree

tests/unit/test_lens_ui_regression.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,11 +2506,19 @@ def test_dollars_suppressed_reads_the_server_display_rule(html):
25062506
# might return. A past figure is checkable against a bill the user already
25072507
# paid; a forward one asks them to trust a projection of a month that has not
25082508
# happened, and trust is the scarce resource.
2509-
def test_inbox_headline_is_the_past_overspend_band(html):
2509+
def test_inbox_headline_is_the_past_overspend_tile(html):
2510+
# 2026-07-26 founder call: the full-width band was removed and this figure
2511+
# now occupies the compact tile slot beside "Fixes applied". The TENSE
2512+
# decision above is unchanged -- only the shape moved.
25102513
start = html.index("function InboxStatTiles")
25112514
end = html.index("function ReviewInboxView", start)
25122515
tile = html[start:end]
2513-
assert "<${PastOverspendBand} block=${pastOverspend}" in tile
2516+
assert "<${PastOverspendTile} block=${pastOverspend}" in tile
2517+
# It sits IN the tile row, beside the applied tile -- not on its own row
2518+
# above it, which is what made it read as a heavy banner.
2519+
row = tile[tile.index('display:flex;gap:14px'):]
2520+
assert "<${PastOverspendTile}" in row
2521+
assert "Fixes applied" in row
25142522
# The old forward-looking headline and its vocabulary are gone from here.
25152523
assert ">Estimated recoverable " not in tile
25162524
assert "est./mo" not in tile
@@ -2529,17 +2537,21 @@ def test_inbox_headline_number_comes_from_the_payload_not_a_client_side_sum(html
25292537
assert "priceable.length * 2 >= openItems.length" not in tile
25302538

25312539

2532-
def test_past_overspend_band_hides_when_nothing_is_open(html):
2533-
# Nothing open means no observed figure to state, so the band hides rather
2540+
def test_past_overspend_tile_hides_when_nothing_is_open(html):
2541+
# Nothing open means no observed figure to state, so the tile hides rather
25342542
# than rendering a fabricated zero — but the excluded-waste line still has
2535-
# to render, so it gets a bare band of its own.
2543+
# to render, which is why it now lives BELOW the tile row rather than
2544+
# inside the tile that can disappear.
25362545
start = html.index("function InboxStatTiles")
25372546
end = html.index("function ReviewInboxView", start)
25382547
tile = html[start:end]
25392548
assert "hasOpenOverspend ? html`" in tile
2540-
band_start = html.index("function PastOverspendBand")
2549+
band_start = html.index("function PastOverspendTile")
25412550
band = html[band_start:html.index("\n}", band_start)]
25422551
assert "if (!causes && !toks) return null;" in band
2552+
# The note is not nested inside the conditional tile.
2553+
note_at = tile.index("<${ExcludedWasteNote}")
2554+
assert "hasOpenOverspend" not in tile[note_at - 200:note_at]
25432555

25442556

25452557
# --- #326: excluded waste (summarize) is stated + linked, never summed ----- #
@@ -2549,7 +2561,10 @@ def test_inbox_stat_tiles_renders_the_excluded_cross_reference(html):
25492561
block = html[start:end]
25502562
# Rendered inside InboxStatTiles, not just defined standalone.
25512563
assert "<${ExcludedWasteNote} excluded=${excluded} />" in block
2552-
assert block.count("<${ExcludedWasteNote} excluded=${excluded} />") == 2
2564+
# Once, not twice: it used to render both inside the band's `note` slot and
2565+
# again in a bare fallback band. With the band gone it has ONE home, below
2566+
# the tile row, where it renders whether or not the tile does.
2567+
assert block.count("<${ExcludedWasteNote} excluded=${excluded} />") == 1
25532568
# Never folded into the blue tile's own dollar figure — only ever a
25542569
# separate stated line with a link out.
25552570
assert "not summed above" in block
@@ -2629,7 +2644,7 @@ def test_select_all_checkbox_sits_beside_the_bulk_dismiss_button(html):
26292644
# checked" rather than inside a <thead><th>.
26302645
assert "function SelectAllCheckbox" in html
26312646
assert (
2632-
"<${SelectAllCheckbox} total=${visible.length} "
2647+
"<${SelectAllCheckbox} total=${shownRelearn.length} "
26332648
"selected=${selectedCount} onToggle=${toggleAll} />"
26342649
) in html
26352650
# The per-row checkbox is still present, just inside a flat row now.
@@ -2657,7 +2672,7 @@ def test_select_all_toggles_off_when_everything_is_selected(html):
26572672
assert "else next.add(sig)" in fn
26582673
# The component delegates to it over the RENDERED row set.
26592674
assert (
2660-
"nextSelectAllSelection(visible.map(c => c.signature), prev)"
2675+
"nextSelectAllSelection(shownRelearn.map(c => c.signature), prev)"
26612676
) in html
26622677

26632678

@@ -2669,8 +2684,8 @@ def test_select_all_applies_only_to_the_rendered_rows(html):
26692684
start = html.index("const selectedVisible =")
26702685
end = html.index("const modalCluster =", start)
26712686
block = html[start:end]
2672-
assert "visible.filter(c => checked.has(c.signature))" in block
2673-
assert "visible.map(c => c.signature)" in block
2687+
assert "shownRelearn.filter(c => checked.has(c.signature))" in block
2688+
assert "shownRelearn.map(c => c.signature)" in block
26742689
assert "d.clusters" not in block
26752690
# The filter that makes `visible` a strict subset is still in place. This
26762691
# previously pinned the `!appliedSigs.has(...)` form verbatim, which meant
@@ -2714,7 +2729,7 @@ def test_dismiss_checked_cannot_reach_an_unlisted_row(html):
27142729
start = html.index("const dismissChecked =")
27152730
end = html.index("const modalCluster =", start)
27162731
fn = html[start:end]
2717-
assert "visible.filter(c => checked.has(c.signature)).map(c => c.signature)" in fn
2732+
assert "shownRelearn.filter(c => checked.has(c.signature)).map(c => c.signature)" in fn
27182733
assert "...checked]" not in fn
27192734

27202735

tests/unit/test_past_overspend.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ def test_ui_renders_the_observed_figure_at_all(ui):
708708
# token class, wrote an honesty basis for it, shipped it on the payload,
709709
# and handed it to a dashboard that referenced it zero times.
710710
assert ui.count("past_overspend_usd") > 0
711-
assert "PastOverspendBand" in ui
711+
assert "PastOverspendTile" in ui
712712

713713

714714
def test_ui_never_derives_a_past_overspend_figure_client_side(ui):
@@ -721,11 +721,14 @@ def test_ui_never_derives_a_past_overspend_figure_client_side(ui):
721721
assert forbidden not in ui, f"UI derives its own figure: {forbidden}"
722722

723723

724-
def test_both_headline_surfaces_read_the_same_server_block(ui):
725-
# The Dashboard hero and the Review inbox headline render the SAME
726-
# component over the SAME payload key, so they cannot disagree on basis,
727-
# window, or number.
728-
assert ui.count("<${PastOverspendBand}") == 2
724+
def test_the_observed_figure_renders_from_the_server_block_only(ui):
725+
# 2026-07-26 founder call: the Dashboard hero band was removed and the
726+
# inbox band became a compact tile, so this figure now has exactly ONE
727+
# render site. The guarantee that survives is the one that mattered: it is
728+
# read from the server's `past_overspend` block, never reduced client-side,
729+
# so what renders cannot drift from what the endpoint computed.
730+
assert ui.count("<${PastOverspendTile}") == 1
731+
assert "PastOverspendBand" not in ui, "the removed band must not linger"
729732
assert "setCostPastOverspend(r.past_overspend || null)" in ui
730733
assert "setHeroPast((r && r.past_overspend) || null)" in ui
731734
# The hero fetches on its OWN effect rather than inside the Dashboard's
@@ -737,7 +740,7 @@ def test_both_headline_surfaces_read_the_same_server_block(ui):
737740

738741

739742
def test_ui_labels_are_past_tense_and_carry_no_recovery_vocabulary(ui):
740-
band = ui[ui.index("function PastOverspendBand"):]
743+
band = ui[ui.index("function PastOverspendTile"):]
741744
band = band[:band.index("\n}")]
742745
# The headline is the AVOIDABLE amount, and says so — it is no longer
743746
# labelled as everything the behaviour cost.
@@ -747,8 +750,12 @@ def test_ui_labels_are_past_tense_and_carry_no_recovery_vocabulary(ui):
747750
assert "could save" not in ui
748751
# No ratio framing ("recovering $X of a $Y problem") anywhere.
749752
assert "recovering $" not in ui
750-
# The cost line is present, past tense, and worded as COST — never waste.
751-
assert "cost ${fmtUsd(cost)} in total" in band
753+
# The cost line survived the band's removal: still present, still past
754+
# tense, still worded as COST rather than waste. It is terser and its long
755+
# form moved into the figure's hover text, but rule 30's disclosure is not
756+
# something a layout change is allowed to drop.
757+
assert "total cost" in band
758+
assert "that is cost, not waste" in band.lower()
752759
assert "That is cost, not waste" in band
753760
fn = ui[ui.index("function observedCostSentence"):]
754761
fn = fn[:fn.index("\n}")]

0 commit comments

Comments
 (0)