Skip to content

fix(dataviz): honour start_at, the layout box, and degenerate scales - #148

Closed
LeadcodeDev wants to merge 1 commit into
fix/audit-lot5-htmlfrom
fix/audit-lot6-dataviz
Closed

fix(dataviz): honour start_at, the layout box, and degenerate scales#148
LeadcodeDev wants to merge 1 commit into
fix/audit-lot5-htmlfrom
fix/audit-lot6-dataviz

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Refs #142 — Dataviz workstream. Eight confirmed findings, plus the same defects in files the workstream did not own.

Stacked on #147 (itself on #146) to keep each diff readable — this one contains only the rustmotion-components changes. Rebase to chantier/audit-remediation as the stack lands.

The findings

Reveal ignored start_at. chart, heatmap, sparkline and treemap drove their animation off raw scene time, so a component with start_at: 2.0 was already fully drawn the moment it appeared. Now measured from start_at, matching Counter::ramp_progress.

progress ignored its layout box. It painted at the declared width/height rather than what taffy computed, so a bar inside a sized container overflowed or under-filled — measured 299px of ink in an 800px box, and a ring centred at (149.5, 9.5) in a 60×60 box.

stacked_bar had no signed extent. Negative totals rendered outside the box: ink at y=[292..599] in a 300px-tall box. Stacks now grow either side of an anchored zero, like bar already did.

heatmap renormalised min→max. A uniform grid of 5.0 painted identically to a grid of 0.0, and color_scale did not mean the absolute 0..1 scale the docs describe. Renormalisation removed.

A flat sparkline glued itself to the bottom edge. Dividing by a floored range normalises every point to 0, which reads as "collapsed to zero" rather than "unchanged". Flat series now centre.

Axis labels drifted. Collected with filter_map, so one datum without a label shifted every subsequent label onto the wrong bar — AAA centred at 104 above a bar centred at 58.5.

treemap overprinted. Label and value shared one baseline. Fragments now stack.

Same bug, other files — fixed here rather than deferred

The workstream owned seven files; three of these defects live in files it did not. Fixing only the owned copies would have left an identical bug behind a green test suite, so they were applied at integration:

File Defect
gauge.rs, dot_map.rs progress_at ignoring start_at
chart/line.rs (×2), chart/waterfall.rs filter_map label drift
stat.rs flat-series divisor, in its inlined sparkline

Two things found beyond the brief

interpolate_color resolved t = 1.0 to the second-to-last colour: the local fraction was recomputed from the clamped segment index. Same function, same component, and the adversarial verifier had already produced the evidence — fixed alongside.

A defensive .max(0.0) on the circular-progress radius: it became reachable only once the ring started honouring its real layout box, which can now be arbitrarily small where the declared defaults never were.

Structural note, not addressed here

progress_at now exists in seven near-identical copies (Counter, Chart, Heatmap, Sparkline, Treemap, Gauge, DotMap), and the flat-series scale in three. The rule of three is well past — a crate-level ramp_progress(start_at, duration, time) would stop the next component reintroducing the same defect. Deliberately not done in this PR: it is a refactor across eight files and would bury sixteen bug fixes under it. Filed as follow-up work on #142.

Verification

cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace — 752 passed, 0 failed, re-run by the orchestrator on the integrated tree. Every fix written red first; the failure output for each is recorded in the workstream report.

Eight confirmed findings across the data components, plus the same defects
found by the audit in files the workstream did not own.

Five components drove their reveal off raw scene time, so a chart with
`start_at: 2.0` was already fully drawn when it appeared. They now measure
elapsed time from `start_at`, matching `Counter::ramp_progress`. The same
bug in `gauge` and `dot_map` is fixed here rather than left for a later
pass — it is one defect in seven copies.

`progress` painted at its declared `width`/`height` instead of the box
taffy computed, so a bar inside a sized container ignored its own layout.
It now paints at `layout.width`/`layout.height`.

`stacked_bar` had no signed extent: negative totals rendered outside the
box. Stacks now grow either side of an anchored zero.

`heatmap` renormalised its data min→max, so a uniform grid of 5.0 painted
identically to a grid of 0.0 and `color_scale` did not mean what the docs
say. The scale is now the documented absolute 0..1. A neighbouring bug in
`interpolate_color` went with it: `t = 1.0` resolved to the second-to-last
colour because the local fraction was recomputed from the clamped segment.

A flat sparkline series divided by a floored range, normalising every point
to 0 and gluing the line to the bottom edge — it read as "collapsed to
zero" rather than "unchanged". Flat series now centre. Fixed in `sparkline`
and in the `stat` card that reimplements the same maths.

Axis labels were collected with `filter_map`, so one datum without a label
shifted every subsequent label onto the wrong bar. Labels now keep one slot
per datum. Fixed in `bar`, and in `line` and `waterfall` which carry the
identical bug.

`treemap` drew its label and value on a single baseline, so the value
overprinted the label. Fragments now stack.
@LeadcodeDev LeadcodeDev added the bug Something isn't working label Aug 8, 2026
@LeadcodeDev LeadcodeDev self-assigned this Aug 8, 2026
@LeadcodeDev

Copy link
Copy Markdown
Owner Author

Recreated against chantier/audit-remediation directly: merging #146 with --delete-branch removed the base branch of the stack and closed the dependent PRs. Superseded — see the replacement PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant