Skip to content

fix: show notification inhibitor in details#3064

Merged
moshloop merged 1 commit into
mainfrom
fix/notification-inhibitor
Jul 14, 2026
Merged

fix: show notification inhibitor in details#3064
moshloop merged 1 commit into
mainfrom
fix/notification-inhibitor

Conversation

@adityathebe

@adityathebe adityathebe commented Jul 9, 2026

Copy link
Copy Markdown
Member

Notification history can mark a send as inhibited when another related notification already fired.

The backend records that inhibitor as parent_id, but the details panel only resolved silence metadata, so inhibited notifications did not show what caused the suppression.

Resolve the parent send-history record for inhibited notifications and render it as Inhibited By so users can see the resource that triggered the inhibition.

Summary by CodeRabbit

  • New Features

    • Added an “Inhibited By” row to notification details, including the related notification info and a “View notification” link when available.
    • Expanded Storybook stories to cover inhibited and sent states with realistic cached query data.
  • Bug Fixes

    • Added “Loading…” and “Unknown” fallbacks for inhibitor details based on availability.
  • Tests

    • Added unit tests verifying inhibited vs non-inhibited rendering, link construction, and related API call behavior.
    • Updated notification details fixtures to support the new scenarios.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aws-preview Ready Ready Preview Jul 14, 2026 12:44pm
flanksource-ui Ready Ready Preview Jul 14, 2026 12:44pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@adityathebe, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 reviews.

How do review 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 refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d1bae11a-cc91-429b-af52-bdcf599f3ec1

📥 Commits

Reviewing files that changed from the base of the PR and between 936e7ed and c6bc144.

📒 Files selected for processing (4)
  • src/components/Notifications/NotificationSendHistory/NotificationDetails.stories.tsx
  • src/components/Notifications/NotificationSendHistory/NotificationDetails.tsx
  • src/components/Notifications/NotificationSendHistory/__fixtures__/notificationDetails.ts
  • src/components/Notifications/NotificationSendHistory/__tests__/NotificationDetails.unit.test.tsx

Walkthrough

Adds an “Inhibited By” lookup to NotificationDetails for inhibited notifications, with notification fixtures, QueryClient-backed Storybook stories, and unit tests covering rendering and API-call behavior.

Changes

Inhibited By feature

Layer / File(s) Summary
Inhibitor query and rendering
src/components/Notifications/NotificationSendHistory/NotificationDetails.tsx
Fetches the parent notification for inhibited records and renders its resource details, loading state, fallback, and optional link.
Notification fixtures
src/components/Notifications/NotificationSendHistory/__fixtures__/notificationDetails.ts
Adds sent Pod and Deployment fixtures, including parent-child notification linkage.
Storybook stories
src/components/Notifications/NotificationSendHistory/NotificationDetails.stories.tsx
Adds QueryClient-backed Inhibited and Sent stories with seeded notification data.
Unit tests for inhibitor rendering
src/components/Notifications/NotificationSendHistory/__tests__/NotificationDetails.unit.test.tsx
Tests inhibited and non-inhibited rendering paths, API calls, resource text, and the generated notification link.

Sequence Diagram(s)

sequenceDiagram
  participant NotificationDetails
  participant ReactQuery
  participant API

  NotificationDetails->>NotificationDetails: check status === inhibited and parent_id
  NotificationDetails->>ReactQuery: useQuery(parent_id)
  ReactQuery->>API: getNotificationSendHistoryById(parent_id)
  API-->>ReactQuery: inhibitor notification data
  ReactQuery-->>NotificationDetails: data / isLoading
  NotificationDetails->>NotificationDetails: render Inhibited By / Loading / Unknown
Loading

Suggested reviewers: moshloop

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: showing the notification inhibitor in the details view.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/notification-inhibitor
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/notification-inhibitor

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (2)
src/components/Notifications/NotificationSendHistory/__tests__/NotificationDetails.unit.test.tsx (1)

43-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding tests for loading and error states.

The current tests cover the happy path (inhibited → fetch + render) and the negative case (non-inhibited → no fetch). Adding tests for the loading state (assert "Loading..." appears before resolution) and error state (mock rejection → "Unknown" or error text) would strengthen coverage for the conditional rendering branches in lines 196-218.

