Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/api/componentreadiness/component_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ func (c *ComponentReportGenerator) generateComponentTestReport(basisStatusMap, s
keySet := sets.NewString(slices.Collect(maps.Keys(basisStatusMap))...)
keySet.Insert(slices.Collect(maps.Keys(sampleStatusMap))...)
for testKeyStr := range keySet {
var cellReport testdetails.TestComparison // The actual stats we return over the API
cellReport := testdetails.TestComparison{Explanations: []string{}} // The actual stats we return over the API
sampleStatus, sampleThere := sampleStatusMap[testKeyStr]
basisStatus, basisThere := basisStatusMap[testKeyStr]

Expand Down
1 change: 1 addition & 0 deletions pkg/api/componentreadiness/test_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ func (c *ComponentReportGenerator) internalGenerateTestDetailsReport(
totalBase, totalSample, report, result, lastFailure := c.summarizeRecordedTestStats(baseStatus, sampleStatus, testKey)

testStats := testdetails.TestComparison{
Explanations: []string{},
RequiredConfidence: c.ReqOptions.AdvancedOption.Confidence,
SampleStats: testdetails.ReleaseStats{
Release: c.ReqOptions.SampleRelease.Name,
Expand Down
2 changes: 1 addition & 1 deletion sippy-ng/src/component_readiness/CompSeverityIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function CompSeverityIcon(props) {
)

let toolTip = statusStr
if (explanations !== undefined && explanations.length > 0) {
if (explanations != null && explanations.length > 0) {
toolTip = explanations.join(' ')
}
Comment on lines +22 to 24

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a regression test for the null explanations crash path.

The Line 22 guard is correct, but this bug fix should be locked with a regression test (e.g., null, undefined, and [] explanations render without throwing and tooltip fallback still works).

As per coding guidelines, “bug fixes should include a regression test that fails without the fix.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sippy-ng/src/component_readiness/CompSeverityIcon.js` around lines 22 - 24,
Add a regression test for CompSeverityIcon that verifies the component safely
handles explanations being null, undefined, and an empty array: render the
component with explanations=null, explanations=undefined, and explanations=[],
assert that rendering does not throw, that no exception occurs in the tooltip
generation code path (the logic around the explanations guard and toolTip), and
that the tooltip fallback/placeholder is shown when explanations is falsy or
empty; add the tests to the existing test suite for this component so they fail
before the guard fix and pass afterward.

Source: Coding guidelines


Expand Down