-
Notifications
You must be signed in to change notification settings - Fork 666
OCPBUGS-63159: Prevent the display of events from projects other than the currently selected project #15836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCPBUGS-63159: Prevent the display of events from projects other than the currently selected project #15836
Conversation
|
@sg00dwin: This pull request references Jira Issue OCPBUGS-63159, 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. |
WalkthroughAdds a new test suite for event utilities and updates EventStream to close its WebSocket and clear the local event cache when effect dependencies change. No public API signatures were modified. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–30 minutes
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
/jira refresh |
|
@sg00dwin: This pull request references Jira Issue OCPBUGS-63159, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (2)
frontend/public/components/__tests__/events.spec.tsx(1 hunks)frontend/public/components/events.jsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
frontend/public/components/events.jsxfrontend/public/components/__tests__/events.spec.tsx
🧬 Code graph analysis (1)
frontend/public/components/__tests__/events.spec.tsx (1)
frontend/public/components/events.jsx (4)
sortEvents(61-63)sortEvents(61-63)typeFilter(66-72)typeFilter(66-72)
🔇 Additional comments (2)
frontend/public/components/events.jsx (1)
394-462: ClearingsortedEventson dependency changes correctly prevents stale cross-namespace eventsResetting the local cache with
setSortedEvents([])whennamespace/fieldSelector/mockchange ensures events from the previously selected project are not displayed while establishing the new stream. Combined with the existing WebSocket teardown, this is a clean, low-risk fix that matches the PR objective.frontend/public/components/__tests__/events.spec.tsx (1)
21-48: sortEvents tests give good coverage for cross-namespace orderingThe tests around
sortEvents(including the “Integration with namespace filtering” block) exercise the key ordering behavior across namespaces and verify that namespace-based filtering preserves sort order. This should help prevent regressions in event ordering for the scenarios described in the bug.Also applies to: 90-142
…selected project. Assisted by Claude
f27d919 to
c07ed11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
frontend/public/components/__tests__/events.spec.tsx (2)
21-48: Consider adding tests for fallback sorting behavior.The tests correctly validate timestamp-based sorting across namespaces. However, the
sortEventsimplementation uses multiple sort keys ([getLastTime, getFirstTime, 'name']), but the current tests only verifylastTimestampsorting.Consider adding tests for scenarios where
lastTimestampis identical and the fallback sorting byfirstTimeornamewould apply. This would ensure complete coverage of the sorting logic.Example test case to add:
it('falls back to firstTime and name when lastTimestamp is identical', () => { const events = [ { ...createMockEvent('ns', 'event-b', 'uid1', '2025-12-10T10:00:00Z'), firstTimestamp: '2025-12-10T09:00:00Z' }, { ...createMockEvent('ns', 'event-a', 'uid2', '2025-12-10T10:00:00Z'), firstTimestamp: '2025-12-10T09:00:00Z' }, ]; const sorted = sortEvents(events); expect(sorted[0].metadata.name).toBe('event-a'); // sorted by name when timestamps match expect(sorted[1].metadata.name).toBe('event-b'); });
96-148: LGTM! Integration tests effectively validate namespace filtering.The integration tests thoroughly validate the PR objectives by demonstrating that:
- Events are sorted by timestamp across namespaces
- Namespace filtering preserves sort order
- Changing the namespace filter produces different results
These tests directly address the bug described in the PR title about preventing display of events from projects other than the currently selected project.
For added robustness, consider tests for edge cases:
it('handles empty event arrays', () => { const sorted = sortEvents([]); expect(sorted).toEqual([]); }); it('handles single event', () => { const event = createMockEvent('ns', 'event', 'uid', '2025-12-10T10:00:00Z'); const sorted = sortEvents([event]); expect(sorted).toHaveLength(1); expect(sorted[0]).toBe(event); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (2)
frontend/public/components/__tests__/events.spec.tsx(1 hunks)frontend/public/components/events.jsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/public/components/events.jsx
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
frontend/public/components/__tests__/events.spec.tsx
🧬 Code graph analysis (1)
frontend/public/components/__tests__/events.spec.tsx (1)
frontend/public/components/events.jsx (5)
sortEvents(61-63)sortEvents(61-63)typeFilter(66-72)typeFilter(66-72)filteredEvents(390-392)
🔇 Additional comments (3)
frontend/public/components/__tests__/events.spec.tsx (3)
1-2: LGTM!The imports are clean and properly reference the utility functions under test.
3-19: LGTM!The mock event helper is well-structured and creates realistic test fixtures. The previous concern about always including the
typeproperty has been properly addressed in the test at lines 82-93, where the type is explicitly removed via destructuring.
50-94: LGTM!The type filtering tests comprehensively cover all scenarios:
- 'all' filter behavior
- Specific type matching (normal/warning)
- Default handling when type property is missing
The previous review concern has been properly addressed at lines 82-93, where the
typeproperty is explicitly removed via destructuring before testing the default behavior. The test now correctly validates that events without atypeproperty are treated as 'normal' type.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhamilto, sg00dwin The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest-required |
|
/jira refresh |
|
@sg00dwin: This pull request references Jira Issue OCPBUGS-63159, which is invalid:
Comment 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. |
|
/jira refresh |
|
@sg00dwin: This pull request references Jira Issue OCPBUGS-63159, which is valid. 3 validation(s) were run on this bug
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. |
|
/cherrypick release-4.21 |
|
@sg00dwin: once the present PR merges, I will cherry-pick it on top of 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 kubernetes-sigs/prow repository. |
|
Needs backport to 4.20, 4.19 |
|
/verified later @yanpzhan |
|
@sg00dwin: This PR has been marked to be verified later by 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. |
|
/label acknowledge-critical-fixes-only |
|
/retest-required |
1 similar comment
|
/retest-required |
|
@sg00dwin: 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. |
|
@sg00dwin: Jira Issue OCPBUGS-63159: All pull requests linked via external trackers have merged: This pull request has the 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. |
|
@sg00dwin: new pull request created: #15867 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 kubernetes-sigs/prow repository. |
|
Fix included in accepted release 4.22.0-0.nightly-2025-12-21-224908 |
Includes tests for