🤖 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
`@src/components/Notifications/NotificationSendHistory/__tests__/NotificationDetails.unit.test.tsx`
around lines 43 - 69, Add unit tests in NotificationDetails.unit.test.tsx to
cover the conditional branches in NotificationDetails for the async fetch flow:
one test should assert the loading UI appears while
mockGetNotificationSendHistoryById is pending, and another should mock a
rejected resolution and verify the error/fallback display (such as "Unknown" or
the expected error text). Use renderNotificationDetails and the existing
mockGetNotificationSendHistoryById setup so the new tests exercise the same
inhibited-history path without changing the current happy-path or non-inhibited
assertions.
src/components/Notifications/NotificationSendHistory/NotificationDetails.tsx (1)

196-218: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider distinguishing query error from "no data" in the Inhibited By field.

When the inhibitor query fails (e.g., 404 or network error), inhibitor is undefined and isLoadingInhibitor is false, so the UI shows "Unknown" — indistinguishable from a successful query that returned no data. Adding an isError check from the query would let you display a more accurate message like "Failed to load" for error states.

♻️ Optional: surface error state
-  const { data: inhibitor, isLoading: isLoadingInhibitor } = useQuery({
+  const { data: inhibitor, isLoading: isLoadingInhibitor, isError: isInhibitorError } = useQuery({
     queryKey: ["notification_send_history_inhibitor", notification.parent_id],
     enabled: shouldFetchInhibitor,
     queryFn: () => getNotificationSendHistoryById(notification.parent_id!)
   });
               ) : isLoadingInhibitor ? (
                 "Loading..."
+              ) : isInhibitorError ? (
+                "Failed to load"
               ) : (
                 "Unknown"
               )
🤖 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 `@src/components/Notifications/NotificationSendHistory/NotificationDetails.tsx`
around lines 196 - 218, The Inhibited By display in NotificationDetails
currently treats query failures the same as empty results by falling back to
"Unknown" when inhibitor is undefined and isLoadingInhibitor is false. Update
the inhibitor query handling in NotificationDetails to expose and check the
query’s isError state alongside inhibitor and isLoadingInhibitor, and render a
distinct error message such as "Failed to load" when the fetch fails while
keeping "Unknown" only for successful no-data cases.
🤖 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.

Nitpick comments:
In
`@src/components/Notifications/NotificationSendHistory/__tests__/NotificationDetails.unit.test.tsx`:
- Around line 43-69: Add unit tests in NotificationDetails.unit.test.tsx to
cover the conditional branches in NotificationDetails for the async fetch flow:
one test should assert the loading UI appears while
mockGetNotificationSendHistoryById is pending, and another should mock a
rejected resolution and verify the error/fallback display (such as "Unknown" or
the expected error text). Use renderNotificationDetails and the existing
mockGetNotificationSendHistoryById setup so the new tests exercise the same
inhibited-history path without changing the current happy-path or non-inhibited
assertions.

In
`@src/components/Notifications/NotificationSendHistory/NotificationDetails.tsx`:
- Around line 196-218: The Inhibited By display in NotificationDetails currently
treats query failures the same as empty results by falling back to "Unknown"
when inhibitor is undefined and isLoadingInhibitor is false. Update the
inhibitor query handling in NotificationDetails to expose and check the query’s
isError state alongside inhibitor and isLoadingInhibitor, and render a distinct
error message such as "Failed to load" when the fetch fails while keeping
"Unknown" only for successful no-data cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e6160312-24d8-4c4b-94bd-f206f3bbab20

📥 Commits

Reviewing files that changed from the base of the PR and between 6abec13 and 7fce455.

📒 Files selected for processing (4)
  • src/components/Notifications/NotificationSendHistory/NotificationDetails.stories.tsx
  • src/components/Notifications/NotificationSendHistory/NotificationDetails.tsx
  • src/components/Notifications/NotificationSendHistory/__fixtures__/notificationDetails.ts
  • src/components/Notifications/NotificationSendHistory/__tests__/NotificationDetails.unit.test.tsx

@adityathebe
adityathebe force-pushed the fix/notification-inhibitor branch from 936e7ed to c6bc144 Compare July 14, 2026 12:41
@moshloop
moshloop merged commit 10d4e77 into main Jul 14, 2026
16 of 18 checks passed
@moshloop
moshloop deleted the fix/notification-inhibitor branch July 14, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants