Skip to content

refactor(fleet): consolidate palette + is_live, drop renderer-polish#166

Merged
NagyVikt merged 1 commit into
mainfrom
refactor/palette-and-is-live-consolidation
May 16, 2026
Merged

refactor(fleet): consolidate palette + is_live, drop renderer-polish#166
NagyVikt merged 1 commit into
mainfrom
refactor/palette-and-is-live-consolidation

Conversation

@NagyVikt
Copy link
Copy Markdown
Contributor

Summary

Operator review flagged three drift sources where per-binary code disagreed with the canonical fleet-ui / fleet-data layer. Compound PR because all three patches touch the same per-binary ios_page_design.rs files.

  • (a) Palette migrationfleet-watcher and fleet-waves were declaring their own iOS-named accent constants. Migrated them to fleet_ui::palette::* and locked the canonical hexes with hex-parity tests.
  • (b) Renderer-polish deletionrust/fleet-renderer-polish/ was library-only, unadopted, and a third copy of those same colors (drift source). Deleted entirely.
  • (c) is_live unification — Added WorkerRow::is_capped() to fleet-data so dashboards can't disagree with the data layer on the "capped" tally.

Drift resolution table

The two per-binary modules used iOS Light-mode system colors; the dashboards render on a dark TUI surface so the palette's iOS Dark-mode variants are correct. Palette wins every contest.

Binary Old constant (hex) Canonical from palette::* (hex) Source
fleet-watcher IOS_BLUE #007aff IOS_TINT #0a84ff Apple .systemBlue (Dark)
fleet-watcher IOS_GREEN #34c759 IOS_GREEN #30d158 Apple .systemGreen (Dark)
fleet-watcher IOS_RED #ff3b30 IOS_DESTRUCTIVE #ff453a Apple .systemRed (Dark)
fleet-watcher IOS_ORANGE #ff9500 IOS_ORANGE #ff9f0a Apple .systemOrange (Dark)
fleet-waves ACCENT #007aff IOS_TINT #0a84ff Apple .systemBlue (Dark)
fleet-waves SUCCESS #34c759 IOS_GREEN #30d158 Apple .systemGreen (Dark)
fleet-waves DANGER #ff3b30 IOS_DESTRUCTIVE #ff453a Apple .systemRed (Dark)
fleet-waves WARNING #ff9500 IOS_ORANGE #ff9f0a Apple .systemOrange (Dark)

Each binary keeps its local surface tones (BG, SURFACE, *_SOFT, etc.) because the mock pages intentionally use a deeper-than-IOS_BG_SOLID ramp to read as distinct visual contexts; only the iOS-named accent palette was drifting.

is_capped contract

/// `true` when this row counts toward the "capped" tally on dashboards.
/// Two independent signals can flip a row to capped:
///   1. agent-auth list reports 5h >= 100%
///   2. The pane scrollback classifier returned PaneState::Capped
pub fn is_capped(&self) -> bool {
    self.five_h_pct >= 100 || matches!(self.state, Some(PaneState::Capped))
}

Migrated fleet-state::Summary::from_rows to call row.is_capped() instead of recomputing inline. is_live already lived on WorkerRow; this just adds the partner predicate so dashboards can't disagree.

Files deleted

  • rust/fleet-renderer-polish/Cargo.toml
  • rust/fleet-renderer-polish/src/lib.rs

The workspace fleet-* glob in rust/Cargo.toml drops it automatically — no manifest edit needed. Verified no other workspace crate referenced fleet-renderer-polish / fleet_renderer_polish before deletion.

Per-binary line-count delta

Modest because most lines came from local surface tones (kept) and the new code is mostly hex-parity tests + the is_capped docstring:

 rust/fleet-data/src/fleet.rs              | 17 ++++++++++           (+17)
 rust/fleet-state/src/ios_page_design.rs   |  5 +--                  (+2 / -3)
 rust/fleet-ui/src/palette.rs              | 53 +++++++++++++++++++  (+53)
 rust/fleet-watcher/src/ios_page_design.rs | 14 +++++---             (+10 / -4)
 rust/fleet-waves/src/ios_page_design.rs   | 11 ++++---              (+7 / -4)

Plus -155 from fleet-renderer-polish removal.

Test plan

  • cargo check --workspace clean
  • cargo test -p fleet-ui --lib — 39 tests pass, palette hex-parity guard (extended) green
  • cargo test --workspace --exclude fleet-ui — all green; fleet-state, fleet-waves, fleet-watcher snapshot tests pass unchanged (TestBackend output is text-only so accent migration does not perturb fixtures)
  • Operator eyeball — the watcher and waves mock pages will now render with #0a84ff / #30d158 / #ff453a / #ff9f0a instead of #007aff / #34c759 / #ff3b30 / #ff9500. Visually this is a slight shift toward the brighter Dark-mode iOS palette already used by fleet-state and the rest of the dashboard. Worth confirming on the live boards.

Notes

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.
@NagyVikt NagyVikt merged commit d80cb92 into main May 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant