refactor(fleet-ui): split tab_strip into mod/layout/render and extract render_pill#156
Merged
Merged
Conversation
…helper Splits the 439-line tab_strip.rs into a tab_strip/ module folder so the single pill loop can call a dedicated render_pill helper instead of inlining 30+ lines of span construction and hit-test bookkeeping per iteration. Public API (TabStrip, Tab, TabHit, COUNTERS_PATH) is unchanged, all 6 existing tests still pass, and rendering output is identical. - tab_strip/mod.rs: public types + render orchestrator - tab_strip/layout.rs: CounterSnapshot, build_pills, natural width, format_clock, format_pill_label, render_counter - tab_strip/render.rs: paint_background, paint_logo_chip, paint_live_chip, render_pill
4 tasks
NagyVikt
added a commit
that referenced
this pull request
May 16, 2026
…166) Operator review flagged three drift sources where per-binary code disagreed with the canonical fleet-ui/data layer. This compound PR unifies all three on the shared crates and deletes a stranded library. (a) Palette migration - Per-binary `ios_page_design.rs` modules in fleet-watcher and fleet-waves declared their own `IOS_BLUE/GREEN/RED/ORANGE` (watcher) and `ACCENT/SUCCESS/DANGER/WARNING` (waves) constants using iOS *Light* system values (#007aff, #34c759, #ff3b30, #ff9500). - These dashboards render on a dark TUI surface, so iOS Dark variants are correct. `fleet-ui::palette` already exposed the canonical Dark-mode constants (#0a84ff, #30d158, #ff453a, #ff9f0a). Each binary now `use`s the palette names and aliases them in-place. - Local surface tones (BG / SURFACE / TEXT / *_SOFT) stay in each binary because the mock pages intentionally use a deeper dark surface than the production board. - Extended the `palette_hex_parity` test to lock in every constant the per-binary modules now import via `palette::*` so future drift fails the test rather than the dashboard. (b) Renderer-polish deletion - `rust/fleet-renderer-polish/` was library-only, unadopted, and declared a third copy of the same iOS-named colors (drift source). - `git rm -r`d the whole crate; no workspace crate depended on it (verified via grep). The `fleet-*` glob in workspace `Cargo.toml` drops it automatically. (c) is_live / is_capped unification - `WorkerRow::is_live` was already on the data layer, but `fleet-state/src/ios_page_design.rs::Summary::from_rows` recomputed "capped" inline as `row.five_h_pct >= 100 || matches!(row.state, Some(PaneState::Capped))`. Any other dashboard that wanted the same tally would have re-derived this rule. - Lifted that predicate to `WorkerRow::is_capped(&self) -> bool` with a docstring spelling out the two-signal contract (cap-pool % crossing the line OR pane classifier returning Capped). Migrated fleet-state's Summary to call `row.is_capped()`. Verification - `cargo check --workspace` clean. - `cargo test --workspace --exclude fleet-ui` all green; `cargo test -p fleet-ui --lib` all green (palette hex-parity guard included). - fleet-ui has a pre-existing test-only compile error in `tests/tab_strip_snapshot.rs` referencing the removed `fleet_ui::tab_strip` module (from PR #156's mod-folder split) — untouched by this PR. - TestBackend snapshot output is text-only, so accent-color migration does not affect any snapshot fixture. Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fleet-ui/src/tab_strip.rs(439 lines) into a module folder:tab_strip/mod.rs(251 lines) —Tab,TabHit,TabStripstruct, public API, teststab_strip/layout.rs(119 lines) —PillSpec, counter snapshot, format helpers, pill geometrytab_strip/render.rs(103 lines) — background/logo/live-chip painters + extractedrender_pillrender_pill(frame, x, y, PillSpec) -> TabHitfrom the inlined pill looprender()shrinks from ~135 lines to ~50 lines of orchestrationBehavior
Public API of
TabStrip,Tab,TabHit,COUNTERS_PATHunchanged. Rendering identical.Test plan
cargo check --workspace— clean (only pre-existing warnings remain)cargo build -p fleet-ui— cleancargo test -p fleet-ui --lib tab_strip— 6/6 pass🤖 Generated with Claude Code