Skip to content

Analytics command bar: replace hero-metric, lead with bypassed techniques + weakest hosts#341

Open
ubercylon8 wants to merge 15 commits into
mainfrom
feat/analytics-command-center
Open

Analytics command bar: replace hero-metric, lead with bypassed techniques + weakest hosts#341
ubercylon8 wants to merge 15 commits into
mainfrom
feat/analytics-command-center

Conversation

@ubercylon8

@ubercylon8 ubercylon8 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Why

The Analytics dashboard opened with a 100px 52.0% — the banned hero-metric the design system explicitly rejects. It spent the most valuable screen space on one aggregate number while the operator's real question — which techniques bypassed, on which hosts — sat three scrolls down. This PR replaces that with a compact status command bar and leads with the two panels an operator acts on. It's the flagship of the command-center redesign, built to the approved mockup.

Third workstream in the redesign; builds on the tokens from #339.

What changed

New reusable primitive

  • BulletBar (components/shared/ui/BulletBar.tsx) — a value-vs-target meter (role="meter"), band-colored (≥80 protected / 50–79 warning / <50 bypassed) with a target marker. Exports a shared scoreBandTone(value) + TONE_TOKEN so the band thresholds live in exactly one place.

Pure derivations (pages/analytics/utils/analyticsDerivations.ts, fully unit-tested)

  • topBypassedTechniques, weakestHosts, totalBypassedCount, scoreDelta — all derived from data the page already fetches (no new API calls, no backend change). They sort copies, never the live React-state arrays.

Status command bar (StatusCommandBar.tsx, replaces HeroMetricsCard)

  • A compact horizontal band (value capped at text-3xl, not text-7xl): Defense Score with an inline sparkline, a 7-day delta chip (the only valence color in the cell), a bullet bar vs the 80% target, and the preserved sub-stats (actual, EDR-only, inconclusive — all neutral). Plus Secure Score (when Defender is configured), Fleet (endpoints/tests), and a "Needs attention" cell (N bypassed / unprotected runs).

Two promoted panels

  • TopBypassedTechniques — sorted worst-first, the single worst row at full --chart-bypassed, others dimmed.
  • WeakestHosts — bullet bars vs the 80% target, <50% red / 50–79% amber, with a legend.

HeroMetricsCard (+ its test) deleted.

Dashboard recomposition (not just additive)

  • Removed the two charts the new panels supersede: ATT&CK Technique Distribution (same techniqueDistData as Top Bypassed) and Defense Score by Host (same defenseScoreByHost as Weakest Hosts) — the dashboard no longer shows the same data twice. DefenseScoreByHostChart deleted.
  • Re-ordered into a deliberate top-to-bottom flow: command bar → [Top Bypassed | Weakest Hosts] → [Trend | Score by Category] → (Defender: Secure Score | Remediation Controls) → [Results by Error Type | Test Coverage] → Test Activity → Test Breadth treemap.
  • Dropped a redundant getTechniqueOverlap fetch from the dashboard load (the Defender tab's TechniqueOverlapChart fetches it independently).

Test evidence

  • cd frontend && npm test418/418 passing, 42 files.
  • Chart-color drift guard → green, now covering the 3 new panels and BulletBar.
  • npx tsc -b + npm run build → clean. Every commit through the pre-commit hook; no --no-verify.
  • Visual-verified in a live dev instance against the mockup: compact command bar, one valence color per cell, worst-first sorting, bullet bars on the 80% marker. Screenshot-matched the approved design.

Design discipline notes (from review)

  • One valence color at a time. The delta chip is the only non-neutral color in the Defense cell; the loud red is reserved for the bypassed count and the worst bypassed technique.
  • WCAG, fixed during review. WeakestHosts originally colored its small score numbers by band — the amber failed AA on the light-theme card (~2.6:1). The score text is now neutral; the band lives in the bullet bar + legend. The big red "N bypassed" stays red because it's large text (3:1 threshold), where --chart-bypassed passes.

Known follow-ups (non-blocking)

  • The "actual · target" sub-line now always shows (previously suppressed when there were no exclusions) — a deliberate mockup choice.
  • StatusCommandBar re-implements a small x.toFixed(1)% formatter inline for a few sub-stats; could share one helper.

Design context

Before/after mockup of all three dashboards: https://claude.ai/code/artifact/10ac4d51-df1f-43d6-a603-931d900e6ffe
Remaining workstreams (separate PRs): Tests ATT&CK coverage matrix; Endpoints fleet-status bar (consumes TaskStatusBadge from #340 + this PR's BulletBar/StatusCommandBar patterns).

🤖 Generated with Claude Code

https://claude.ai/code/session_01QdfJwx8RKSiJ29FNfGQMSf

ubercylon8 and others added 10 commits July 6, 2026 10:06
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QdfJwx8RKSiJ29FNfGQMSf
Extract scoreBandTone() from BulletBar as a shared helper (>=80
protected, >=50 warning, else bypassed) and have WeakestHosts derive
its score-text color through it instead of duplicating the thresholds
a third time.

Add StatusCommandBar: a compact horizontal band (Card, aria-busy when
loading) that replaces HeroMetricsCard's giant text-7xl hero number
with a text-3xl max value, a delta chip, a BulletBar vs the 80%
target, an optional Sparkline, and Fleet / Needs-attention / Secure
Score cells. Preserves HeroMetricsCard's exact sub-stat wording
(actual X% (N excluded), EDR-only X%, X% inconclusive) and null ->
em-dash handling. HeroMetricsCard itself is left in place; wiring the
new bar into AnalyticsDashboardPage and removing the old card is
Task 6.
…share TONE_TOKEN

The "X% inconclusive" sub-line in StatusCommandBar was styled with
var(--chart-warn) (amber), introducing a third color into the Defense
cell. The redesign rule reserves the delta chip as the only valence
color there, with bypassed-red the single saturated signal. Make the
line neutral (text-muted-foreground) like its actual/EDR-only siblings;
"inconclusive" carries the meaning. Add a regression test asserting the
line is not rendered with var(--chart-warn).

Also dedup TONE_TOKEN: it had become an identical copy in both
BulletBar and WeakestHosts. Promote it to an export from BulletBar
(alongside scoreBandTone, the shared threshold source of truth) and
import it in WeakestHosts.
… bar

The "Needs attention" cell showed a bare bypassed count (e.g. "4,484
bypassed") with no unit, reading like a count of discrete techniques
and clashing with the other cells that pair a number with a unit
("22 endpoints", "168 tests"). bypassedCount is the sum of UNPROTECTED
test executions, so add a muted caption line — "unprotected runs" —
under the value, matching the Fleet cell's caption styling. When a
bypassedTacticCount is provided the existing "{n} tactics" caption
still takes precedence. Number and color are unchanged.
@ubercylon8
ubercylon8 requested a review from a team July 6, 2026 15:13
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Jul 6, 2026 4:30pm
projectachilles-io Ready Ready Preview, Comment Jul 6, 2026 4:30pm
wiki Ready Ready Preview, Comment Jul 6, 2026 4:30pm

…d-center

# Conflicts:
#	frontend/src/pages/analytics/components/HeroMetricsCard.tsx
#	frontend/src/pages/analytics/components/__tests__/HeroMetricsCard.test.tsx
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Semgrep SAST Results

No security findings. All 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