RHIDP-14178 As a Platform Engineer, I want to configure filters for aggregation scorecard cards - #4125
Conversation
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
|
🤖 Finished Review · ✅ Success · Started 10:37 AM UTC · Completed 10:57 AM UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4125 +/- ##
==========================================
+ Coverage 58.11% 58.14% +0.02%
==========================================
Files 2422 2426 +4
Lines 96484 96536 +52
Branches 26885 26890 +5
==========================================
+ Hits 56075 56127 +52
Misses 38914 38914
Partials 1495 1495
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
ReviewFindingsLow
Previous runReviewFindingsLow
Previous run (2)ReviewFindingsHigh
Medium
Low
Next steps:
Previous run (3)ReviewFindingsMedium
Low
Next steps:
Previous run (4)ReviewFindingsMedium
Low
Previous run (5)ReviewFindingsLow
Labels: PR introduces new scalar aggregation KPI types with filtering, documentation, and tests — matches the enhancement label convention used by other scorecard feature PRs. |
|
🤖 Review · ❌ Terminated · Started 2:05 PM UTC · Ended 2:47 PM UTC |
|
🤖 Finished Review · ✅ Success · Started 2:05 PM UTC · Completed 2:47 PM UTC |
be2bce6 to
ea955a2
Compare
|
🤖 Review · ❌ Terminated · Started 2:16 PM UTC · Ended 2:59 PM UTC |
|
🤖 Finished Review · ✅ Success · Started 2:16 PM UTC · Completed 2:59 PM UTC |
ea955a2 to
647246b
Compare
|
🤖 Review · ❌ Terminated · Started 4:19 PM UTC · Ended 4:41 PM UTC |
|
🤖 Finished Review · ✅ Success · Started 4:19 PM UTC · Completed 4:41 PM UTC |
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
647246b to
8a9dca8
Compare
|
🤖 Review · ❌ Terminated · Started 9:06 AM UTC · Ended 9:23 AM UTC |
|
Superseded by updated review
|
🤖 Finished Review · ✅ Success · Started 9:06 AM UTC · Completed 9:23 AM UTC |
|
🤖 Review · ❌ Terminated · Started 9:31 AM UTC · Ended 9:47 AM UTC |
PR Summary by QodoAdd filter.status for scalar Scorecard aggregations with startup validation
AI Description
Diagram
High-Level Assessment
Files changed (42)
|
Code Review by Qodo
1. Wrong threshold override path
|
There was a problem hiding this comment.
Note: The following inline comments could not be posted on the diff (GitHub returned 422) and are included here instead:
workspaces/scorecard/plugins/scorecard-backend/src/database/DatabaseMetricValues.ts(file-level): Line 498 · [low] edge-case
The filter condition if (filter?.status) uses JavaScript truthiness. If a caller bypasses config parsing and passes { status: '' }, the filter would be silently skipped. In practice, the Zod schema enforces min(1) and buildAggregationConfigFilter uses getOptionalString, so an empty string cannot reach this code path through any supported flow.
workspaces/scorecard/plugins/scorecard-backend/src/validation/validateScalarAggregationConfig.ts:49: [low] naming-convention
Accepts ValidatedAggregationConfig then casts to ScalarAggregationConfig internally. Since the caller already narrows via isScalarAggregationType, the input type could be ScalarAggregationConfig directly, eliminating the cast and improving type safety.
Suggested fix: Change the aggregationConfig field in ValidateScalarAggregationConfigOptions from ValidatedAggregationConfig to ScalarAggregationConfig, then remove the as ScalarAggregationConfig cast.
workspaces/scorecard/plugins/scorecard-backend/src/utils/aggregation/buildAggregationConfigFilter.ts:27: [low] naming-convention
Returns empty object {} and uses Object.keys().length check for absence, while sister utility buildAggregationConfigThresholds returns undefined. Inconsistent absence-signaling pattern between the two utilities.
Suggested fix: Consider returning AggregationConfigFilter | undefined and returning undefined when no filter properties are set, matching buildAggregationConfigThresholds.
workspaces/scorecard/plugins/scorecard-backend/src/validation/validateScalarAggregationConfig.ts:42: [low] scope-creep
Boolean metric relaxation for count type is not mentioned in the PR description. Expands feature surface beyond filter.status.
|
🤖 Finished Review · ✅ Success · Started 9:31 AM UTC · Completed 9:47 AM UTC |



Hey, I just made a Pull Request!
Implemented logic to support filter by
statusfor scalar aggregation types (sum,average,count,min,max).This PR for:
✔️ Checklist
How to test
Preparing
app-config.local.yaml(orapp-config.yaml) underscorecard.aggregationKPIs:Testing
Get filtered by status aggregation result
In this test case expected that:
scorecard.aggregationKPIs.totalCriticalPRs.typeshould be any of scalar type (sum,average,count,min,max)scorecard.aggregationKPIs.totalCriticalPRs.filtershould be one of configured thresholds.Get error when filter by status is not follow configured thresholds
In this test case expected that:
scorecard.aggregationKPIs.totalCriticalPRs.typeshould be any of scalar type (sum,average,count,min,max)scorecard.aggregationKPIs.totalCriticalPRs.filtershouldn't be one of configured thresholds (for example enterstatus: unreal).Get aggregation result when
statusGroupedorweightedStatusScoreaggregation types were used and filters configuredIn this test case expected that:
scorecard.aggregationKPIs.totalCriticalPRs.typeshould be any of scalar type (statusGrouped,weightedStatusScore)scorecard.aggregationKPIs.totalCriticalPRs.filtershould be one of configured thresholds.Result: returned data should not be affected by configured filters