Skip to content

feat(hud): rate limit format with severity icons (Wave 1-C) #1470

Description

@JeremyDev87

Problem

Current rate limit badge RL:5h:13%,7d:96% is cramped and non-intuitive:

  • Colon-heavy syntax (3 colons)
  • Comma as separator is easy to miss
  • 96% (critical) looks the same visually as 13% (safe)

Fix (Wave 1-C)

Severity-icon rendering with space separator:

  • RL:5h░13% 7d▓96%
  • light (U+2591): pct ≤ 60 (healthy)
  • medium (U+2592): 60 < pct ≤ 85 (warning)
  • dark (U+2593): pct > 85 (critical)
  • Space replaces comma
  • RL: prefix preserved for downstream anchors

Defensive coercion

New _coerce_percentage() helper: None/non-numeric strings default to 0.0 instead of crashing via TypeError (addresses Wave 1-A security reviewer's low finding).

Tests

19 new + 3 updated in test_hud_rate_limits.py:

  • All 3 severity buckets
  • Boundary checks (60, 85, 85.01)
  • Both-tier rendering with mixed severity
  • None / non-numeric / empty tier defensive coercion
  • Space-separator assertion (no comma)
  • Re-export identity lock
  • Internal _severity_icon helper exposure test

3 test_hud.py tests updated to new format.

162/162 tests pass.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions