ACM-39806: [release-2.15] Trim whitespace when splitting security-group annotations - #6643
Conversation
The Governance Overview Standards/Categories/Controls cards, and the
policy drill-down sidebar behind them, group policies by splitting
the policy.open-cluster-management.io/{standards,categories,controls}
annotation on ",". String.split(',') leaves a leading space on every
token after the first (e.g. "A, B".split(',') -> ["A", " B"]), so the
same logical value produces a second, distinct row whenever it isn't
first in a comma-separated list on some policies but is standalone or
first-in-list on others.
Trim each token after splitting in both useSecurityGroupViolations
(Overview.tsx) and the matching filter in
SecurityGroupPolicySummarySidebar.tsx so aggregation and drill-down
filtering key off the same normalized value regardless of annotation
formatting.
Reported in Red Hat case 04500068.
Signed-off-by: Sunny Gupta <sungupta@redhat.com>
The SecurityGroupPolicySummarySidebar drill-down applies the same comma-split-without-trim fix as useSecurityGroupViolations, but the existing regression test only exercised the Overview card path, leaving the sidebar's fixed line uncovered on new code (SonarCloud flagged 50% coverage on new code, below the 70% gate). Add a test that renders SecurityGroupPolicySummarySidebar directly with a policy whose matching standard is not first in its comma-separated annotation, and asserts the policy appears in the filtered list. Verified this test fails without the sidebar's .trim() fix and passes with it. Signed-off-by: Sunny Gupta <sungupta@redhat.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: stolostron/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: openshift-cherrypick-robot 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 |
|
@openshift-cherrypick-robot: The following test failed, say
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. |
Regarding: https://redhat.atlassian.net/browse/ACM-39806
This is an automated cherry-pick of #6535
/assign Randy424