[AAASM-3512] ♻️ (dashboard): Harden Overview page — Sonar fixes + tests#1188
Merged
Chisanan232 merged 7 commits intoJun 21, 2026
Merged
Conversation
Resolves SonarCloud typescript:S4624 in the Overview LayerCard: the inner
`${...}` template was nested inside the className template literal. Hoist it to
a named `toneClass` const. No behaviour change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolves SonarCloud typescript:S6772: the whitespace between "Overview" and the
zh subtitle <span> was implicit (collapsed JSX text). Make the intended single
space explicit with `{' '}`. Rendered output is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolves SonarCloud typescript:S3735: the error-state retry handler discarded the refetch() promise with the `void` operator. Use the repo's `ignorePromise` helper (already used by every other page) — it satisfies no-floating-promises, swallows unexpected rejections, and tolerates the test mock's undefined return. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolves SonarCloud typescript:S3776 (Cognitive Complexity 18 > 15) in OverviewPage. Move the pure KPI/score/alert derivations into a side-effect-free `deriveOverviewKpis` helper, hoist the alert sort comparator (`compareBySeverity` + `SEVERITY_RANK`) out of the component, and extract the recent-decisions row into a `RecentDecisionRow` component. The component now destructures one helper result. No behaviour change — rendered output is identical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract `deriveOverviewKpis` + `compareBySeverity` + `OverviewKpis` into a plain `OverviewPage.kpis.ts` module (matching the repo's fleetTypes/fleetFilters pattern). Keeps `OverviewPage.tsx` a components-only module so it satisfies react-refresh `only-export-components`, and makes the pure derivation directly unit-testable. No behaviour change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover the extracted Overview KPI helper: empty-fleet (total === 0) full-score posture, mode/flag counting, identity/capability score degradation, identity clamp at zero, blocked/scrubbed null-as-zero summation, FIRING-only filtering with most-severe top-alert selection, and the no-firing undefined case. Plus the severity comparator ordering and the equal-severity (0) branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend OverviewPage component coverage: default 24h window + all four window-toggle states (1h/24h/7d/30d) asserting single-active and subtitle echo; singular/plural/healthy hero posture messages; fleet-snapshot mode/flag tile derivations; recent-decisions severity→decision mapping (deny/narrow/scrub) with agentId vs fleet rendering; empty recent note; approvals clear vs awaiting copy; and fleet-wide top-issue with active-policy count. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
Author
🔎 Review (Claude Code) — ready for approvalCI: ✅ All green — 0 failures (Dashboard tests + coverage, aa-cli build compat, CI Success all pass). The Scope vs AAASM-3512: ✅ Fixes all 4 listed SonarCloud issues in
Tests (2-2): +23 meaningful cases (new Verdict: Scope-complete, correct, green, well-tested. Ready to approve & merge. |
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.
Description
Refactor-only hardening of the dashboard Overview page to clear the four
SonarCloud Reliability/Maintainability issues flagged on
dashboard/src/pages/OverviewPage.tsx, plus broader test coverage. No behaviourchange to the page — rendered output is identical.
SonarCloud rules fixed:
typescript:S4624(nested template literals)${TONE_CLASS[...]}template into a namedtoneClassconst inLayerCard.typescript:S3776(Cognitive Complexity 18 > 15)deriveOverviewKpis+compareBySeverityin a siblingOverviewPage.kpis.tsmodule, and pulled the recent-decisions row into aRecentDecisionRowcomponent. The component now destructures one helper result.typescript:S3735(voidoperator)void agentsQuery.refetch()with the repo's existingignorePromise(...)helper (already used by every other page) — satisfiesno-floating-promises, swallows unexpected rejections, tolerates the test mock'sundefinedreturn.typescript:S6772(ambiguous JSX spacing){' '}between "Overview" and the zh subtitle<span>in the<h1>.Type of Change
Breaking Changes
Related Issues
Testing
Tests added:
OverviewPage.kpis.test.ts(new, 9 cases) —deriveOverviewKpisbranches:empty-fleet
total === 0full-score posture, mode/flag counting, identity &capability score degradation, identity clamp-at-zero, blocked/scrubbed
null-as-zero summation, FIRING-only filtering + most-severe top-alert,
no-firing undefined case; plus
compareBySeverityordering and theequal-severity (0) branch.
OverviewPage.test.tsx(extended, +14 cases) — default 24h window + all fourwindow-toggle states (1h/24h/7d/30d) asserting single-active + subtitle echo;
singular/plural/healthy hero posture messages; fleet-snapshot mode/flag tile
derivations; recent-decisions severity→decision mapping (deny/narrow/scrub)
with agentId-vs-fleet rendering; empty recent note; approvals clear-vs-awaiting
copy; fleet-wide top-issue with active-policy count. (loading/error/empty
states were already covered and remain green.)
Local validation (all green):
pnpm type-check— cleanpnpm lint(--max-warnings 0) — cleanpnpm build— succeeds (pre-existing chunk-size warnings only)pnpm test— 148 files / 1326 tests passed (Overview suite: 22 + KPI suite: 9)Checklist
🤖 Generated with Claude Code