Skip to content

RHIDP-16658: Consume backend-provided color for scalar aggregation KPI cards - #4582

Open
imykhno wants to merge 1 commit into
redhat-developer:mainfrom
imykhno:feat/update-scorecard-scalar-aggregation-response
Open

RHIDP-16658: Consume backend-provided color for scalar aggregation KPI cards#4582
imykhno wants to merge 1 commit into
redhat-developer:mainfrom
imykhno:feat/update-scorecard-scalar-aggregation-response

Conversation

@imykhno

@imykhno imykhno commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Hey, I just made a Pull Request!

In this PR, we added the result.aggregationChartDisplayColor attribute to the scalar aggregation response. The color will be calculated on the backend, which now returns only the correct value.

Dropping result.thresholds was not implemented in this PR, as we decided that the UI may still need threshold information for certain charts

This PR is for:

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

@rhdh-gh-app

rhdh-gh-app Bot commented Sep 4, 2026

Copy link
Copy Markdown

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-scorecard-backend workspaces/scorecard/plugins/scorecard-backend patch v4.2.0
@red-hat-developer-hub/backstage-plugin-scorecard-common workspaces/scorecard/plugins/scorecard-common patch v4.2.0
@red-hat-developer-hub/backstage-plugin-scorecard workspaces/scorecard/plugins/scorecard patch v4.2.0

@rhdh-qodo-merge

Copy link
Copy Markdown

PR Summary by Qodo

Return backend-calculated colors for scalar aggregation KPI cards

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds backend-calculated display colors to scalar aggregation responses.
• Introduces scalar-specific default thresholds and shared color resolution.
• Updates public types, fixtures, API reports, and regression tests.
Diagram

graph TD
  C["KPI Config"] --> S["Scalar Strategy"] --> H["Color Helper"] --> E["Threshold Evaluator"]
  S --> R["Scalar Response"] --> U["Frontend Contract"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Calculate colors in the frontend
  • ➕ Avoids expanding the scalar aggregation API response.
  • ➕ Allows each visualization to choose its own presentation color.
  • ➖ Duplicates backend threshold evaluation logic across clients.
  • ➖ Can produce inconsistent colors when client and backend rules diverge.
  • ➖ Requires every consumer to understand threshold ordering and defaults.

Recommendation: Keep color calculation in the backend as implemented. It establishes one source of truth for threshold interpretation and aligns scalar aggregation behavior with weighted-status aggregation; retaining thresholds also preserves chart and legend flexibility for clients.

Files changed (15) +192 / -52

Enhancement (4) +85 / -4
aggregationKPIs.tsDefine default scalar KPI thresholds +25/-0

Define default scalar KPI thresholds

• Introduces ordered success, warning, and error thresholds used when scalar aggregation configuration omits explicit rules.

workspaces/scorecard/plugins/scorecard-backend/src/constants/aggregationKPIs.ts

ScalarAggregationStrategy.tsResolve scalar aggregation display colors +20/-4

Resolve scalar aggregation display colors

• Calculates the scalar result color from configured or scalar-default thresholds and includes it in the response. Aggregation now fails with actionable configuration guidance when no colored rule matches, while time-series processing adopts the same scalar defaults.

workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts

getAggregationChartDisplayColor.tsAdd shared threshold color helper +39/-0

Add shared threshold color helper

• Adds a reusable utility that evaluates a numeric value against ordered threshold rules and returns the matching rule's color.

workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/getAggregationChartDisplayColor.ts

aggregation.tsExtend the scalar aggregation result contract +1/-0

Extend the scalar aggregation result contract

• Makes the backend-calculated aggregation chart display color a required field of scalar aggregation results.

workspaces/scorecard/plugins/scorecard-common/src/types/aggregation.ts

Refactor (1) +2 / -18
WeightedStatusScoreAggregationStrategy.tsShare aggregation color resolution logic +2/-18

Share aggregation color resolution logic

• Replaces the weighted-status strategy's private color resolver with the reusable aggregation color helper.

workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/WeightedStatusScoreAggregationStrategy.ts

Tests (7) +89 / -18
mockAggregatedMetricResult.tsAdd display color to scalar result fixture +1/-0

Add display color to scalar result fixture

• Extends the shared scalar aggregation fixture with the new backend-provided warning color.

workspaces/scorecard/plugins/scorecard-backend/fixtures/mockAggregatedMetricResult.ts

mockAggregationConfig.tsUse scalar-specific default thresholds in fixtures +8/-7

Use scalar-specific default thresholds in fixtures

• Updates mock scalar configurations to use the new KPI-specific default threshold rules instead of the generic number thresholds.

workspaces/scorecard/plugins/scorecard-backend/fixtures/mockAggregationConfig.ts

scalarAggregationStrategy.test.tsVerify scalar colors and threshold defaults +5/-5

Verify scalar colors and threshold defaults

• Updates strategy expectations for scalar-specific defaults and asserts backend-calculated colors for default and custom thresholds.

workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/scalarAggregationStrategy.test.ts

mappers.test.tsInclude scalar display colors in mapper fixtures +2/-0

Include scalar display colors in mapper fixtures

• Extends scalar mapper inputs with the required aggregation chart display color.

workspaces/scorecard/plugins/scorecard-backend/src/service/mappers.test.ts

router.test.tsValidate scalar colors in API responses +6/-5

Validate scalar colors in API responses

• Updates router response assertions to expect backend-calculated scalar colors and scalar-specific default thresholds. It also converts the Backstage configuration import to a type-only import.

workspaces/scorecard/plugins/scorecard-backend/src/service/router.test.ts

getAggregationChartDisplayColor.test.tsTest shared aggregation color resolution +64/-0

Test shared aggregation color resolution

• Covers unmatched thresholds, rules without colors, and first-match ordering for the new color helper.

workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/getAggregationChartDisplayColor.test.ts

ScorecardHomepageCard.test.tsxUpdate homepage scalar card fixture +3/-1

Update homepage scalar card fixture

• Aligns the homepage scalar scorecard fixture with scalar-specific default thresholds and the required backend-provided display color.

workspaces/scorecard/plugins/scorecard/src/components/ScorecardHomepageSection/tests/ScorecardHomepageCard.test.tsx

Documentation (3) +16 / -12
hungry-walls-burn.mdDeclare patch releases for Scorecard packages +7/-0

Declare patch releases for Scorecard packages

• Adds a changeset documenting the scalar aggregation response update and patch releases for the backend, common, and frontend packages.

workspaces/scorecard/.changeset/hungry-walls-burn.md

report.api.mdDocument scalar display color response field +2/-1

Document scalar display color response field

• Updates the generated common-package API report to expose 'aggregationChartDisplayColor' on scalar aggregation results. It also reflects generated ordering changes for threshold color values.

workspaces/scorecard/plugins/scorecard-common/report.api.md

report.api.mdRefresh the frontend API report +7/-11

Refresh the frontend API report

• Refreshes generated frontend API declaration ordering without changing the exposed Scorecard behavior.

workspaces/scorecard/plugins/scorecard/report.api.md

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 4, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:55 PM UTC · Completed 1:03 PM UTC

Commit: ef8296c · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $1.33

@rhdh-qodo-merge

rhdh-qodo-merge Bot commented Sep 4, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Failed samples report success color ✓ Resolved 🐞 Bug ≡ Correctness
Description
The strategy evaluates the placeholder value 0 even when total is zero, causing the default
<10 rule to return success.main for empty or all-failed aggregations. Consumers of the new
server-provided field can consequently display a successful KPI despite there being no successful
sample.
Code

workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts[R72-75]

+    const aggregationChartDisplayColor = getAggregationChartDisplayColor(
+      value,
+      headlineThresholds,
+    );
Relevance

●●● Strong

Recent precedent accepted skipping threshold coloring when scalar aggregations have no successful
samples.

PR-#4395

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The database aggregation excludes missing/error values and defaults an empty aggregate to `value: 0,
total: 0`; the mapper preserves those defaults. The new unconditional color lookup then matches the
default <10 success rule, while the scalar card's existing guard confirms zero-total results
require a neutral color.

workspaces/scorecard/plugins/scorecard-backend/src/database/DatabaseMetricValues.ts[215-235]
workspaces/scorecard/plugins/scorecard-backend/src/service/mappers.ts[54-66]
workspaces/scorecard/plugins/scorecard-backend/src/constants/aggregationKPIs.ts[56-65]
workspaces/scorecard/plugins/scorecard/src/components/AggregatedMetricCards/ScalarStatCard/ScalarStatCard.tsx[66-78]
PR-#4395

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Scalar aggregation derives a threshold color from `value` even when no successful rows contributed to that value.

## Issue Context
The scalar mapper uses zero as the placeholder when no value exists, while `total` identifies whether successful samples contributed. Skip threshold coloring when `total === 0`, represent the response color as nullable or another explicit neutral state, and retain the card's grey fallback.

## Fix Focus Areas
- workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts[59-80]
- workspaces/scorecard/plugins/scorecard-common/src/types/aggregation.ts[109-112]
- workspaces/scorecard/plugins/scorecard/src/components/AggregatedMetricCards/ScalarStatCard/ScalarStatCard.tsx[66-78]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Optional colors now fail requests ✓ Resolved 🐞 Bug ≡ Correctness
Description
A valid scalar threshold rule using a standard key without its optional color now makes
aggregate throw instead of applying the documented standard color. Existing configurations that
previously rendered with default success, warning, or error colors will therefore fail their
aggregation request.
Code

workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts[R77-80]

+    if (!aggregationChartDisplayColor) {
+      throw new Error(
+        `The color for value '${value}' metric '${metric.id}' is not configured. Check the 'scorecard.aggregationKPIs.${aggregationConfig.id}.options.thresholds' configuration.`,
+      );
Relevance

●●● Strong

Optional colors require standard defaults; throwing on valid configurations is a concrete
backward-compatibility bug.

PR-#4395

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ThresholdRule.color is optional and standard keys are explicitly documented as having defaults.
The new helper returns the raw optional color, while the existing classifier applies
withStandardThresholdDefaults; the strategy now throws when the raw lookup returns undefined.

workspaces/scorecard/plugins/scorecard-common/src/types/threshold.ts[34-43]
workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/getAggregationChartDisplayColor.ts[30-38]
workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/classifyNumberAgainstThresholds.ts[29-41]
workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/withStandardThresholdDefaults.ts[40-52]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Scalar aggregation directly reads the matched rule's optional `color` and throws when it is absent, even though standard threshold keys have defined default colors.

## Issue Context
Use the existing threshold classification/defaulting path so `success`, `warning`, and `error` rules without explicit colors receive their standard colors. Keep appropriate handling for genuinely unresolvable custom rules.

## Fix Focus Areas
- workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts[72-81]
- workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/getAggregationChartDisplayColor.ts[26-38]
- workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/classifyNumberAgainstThresholds.ts[24-41]
- workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/withStandardThresholdDefaults.ts[40-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Default direction documented backwards 🐞 Bug ⚙ Maintainability
Description
The new default's comment says higher values are better, but its rules classify low values as
success and high values as error. This misleading contract can cause future changes to invert scalar
KPI threshold behavior.
Code

workspaces/scorecard/plugins/scorecard-backend/src/constants/aggregationKPIs.ts[R51-52]

+ * Default applied by `ScalarAggregationStrategy` when `options.thresholds` is omitted
+ * from app-config. Higher value = better. Evaluated in order; first match wins.
Relevance

●●● Strong

The comment directly contradicts its adjacent threshold rules; correcting this documentation is a
trivial deterministic fix.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The comment explicitly states higher values are better, while the immediately following rules assign
success to <10 and error to >50.

workspaces/scorecard/plugins/scorecard-backend/src/constants/aggregationKPIs.ts[50-70]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The scalar default threshold comment describes the opposite direction from the implemented rules.

## Issue Context
The rules implement lower-is-better behavior: values below 10 succeed and values above 50 fail.

## Fix Focus Areas
- workspaces/scorecard/plugins/scorecard-backend/src/constants/aggregationKPIs.ts[50-70]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Scalar card ignores response color 🐞 Bug ≡ Correctness
Description
The new aggregationChartDisplayColor response field has no effect on scalar KPI cards because
ScalarStatCard still derives its color locally from result.thresholds. This defeats the
server-authoritative color behavior that the response addition is intended to provide.
Code

workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts[89]

+      aggregationChartDisplayColor,
Relevance

● Weak

Recent precedent explicitly rejected requiring scalar cards to consume the backend-provided color.

PR-#4395

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The backend adds the computed field to the scalar result, while the scalar card only calls
getMatchingThresholdKey and resolves the threshold rule color locally. The weighted card
demonstrates the intended consumption pattern by passing result.aggregationChartDisplayColor to
resolveStatusColor.

workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts[72-90]
workspaces/scorecard/plugins/scorecard/src/components/AggregatedMetricCards/ScalarStatCard/ScalarStatCard.tsx[66-78]
workspaces/scorecard/plugins/scorecard/src/components/AggregatedMetricCards/WeightedStatusScoreCard/WeightedStatusScoreCardComponent.tsx[74-79]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Scalar aggregation responses now include `aggregationChartDisplayColor`, but `ScalarStatCard` ignores it and continues deriving the display color from thresholds.

## Issue Context
Weighted status cards already consume the backend-provided field. Preserve the scalar card's neutral fallback for `total === 0`, but use the backend-provided color for successful samples.

## Fix Focus Areas
- workspaces/scorecard/plugins/scorecard-backend/src/service/aggregations/strategies/ScalarAggregationStrategy.ts[83-90]
- workspaces/scorecard/plugins/scorecard/src/components/AggregatedMetricCards/ScalarStatCard/ScalarStatCard.tsx[66-78]
- workspaces/scorecard/plugins/scorecard/src/components/AggregatedMetricCards/ScalarStatCard/ScalarStatCard.tsx[107-113]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
⚠️ Tickets: not configured — ticket URL found in PR but could not be fetched — check ticket provider credentials
✅ Compliance rules (platform): 11 rules
✅ Cross-repo context — repo relationships
  Explored: repo: redhat-developer/rhdh (sha: 506c86ab)

Grey Divider

Tip of the day
💡 Did you know, you can route each action level your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@rhdh-qodo-merge rhdh-qodo-merge Bot added documentation Improvements or additions to documentation enhancement New feature or request Tests labels Sep 4, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review

Verdict: Comment — medium-severity findings worth noting, none blocking.

This PR extracts aggregationChartDisplayColor computation into a shared backend utility, adds it as a new field on ScalarAggregationResult, widens the existing field on WeightedStatusScoreAggregationResult to string | null, and returns null when total === 0 instead of throwing. The change is well-structured: the utility extraction reduces duplication, test coverage is solid for the new paths, and the frontend null-handling fallback to grey is correct.

No security or critical/high-severity findings.


Medium findings

1. Misleading JSDoc on default scalar thresholds

File: workspaces/scorecard/plugins/scorecard-backend/src/constants/aggregationKPIs.ts (line 37)

The JSDoc comment on DEFAULT_SCALAR_AGGREGATION_KPI_RESULT_THRESHOLDS states "Higher value = better" but the threshold rules define <10 as SUCCESS and >50 as ERROR, meaning lower values are better. This appears to be a copy-paste from the weighted status score constant (where higher is better). While not a runtime bug, it will mislead operators configuring custom thresholds.

Suggestion: Change to "Lower value = better" or remove the directional hint.

2. Frontend scalar card does not consume the new backend-provided color

File: workspaces/scorecard/plugins/scorecard/src/components/AggregatedMetricCards/ScalarStatCard/ScalarStatCard.tsx (line 69)

The PR title says "Consume backend-provided color for scalar aggregation KPI cards" but ScalarStatCard still derives color client-side via getMatchingThresholdKey + getStatusConfig + resolveStatusColor. The new aggregationChartDisplayColor field is produced by the backend but never read by the frontend for scalar cards. If a follow-up PR is planned for the frontend migration, consider clarifying in the PR description.

3. Backward-compatibility / semver concern

File: workspaces/scorecard/plugins/scorecard-common/src/types/aggregation.ts (lines 103, 109)

Two changes to @public exported types are marked as patch in the changeset:

  • ScalarAggregationResult gains a new required field aggregationChartDisplayColor: string | null
  • WeightedStatusScoreAggregationResult.aggregationChartDisplayColor widens from string to string | null

These are technically breaking under strict semver. In practice, the impact is mitigated — these types are primarily API response shapes constructed only within the backend workspace, so external consumers constructing them is unlikely. However, any consumer assigning aggregationChartDisplayColor to a string-typed variable (without a null guard) would get a compile error.

Suggestion: Consider bumping scorecard-common to minor to signal the API surface change, or make the new field optional (aggregationChartDisplayColor?: string | null).

4. Documentation gaps in aggregation.md

File: workspaces/scorecard/plugins/scorecard-backend/docs/aggregation.md (lines 281–317)

The "Scalar result fields" table (line 288) and the example scalar JSON response (line 303) do not include the new aggregationChartDisplayColor field. Consumers reading these docs will not know the field exists in the API response.

Suggestion: Add a row to the scalar result fields table and add the field to the example JSON.


Low findings (non-blocking)

# Category File Description
1 test adequacy packages/app-legacy/e2e-tests/utils/scorecardResponseUtils.ts:285 E2E fixture has total: 0 with aggregationChartDisplayColor: '#6bb300' (non-null). After this PR, backend returns null when total is 0 — fixture is stale.
2 maintenance ScalarAggregationStrategy.ts:70 Color uses DEFAULT_SCALAR_AGGREGATION_KPI_RESULT_THRESHOLDS while result.thresholds falls back to DEFAULT_NUMBER_THRESHOLDS. Rules are identical today but live in separate packages and could drift.
3 style getAggregationChartDisplayColor.ts:33 Function instantiates new ThresholdEvaluator() on every call. The old WeightedStatusScoreAggregationStrategy method did the same, so this is not a regression, but the constructor-injection pattern used elsewhere is more testable.
4 code organization getAggregationChartDisplayColor.ts:29 Logic partially duplicates classifyNumberAgainstThresholds (both call getFirstMatchingThreshold + rule lookup). Note: direct reuse would change behavior since classifyNumberAgainstThresholds applies withStandardThresholdDefaults.
5 docs aggregation.md:272, thresholds.md:228,230 Three doc sections are slightly stale: weighted result description doesn't mention null, scalar thresholds section understates backend's active use of color, defaults bullet omits new constant.
6 test adequacy isScalarAggregation.test.ts:29 Test fixture missing aggregationChartDisplayColor. Test still passes (type guard checks structural properties only) but fixture is incomplete.
Previous run

Review — comment

PR: #4582RHIDP-16658: Consume backend-provided color for scalar aggregation KPI cards

Summary

This PR adds backend-computed aggregationChartDisplayColor to scalar aggregation results, matching the existing pattern in WeightedStatusScoreAggregationStrategy. The implementation is well-structured:

  • Extracts getAggregationChartDisplayColor into a shared utility, eliminating duplication between the weighted-status-score and scalar strategies.
  • Introduces DEFAULT_SCALAR_AGGREGATION_KPI_RESULT_THRESHOLDS with explicit colors (unlike the old DEFAULT_NUMBER_THRESHOLDS which was colorless), enabling meaningful color computation for the default path.
  • Adds a required aggregationChartDisplayColor: string field to the ScalarAggregationResult type in scorecard-common.
  • Test coverage is solid across the new utility, strategy, mappers, and router tests.

The refactor is faithful — getAggregationChartDisplayColor is identical in logic to the private method it replaces in WeightedStatusScoreAggregationStrategy, and the error-throw guard on missing color is consistent with the weighted strategy.

Findings

1. Cross-package deep import from frontend test into backend src/ (medium — style/conventions)

ScorecardHomepageCard.test.tsx introduces:

import { DEFAULT_SCALAR_AGGREGATION_KPI_RESULT_THRESHOLDS }
  from '@red-hat-developer-hub/backstage-plugin-scorecard-backend/src/constants/aggregationKPIs';

This is the first cross-boundary deep import from the scorecard frontend plugin into the backend's internal src/ tree. It bypasses the backend's public API surface and creates a fragile test-time dependency — any restructuring of the backend's internal modules would break this test.

Remediation: Either re-export this constant from scorecard-common (since both backend and frontend need it), or define the threshold fixture inline in the test. Since the constant represents default backend behavior, re-exporting from scorecard-common alongside DEFAULT_NUMBER_THRESHOLDS is the cleaner approach.

2. Misleading JSDoc comment on new thresholds constant (low — documentation)

The comment on DEFAULT_SCALAR_AGGREGATION_KPI_RESULT_THRESHOLDS in aggregationKPIs.ts states:

Higher value = better. Evaluated in order; first match wins.

But the rules define <10 → success and >50 → error, which means lower values are better. The neighboring DEFAULT_WEIGHTED_STATUS_SCORE_KPI_RESULT_THRESHOLDS correctly says "Higher headline percentage = better" where >=80 is success. The new comment appears to be copy-pasted without updating the direction.

Remediation: Change "Higher value = better" to "Lower value = better" (or "High count indicates problems" to match the DEFAULT_NUMBER_THRESHOLDS JSDoc it replaces).

@fullsend-ai-review fullsend-ai-review Bot added the requires-manual-review Review requires human judgment label Sep 4, 2026
@imykhno
imykhno force-pushed the feat/update-scorecard-scalar-aggregation-response branch from ef8296c to 4083f08 Compare September 4, 2026 17:24
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 4, 2026

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 5:26 PM UTC · Ended 5:33 PM UTC

Commit: 4083f08 · View workflow run →

…gregation response

Signed-off-by: Ihor Mykhno imykhno@redhat.com
Assisted-By: Cursor <cursoragent@cursor.com>
@imykhno
imykhno force-pushed the feat/update-scorecard-scalar-aggregation-response branch from 4083f08 to 2fba3b8 Compare September 4, 2026 17:32
@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 4, 2026

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 5:34 PM UTC · Ended 5:53 PM UTC

Commit: 2fba3b8 · View workflow run →

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 62.38%. Comparing base (57947b4) to head (2fba3b8).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4582   +/-   ##
=======================================
  Coverage   62.37%   62.38%           
=======================================
  Files        2607     2608    +1     
  Lines      104756   104775   +19     
  Branches    29430    29441   +11     
=======================================
+ Hits        65346    65365   +19     
  Misses      38819    38819           
  Partials      591      591           
Flag Coverage Δ *Carryforward flag
adoption-insights 84.77% <ø> (ø) Carriedforward from 57947b4
ai-integrations 78.80% <ø> (ø) Carriedforward from 57947b4
app-defaults 56.22% <ø> (ø) Carriedforward from 57947b4
augment 46.67% <ø> (ø) Carriedforward from 57947b4
boost 80.51% <ø> (ø) Carriedforward from 57947b4
bulk-import 73.12% <ø> (ø) Carriedforward from 57947b4
cost-management 13.35% <ø> (ø) Carriedforward from 57947b4
dcm 73.47% <ø> (ø) Carriedforward from 57947b4
e2e-adoption-insights 60.00% <ø> (ø) Carriedforward from 57947b4
e2e-extensions 62.31% <ø> (ø) Carriedforward from 57947b4
e2e-global-header 50.35% <ø> (ø) Carriedforward from 57947b4
e2e-homepage 61.11% <ø> (ø) Carriedforward from 57947b4
e2e-intelligent-assistant 47.04% <ø> (ø) Carriedforward from 57947b4
e2e-orchestrator 49.52% <ø> (ø) Carriedforward from 57947b4
e2e-orchestrator-plugin 49.51% <ø> (ø) Carriedforward from 57947b4
e2e-quickstart 55.21% <ø> (ø) Carriedforward from 57947b4
e2e-scorecard 50.26% <ø> (+0.05%) ⬆️ Carriedforward from 57947b4
e2e-theme 16.36% <ø> (ø) Carriedforward from 57947b4
extensions 57.37% <ø> (ø) Carriedforward from 57947b4
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 57947b4
global-header 68.09% <ø> (ø) Carriedforward from 57947b4
homepage 48.39% <ø> (ø) Carriedforward from 57947b4
install-dynamic-plugins 71.31% <ø> (ø) Carriedforward from 57947b4
intelligent-assistant 76.43% <ø> (ø) Carriedforward from 57947b4
konflux 91.98% <ø> (ø) Carriedforward from 57947b4
lightspeed 69.02% <ø> (ø) Carriedforward from 57947b4
mcp-integrations 84.14% <ø> (ø) Carriedforward from 57947b4
orchestrator 71.13% <ø> (ø) Carriedforward from 57947b4
quickstart 63.74% <ø> (ø) Carriedforward from 57947b4
sandbox 79.56% <ø> (ø) Carriedforward from 57947b4
scorecard 88.00% <96.66%> (+0.04%) ⬆️
theme 87.91% <ø> (ø) Carriedforward from 57947b4
translations 5.12% <ø> (ø) Carriedforward from 57947b4
x2a 77.10% <ø> (ø) Carriedforward from 57947b4

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57947b4...2fba3b8. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:

  • workspaces/scorecard/plugins/scorecard-backend/src/constants/aggregationKPIs.ts (file-level): Line 37 · [medium] documentation error

JSDoc comment on DEFAULT_SCALAR_AGGREGATION_KPI_RESULT_THRESHOLDS states 'Higher value = better' but the threshold rules define '<10' as SUCCESS and '>50' as ERROR, meaning lower values are better. Copy-paste from weighted status score constant where higher is indeed better.

Suggested fix: Change the comment to 'Lower value = better' or remove the directional statement.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

/**
* @public
*/
export type ScalarAggregationResult = ScalarAggregatedMetric & {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[medium] backward-compatibility

Two type changes to @public exports marked as 'patch': (1) ScalarAggregationResult gains required field aggregationChartDisplayColor: string | null, (2) WeightedStatusScoreAggregationResult.aggregationChartDisplayColor widens from string to string | null. These are technically breaking under strict semver, though practical impact is mitigated since these are API response shapes constructed only within the backend workspace.

Suggested fix: Bump scorecard-common changeset to 'minor' to signal the API surface change, or make the new field optional (aggregationChartDisplayColor?: string | null).

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment and removed requires-manual-review Review requires human judgment labels Sep 4, 2026
@fullsend-ai-review

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 5:34 PM UTC · Completed 5:53 PM UTC

Commit: 2fba3b8 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $6.82

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

Labels

documentation Improvements or additions to documentation enhancement New feature or request requires-manual-review Review requires human judgment Tests workspace/scorecard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant