OU-1409: feat: fetch lazily ai proposal for each row in the alert list#1014
OU-1409: feat: fetch lazily ai proposal for each row in the alert list#1014jgbernalp wants to merge 1 commit into
Conversation
|
@jgbernalp: This pull request references OU-1409 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set. 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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jgbernalp 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 |
|
Warning Review limit reached
More reviews will be available in 33 minutes and 40 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (12)
WalkthroughAdds alert fingerprinting helpers and tests, a proposal lookup hook, shared React Query provider wiring for alert pages, and alert-row dropdown actions for AI investigations. ChangesAI investigation proposals
Sequence Diagram(s)sequenceDiagram
participant User
participant KebabDropdown
participant AlertTableRow
participant useProposalCheck
participant buildQueryFn
participant ProposalModel
participant getProposalsUrl
User->>KebabDropdown: hover menu toggle
KebabDropdown->>AlertTableRow: invoke onMouseEnter
AlertTableRow->>useProposalCheck: prefetch()
useProposalCheck->>buildQueryFn: list ProposalModel items
buildQueryFn->>ProposalModel: fetch by namespace and labels
ProposalModel-->>buildQueryFn: items
buildQueryFn-->>useProposalCheck: query result
useProposalCheck-->>AlertTableRow: proposals, hasProposal, alertFingerprint
AlertTableRow->>getProposalsUrl: build proposals URL
AlertTableRow->>KebabDropdown: render "View AI Investigation"
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
web/src/components/alerting/AlertsPage.tsx (1)
326-333: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winScope query defaults to proposal query instead of page-wide client defaults.
retry: falseandrefetchOnWindowFocus: falseat client level apply to every query under Alerts; keeping these in the proposal hook avoids cross-feature coupling.🤖 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 `@web/src/components/alerting/AlertsPage.tsx` around lines 326 - 333, The QueryClient in AlertsPage is setting page-wide defaults that affect every query under Alerts, but these settings should only apply to the proposal query. Remove the query defaults from the QueryClient setup and move retry and refetchOnWindowFocus into the specific proposal hook or query options used for that fetch, so only that path is scoped; use the QueryClient and proposal query hook in AlertsPage to locate the affected configuration.web/src/components/CustomIcon.tsx (1)
18-34: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer a named export for the component.
The repo convention is named exports for React components (
export const ErrorAlert: FC<...>).CustomIconuses a default export, whichAlertTableRow.tsximports asimport CustomIcon from '../../CustomIcon'. Consider switching both to a named export for consistency.♻️ Proposed change
-const CustomIcon: FC<CustomIconProps> = ({ name, className }) => { +export const CustomIcon: FC<CustomIconProps> = ({ name, className }) => { const icon = icons[name]; @@ }; - -export default CustomIcon;Update the import in
AlertTableRow.tsx:-import CustomIcon from '../../CustomIcon'; +import { CustomIcon } from '../../CustomIcon';As per coding guidelines: "Functional component with FC type and named export".
🤖 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 `@web/src/components/CustomIcon.tsx` around lines 18 - 34, CustomIcon is using a default export, but the codebase convention is named exports for React FC components. Update CustomIcon to use a named export (matching patterns like ErrorAlert) and then change AlertTableRow to import the component by name instead of default. Keep the component signature and behavior unchanged; only adjust the export/import around CustomIcon.Source: Coding guidelines
🤖 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 `@web/src/components/alerting/AlertList/AlertTableRow.tsx`:
- Around line 75-85: The AlertTableRow dropdown is using translation calls for
AI Investigation labels that do not yet exist in the locale bundle. Add the
missing keys for “View AI Investigation” and “Loading investigations...” to the
monitoring plugin English locale so the t(...) lookups in AlertTableRow resolve
cleanly; use the existing translation structure in the locale JSON and then run
the translation test check to confirm the new keys are recognized.
- Around line 63-77: The AI Investigation dropdown link in AlertTableRow should
avoid building a query with an undefined proposal name. Update the proposalUrl
construction so the single-proposal path only uses the name when
proposals[0].metadata?.name is present, and otherwise falls back to the
fingerprint-based URL like the multi-proposal case. Keep the fix localized to
the hasProposal block and the getProposalsUrl / navigate flow.
In `@web/src/components/kebab-dropdown.tsx`:
- Around line 1-11: The KebabDropdown props currently reference the React
namespace for the dropdownItems type without importing it, which will trigger a
TypeScript error. Update the react import in KebabDropdown to bring in ReactNode
directly, and change the prop type to use that imported symbol instead of
React.ReactNode; follow the same import pattern used in TableToolbar to keep
type-only imports consistent.
---
Nitpick comments:
In `@web/src/components/alerting/AlertsPage.tsx`:
- Around line 326-333: The QueryClient in AlertsPage is setting page-wide
defaults that affect every query under Alerts, but these settings should only
apply to the proposal query. Remove the query defaults from the QueryClient
setup and move retry and refetchOnWindowFocus into the specific proposal hook or
query options used for that fetch, so only that path is scoped; use the
QueryClient and proposal query hook in AlertsPage to locate the affected
configuration.
In `@web/src/components/CustomIcon.tsx`:
- Around line 18-34: CustomIcon is using a default export, but the codebase
convention is named exports for React FC components. Update CustomIcon to use a
named export (matching patterns like ErrorAlert) and then change AlertTableRow
to import the component by name instead of default. Keep the component signature
and behavior unchanged; only adjust the export/import around CustomIcon.
🪄 Autofix (Beta)
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 YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: cca6579c-b991-4867-af50-a736e45a8006
📒 Files selected for processing (11)
web/src/components/CustomIcon.tsxweb/src/components/ai-proposals/alert-identifier.spec.tsweb/src/components/ai-proposals/alert-identifier.tsweb/src/components/ai-proposals/constants.tsweb/src/components/ai-proposals/useProposalCheck.tsweb/src/components/alerting/AlertList/AlertTableRow.tsxweb/src/components/alerting/AlertsPage.tsxweb/src/components/console/models/index.tsweb/src/components/data-test.tsweb/src/components/hooks/usePerspective.tsxweb/src/components/kebab-dropdown.tsx
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
de1f063 to
9a8903d
Compare
|
@jgbernalp: 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. |
Screen.Recording.2026-06-25.at.14.06.55.mov