OCPBUGS-14473: Guard against undefined data in dashboard charts - #16952
OCPBUGS-14473: Guard against undefined data in dashboard charts#16952ericahinkleRH wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@ericahinkleRH: This pull request references Jira Issue OCPBUGS-14473, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughEmpty query series and area chart datasets remain safe when they contain no data points. Translation, legend formatting, and tooltip date formatting avoid accessing missing entries. ChangesEmpty dataset handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ericahinkleRH The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/jira refresh |
|
@ericahinkleRH: This pull request references Jira Issue OCPBUGS-14473, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (yapei@redhat.com), skipping review request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In
`@frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsx`:
- Around line 78-80: Remove the first-series fast path that checks
originalData[0].length before the per-query loop in the translation logic. Let
the loop in UtilizationItem handle null and empty queries independently,
preserving them while still translating later non-empty series. Add regression
tests covering [null, data] and [[], data].
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 637fd756-0201-42d5-a10d-efbc0f1264d1
📒 Files selected for processing (2)
frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsxfrontend/public/components/graphs/area.tsx
4c0126d to
ed52791
Compare
|
@ericahinkleRH: This pull request references Jira Issue OCPBUGS-14473, which is valid. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (yapei@redhat.com), skipping review request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/test backend |
When Prometheus polling returns empty results for individual utilization queries at different times, the data array can contain empty sub-arrays that crash on property access. Add null checks in UtilizationItem and optional chaining in AreaChart to prevent the TypeError. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ed52791 to
09a370c
Compare
|
@ericahinkleRH: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/test e2e-gcp-console |
|
/test e2e-gcp-console |
|
/test e2e-playwright |
Problem
Visiting Home → Overview and leaving the page open for an extended period causes a crash:
This happens when Prometheus polling returns empty results for individual network utilization queries at different times. The
mapTranslatedDatafunction inUtilizationItemonly checks if the first sub-array is empty, but subsequent sub-arrays can also be empty, causingquery[0].descriptionto throw. Similarly,AreaChartaccessesd[0].descriptionwithout optional chaining in the legend data mapping.Root Cause
PrometheusMultilineUtilizationItembuilds a stats array where individual queries can return empty:[[valid_data], []]mapTranslatedDataonly checksoriginalData[0].length === 0, so it passes when the first query has data but a later one is emptyAreaChart,legendDatamapping accessesd[0].descriptionwithout optional chaining, despited[0]potentially being undefinedSolution
mapTranslatedDataloop instead of crashing?.) ond[0]accesses inlegendDatamapping andformatDatecallback, matching the existing safe pattern already used elsewhere in the same fileTesting
Fixes: https://redhat.atlassian.net/browse/OCPBUGS-14473
Summary by CodeRabbit