Repository navigation
ROCMAI-853: delete the dead instances card grid, the heatmap module and what only they used - #878
Conversation
The Instances Observe tab has drawn its per-instance table (`draw_table`) since the five-tab redesign; the older full-screen card grid (`draw`, `draw_card`, `draw_card_grid`, `compact_line`, the kv-cache heatmap block and its layout helpers, and the card `hit_test`) has had no production caller since then. Nothing outside tests reached it: `draw` was only imported by a test module in `instance_detail.rs`, `hit_test` is not wired in the mouse handling (which routes only the Rocm and Serving tabs), and `ui::heatmap` was used only by the grid's kv-cache block. Removes from `ui/tabs/instances.rs`: `draw`, `compute_heatmap_height`, `draw_card_grid`, `draw_kv_heatmap`, `label_width_for`, `build_kv_heatmap_rows`, `pick_cols`, `status_role`, `draw_card`, `compact_line`, `hit_test` and `point_in_rect`, with the tests that only exercised them. Removes the `ui/heatmap.rs` module (`Heatmap`, `HeatmapRow`, `truncate_to`) and its declaration. The tests that also cover live code stay: the empty-state test now renders through `draw_table`, which shares `draw_empty` with the old entry point, and the instance-detail VRAM test keeps its detail-modal half, since `draw_detail` renders the same used/total string. `draw_table`, `draw_empty`, `sorted_instances`, `clamp_sel`, `status_meta` and the shared test fixtures are unchanged. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
`pct_opt` and `reqs_opt` were only called by the deleted instance card, so nothing in production reads them any more; their only remaining users were their own unit tests. `pct` and `si`, which they wrapped, still have production callers and stay. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
… the deleted card used `BoxRole::from_tone` derived a card border from a status tone, and its only production caller was the instance card's `status_role`. With the card grid gone it has no caller (just its own two tests), and `BoxRole::Danger` was constructed only by `from_tone`, so it is never constructed either. Removes both, their tests, the `StatusTone` import in `panel.rs`, and the two places that describe them: the doc on `instance_status_tone` and the shared-components note in AGENTS.md. `instance_status_tone` and `Theme::instance_status_color` are unchanged and still drive the status text color. This is a separate commit from the card-grid deletion so it can be dropped on its own if a bordered status card is wanted again; `from_tone` was added shortly before the grid was found to be dead. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
What changed in this PR
Removes unreachable Instances Observe card-grid UI (and its heatmap) and cleans up now-orphaned UI helpers/APIs, leaving the production table-based Observe view and instance detail modal intact.
Changes:
- Deleted the old Instances card grid renderer, hit-testing, and the
ui::heatmapwidget module along with their dedicated tests. - Removed format helpers (
pct_opt,reqs_opt) that were only used by the deleted card grid. - Removed
BoxRole::from_toneandBoxRole::Dangernow orphaned by the UI deletions, and updated docs accordingly.
| File | Description |
|---|---|
| crates/rocm-dash-tui/src/ui/theme.rs | Updates tone documentation to remove references to deleted border-mapping API. |
| crates/rocm-dash-tui/src/ui/tabs/instances.rs | Removes dead card-grid/heatmap paths and associated tests; table renderer remains. |
| crates/rocm-dash-tui/src/ui/panel.rs | Removes BoxRole::Danger and BoxRole::from_tone, plus their tests. |
| crates/rocm-dash-tui/src/ui/mod.rs | Removes pub mod heatmap; export after deleting the module. |
| crates/rocm-dash-tui/src/ui/instance_detail.rs | Removes test-only usage of deleted instances::draw entry point. |
| crates/rocm-dash-tui/src/ui/heatmap.rs | Deletes the heatmap widget implementation and its tests. |
| crates/rocm-dash-tui/src/ui/format.rs | Removes pct_opt / reqs_opt public helpers and their tests. |
| AGENTS.md | Updates guidance to remove references to BoxRole::from_tone. |
Review effort: Lite
| pub mod format; | ||
| pub mod gradient; | ||
| mod header; | ||
| pub mod heatmap; | ||
| mod help_modal; | ||
| pub mod install_manager; | ||
| mod instance_detail; |
There was a problem hiding this comment.
Checked: the workspace sets publish = false for every first-party crate ("an application, not crates.io libraries" in the root Cargo.toml), and the only users of crate::ui::heatmap on main are the card-grid functions in ui/tabs/instances.rs that this PR deletes. rocm-dash-tui is used only as a dependency of the in-tree rocm binary, so there is no downstream consumer whose import could break, and no compatibility shim is kept.
nowycondro
left a comment
There was a problem hiding this comment.
🤖 Automated review (Claude Code) · 1dd71eb
This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.
Review — no blocking findings
Full review of the whole change (3 commits, 8 files, +11/-1038 lines), diffed against the true merge-base db7e5408 (the PR's reported base.sha, a7f84e8a, is main's current tip and is not an ancestor of the head commit — see note below; the file set and diffstat I reviewed match the PR's own description exactly, so this did not change what was reviewed).
Implements ROCMAI-853 in full ("Phase 8.1-H step 7, PR 7 of 7"). The ticket's own decision log ("Decision, 2026-11-04: delete, do not rewire") matches this PR's description and code precisely, down to the same list of 12 dead functions in instances.rs, the same orphaned ui/heatmap.rs and BoxRole::Danger, and the same explicit carve-outs (skills.rs, #842's items). No mismatch between the ticket and the change.
Blocking
None
Non-blocking
- Stale doc comment still describes deleted "card" code —
crates/rocm-dash-tui/src/ui/instance_detail.rs:9
The module doc reads: "...which stay single-sourced beside the table and card code that also use them". The card code (draw_card,draw_card_grid,status_role, etc.) is exactly what this PR deletes frominstances.rs, and this PR already edits this same doc-comment-adjacent file (dropping theuse …instances::draw;test import) and updates the analogous sentences intheme.rs,instances.rs's own module doc, andAGENTS.md— but missed this one instance in a file it was already touching for the same reason.
Confidence 85 · mechanical · Fix: drop "and card" so it reads "...beside the table code that also use them."
Decisions for the author
- Manual dead-code audits vs. a structural guard — non-blocking-improvement
The PR's own description notes this code stayed alive for as long as it did becauseuiis apubmodule on a library crate, so no compiler/lint ever flagged it as dead; the audit that caught it was a manual, one-offpub(crate)scratch-narrowing.ui/launcher.rsneeds thepubforapps/rocm, so blanket-narrowing isn't available, but a periodic/scheduled CI job that does the samepub(crate)+cargo checknarrowing this PR did by hand would catch the next round of this class of drift automatically instead of waiting for another manual audit ticket.
Positive signals
- Impact analysis (this review's own repo-wide grep sweep, independently run across every removed symbol —
draw,hit_test,compute_heatmap_height,draw_card_grid,draw_kv_heatmap,label_width_for,build_kv_heatmap_rows,pick_cols,status_role,draw_card,compact_line,point_in_rect,Heatmap,HeatmapRow,pct_opt,reqs_opt,BoxRole::Danger,BoxRole::from_tone) found zero remaining references anywhere in the workspace, includingapps/rocm, the dash-TUI examples, and the e2e-cucumber test driver — confirming the PR's own "nothing else reaches this" claim rather than just trusting it. - The three commits are genuinely independently droppable as claimed: commit 3 (
BoxRole::from_tone/Danger) depends only on commit 1 having already removedstatus_role, and nothing depends on commit 3 in the other direction. sorted_instances's andinstance_status_tone's doc comments were correctly updated to drop their grid/from_tonereferences, and no stray "heatmap"/"card grid" text was left indocs/architecture.mdor anywhere else indocs/.
Deployment notes
None — no user-visible behavior change (confirmed: draw_table/draw_detail and their tests are untouched), no schema/config/migration involved.
What this covered
Fanned out to two independent background workers: one for the code-correctness + impact-analysis pass (all 8 touched files read in full at head 1dd71eb8, plus surrounding callers — app/scrollbar.rs's mouse dispatch, gradient.rs, theme.rs's StatusTone — and an exhaustive repo-wide grep sweep for every removed symbol), and one for the four source-reading passes (agent-instruction adherence against root AGENTS.md, git history/blame on the touched regions back to their origin, a search of all 116 local branches and PR #62/#850 for prior review comments on this same code, and a full re-read of every comment/doc-comment in the touched files). Both ran blind (no PR description, no discussion) and reported back independently; I verified the one surviving finding directly against the file myself before scoring it. CI was read, not re-derived: all functional checks (build-and-test, clippy, Test (affected crates), Coverage (rocm-dash crates, ratcheted), Windows build/lint, E2E consolidated report) show success on this exact head commit; the hardware-specific E2E matrix jobs show skipped, expected since this PR's head lives on a fork (jussielo-amd/rocm-cli) without access to self-hosted runners. Neither worker had a local Rust toolchain, so cargo test/clippy were read from CI rather than re-run locally — noted as a gap, not assumed.
Ticket ROCMAI-853 retrieved directly via its key (not via a link in the description) and read in full; see the intent line above for the reconciliation.
Not reconciled against this PR's existing review thread (the Copilot bot's single "medium severity" note about pub mod heatmap; being a public-API removal) — that comment was visible to me only incidentally during the required duplicate-review claim-check, was never passed to either blind worker, and this review's own independent impact-analysis (above) already covers the same ground and found no actual external caller of the removed heatmap module.
🤖 Generated with Claude Code
juhovainio
left a comment
There was a problem hiding this comment.
Deletion looks clean. No live references to the removed symbols remain at the head; the helpers the card shared (lerp3_t, mib_pair, gen_tps_compact, tokens_per_watt_cell, draw_empty, clamp_sel) still have callers; the removed tests covered only deleted code, and the empty-state test now runs through draw_table. Docs have no leftover references, the dash coverage-floor job is green, and the scope matches the ticket.
One non-blocking nit in a file this PR doesn't touch: crates/rocm-dash-daemon/src/demo.rs:189 still says "heatmap and per-GPU sparklines", which refers to the heatmap deleted here. Worth rewording in this PR or a follow-up.
…rd grid Comment-only. The demo generator's phase offset, the board-power threshold note, the instance cursor doc, the instance detail module doc, the launch-args doc and the gen_tps_compact doc named the instances card grid or the heatmap module that the earlier commits delete. Each now describes what the dashboard draws today: the Observe table, the per-GPU utilization sparklines, and the temperature and power colors. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
|
Thanks for the approval and the note about I also grepped for the same kind of leftover and fixed the five others I found: the "heatmap/gauge colors" comment in |

Why
The Instances Observe tab has drawn its per-instance table (
draw_table) since the five-tab redesign replaced the older full-screen card grid, but the grid and everything behind it stayed in the crate. Nothing in production reaches it:instances::drawwas referenced only by a#[cfg(test)]import inui/instance_detail.rs,observe.rscalls onlydraw_table, the grid'shit_testis not wired into the mouse handling (which routes only the Rocm and Serving tabs), andui::heatmapwas used only by the grid's kv-cache block. No lint fires becauseuiis apubmodule of a library crate, so the roughly 17 tests that exercised the grid were the only thing keeping it alive. This is part of the follow-up work from the modularization audit. Completes ROCMAI-853.What changes
Four commits, each reviewable or droppable on its own; the fourth is comment-only.
The first deletes the card grid and the heatmap. From
ui/tabs/instances.rsit removesdraw,compute_heatmap_height,draw_card_grid,draw_kv_heatmap,label_width_for,build_kv_heatmap_rows,pick_cols,status_role,draw_card,compact_line,hit_testandpoint_in_rect, and updates the module doc and thesorted_instancesdoc to describe a table rather than a grid. It deletes theui/heatmap.rsmodule (Heatmap,HeatmapRow,truncate_to) and its declaration inui/mod.rs. Tests that only exercised the deleted code go with it: 13 ininstances.rsand the 9 inheatmap.rs. Two tests also cover live code and were kept. The empty-state test (draw_empty_names_the_platform_reason_for_the_in_process_collector) now renders throughdraw_table, which sharesdraw_emptywith the old entry point, and the instance-detail VRAM test keeps its detail-modal half, sincedraw_detailrenders the same used/total string as the grid did.draw_table,draw_empty,sorted_instances,clamp_sel,status_metaand the fixtures other tests import are unchanged, andgen_tps_compactandmib_pair, which the card also used, still have other callers.The second removes
pct_optandreqs_optfromui/format.rswith their two tests: the card was their only production caller.pctandsi, which they wrapped, are still used and stay.The third removes
BoxRole::from_toneandBoxRole::Danger, which the deletion newly orphans.from_tone(added recently when instance and service status colors were unified) was called only by the card'sstatus_role, andDangerwas constructed only byfrom_tone. It also removes their two tests, the now-unusedStatusToneimport inpanel.rs, the sentence in theinstance_status_tonedoc that namedfrom_tone, and the sentence in the shared-components list inAGENTS.mdthat described it as the way to derive a card border from a tone.instance_status_toneandTheme::instance_status_colorare unchanged and still drive status text color. I kept this separate becausefrom_toneis new and documents a convention inAGENTS.md: if a bordered status card is wanted again, drop this one commit and the rest of the PR still stands.The fourth is a comment-only follow-up from review: it rewrites the doc comments that still named the deleted card grid or heatmap, in
rocm-dash-daemon/src/demo.rs(the phase offset now says it staggers the Observe table curves and the per-GPU utilization sparklines, and the launch-args note names the detail modal),ui/widgets.rs(the power-threshold note now speaks of temperature and power colors, which is whattemperature_styleandpower_styleuse them for),app/mod.rs(instance_selis a cursor into the table),ui/instance_detail.rsandui/format.rs. No code line changes in that commit.Verification
Run locally on the final branch:
cargo fmt --all --check(clean);cargo clippy -p rocm-dash-tui --all-targets -- -D warnings(clean, run once after the card-grid and formatter deletions and again after the third commit; after the fourth it was run forrocm-dash-daemonandrocm-dash-tuitogether, also clean);cargo test -p rocm-dash-tui(975 passed, 0 failed, 4 ignored, plus the crate's integration tests);cargo xtask manifest --checkandcargo xtask check-crate-edges(both pass); and the repository's pre-commit hooks on all four commits (fmt, license headers, markdown links, commit signing, sign-off). A leak scan of the diff against the merge base and a conflict-marker grep are clean, and a merge dry-run against the currentmainreports no conflicts.The dead-code check from the audit was re-run on the final tree: with
pub mod uinarrowed topub(crate)in a scratch edit (since reverted),cargo check -p rocm-dash-tui --libreports nothing ininstances.rs,format.rsor the removed heatmap module. Before the third commit it flagged exactly the two items that commit removes,BoxRole::from_toneandBoxRole::Danger, so nothing else was orphaned. It still flags items that are not part of this change: theskills.rssubsystem (its own ticket),dock::triptych,chat::transcript_linesandhardware::gpu_visible_countwithROWS_ABOVE_GPUS(all removed by #842), theui/launcher.rsitems (used byapps/rocm, so not dead), and some re-export imports inui/modal.rs, which I left alone.Not run
The full workspace tests,
smoke_local, the e2e-cucumber suite and the Windows lane were not run; CI carries them. The coverage floor was not checked.cargo xtask coveragemeasures the whole workspace under instrumentation, which is far outside what I could run here, and a single-crate run would not be comparable to the committed floor. This change removes about 1,000 lines of well-covered code and 26 tests from a crate whose floor is 89.33% with a 0.2-point tolerance, so the floor may drop below tolerance. If the coverage job reports that, the right follow-up iscargo xtask coverage --blesswith that justification in its commit, not weakening or restoring a test. I did not re-bless anything.Overlaps and scope
#812 edits
ui/tabs/instances.rsandui/format.rs, so whichever of the two lands second will need a rebase. The other dead dash-TUI helpers from the same audit (dock::triptych,chat::transcript_lines,hardware::gpu_visible_countandROWS_ABOVE_GPUS) are in #842, not here. No other open PR touchesheatmap.rs.There is no user-visible behavior change and no scenario is needed: the code removed is unreachable from the dashboard, and the live Observe table and detail modal keep their existing unit tests unchanged.