Skip to content

fix(dashboard): make provider card warning indicators expose the interaction they advertise - #10448

Open
diegosouzapw wants to merge 2 commits into
release/v3.8.50from
fix/10261-provider-warning-badges
Open

fix(dashboard): make provider card warning indicators expose the interaction they advertise#10448
diegosouzapw wants to merge 2 commits into
release/v3.8.50from
fix/10261-provider-warning-badges

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Closes #10261

Root cause

src/app/(dashboard)/dashboard/providers/components/ProviderCard.tsx rendered two warning indicators that advertised interaction they did not implement:

  1. Usage-risk indicator (subscriptionRisk) — a plain <span title="… click for details"> with no onClick, no role, and no dialog. Clicking it did nothing.
  2. Connection warning-count badge — a static Badge with no title (no reasons exposed) and no click affordance, even though the reasons (failures, lastFailure, totalRequests) already exist per-connection in providerSpecificData.apiKeyHealth[] and are shown in EditConnectionModal.tsx.

Fix

  • The usage-risk indicator is now a real <button role... aria-haspopup="dialog"> that opens an accessible Modal (reuses the existing riskNotice copy, keyed by riskNoticeVariant).
  • The warning-count badge is wrapped in a keyboard- and pointer-interactive control (role="button", tabIndex=0, Enter/Space activation) exposing a sanitized reasons summary (max failure count + relative last-failure time — never raw upstream error text, Hard Rule fix(ui): fix Select dropdown dark theme inconsistency #12) via title/aria-label, and navigates to the provider detail/health view on activation.
  • The two indicators are now visually distinct: the risk indicator keeps the bare material-symbols-outlined glyph; the warning badge is the pill-shaped Badge component.
  • Both new interactive elements call preventDefault()/stopPropagation() so they don't trigger the card's wrapping <Link> navigation (existing pattern from handleTestClick/handleToggle).
  • page.tsx now aggregates a sanitized warningMaxFailures / warningLastFailureRelative summary from apiKeyHealth alongside the existing warning count.
  • Added providers.riskNotice.detailsTitle and providers.warningNotice.{tooltip,lastFailureSuffix,ariaLabel} to en.json.

Regression test

src/app/(dashboard)/dashboard/providers/components/__tests__/providerCardWarningIndicators.test.tsx (vitest, matches the tests/unit/**/*.test.tsx / dashboard/providers/**/__tests__/** include globs in vitest.config.ts):

  • risk indicator opens an accessible dialog on click, and never leaks credential-shaped strings
  • risk indicator is a real interactive control reachable and activatable by keyboard (focus + Enter)
  • warning badge exposes sanitized reasons + a distinct click/keyboard affordance (tabindex=0, no raw upstream error strings)
  • the two indicators use visually distinct styling
✓ src/app/.../__tests__/providerCardWarningIndicators.test.tsx (4 tests) — 4 passed

Gates run

  • npm run typecheck:core — clean
  • npx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files> — clean
  • node scripts/check/check-file-size.mjs — OK, no new violations on touched files
  • node scripts/check/check-complexity.mjs — OK (2456 vs baseline 2774)
  • node scripts/check/check-cognitive-complexity.mjs — OK (1104 vs baseline 1223)
  • node scripts/check/check-test-discovery.mjs — OK, new test file discovered
  • New regression test: 4/4 passing under npx vitest run
  • Pre-existing tests referencing ProviderCard (tests/unit/ui/providerCardHandle.test.tsx, highlightableProviderCard.test.tsx, providerCardKimiPartnerAccent.test.tsx, card-hover-visible.test.ts, providers-page-utils.test.ts) — confirmed by content inspection that none touch subscriptionRisk/warningCount/the changed lines; a devbox-saturated (13-way parallel fan-out) npm run test:unit run hit vitest worker-pool timeouts unrelated to this diff, consistent with known devbox-under-load flakiness, not a regression from this change.

⚠️ base-red inherited: #9985 — ESLint errors (2) from #10250 (unrelated i18n PT-PT translation commit; pre-existing on the release tip, not touched by this PR).

…raction they advertise

The usage-risk indicator (subscriptionRisk) promised "click for details" in its
tooltip but was a bare <span> with no onClick/role/dialog. The connection
warning-count badge exposed neither a title tooltip (reasons) nor any click
affordance, even though the reasons already exist in
providerSpecificData.apiKeyHealth[].

Turn the risk indicator into a real <button role/aria-haspopup="dialog"> that
opens an accessible Modal reusing the existing riskNotice copy, and wrap the
warning badge in a keyboard- and pointer-interactive control that surfaces a
sanitized reasons summary (max failure count + relative last-failure time,
never raw upstream error text) and navigates to the connection detail/health
view on activation. Both indicators are now visually distinct (bare icon vs.
pill Badge).

Closes #10261
… all 42 locales (#10261)

Real Vietnamese translations (vi.json has a strict no-__MISSING__-marker gate);
other 41 locales carry the sync-ui __MISSING__ placeholder pending the normal
translation pass.
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.

fix(dashboard): provider warning badges should expose their details consistently

2 participants