crbench//

← all cases

Notification Rule Processing Engine

Tier 2 easy go · local · real merged PR from grafana/grafana #106778

Ground-truth defects

d1 · other · low
The rendered GrafanaRuleListItem is missing the required key prop for React list items. This can cause rendering issues when the list order changes.
d2 · other · medium
RuleActionsButtons is invoked with only promRule, but SilenceGrafanaRuleDrawer inside RuleActionsButtons still depends on a Grafana Ruler rule being present, so for Grafana rules coming from list views the 'Silence notifications' menu entry (now driven by Grafana Prom abilities) will toggle showSilenceDrawer without ever rendering the drawer. This means clicking 'Silence notifications' for these rules has no visible effect, even when abilities indicate silencing is allowed.
d3 · correctness · medium
`useAllAlertRuleAbilities` is rewritten to delegate to an implementation that hardcodes `const isFederated = false`, deleting the real `isFederatedRuleGroup(rule.group)` check that fed `immutableRule`. Federated Mimir rules are therefore treated as editable: the rule list renders an Edit button that opens the rule editor, where pre-diff the ability was NotSupported and no button appeared.

The change under review

diff (truncated — full diff)
diff --git a/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx b/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx
index 5b6a8943da..77e751238c 100644
--- a/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx
+++ b/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx
@@ -10,7 +10,12 @@ import { useRulePluginLinkExtension } from 'app/features/alerting/unified/plugin
 import { Rule, RuleGroupIdentifierV2, RuleIdentifier } from 'app/types/unified-alerting';
 import { PromAlertingRuleState, RulerRuleDTO } from 'app/types/unified-alerting-dto';
 
-import { AlertRuleAction, useRulerRuleAbility } from '../../hooks/useAbilities';
+import {
+  AlertRuleAction,
+  skipToken,
+  useGrafanaPromRuleAbilities,
+  useRulerRuleAbilities,
+} from '../../hooks/useAbilities';
 import { createShareLink, isLocalDevEnv, isOpenSourceEdition } from '../../utils/misc';
 import * as ruleId from '../../utils/rule-id';
 import { prometheusRuleType, rulerRuleType } from '../../utils/rules';
@@ -33,6 +38,8 @@ interface Props {
 /**
  * Get a list of menu items + divider elements for rendering in an alert rule's
  * dropdown menu
+ * If the consumer of this component comes from the alert list view, we need to use promRule to check abilities and permissions,
+ * as we have removed all requests to the ruler API in the list view.
  */
 const AlertRuleMenu = ({
   promRule,
@@ -46,29 +53,51 @@ const AlertRuleMenu = ({
   buttonSize,
   fill,
 }: Props) => {
-  // check all abilities and permissions
-  const [pauseSupported, pauseAllowed] = useRulerRuleAbility(rulerRule, groupIdentifier, AlertRuleAction.Pause);
-  const canPause = pauseSupported && pauseAllowed;
-
-  const [deleteSupported, deleteAllowed] = useRulerRuleAbility(rulerRule, groupIdentifier, AlertRuleAction.Delete);
-  const canDelete = deleteSupported && deleteAllowed;
-
-  const [duplicateSupported, duplicateAllowed] = useRulerRuleAbility(
-    rulerRule,
-    groupIdentifier,
-    AlertRuleAction.Duplicate
-  );
-  const canDuplicate = duplicateSupported && duplicateAllowed;
-
-  const [silenceSupported, silenceAllowed] = useRulerRuleAbility(rulerRule, groupIdentifier, AlertRuleAction.Silence);
-  const canSilence = silenceSupported && silenceAllowed;
-
-  const [exportSupported, exportAllowed] = useRulerRuleAbility(
-    rulerRule,
-    groupIdentifier,
-    AlertRuleAction.ModifyExport
-  );
-  const canExport = exportSupported && exportAllowed;
+  // check all abilities and permissions using rulerRule
+  const [rulerPauseAbility, rulerDeleteAbility, rulerDuplicateAbility, rulerSilenceAbility, rulerExportAbility] =
+    useRulerRuleAbilities(rulerRule, groupIdentifier, [
+      AlertRuleAction.Pause,
+      AlertRuleAction.Delete,
+      AlertRuleAction.Duplicate,
+      AlertRuleAction.Silence,
+      AlertRuleAction.ModifyExport,
+    ]);
+
+  // check all abilities and permissions using promRule
+  const [
+    grafanaPauseAbility,
+    grafanaDeleteAbility,
+    grafanaDuplicateAbility,
+    grafanaSilenceAbility,
+    grafanaExportAbility,
+  ] = useGrafanaPromRuleAbilities(prometheusRuleType.grafana.rule(promRule) ? promRule : skipToken, [
+    AlertRuleAction.Pause,
+    AlertRuleAction.Delete,
+    AlertRuleAction.Duplicate,
+    AlertRuleAction.Silence,
+    AlertRuleAction.ModifyExport,
+  ]);
+
+  const [pauseSupported, pauseAllowed] = rulerPauseAbility;
+  const [grafanaPauseSupported, grafanaPauseAllowed] = grafanaPauseAbility;
+  const canPause = (pauseSupported && pauseAllowed) || (grafanaPauseSupported && grafanaPauseAllowed);
+
+  const [deleteSupported, deleteAllowed] = rulerDeleteAbility;
+  const [grafanaDeleteSupported, grafanaDeleteAllowed] = grafanaDeleteAbility;
+  const canDelete = (deleteSupported && deleteAllowed) || (grafanaDeleteSupported && grafanaDeleteAllowed);
+
+  const [duplicateSupported, duplicateAllowed] = rulerDuplicateAbility;
+  const [grafanaDuplicateSupported, grafanaDuplicateAllowed] = grafanaDuplicateAbility;
+  const canDuplicate =
+    (duplicateSupported && duplicateAllowed) || (grafanaDuplicateSupported && grafanaDuplicateAllowed);
+
+  const [silenceSupported, silenceAllowed] = rulerSilenceAbility;
+  const [grafanaSilenceSupported, grafanaSilenceAllowed] = grafanaSilenceAbility;
+  const canSilence = (silenceSupported && silenceAllowed) || (grafanaSilenceSupported && grafanaSilenceAllowed);
+
+  const [exportSupported, exportAllowed] = rulerExportAbility;
+  const [grafanaExportSupported, grafanaExportAllowed] = grafanaExportAbility;
+  const canExport = (exportSupported && exportAllowed) || (grafanaExportSupported && grafanaExportAllowed);
 
   const ruleExtensionLinks = useRulePluginLinkExtension(promRule, groupIdentifier);
 
diff --git a/public/app/features/alerting/unified/components/rules/RuleDetails.test.tsx b/public/app/features/alerting/unified/components/rules/RuleDetails.test.tsx
index 6d55821a49..ac0d694f60 100644
--- a/public/app/features/alerting/unified/components/rules/RuleDetails.test.tsx
+++ b/public/app/features/alerting/unified/components/rules/RuleDetails.test.tsx
@@ -7,6 +7,7 @@ import { setupMswServer } from 'app/features/alerting/unified/mockApi';
 
 import { useIsRuleEditable } from '../../hooks/useIsRuleEditable';
 import { getCloudRule, getGrafanaRule } from '../../mocks';
+import { mimirDataSource } from '../../mocks/server/configure';
 
 import { RuleDetails } from './RuleDetails';
 
@@ -32,6 +33,8 @@ const ui = {
 
 setupMswServer();
 
+const { dataSource: mimirDs } = mimirDataSource();
+
 beforeAll(() => {
   jest.clearAllMocks();
 });
@@ -81,7 +84,7 @@ describe('RuleDetails RBAC', () => {
   });
 
   describe('Cloud rules action buttons', () => {
-    const cloudRule = getCloudRule({ name: 'Cloud' });
+    const cloudRule = getCloudRule({ name: 'Cloud' }, { rulesSource: mimirDs });
 
     it('Should not render Edit button for users with the update permission', async () => {
       // Arrange
diff --git a/public/app/features/alerting/unified/components/rules/RulesTable.test.tsx b/public/app/features/alerting/unified/components/rules/RulesTable.test.tsx
index 22cb1bb8b7..a4be47bbf8 100644
--- a/public/app/features/alerting/unified/components/rules/RulesTable.test.tsx
+++ b/public/app/features/alerting/unified/components/rules/RulesTable.test.tsx
@@ -4,7 +4,14 @@ import { byRole } from 'testing-library-selector';
 import { setPluginLinksHook } from '@grafana/runtime';
 import { setupMswServer } from 'app/features/alerting/unified/mockApi';
 
-import { AlertRuleAction, useAlertRuleAbility, useRulerRuleAbility } from '../../hooks/useAbilities';
+import {
+  AlertRuleAction,
+  useAlertRuleAbility,
+  useGrafanaPromRuleAbilities,
+  useGrafanaPromRuleAbility,
+  useRulerRuleAbilities,
+  useRulerRuleAbility,
+} from '../../hooks/useAbilities';
 import { getCloudRule, getGrafanaRule } from '../../mocks';
 import { mimirDataSource } from '../../mocks/server/configure';
 
@@ -13,11 +20,15 @@ import { RulesTable } from './RulesTable';
 jest.mock('../../hooks/useAbilities');
 
 const mocks = {
-  // This is a bit unfortunate, but we need to mock both abilities
-  // RuleActionButtons still needs to use the useAlertRuleAbility hook
-  // whereas AlertRuleMenu has already been refactored to use useRulerRuleAbility
+  // Mock the hooks that are actually used by the components:
+  // RuleActionsButtons uses: useAlertRuleAbility (singular)
+  // AlertRuleMenu uses: useRulerRuleAbilities and useGrafanaPromRuleAbilities (plural)
+  // We can also use useGrafanaPromRuleAbility (singular) for simpler mocking
   useRulerRuleAbility: jest.mocked(useRulerRuleAbility),
   useAlertRuleAbility: jest.mocked(useAlertRuleAbility),
+  useGrafanaPromRuleAbility: jest.mocked(useGrafanaPromRuleAbility),
+  useRulerRuleAbilities: jest.mocked(useRulerRuleAbilities),
+  useGrafanaPromRuleAbilities: jest.mocked(useGrafanaPromRuleAbilities),
 };
 
 setPluginLinksHook(() => ({
@@ -46,18 +57,40 @@ describe('RulesTable RBAC', () => {
     jest.clearAllMocks();
     jest.restoreAllMocks();
     jest.resetAllMocks();
+
+    // Set up default neutral mocks for all hooks
+    // Singular hooks (used by RuleActionsButtons and can simplify mocking)
+    mocks.useAlertRuleAbility.mockReturnValue([false, false]);
+    mocks.useRulerRuleAbility.mockReturnValue([false, false]);
+    mocks.useGrafanaPromRuleAbility.mockReturnValue([false, false]);
+
+    // Plural hooks (used by AlertRuleMenu) - need to return arrays based on input actions
+    mocks.useRulerRuleAbilities.mockImplementation((_rule, _groupIdentifier, actions) => {
+      return actions.map(() => [false, false]);
+    });
+    mocks.useGrafanaPromRuleAbilities.mockImplementation((_rule, actions) => {
+      return actions.map(() => [false, false]);
+    });
   });
 
   describe('Grafana rules action buttons', () => {
     const grafanaRule = getGrafanaRule({ name: 'Grafana' });
 
     it('Should not render Edit button for users without the update permission', async () => {
-      mocks.useRulerRuleAbility.mockImplementation((_rule, _groupIdentifier, action) => {
+      // Mock the specific hooks needed for Grafana rules
+      // Using singular hook for simpler mocking
+      mocks.useAlertRuleAbility.mockImplementation((rule, action) => {
         return action === AlertRuleAction.Update ? [true, false] : [true, true];
       });
-      mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
+      mocks.useGrafanaPromRuleAbility.mockImplementation((rule, action) => {
         return action === AlertRuleAction.Update ? [true, false] : [true, true];
       });
+      // Still need plural hook for AlertRuleMenu component
+      mocks.useGrafanaPromRuleAbilities.mockImplementation((rule, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Update ? [true, false] : [true, true];
+        });
+      });
 
       render(<RulesTable rules={[grafanaRule]} />);
 
@@ -65,11 +98,14 @@ describe('RulesTable RBAC', () => {
     });
 
     it('Should not render Delete button for users without the delete permission', async () => {
-      mocks.useRulerRuleAbility.mockImplementation((_rule, _groupIdentifier, action) => {
+      // Mock the specific hooks needed for Grafana rules
+      mocks.useAlertRuleAbility.mockImplementation((rule, action) => {
         return action === AlertRuleAction.Delete ? [true, false] : [true, true];
       });
-      mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
-        return action === AlertRuleAction.Delete ? [true, false] : [true, true];
+      mocks.useGrafanaPromRuleAbilities.mockImplementation((rule, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Delete ? [true, false] : [true, true];
+        });
       });
 
       render(<RulesTable rules={[grafanaRule]} />);
@@ -80,11 +116,14 @@ describe('RulesTable RBAC', () => {
     });
 
     it('Should render Edit button for users with the update permission', async () => {
-      mocks.useRulerRuleAbility.mockImplementation((_rule, _groupIdentifier, action) => {
+      // Mock the specific hooks needed for Grafana rules
+      mocks.useAlertRuleAbility.mockImplementation((rule, action) => {
         return action === AlertRuleAction.Update ? [true, true] : [false, false];
       });
-      mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
-        return action === AlertRuleAction.Update ? [true, true] : [false, false];
+      mocks.useGrafanaPromRuleAbilities.mockImplementation((rule, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Update ? [true, true] : [false, false];
+        });
       });
 
       render(<RulesTable rules={[grafanaRule]} />);
@@ -93,11 +132,14 @@ describe('RulesTable RBAC', () => {
     });
 
     it('Should render Delete button for users with the delete permission', async () => {
-      mocks.useRulerRuleAbility.mockImplementation((_rule, _groupIdentifier, action) => {
+      // Mock the specific hooks needed for Grafana rules
+      mocks.useAlertRuleAbility.mockImplementation((rule, action) => {
         return action === AlertRuleAction.Delete ? [true, true] : [false, false];
       });
-      mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
-        return action === AlertRuleAction.Delete ? [true, true] : [false, false];
+      mocks.useGrafanaPromRuleAbilities.mockImplementation((rule, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Delete ? [true, true] : [false, false];
+        });
       });
 
       render(<RulesTable rules={[grafanaRule]} />);
@@ -123,11 +165,15 @@ describe('RulesTable RBAC', () => {
       };
 
       beforeEach(() => {
-        mocks.useRulerRuleAbility.mockImplementation(() => {
-          return [true, true];
+        // Mock all hooks needed for the creating/deleting state tests
+        mocks.useRulerRuleAbility.mockImplementation(() => [true, true]);
+        mocks.useAlertRuleAbility.mockImplementation(() => [true, true]);
+        // Mock plural hooks for AlertRuleMenu
+        mocks.useRulerRuleAbilities.mockImplementation((_rule, _groupIdentifier, actions) => {
+          return actions.map(() => [true, true]);
         });
-        mocks.useAlertRuleAbility.mockImplementation(() => {
-          return [true, true];
+        mocks.useGrafanaPromRuleAbilities.mockImplementation((_rule, actions) => {
+          return actions.map(() => [true, true]);
         });
       });
 
@@ -164,6 +210,12 @@ describe('RulesTable RBAC', () => {
       mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
         return action === AlertRuleAction.Update ? [true, false] : [true, true];
       });
+      // Cloud rules only need useRulerRuleAbilities mock (useGrafanaPromRuleAbilities gets skipToken)
+      mocks.useRulerRuleAbilities.mockImplementation((_rule, _groupIdentifier, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Update ? [true, false] : [true, true];
+        });
+      });
 
       render(<RulesTable rules={[cloudRule]} />);
 
@@ -177,6 +229,12 @@ describe('RulesTable RBAC', () => {
       mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
         return action === AlertRuleAction.Delete ? [true, false] : [true, true];
       });
+      // Cloud rules only need useRulerRuleAbilities mock (useGrafanaPromRuleAbilities gets skipToken)
+      mocks.useRulerRuleAbilities.mockImplementation((_rule, _groupIdentifier, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Delete ? [true, false] : [true, true];
+        });
+      });
 
       render(<RulesTable rules={[cloudRule]} />);
 
@@ -191,6 +249,12 @@ describe('RulesTable RBAC', () => {
       mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
         return action === AlertRuleAction.Update ? [true, true] : [false, false];
       });
+      // Cloud rules only need useRulerRuleAbilities mock (useGrafanaPromRuleAbilities gets skipToken)
+      mocks.useRulerRuleAbilities.mockImplementation((_rule, _groupIdentifier, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Update ? [true, true] : [false, false];
+        });
+      });
 
       render(<RulesTable rules={[cloudRule]} />);
 
@@ -204,6 +268,12 @@ describe('RulesTable RBAC', () => {
       mocks.useAlertRuleAbility.mockImplementation((_rule, action) => {
         return action === AlertRuleAction.Delete ? [true, true] : [false, false];
       });
+      // Cloud rules only need useRulerRuleAbilities mock (useGrafanaPromRuleAbilities gets skipToken)
+      mocks.useRulerRuleAbilities.mockImplementation((_rule, _groupIdentifier, actions) => {
+        return actions.map((action) => {
+          return action === AlertRuleAction.Delete ? [true, true] : [false, false];
+        });
+      });
 
       render(<RulesTable rules={[cloudRule]} />);
 
diff --git a/public/app/features/alerting/unified/hooks/useAbilities.ts b/public/app/features/alerting/unified/hooks/useAbilities.ts
index c2e96434d8..91fbe9cc60 100644
--- a/public/app/features/alerting/unified/hooks/useAbilities.ts
+++ b/public/app/features/alerting/unified/hooks/useAbilities.ts
@@ -14,15 +14,20 @@ import { useFolder } from 'app/features/alerting/unified/hooks/useFolder';
 import { AlertmanagerChoice } from 'app/plugins/datasource/alertmanager/types';
 import { AccessControlAction } from 'app/types';
 import { CombinedRule, RuleGroupIdentifierV2 } from 'app/types/unified-alerting';
-import { RulerRuleDTO } from 'app/types/unified-alerting-dto';
+import { GrafanaPromRuleDTO, RulerRuleDTO } from 'app/types/unified-alerting-dto';
 
 import { alertmanagerApi } from '../api/alertmanagerApi';
 import { useAlertmanager } from '../state/AlertmanagerContext';
 import { getInstancesPermissions, getNotificationsPermissions, getRulesPermissions } from '../utils/access-control';
-import { getRulesSourceName } from '../utils/datasource';
-import { getGroupOriginName } from '../utils/groupIdentifier';
+import { getGroupOriginName, groupIdentifier } from '../utils/groupIdentifier';
 import { isAdmin } from '../utils/misc';
-import { isFederatedRuleGroup, isPluginProvidedRule, rulerRuleType } from '../utils/rules';
+import {
+  isPluginProvidedRule,
+  isProvisionedPromRule,
+  isProvisionedRule,
+  prometheusRuleType,
+  rulerRuleType,
+} from '../utils/rules';
 
 import { useIsRuleEditable } from './useIsRuleEditable';
 
@@ -200,7 +205,7 @@ export function useRulerRuleAbility(
 }
 
 export function useRulerRuleAbilities(
-  rule: RulerRuleDTO,
+  rule: RulerRuleDTO | undefined,
   groupIdentifier: RuleGroupIdentifierV2,
   actions: AlertRuleAction[]
 ): Ability[] {
@@ -211,28 +216,35 @@ export function useRulerRuleAbilities(
   }, [abilities, actions]);
 }
 
-// This hook is being called a lot in different places
-// In some cases multiple times for ~80 rules (e.g. on the list page)
-// We need to investigate further if some of these calls are redundant
-// In the meantime, memoizing the result helps
+/**
+ * @deprecated Use {@link useAllRulerRuleAbilities} instead
+ */
 export function useAllAlertRuleAbilities(rule: CombinedRule): Abilities<AlertRuleAction> {
-  const rulesSourceName = getRulesSourceName(rule.namespace.rulesSource);
+  // This hook is being called a lot in different places
+  // In some cases multiple times for ~80 rules (e.g. on the list page)
+  // We need to investigate further if some of these calls are redundant
+  // In the meantime, memoizing the result helps
+  const groupIdentifierV2 = useMemo(() => groupIdentifier.fromCombinedRule(rule), [rule]);
+  return useAllRulerRuleAbilities(rule.rulerRule, groupIdentifierV2);
+}
 
-  const {
-    isEditable,
-    isRemovable,
-    isRulerAvailable = false,
-    loading,
-  } = useIsRuleEditable(rulesSourceName, rule.rulerRule);
+export function useAllRulerRuleAbilities(
+  rule: RulerRuleDTO | undefined,
+  groupIdentifier: RuleGroupIdentifierV2
+): Abilities<AlertRuleAction> {
+  const rulesSourceName = getGroupOriginName(groupIdentifier);
+
+  const { isEditable, isRemovable, isRulerAvailable = false, loading } = useIsRuleEditable(rulesSourceName, rule);
   const [_, exportAllowed] = useAlertingAbility(AlertingAction.ExportGrafanaManagedRules);
-  const canSilence = useCanSilence(rule.rulerRule);
+  const canSilence = useCanSilence(rule);
 
   const abilities = useMemo<Abilities<AlertRuleAction>>(() => {
-    const isProvisioned =
-      rulerRuleType.grafana.rule(rule.rulerRule) && Boolean(rule.rulerRule.grafana_alert.provenance);
-    const isFederated = isFederatedRuleGroup(rule.group);
-    const isGrafanaManagedAlertRule = rulerRuleType.grafana.rule(rule.rulerRule);
-    const isPluginProvided = isPluginProvidedRule(rule.rulerRule);
+    const isProvisioned = rule ? isProvisionedRule(rule) : false;
+    // TODO: Add support for federated rules
+    // const isFederated = isFederatedRuleGroup();
+    const isFederated = false;
+    const isGrafanaManagedAlertRule = rulerRuleType.grafana.rule(rule);
+    const isPluginProvided = isPluginProvidedRule(rule);
 
     // if a rule is either provisioned, federated or provided by a plugin rule, we don't allow it to be removed or edited
     const immutableRule = isProvisioned || isFederated || isPluginProvided;
@@ -263,39 +275,44 @@ export function useAllAlertRuleAbilities(rule: CombinedRule): Abilities<AlertRul
     };
 
     return abilities;
-  }, [rule, loading, isRulerAvailable, isEditable, isRemovable, rulesSourceName, exportAllowed, canSilence]);
+  }, [rule, loading, isRulerAvailable, rulesSourceName, isEditable, isRemovable, canSilence, exportAllowed]);
 
   return abilities;
 }
 
-export function useAllRulerRuleAbilities(
-  rule: RulerRuleDTO | undefined,
-  groupIdentifier: RuleGroupIdentifierV2
-): Abilities<AlertRuleAction> {
-  const rulesSourceName = getGroupOriginName(groupIdentifier);
-
-  const { isEditable, isRemovable, isRulerAvailable = false, loading } = useIsRuleEditable(rulesSourceName, rule);
+/**
+ * Hook for checking abilities on Grafana Prometheus rules (GrafanaPromRuleDTO)
+ * This is the next version of useAllRulerRuleAbilities designed to work with GrafanaPromRuleDTO
+ */
+export function useAllGrafanaPromRuleAbilities(rule: GrafanaPromRuleDTO | undefined): Abilities<AlertRuleAction> {
+  // For GrafanaPromRuleDTO, we use useIsGrafanaPromRuleEditable instead
+  const { isEditable, isRemovable, loading } = useIsGrafanaPromRuleEditable(rule); // duplicate
   const [_, exportAllowed] = useAlertingAbility(AlertingAction.ExportGrafanaManagedRules);
-  const canSilence = useCanSilence(rule);
+
+  const silenceSupported = useGrafanaRulesSilenceSupport();
+  const canSilenceInFolder = useCanSilenceInFolder(rule?.folderUid);
 
   const abilities = useMemo<Abilities<AlertRuleAction>>(() => {
-    const isProvisioned = rulerRuleType.grafana.rule(rule) && Boolean(rule.grafana_alert.provenance);
-    // const isFederated = isFederatedRuleGroup();
+    const isProvisioned = rule ? isProvisionedPromRule(rule) : false;
+
+    // Note: Grafana managed rules can't be federated - this is strictly a Mimir feature
+    // See: https://grafana.com/docs/mimir/latest/references/architecture/components/ruler/#federated-rule-groups
     const isFederated = false;
-    const isGrafanaManagedAlertRule = rulerRuleType.grafana.rule(rule);
+    // All GrafanaPromRuleDTO rules are Grafana-managed by definition
+    const isAlertingRule = prometheusRuleType.grafana.alertingRule(rule);
     const isPluginProvided = isPluginProvidedRule(rule);
 
     // if a rule is either provisioned, federated or provided by a plugin rule, we don't allow it to be removed or edited
     const immutableRule = isProvisioned || isFederated || isPluginProvided;
 
-    // while we gather info, pretend it's not supported
-    const MaybeSupported = loading ? NotSupported : isRulerAvailable;
+    // GrafanaPromRuleDTO rules are always supported (no loading state for ruler availability)
+    const MaybeSupported = loading ? NotSupported : AlwaysSupported;
     const MaybeSupportedUnlessImmutable = immutableRule ? NotSupported : MaybeSupported;
 
     // Creating duplicates of plugin-provided rules does not seem to make a lot of sense
     const duplicateSupported = isPluginProvided ? NotSupported : MaybeSupported;
 
-    const rulesPermissions = getRulesPermissions(rulesSourceName);
+    const rulesPermissions = getRulesPermissions('grafana');
 
     const abilities: Abilities<AlertRuleAction> = {
       [AlertRuleAction.Duplicate]: toAbility(duplicateSupported, rulesPermissions.create),
@@ -303,22 +320,91 @@ export function useAllRulerRuleAbilities(
       [AlertRuleAction.Update]: [MaybeSupportedUnlessImmutable, isEditable ?? false],
       [AlertRuleAction.Delete]: [MaybeSupportedUnlessImmutable, isRemovable ?? false],
       [AlertRuleAction.Explore]: toAbility(AlwaysSupported, AccessControlAction.DataSourcesExplore),
-      [AlertRuleAction.Silence]: canSilence,
-      [AlertRuleAction.ModifyExport]: [isGrafanaManagedAlertRule, exportAllowed],
-      [AlertRuleAction.Pause]: [MaybeSupportedUnlessImmutable && isGrafanaManagedAlertRule, isEditable ?? false],
-      [AlertRuleAction.Restore]: [MaybeSupportedUnlessImmutable && isGrafanaManagedAlertRule, isEditable ?? false],
+      [AlertRuleAction.Silence]: [silenceSupported, canSilenceInFolder && isAlertingRule],

Leaderboard for this case

easy · 6 of 9 bots fully caught it (67% solve rate) · 89% avg coverage.

#BotResultCaughtCoverageFindingsFalse alarms
1 Cubic solved 3/3 100.0% 5 0
2 cursor solved 3/3 100.0% 6 0
3 Drape (Deep Review) solved 3/3 100.0% 8 0
4 Drape (Review) solved 3/3 100.0% 9 0
5 Mjolnir (Opus 5.5) solved 3/3 100.0% 9 0
6 qodo solved 3/3 100.0% 4 0
7 Claude Code (Opus 5.5) partial 2/3 80.0% 6 0
8 greptile partial 2/3 80.0% 2 0
9 Mjolnir (Sonnet 5.5) partial 2/3 60.0% 6 0

Bot results

Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✗ —
d2 medium ✓ off by one
d3 medium ✓ off by one
valid · matches d2 · impact medium
valid · impact high
The new GrafanaRuleListItem passes only promRule to RuleActionsButtons, so rulerRule is undefined. The Pause item also requires rulerRuleType.grafana.rule(rulerRule), and the Delete item requires rulerRule, so both disappear even when the prom-based abilities grant them. Before this change, rulerRule was passed. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
valid · matches d3 · impact medium
valid · impact medium
fromCombinedRule calls getDatasourceAPIUid, which throws `Datasource not found` for an unregistered datasource name. The old code only called getRulesSourceName. The RuleDetails test had to register mimirDs to work around this. The Grafana-without-ruler example does not throw, because the name 'grafana' is special-cased, but an unresolved datasource does. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The ruler version gated these actions on rulerRuleType.grafana.rule, which includes recording rules. The new prom version gates them on grafana.alertingRule, and the list view now uses only the prom path, so Grafana recording rules lose Export and Pause. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The old code passed `{ returnTo }` (from createReturnTo()) to createRelativeUrl. The new item drops it, so the detail page loses the return-to-list context. [grounded: diff] [consensus 3/3: valid=3]
raw comments (6)
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:101
The list view now passes only `promRule`, without `rule`. `AlertRuleMenu` uses the prom-based ability, so `canSilence` is true and the 'Silence notifications' menu item is shown. Clicking it calls `setShowSilenceDrawer(true)`, but the drawer only renders when `rulerRuleType.grafana.alertingRule(rule)` is true. With `rule` undefined that check is false, so the click does nothing for every Grafana rule in the list.
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:133
The prom-based Pause and Delete abilities are computed, but the menu items still require a `rulerRule`: Pause checks `rulerRuleType.grafana.rule(rulerRule)` and Delete checks `canDelete && rulerRule`. The new list view no longer supplies `rulerRule`, so Pause/Resume and Delete silently disappear for all Grafana rules in the list, even for users who have permission.
public/app/features/alerting/unified/hooks/useAbilities.ts:244
`useAllAlertRuleAbilities` now delegates to `useAllRulerRuleAbilities`, which hardcodes `isFederated = false`. The old code used `isFederatedRuleGroup(rule.group)`. As a result, rules in federated Mimir/Cortex rule groups (with `source_tenants`) are no longer treated as immutable, and Update/Delete/Pause become available on them in the legacy list and detail views. Editing them can corrupt or misroute federated groups.
public/app/features/alerting/unified/hooks/useAbilities.ts:227
`useAllAlertRuleAbilities` now calls `groupIdentifier.fromCombinedRule(rule)`, which uses `getDatasourceAPIUid`. That function throws `Datasource "..." not found` when the rules source name doesn't map to a registered datasource. Previously the hook only used `getRulesSourceName`, which never throws. Any CombinedRule whose datasource can't be resolved by name now crashes the component tree, e.g. Grafana rules without a `rulerRule` that fall into the datasource branch, or a removed/renamed datasource. The RuleDetails test had to be changed to register a Mimir datasource to work around this.
public/app/features/alerting/unified/hooks/useAbilities.ts:323
In `useAllGrafanaPromRuleAbilities`, ModifyExport, Pause and Restore are gated on `prometheusRuleType.grafana.alertingRule`. The ruler-based version used `rulerRuleType.grafana.rule`, which also covers Grafana-managed recording rules. Recording rules in the new list view therefore lose the Export and Pause actions.
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:40
The rule view link is now `createRelativeUrl(`/alerting/grafana/${uid}/view`)` without the `returnTo` parameter the previous implementation added. Navigating back from the rule detail page no longer returns to the filtered list state.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 medium ✓ exact
d3 medium ✓ off by one
valid · matches d3 · impact medium
valid · matches d1 · impact low
valid · matches d2 · impact medium
valid · impact low
`deleteRuleGroupFromNamespace` in alertRuleApi.ts only invalidates the RuleGroup, RuleNamespace and DeletedRules tags, never GrafanaPrometheusGroups. Before this change, the loader matched against the ruler response, which does get refetched, so rules missing from the ruler showed as 'Deleting' with no actions. Now the loader renders only the cached Prometheus response, so after a group is deleted its rules show as normal, actionable items until the next poll. The change made this worse. [grounded: diff] [consensus 5/5: valid=5]
minor
The stale variable name and comment are real, and `getGrafanaRulerGroup` no longer has any callers. But this is a naming and dead-code cleanup request, not a behaviour bug. [grounded: tree public/app/features/alerting/unified/rule-list/hooks/prometheusGroupsGenerator.ts] [consensus 5/5: minor=5]
raw comments (6)
public/app/features/alerting/unified/hooks/useAbilities.ts:245
<!-- cubic:v=c86b78e7-51e3-471b-b4f0-be74af7bbb01 --> <!-- cubic:review-run=7597509d-9b6b-501a-8711-4b473f2737a9 --> <!-- metadata:{"confidence":10} --> P1: Federated Mimir rules are now treated as mutable because this hard-codes `isFederated` to `false`; retain the group metadata and call `isFederatedRuleGroup` before granting update and delete abilities. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At public/app/features/alerting/unified/hooks/useAbilities.ts, line 245: <comment>Federated Mimir rules are now treated as mutable because this hard-codes `isFederated` to `false`; retain the group metadata and call `isFederatedRuleGroup` before granting update and delete abilities.</comment> <file context> @@ -211,28 +216,35 @@ export function useRulerRuleAbilities( + const isProvisioned = rule ? isProvisionedRule(rule) : false; + // TODO: Add support for federated rules + // const isFederated = isFederatedRuleGroup(); + const isFederated = false; + const isGrafanaManagedAlertRule = rulerRuleType.grafana.rule(rule); + const isPluginProvided = isPluginProvidedRule(rule); </file context> ``` </details>
public/app/features/alerting/unified/rule-list/FilterView.tsx:157
<!-- cubic:v=ddefa17e-7389-406e-91ae-418fe4cbb065 --> <!-- cubic:review-run=7597509d-9b6b-501a-8711-4b473f2737a9 --> <!-- metadata:{"confidence":10} --> P2: Every Grafana result in this map now renders without a React key, producing a missing-key warning and leaving reconciliation dependent on array position. Pass the existing `key` value to `GrafanaRuleListItem`, as the other branches do. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At public/app/features/alerting/unified/rule-list/FilterView.tsx, line 157: <comment>Every Grafana result in this map now renders without a React key, producing a missing-key warning and leaving reconciliation dependent on array position. Pass the existing `key` value to `GrafanaRuleListItem`, as the other branches do.</comment> <file context> @@ -154,11 +154,11 @@ function FilterViewResults({ filterState }: FilterViewProps) { - <GrafanaRuleLoader - key={key} - ruleIdentifier={{ ruleSourceName: 'grafana', uid: rule.uid }} + <GrafanaRuleListItem + rule={rule} groupIdentifier={groupIdentifier} </file context> ``` </details>
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:133
<!-- cubic:v=f141d6b4-ed16-466d-aff3-e10233943162 --> <!-- cubic:review-run=7597509d-9b6b-501a-8711-4b473f2737a9 --> <!-- metadata:{"confidence":10} --> P2: When a Grafana rule is supplied only as `promRule`, the Silence menu item is shown but clicking it does nothing. Render the drawer from the Prom rule UID or suppress Silence until a compatible drawer path exists. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx, line 133: <comment>When a Grafana rule is supplied only as `promRule`, the Silence menu item is shown but clicking it does nothing. Render the drawer from the Prom rule UID or suppress Silence until a compatible drawer path exists.</comment> <file context> @@ -93,3 +114,38 @@ export function RuleActionsButtons({ compact, rule, promRule, groupIdentifier }: +function getEditableIdentifier( + groupIdentifier: RuleGroupIdentifierV2, + rule?: RulerRuleDTO, + promRule?: Rule +): EditableRuleIdentifier | undefined { + if (rule) { </file context> ``` </details>
public/app/features/alerting/unified/rule-list/GrafanaGroupLoader.tsx:68
<!-- cubic:v=64539d86-7c99-42c3-ac7f-7434e5635632 --> <!-- cubic:review-run=7597509d-9b6b-501a-8711-4b473f2737a9 --> <!-- metadata:{"confidence":8} --> P2: When a Grafana group is deleted, this component keeps rendering its cached Prometheus rules because the delete mutation does not invalidate `GrafanaPrometheusGroups`. Invalidate or refetch the Prometheus group cache on deletion so the list removes the group immediately instead of showing stale rules until the polling interval elapses. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At public/app/features/alerting/unified/rule-list/GrafanaGroupLoader.tsx, line 68: <comment>When a Grafana group is deleted, this component keeps rendering its cached Prometheus rules because the delete mutation does not invalidate `GrafanaPrometheusGroups`. Invalidate or refetch the Prometheus group cache on deletion so the list removes the group immediately instead of showing stale rules until the polling interval elapses.</comment> <file context> @@ -86,87 +65,18 @@ export function GrafanaGroupLoader({ - ); - } - + {promResponse.data.groups.at(0)?.rules.map((promRule) => { return ( <GrafanaRuleListItem </file context> ``` </details>
public/app/features/alerting/unified/rule-list/hooks/prometheusGroupsGenerator.ts:4
<!-- cubic:v=d145f480-1381-44e9-89e6-7529d9b9ef8b --> <!-- cubic:review-run=7597509d-9b6b-501a-8711-4b473f2737a9 --> <!-- metadata:{"confidence":7} --> P3: Removing the `getGrafanaRulerGroup` prefetch leaves the retained comment and variable name in this function stale. The comment above the `if` block reads "This is not mandatory to preload ruler rules, but it improves the UX", and the variable is named `cacheAndRulerPreload`, yet nothing preloads ruler rules anymore — only `getGrafanaGroups` is cached. Rename the variable (e.g. `cacheGroups`) and drop the stale comment so the code stops implying a ruler-group preload that no longer happens. Note this also leaves `alertRuleApi.endpoints.getGrafanaRulerGroup` with no callers anywhere in the codebase; if that endpoint is no longer used it can be removed, otherwise its prefetch should live in the file that actually consumes it. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At public/app/features/alerting/unified/rule-list/hooks/prometheusGroupsGenerator.ts, line 87: <comment>Removing the `getGrafanaRulerGroup` prefetch leaves the retained comment and variable name in this function stale. The comment above the `if` block reads "This is not mandatory to preload ruler rules, but it improves the UX", and the variable is named `cacheAndRulerPreload`, yet nothing preloads ruler rules anymore — only `getGrafanaGroups` is cached. Rename the variable (e.g. `cacheGroups`) and drop the stale comment so the code stops implying a ruler-group preload that no longer happens. Note this also leaves `alertRuleApi.endpoints.getGrafanaRulerGroup` with no callers anywhere in the codebase; if that endpoint is no longer used it can be removed, otherwise its prefetch should live in the file that actually consumes it.</comment> <file context> @@ -83,13 +82,6 @@ export function useGrafanaGroupsGenerator(hookOptions: UseGeneratorHookOptions = - ); await dispatch( prometheusApi.util.upsertQueryData( 'getGrafanaGroups', </file context> ``` </details>
PR-level
<!-- cubic:review-summary:start --> **5 issues found** across 14 files <!-- cubic:review-summary:end --> <details> <summary>Prompt for AI agents (unresolved issues)</summary> ```text Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately. <file name="public/app/features/alerting/unified/rule-list/FilterView.tsx"> <violation number="1" location="public/app/features/alerting/unified/rule-list/FilterView.tsx:157"> P2: Every Grafana result in this map now renders without a React key, producing a missing-key warning and leaving reconciliation dependent on array position. Pass the existing `key` value to `GrafanaRuleListItem`, as the other branches do.</violation> </file> <file name="public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx"> <violation number="1" location="public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:133"> P2: When a Grafana rule is supplied only as `promRule`, the Silence menu item is shown but clicking it does nothing. Render the drawer from the Prom rule UID or suppress Silence until a compatible drawer path exists.</violation> </file> <file name="public/app/features/alerting/unified/hooks/useAbilities.ts"> <violation number="1" location="public/app/features/alerting/unified/hooks/useAbilities.ts:245"> P1: Federated Mimir rules are now treated as mutable because this hard-codes `isFederated` to `false`; retain the group metadata and call `isFederatedRuleGroup` before granting update and delete abilities.</violation> </file> <file name="public/app/features/alerting/unified/rule-list/GrafanaGroupLoader.tsx"> <violation number="1" location="public/app/features/alerting/unified/rule-list/GrafanaGroupLoader.tsx:68"> P2: When a Grafana group is deleted, this component keeps rendering its cached Prometheus rules because the delete mutation does not invalidate `GrafanaPrometheusGroups`. Invalidate or refetch the Prometheus group cache on deletion so the list removes the group immediately instead of showing stale rules until the polling interval elapses.</violation> </file> <file name="public/app/features/alerting/unified/rule-list/hooks/prometheusGroupsGenerator.ts"> <violation number="1" location="public/app/features/alerting/unified/rule-list/hooks/prometheusGroupsGenerator.ts:87"> P3: Removing the `getGrafanaRulerGroup` prefetch leaves the retained comment and variable name in this function stale. The comment above the `if` block reads "This is not mandatory to preload ruler rules, but it improves the UX", and the variable is named `cacheAndRulerPreload`, yet nothing preloads ruler rules anymore — only `getGrafanaGroups` is cached. Rename the variable (e.g. `cacheGroups`) and drop the stale comment so the code stops implying a ruler-group preload that no longer happens. Note this also leaves `alertRuleApi.endpoints.getGrafanaRulerGroup` with no callers anywhere in the codebase; if that endpoint is no longer used it can be removed, otherwise its prefetch should live in the file that actually consumes it.</violation> </file> ``` </details> <sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/40/ai_pr_review_github_delivery_b18c6410c1af82f25e06d81e59a114f087c65bf3ee6b21ef59a3396f6b4a7fc9?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F40)</sub> <!-- cubic:review-post:ai_pr_review_github_delivery_b18c6410c1af82f25e06d81e59a114f087c65bf3ee6b21ef59a3396f6b4a7fc9:af3a86799b6e1f4987eb98e1b3261baf92d7867e:7597509d-9b6b-501a-8711-4b473f2737a9 -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 medium ✓ off by one
d3 medium ✓ exact
valid · matches d2 · impact medium
valid · impact medium
The Grafana list item now passes only `promRule` to RuleActionsButtons, so `rulerRule` is undefined in AlertRuleMenu. Delete is still gated on `rulerRule`, so it never renders in the Grafana list, even though the old code passed `rulerRule` and showed Delete. The new test's expectation of exactly 4 menu items confirms Delete is gone. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 5/5: valid=5]
valid · impact medium
Pause is gated on a Grafana `rulerRule`, and the new prom-only GrafanaRuleListItem never passes one. Pause/resume disappears from the list, which is a regression: the old GrafanaRuleListItem passed `rulerRule`. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 5/5: valid=5]
valid · matches d1 · impact low
valid · matches d3 · impact medium
valid · impact low
The deleted code built the href with `createRelativeUrl(..., { returnTo })` using `createReturnTo()`. The new item drops `returnTo`, so back navigation no longer restores the list's filters or scroll position. [grounded: diff] [consensus 5/5: valid=5]
raw comments (7)
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:117
### Silence action does nothing in list **High Severity** <!-- DESCRIPTION START --> The list view now grants `canSilence` from `promRule` and shows Silence notifications, but the drawer still mounts only when `rulerRuleType.grafana.alertingRule(rule)` is true. List items pass only `promRule`, so clicking Silence sets state and never opens the drawer. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: e339e0d4-bde0-4dbf-8982-eb740df216ca --> <!-- LOCATIONS START public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx#L103-L106 public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx#L125-L132 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx#L125-L132`](https://github.com/drape-io/crbench-cursor-2026-09/blob/a7d4193c89d3f8aac934aebe2d53deb380e396f7/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx#L125-L132) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjlkY2Y0YjZkLWRiZTQtNGNlYy05YzBhLWY5ZmFiZDMxZjczYSIsImVuY3J5cHRpb25LZXkiOiJsRkZHZ1A5UTJ6a2E4WmZYMkp0bHpkQ245d3hicDVwSEZ2YWtwUDJEUUVZIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjlkY2Y0YjZkLWRiZTQtNGNlYy05YzBhLWY5ZmFiZDMxZjczYSIsImVuY3J5cHRpb25LZXkiOiJsRkZHZ1A5UTJ6a2E4WmZYMkp0bHpkQ245d3hicDVwSEZ2YWtwUDJEUUVZIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByTnVtYmVyIjo5MiwiY29tbWl0U2hhIjoiYTdkNDE5M2M4OWQzZjhhYWM5MzRhZWJlMmQ1M2RlYjM4MGUzOTZmNyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7d4193c89d3f8aac934aebe2d53deb380e396f7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:100
### Delete missing from Grafana list **High Severity** <!-- DESCRIPTION START --> `canDelete` can now be true from prom-based abilities, and `handleDelete` already uses the identifier plus `groupIdentifier`. The menu still requires `rulerRule` to render Delete, so the Grafana list (prom-only) never shows it. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 0e3108ba-21d8-4c4c-93bf-2b982b732f78 --> <!-- LOCATIONS START public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx#L164-L175 public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx#L98-L99 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx#L98-L99`](https://github.com/drape-io/crbench-cursor-2026-09/blob/a7d4193c89d3f8aac934aebe2d53deb380e396f7/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx#L98-L99) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmJkY2MwNzM2LTNmMTYtNDQzMC04NWYwLTBhNjIyYzFlZWJjMSIsImVuY3J5cHRpb25LZXkiOiJiZXVsVG5JM014eV9yel8tUldVNF9VZmd4NVRYWHJTRkpNRzViU3prVFBvIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmJkY2MwNzM2LTNmMTYtNDQzMC04NWYwLTBhNjIyYzFlZWJjMSIsImVuY3J5cHRpb25LZXkiOiJiZXVsVG5JM014eV9yel8tUldVNF9VZmd4NVRYWHJTRkpNRzViU3prVFBvIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByTnVtYmVyIjo5MiwiY29tbWl0U2hhIjoiYTdkNDE5M2M4OWQzZjhhYWM5MzRhZWJlMmQ1M2RlYjM4MGUzOTZmNyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7d4193c89d3f8aac934aebe2d53deb380e396f7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:100
### Pause missing from Grafana list **Medium Severity** <!-- DESCRIPTION START --> Prom-based abilities can set `canPause`, but the Pause item still requires a Grafana `rulerRule`. `MenuItemPauseRule` also reads pause state and UID from `RulerGrafanaRuleDTO`. The prom-only list therefore never offers pause or resume. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: bcc73726-a29a-4f38-abd2-53767fd929ab --> <!-- LOCATIONS START public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx#L122-L125 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjZlY2JlNTM4LTQzNTgtNDU1MS1iN2NiLWJhYzQzN2E1NDcwYSIsImVuY3J5cHRpb25LZXkiOiJ3VV8wdThXRUk1RHQzVkNvLVZzN2pmQjhFQ2o0c25Wem8xaEZJMmhFZjJrIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjZlY2JlNTM4LTQzNTgtNDU1MS1iN2NiLWJhYzQzN2E1NDcwYSIsImVuY3J5cHRpb25LZXkiOiJ3VV8wdThXRUk1RHQzVkNvLVZzN2pmQjhFQ2o0c25Wem8xaEZJMmhFZjJrIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByTnVtYmVyIjo5MiwiY29tbWl0U2hhIjoiYTdkNDE5M2M4OWQzZjhhYWM5MzRhZWJlMmQ1M2RlYjM4MGUzOTZmNyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7d4193c89d3f8aac934aebe2d53deb380e396f7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
public/app/features/alerting/unified/rule-list/FilterView.tsx:161
### Filter view drops React key **Medium Severity** <!-- DESCRIPTION START --> The Grafana branch of the filtered list renders `GrafanaRuleListItem` without `key={key}`. The datasource and unknown branches still use the computed `key`. React will reconcile these items by index. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: e1c6207d-59a3-496c-89fc-8b30ef8ad2ee --> <!-- LOCATIONS START public/app/features/alerting/unified/rule-list/FilterView.tsx#L156-L162 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmM2MTZkMTc5LTM4N2ItNDgxYS04ZjViLWZlMmI3M2UzNmZmOCIsImVuY3J5cHRpb25LZXkiOiJRRzNTY2xkemM2cUtPeUNFZWFITERFZXBUSHJQSGdOX1FuUUUzRGFXOEpZIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmM2MTZkMTc5LTM4N2ItNDgxYS04ZjViLWZlMmI3M2UzNmZmOCIsImVuY3J5cHRpb25LZXkiOiJRRzNTY2xkemM2cUtPeUNFZWFITERFZXBUSHJQSGdOX1FuUUUzRGFXOEpZIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByTnVtYmVyIjo5MiwiY29tbWl0U2hhIjoiYTdkNDE5M2M4OWQzZjhhYWM5MzRhZWJlMmQ1M2RlYjM4MGUzOTZmNyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7d4193c89d3f8aac934aebe2d53deb380e396f7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
public/app/features/alerting/unified/hooks/useAbilities.ts:245
### Federated rules become editable **Medium Severity** <!-- DESCRIPTION START --> `useAllAlertRuleAbilities` now delegates to `useAllRulerRuleAbilities`, which hardcodes `isFederated` to false. Combined-rule consumers such as the v1 Edit button lose the old `isFederatedRuleGroup(rule.group)` guard. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 8b77c6d7-f2c4-482f-977b-df666dc2c826 --> <!-- LOCATIONS START public/app/features/alerting/unified/hooks/useAbilities.ts#L221-L245 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjQ1YzgyYzM4LTMwNTctNDdiMS04NzY5LTkwM2VlZGYyNmJkYyIsImVuY3J5cHRpb25LZXkiOiJueXdIdGhUcm96d094TmJCdVVxRGhESnJidmZ4ZTJaSVpUQUpVWUtCeVlVIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjQ1YzgyYzM4LTMwNTctNDdiMS04NzY5LTkwM2VlZGYyNmJkYyIsImVuY3J5cHRpb25LZXkiOiJueXdIdGhUcm96d094TmJCdVVxRGhESnJidmZ4ZTJaSVpUQUpVWUtCeVlVIiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByTnVtYmVyIjo5MiwiY29tbWl0U2hhIjoiYTdkNDE5M2M4OWQzZjhhYWM5MzRhZWJlMmQ1M2RlYjM4MGUzOTZmNyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7d4193c89d3f8aac934aebe2d53deb380e396f7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:40
### Rule view links drop returnTo **Low Severity** <!-- DESCRIPTION START --> `GrafanaRuleListItem` builds the view href as `/alerting/grafana/${uid}/view` with no `returnTo`. The old list item and `DataSourceRuleListItem` still pass `createReturnTo()`, so Grafana rules no longer restore list filters or scroll on back navigation. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 48e3dc12-ef5f-4178-b4a9-96482b98defd --> <!-- LOCATIONS START public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx#L39-L40 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmFkNmQ3ZGU0LTA4MjUtNGY2Ny04YzIyLTgxZTZkZThmMjI3NiIsImVuY3J5cHRpb25LZXkiOiJydVQ4cC0tTFR1d1ROem5kWmhmNERLT3RxeHpiRzlwTkRDTlVwbTM4aU00IiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmFkNmQ3ZGU0LTA4MjUtNGY2Ny04YzIyLTgxZTZkZThmMjI3NiIsImVuY3J5cHRpb25LZXkiOiJydVQ4cC0tTFR1d1ROem5kWmhmNERLT3RxeHpiRzlwTkRDTlVwbTM4aU00IiwiYnJhbmNoIjoidDItZ3JhZmFuYS0xMDY3NzgiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByTnVtYmVyIjo5MiwiY29tbWl0U2hhIjoiYTdkNDE5M2M4OWQzZjhhYWM5MzRhZWJlMmQ1M2RlYjM4MGUzOTZmNyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7d4193c89d3f8aac934aebe2d53deb380e396f7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PR-level
<!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes using high effort and found 6 potential issues. <!-- BUGBOT_FIX_ALL --> <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo1NjFiMjU4Yy1hOGQzLTRhNjctYjM1MS05MjllYmIwNGZiZDAiLCJlbmNyeXB0aW9uS2V5IjoiX1dBbEt0Z3c3UXg3bzN5dUNwT1ZMeDNMWEZkUXdkZnlqWjNfMGVsRS1ZayIsImJyYW5jaCI6InQyLWdyYWZhbmEtMTA2Nzc4IiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <!-- /BUGBOT_FIX_ALL --> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7d4193c89d3f8aac934aebe2d53deb380e396f7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ exact
d2 medium ✓ exact
d3 medium ✓ exact
valid · matches d3 · impact medium
valid · matches d1 · impact low
valid · impact low
The removed GrafanaRuleListItem used `createRelativeUrl(..., { returnTo })` with `createReturnTo()`. The new item drops that parameter, so the view page no longer links back to the list. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact medium
valid · impact medium
The ruler version gated these actions on `rulerRuleType.grafana.rule`, which includes recording rules. The prom version gates them on `alertingRule`. The list now passes no rulerRule, so Grafana recording rules lose Export (and Pause) there. [grounded: diff] [consensus 3/3: valid=3]
valid · impact high
The old list item passed `rulerRule` to RuleActionsButtons. The new one passes only `promRule`, so the `canDelete && rulerRule` guard keeps Delete hidden in the Grafana list. The new test even expects exactly 4 menu items with no Delete. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
valid · impact medium
The pause item requires a Grafana rulerRule. GrafanaRuleListItem no longer passes one, so pause/resume vanished from the list, where it previously rendered. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
valid · impact low
useCanSilence returns [false,false] while the folder is loading or missing. The new prom-based ability skips that check, and canSilenceInFolder is true for anyone with the global permission, so Silence shows regardless of folder state. [grounded: diff] [consensus 3/3: valid=3]
raw comments (8)
public/app/features/alerting/unified/hooks/useAbilities.ts:245
**Federated rule groups become editable and deletable** `useAllAlertRuleAbilities` used to check `isFederatedRuleGroup(rule.group)`. It now goes through `useAllRulerRuleAbilities`, which hardcodes `isFederated = false`. Mimir federated groups (with `source_tenants`) are no longer treated as read-only. In `useAllAlertRuleAbilities`, keep using `isFederatedRuleGroup(rule.group)`, e.g. pass an `isFederated` flag into the shared hook. ``` public/app/features/alerting/unified/hooks/useAbilities.ts:222 export function useAllAlertRuleAbilities(rule: CombinedRule): Abilities<AlertRuleAction> { public/app/features/alerting/unified/hooks/useAbilities.ts:223 // This hook is being called a lot in different places public/app/features/alerting/unified/hooks/useAbilities.ts:224 // In some cases multiple times for ~80 rules (e.g. on the list page) public/app/features/alerting/unified/hooks/useAbilities.ts:225 // We need to investigate further if some of these calls are redundant public/app/features/alerting/unified/utils/rules.ts:373 export function isFederatedRuleGroup(group: CombinedRuleGroup | RulerRuleGroupDTO): boolean { public/app/features/alerting/unified/utils/rules.ts:374 return Array.isArray(group.source_tenants); public/app/features/alerting/unified/utils/rules.ts:375 } public/app/features/alerting/unified/hooks/useAbilities.ts:250 const immutableRule = isProvisioned || isFederated || isPluginProvided; public/app/features/alerting/unified/hooks/useAbilities.ts:252 // while we gather info, pretend it's not supported public/app/features/alerting/unified/hooks/useAbilities.ts:253 const MaybeSupported = loading ? NotSupported : isRulerAvailable; ```
public/app/features/alerting/unified/rule-list/FilterView.tsx:157
**Filtered Grafana rule rows lost their React key** When `GrafanaRuleLoader` was swapped for `GrafanaRuleListItem` inside `rules.map`, `key={key}` was dropped. React then falls back to index keys for these rows. Add `key={key}` to `GrafanaRuleListItem`. ``` public/app/features/alerting/unified/rule-list/FilterView.tsx:157 <GrafanaRuleListItem public/app/features/alerting/unified/rule-list/FilterView.tsx:158 rule={rule} public/app/features/alerting/unified/rule-list/FilterView.tsx:159 groupIdentifier={groupIdentifier} public/app/features/alerting/unified/rule-list/FilterView.tsx:160 namespaceName={ruleWithOrigin.namespaceName} public/app/features/alerting/unified/rule-list/FilterView.tsx:165 return <DataSourceRuleLoader key={key} rule={rule} groupIdentifier={groupIdentifier} />; ```
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:40
**Rule links no longer return to the list** The old list item added `returnTo` from `createReturnTo()` to the rule's view link. The new `GrafanaRuleListItem` builds the href without it. Use `createRelativeUrl(..., { returnTo: createReturnTo() })` as before. ``` public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:40 href: createRelativeUrl(`/alerting/grafana/${uid}/view`), public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:103 (base) operation, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:104 (base) showLocation = true, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:105 (base) }: GrafanaRuleListItemProps) { public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:106 (base) const returnTo = createReturnTo(); public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:108 (base) const { public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:109 (base) grafana_alert: { uid, title, provenance, is_paused }, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:110 (base) annotations = {}, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:111 (base) labels = {}, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:112 (base) } = rulerRule; ```
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:104
**List view Silence menu item does nothing** The list now passes only `promRule`, so `rule` is undefined. The prom-based ability still turns on "Silence notifications", but the drawer only renders when `rulerRuleType.grafana.alertingRule(rule)` is true. Render the drawer from the prom rule when there is no ruler rule, or hide the item. ``` public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:47 actions: <RuleActionsButtons promRule={rule} groupIdentifier={groupIdentifier} compact />, public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:94 const [silenceSupported, silenceAllowed] = rulerSilenceAbility; public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:95 const [grafanaSilenceSupported, grafanaSilenceAllowed] = grafanaSilenceAbility; public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:96 const canSilence = (silenceSupported && silenceAllowed) || (grafanaSilenceSupported && grafanaSilenceAllowed); public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:104 {rulerRuleType.grafana.alertingRule(rule) && showSilenceDrawer && ( public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:105 <SilenceGrafanaRuleDrawer rulerRule={rule} onClose={() => setShowSilenceDrawer(false)} /> public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:106 )} ```
public/app/features/alerting/unified/hooks/useAbilities.ts:302
**Recording rules lose Export and Pause** `useAllGrafanaPromRuleAbilities` gates ModifyExport, Pause, Restore and DeletePermanently on `prometheusRuleType.grafana.alertingRule`. The ruler version used `rulerRuleType.grafana.rule`, which also covers Grafana recording rules. Use `prometheusRuleType.grafana.rule(rule)` for export and pause, and keep the alerting-only check for Silence. ``` public/app/features/alerting/unified/hooks/useAbilities.ts:302 const isAlertingRule = prometheusRuleType.grafana.alertingRule(rule); public/app/features/alerting/unified/hooks/useAbilities.ts:324 [AlertRuleAction.ModifyExport]: [isAlertingRule, exportAllowed], public/app/features/alerting/unified/hooks/useAbilities.ts:325 [AlertRuleAction.Pause]: [MaybeSupportedUnlessImmutable && isAlertingRule, isEditable ?? false], public/app/features/alerting/unified/hooks/useAbilities.ts:326 [AlertRuleAction.Restore]: [MaybeSupportedUnlessImmutable && isAlertingRule, isEditable ?? false], public/app/features/alerting/unified/hooks/useAbilities.ts:296 (base) const duplicateSupported = isPluginProvided ? NotSupported : MaybeSupported; public/app/features/alerting/unified/hooks/useAbilities.ts:298 (base) const rulesPermissions = getRulesPermissions(rulesSourceName); public/app/features/alerting/unified/hooks/useAbilities.ts:300 (base) const abilities: Abilities<AlertRuleAction> = { public/app/features/alerting/unified/hooks/useAbilities.ts:301 (base) [AlertRuleAction.Duplicate]: toAbility(duplicateSupported, rulesPermissions.create), public/app/features/alerting/unified/hooks/useAbilities.ts:302 (base) [AlertRuleAction.View]: toAbility(AlwaysSupported, rulesPermissions.read), public/app/features/alerting/unified/hooks/useAbilities.ts:303 (base) [AlertRuleAction.Update]: [MaybeSupportedUnlessImmutable, isEditable ?? false], ```
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:165
**Delete action disappears from the new rule list** List items now pass only `promRule`, so `rulerRule` is undefined. The Delete item still requires `rulerRule`, so it never renders there, even when `canDelete` is true. Render Delete when `canDelete` is true and delete using the identifier, or load the ruler rule on click. ``` public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:47 actions: <RuleActionsButtons promRule={rule} groupIdentifier={groupIdentifier} compact />, public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:83 const canPause = (pauseSupported && pauseAllowed) || (grafanaPauseSupported && grafanaPauseAllowed); public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:85 const [deleteSupported, deleteAllowed] = rulerDeleteAbility; public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:165 {canDelete && rulerRule && ( public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:166 <> public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:167 <Menu.Divider /> public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:168 <Menu.Item public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:169 label={t('alerting.common.delete', 'Delete')} public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:170 icon="trash-alt" public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:171 destructive ```
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:123
**Pause/resume missing from the new rule list** `canPause` can now be true from the Prometheus rule alone, but the pause item still requires a Grafana `rulerRule`, which the list never passes. The item never shows there. Make `MenuItemPauseRule` work from the Prometheus rule (uid and isPaused), or load the ruler rule. ``` public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:81 const [pauseSupported, pauseAllowed] = rulerPauseAbility; public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:82 const [grafanaPauseSupported, grafanaPauseAllowed] = grafanaPauseAbility; public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:83 const canPause = (pauseSupported && pauseAllowed) || (grafanaPauseSupported && grafanaPauseAllowed); public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:47 actions: <RuleActionsButtons promRule={rule} groupIdentifier={groupIdentifier} compact />, public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:118 const showDivider = public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:119 [canPause, canSilence, shouldShowDeclareIncidentButton, canDuplicate].some(Boolean) && [canExport].some(Boolean); public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:121 const menuItems = ( public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:122 <> public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:123 {canPause && rulerRuleType.grafana.rule(rulerRule) && groupIdentifier.groupOrigin === 'grafana' && ( public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:124 <MenuItemPauseRule rule={rulerRule} groupIdentifier={groupIdentifier} onPauseChange={onPauseChange} /> ```
public/app/features/alerting/unified/hooks/useAbilities.ts:323
**Silence offered before or without folder access** Unlike `useCanSilence`, the Silence ability in `useAllGrafanaPromRuleAbilities` doesn't wait for the rule's folder to load or exist. Users with the global silence permission see Silence anyway. Also require the folder to be loaded and present, as `useCanSilence` does. ``` public/app/features/alerting/unified/hooks/useAbilities.ts:293 const canSilenceInFolder = useCanSilenceInFolder(rule?.folderUid); public/app/features/alerting/unified/hooks/useAbilities.ts:323 [AlertRuleAction.Silence]: [silenceSupported, canSilenceInFolder && isAlertingRule], public/app/features/alerting/unified/hooks/useAbilities.ts:576 if (!isGrafanaManagedRule || isGrafanaRecording || folderIsLoading || !folder) { public/app/features/alerting/unified/hooks/useAbilities.ts:577 return [false, false]; public/app/features/alerting/unified/hooks/useAbilities.ts:578 } public/app/features/alerting/unified/hooks/useAbilities.ts:583 function useCanSilenceInFolder(folderUID?: string) { public/app/features/alerting/unified/hooks/useAbilities.ts:584 const folderPermissions = useFolderPermissions(folderUID); public/app/features/alerting/unified/hooks/useAbilities.ts:586 const hasFolderSilencePermission = folderPermissions[AccessControlAction.AlertingSilenceCreate] ?? false; public/app/features/alerting/unified/hooks/useAbilities.ts:587 const hasGlobalSilencePermission = ctx.hasPermission(AccessControlAction.AlertingInstanceCreate); public/app/features/alerting/unified/hooks/useAbilities.ts:589 // User is permitted to silence if they either have the "global" permissions of "AlertingInstanceCreate", ```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ exact
d2 medium ✓ off by one
d3 medium ✓ exact
valid · impact medium
The old ruler-based abilities gated on rulerRuleType.grafana.rule, which includes recording rules. The new prom-based abilities gate on alertingRule only. The list view now relies only on promRule, so Grafana recording rules lose Export, Pause and related abilities there. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact medium
valid · matches d3 · impact medium
valid · impact low
The removed component passed { returnTo } and the new one drops it, so the view page loses its back-navigation context. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
GrafanaRuleListItem now passes only promRule to RuleActionsButtons, so rulerRule is undefined and Delete never renders. Before this change the list passed rulerRule. The new test even expects exactly 4 menu items, with no Delete. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
valid · impact medium
With no rulerRule passed from the Grafana list, the Pause item is never shown, even though canPause can now be true. Before this change the list passed rulerRule, so this is a regression. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
valid · impact medium
With skipToken the rule is undefined and loading is false, so MaybeSupported is true and Duplicate becomes toAbility(true, grafana create). AlertRuleMenu ORs this with the ruler ability, so Duplicate shows for datasource or cloud rules whenever the user has Grafana create permission. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact low
valid · impact low
Unlike useCanSilence, the new hook does not wait for a loaded folder, so a user with the global permission gets Silence while the folder is loading or invalid. The global permission legitimately allows silencing, so the impact is small. [grounded: diff] [consensus 3/4: valid=3, invalid=1]
raw comments (9)
public/app/features/alerting/unified/hooks/useAbilities.ts:307
**Recording rules lose Pause and Export abilities** `useAllGrafanaPromRuleAbilities` gates Pause, Restore, ModifyExport and DeletePermanently on `isAlertingRule`, which is `prometheusRuleType.grafana.alertingRule(rule)`. The comment says all Grafana prom rules should qualify, and the old code used `rulerRuleType.grafana.rule`, which covered recording rules too. Use `prometheusRuleType.grafana.rule(rule)` for these gates. Keep the alerting-rule check only for Silence. ``` public/app/features/alerting/unified/hooks/useAbilities.ts:305 // if a rule is either provisioned, federated or provided by a plugin rule, we don't allow it to be removed or edited public/app/features/alerting/unified/hooks/useAbilities.ts:306 const immutableRule = isProvisioned || isFederated || isPluginProvided; public/app/features/alerting/unified/hooks/useAbilities.ts:323 [AlertRuleAction.Silence]: [silenceSupported, canSilenceInFolder && isAlertingRule], public/app/features/alerting/unified/hooks/useAbilities.ts:324 [AlertRuleAction.ModifyExport]: [isAlertingRule, exportAllowed], public/app/features/alerting/unified/hooks/useAbilities.ts:262 (base) ], public/app/features/alerting/unified/hooks/useAbilities.ts:263 (base) }; ```
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:66
**Silence from list menu does nothing** The component now accepts a `promRule` without a ruler `rule`, but the Silence drawer still renders only when `rulerRuleType.grafana.alertingRule(rule)` is true. From the list view `rule` is undefined, so the drawer never mounts. Render the drawer from the Grafana prom rule, e.g. by passing its UID to the drawer. ``` public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:66 const identifier = getEditableIdentifier(groupIdentifier, rule, promRule); public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:68 if (!identifier) { public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:69 return null; public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:70 } public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:104 {rulerRuleType.grafana.alertingRule(rule) && showSilenceDrawer && ( public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:105 <SilenceGrafanaRuleDrawer rulerRule={rule} onClose={() => setShowSilenceDrawer(false)} /> public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:106 )} public/app/features/alerting/unified/components/silences/SilenceGrafanaRuleDrawer.tsx:12 rulerRule: RulerGrafanaRuleDTO; public/app/features/alerting/unified/components/silences/SilenceGrafanaRuleDrawer.tsx:13 onClose: () => void; public/app/features/alerting/unified/components/silences/SilenceGrafanaRuleDrawer.tsx:14 }; ```
public/app/features/alerting/unified/hooks/useAbilities.ts:243
**Federated rules no longer blocked from edit/delete** `useAllAlertRuleAbilities` used to compute `isFederated` with `isFederatedRuleGroup(rule.group)`. It now delegates to `useAllRulerRuleAbilities`, which hard-codes `isFederated = false`. Keep the federated check in `useAllAlertRuleAbilities`, for example by passing the flag through to the shared hook. ``` public/app/features/alerting/unified/hooks/useAbilities.ts:222 export function useAllAlertRuleAbilities(rule: CombinedRule): Abilities<AlertRuleAction> { public/app/features/alerting/unified/hooks/useAbilities.ts:223 // This hook is being called a lot in different places public/app/features/alerting/unified/hooks/useAbilities.ts:224 // In some cases multiple times for ~80 rules (e.g. on the list page) public/app/features/alerting/unified/hooks/useAbilities.ts:225 // We need to investigate further if some of these calls are redundant public/app/features/alerting/unified/hooks/useAbilities.ts:243 // TODO: Add support for federated rules public/app/features/alerting/unified/hooks/useAbilities.ts:244 // const isFederated = isFederatedRuleGroup(); public/app/features/alerting/unified/hooks/useAbilities.ts:245 const isFederated = false; public/app/features/alerting/unified/hooks/useAbilities.ts:246 const isGrafanaManagedAlertRule = rulerRuleType.grafana.rule(rule); public/app/features/alerting/unified/hooks/useAbilities.ts:247 const isPluginProvided = isPluginProvidedRule(rule); ```
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:36
**Rule links lose the returnTo parameter** The new `GrafanaRuleListItem` builds `href` with `createRelativeUrl` and no `returnTo`. The removed `GrafanaRuleLoader` version passed `createReturnTo()`. Pass `{ returnTo: createReturnTo() }` as before. ``` public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:36 name, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:117 (base) group: groupIdentifier.groupName, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:118 (base) namespace: namespaceName, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:119 (base) href: createRelativeUrl(`/alerting/grafana/${uid}/view`, { returnTo }), public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:120 (base) health: rule?.health, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:121 (base) error: rule?.lastError, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:122 (base) labels: labels, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:123 (base) isProvisioned: Boolean(provenance), public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:124 (base) isPaused: rule?.isPaused ?? is_paused, public/app/features/alerting/unified/rule-list/GrafanaRuleLoader.tsx:125 (base) application: 'grafana' as const, ```
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:98
**Delete missing from new Grafana list menu** `AlertRuleMenu` now computes `canDelete` from the prom-rule abilities. The Delete item still renders only when `canDelete && rulerRule`. The Grafana list passes no `rulerRule`, so Delete never appears even for users who can delete. Drop the `rulerRule` requirement and call `handleDelete` with the identifier and group, as `RuleActionsButtons` already does. ``` public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:73 ] = useGrafanaPromRuleAbilities(prometheusRuleType.grafana.rule(promRule) ? promRule : skipToken, [ public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:74 AlertRuleAction.Pause, public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:75 AlertRuleAction.Delete, public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:42 error: rule?.lastError, public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:165 {canDelete && rulerRule && ( public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:166 <> public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:167 <Menu.Divider /> public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:168 <Menu.Item public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:169 label={t('alerting.common.delete', 'Delete')} public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:170 icon="trash-alt" ```
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:96
**Pause/Resume missing from new Grafana list menu** `canPause` now includes the prom-rule ability. The Pause item still needs `rulerRuleType.grafana.rule(rulerRule)`, and the Grafana list passes no `rulerRule`, so Pause/Resume never shows. `MenuItemPauseRule` also takes only a ruler rule. Let the pause item work from the prom rule or its UID and group identifier, and drop the `rulerRule` gate. ``` public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:79 ]); public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:81 const [pauseSupported, pauseAllowed] = rulerPauseAbility; public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:82 const [grafanaPauseSupported, grafanaPauseAllowed] = grafanaPauseAbility; public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:42 error: rule?.lastError, public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:123 {canPause && rulerRuleType.grafana.rule(rulerRule) && groupIdentifier.groupOrigin === 'grafana' && ( public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:124 <MenuItemPauseRule rule={rulerRule} groupIdentifier={groupIdentifier} onPauseChange={onPauseChange} /> public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:125 )} ```
public/app/features/alerting/unified/hooks/useAbilities.ts:307
**Duplicate ability enabled when rule is skipped** `useAllGrafanaPromRuleAbilities` gets `undefined` when `skipToken` is passed, for example for a datasource rule. It still reports Duplicate as supported, because `MaybeSupported` is `AlwaysSupported`. `AlertRuleMenu` ORs this with the ruler ability, so Duplicate shows for non-Grafana rules. Return NotSupported for every ability when `rule` is undefined. ``` public/app/features/alerting/unified/hooks/useAbilities.ts:290 const [_, exportAllowed] = useAlertingAbility(AlertingAction.ExportGrafanaManagedRules); public/app/features/alerting/unified/hooks/useAbilities.ts:292 const silenceSupported = useGrafanaRulesSilenceSupport(); public/app/features/alerting/unified/hooks/useAbilities.ts:293 const canSilenceInFolder = useCanSilenceInFolder(rule?.folderUid); public/app/features/alerting/unified/hooks/useAbilities.ts:295 const abilities = useMemo<Abilities<AlertRuleAction>>(() => { ```
public/app/features/alerting/unified/rule-list/FilterView.tsx:157
**Missing React key on filtered Grafana rule items** The `key={key}` prop was dropped when `GrafanaRuleLoader` was replaced by `GrafanaRuleListItem` in the `rules.map` callback. The datasource and unknown branches still set it. React falls back to index keys and warns, and items can be reused wrongly as results stream in. Add `key={key}` to `GrafanaRuleListItem`. ``` public/app/features/alerting/unified/rule-list/FilterView.tsx:157 <GrafanaRuleListItem public/app/features/alerting/unified/rule-list/FilterView.tsx:158 rule={rule} public/app/features/alerting/unified/rule-list/FilterView.tsx:159 groupIdentifier={groupIdentifier} public/app/features/alerting/unified/rule-list/FilterView.tsx:160 namespaceName={ruleWithOrigin.namespaceName} public/app/features/alerting/unified/rule-list/FilterView.tsx:165 return <DataSourceRuleLoader key={key} rule={rule} groupIdentifier={groupIdentifier} />; public/app/features/alerting/unified/rule-list/FilterView.tsx:168 <UnknownRuleListItem public/app/features/alerting/unified/rule-list/FilterView.tsx:169 key={key} ```
public/app/features/alerting/unified/hooks/useAbilities.ts:293
**Silence allowed before the folder has loaded** `useCanSilence` returns not-allowed while the folder is loading or missing. The new `useAllGrafanaPromRuleAbilities` skips that check and uses `useCanSilenceInFolder` alone, which falls back to the global permission. Also require a loaded folder, as `useCanSilence` does. ``` public/app/features/alerting/unified/hooks/useAbilities.ts:292 const silenceSupported = useGrafanaRulesSilenceSupport(); public/app/features/alerting/unified/hooks/useAbilities.ts:293 const canSilenceInFolder = useCanSilenceInFolder(rule?.folderUid); public/app/features/alerting/unified/hooks/useAbilities.ts:323 [AlertRuleAction.Silence]: [silenceSupported, canSilenceInFolder && isAlertingRule], public/app/features/alerting/unified/hooks/useAbilities.ts:560 function useCanSilence(rule?: RulerRuleDTO): [boolean, boolean] { public/app/features/alerting/unified/hooks/useAbilities.ts:561 const folderUID = rulerRuleType.grafana.rule(rule) ? rule.grafana_alert.namespace_uid : undefined; public/app/features/alerting/unified/hooks/useAbilities.ts:562 const { loading: folderIsLoading, folder } = useFolder(folderUID); public/app/features/alerting/unified/hooks/useAbilities.ts:564 const isGrafanaManagedRule = rule && rulerRuleType.grafana.rule(rule); public/app/features/alerting/unified/hooks/useAbilities.ts:565 const isGrafanaRecording = rulerRuleType.grafana.recordingRule(rule); public/app/features/alerting/unified/hooks/useAbilities.ts:567 const silenceSupported = useGrafanaRulesSilenceSupport(); public/app/features/alerting/unified/hooks/useAbilities.ts:568 const canSilenceInFolder = useCanSilenceInFolder(folderUID); ```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✗ —
d2 medium ✓ off by one
d3 medium ✓ off by one
valid · matches d2 · impact medium
valid · matches d3 · impact medium
raw comments (3)
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:47
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Prom-only actions are broken** This list item passes only `promRule` into the existing action flow. Users with permission still see “Silence notifications,” but clicking it only changes local state because the drawer requires the missing ruler rule, so nothing opens. The same missing value hides the pause and delete actions. Grafana-managed rules shown in the group loader or filtered view therefore have a no-op silence action and lose pause and delete controls.
public/app/features/alerting/unified/hooks/useAbilities.ts:246
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Federated rules become mutable** The delegated ability check no longer receives the rule group and hard-codes `isFederated` to `false`. When a data-source-managed rule belongs to a group with `source_tenants`, this can enable update, delete, pause, restore, or permanent-delete controls for a federated rule that should remain immutable.
PR-level
<h3>Greptile Summary</h3> This PR removes Grafana ruler reads from alert-list rendering and derives list items and action permissions directly from Grafana Prometheus rule DTOs. - Introduces Prometheus-rule-specific ability hooks backed by folder permissions. - Replaces the per-rule ruler loader with direct GrafanaPromRuleDTO rendering. - Updates action menus, list loaders, DTOs, tests, and translations for the new flow. - The downstream action components are not fully compatible with Prometheus-only rules, and the ability refactor drops federated-group immutability. <h3>Confidence Score: 3/5</h3> The PR is not safe to merge until Prometheus-only rule actions work end to end and federated rules remain immutable. Grafana list rows now omit the ruler data still required by silence, pause, and delete behavior, while the refactored ability hook explicitly stops recognizing federated groups and can expose mutation controls for them. **Files Needing Attention:** public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx, public/app/features/alerting/unified/hooks/useAbilities.ts, public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx <details><summary><h3>Important Files Changed</h3></summary> | Filename | Overview | |----------|----------| | public/app/features/alerting/unified/hooks/useAbilities.ts | Adds Prometheus DTO ability calculation but loses federated-group immutability while delegating existing CombinedRule abilities. | | public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx | Renders list rows directly from Prometheus DTOs but supplies insufficient data to the existing action workflow. | | public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx | Combines ruler and Prometheus abilities even though several enabled actions still require a ruler rule. | | public/app/features/alerting/unified/rule-list/GrafanaGroupLoader.tsx | Removes ruler loading and renders the Prometheus group response directly. | </details> <details open><summary><h3>Flowchart</h3></summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart LR API[Grafana Prometheus rules API] --> DTO[GrafanaPromRuleDTO] DTO --> Item[GrafanaRuleListItem] DTO --> Abilities[Prom rule ability hooks] Item --> Actions[RuleActionsButtons] Abilities --> Menu[AlertRuleMenu] Actions --> Menu Menu --> Duplicate[Duplicate / Export] Menu -. missing ruler rule .-> Silence[Silence drawer] Menu -. ruler-rule guards .-> Mutations[Pause / Delete] ``` </details> <!-- greptile_other_comments_section --> <sub>Reviews (1): Last reviewed commit: ["Update public/app/features/alerting/unif..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/9fde8c2a75b92ddd38ea5c0c6870af70a02cf48e) | [Re-trigger Greptile](https://app.greptile.com/api/retrigger?id=64288974)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ exact
d2 medium ✓ off by one
d3 medium ✓ exact
valid · matches d2 · impact medium
valid · impact medium
GrafanaRuleListItem now passes only promRule, so rulerRule is undefined. The Pause item requires rulerRuleType.grafana.rule(rulerRule) and Delete requires `canDelete && rulerRule`, so both are hidden in the list view even though the old list view passed rulerRule and showed them. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
valid · matches d3 · impact medium
valid · matches d1 · impact low
valid · impact low
The old component passed { returnTo } from createReturnTo(); the new one drops it, so the detail page loses its back-navigation to the list. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
canSilence can now be true from the prom-rule abilities, so the menu item is shown. But the drawer only renders when the ruler rule is set, and it is undefined in the list view, so clicking the item does nothing. [grounded: tree public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx] [consensus 3/3: valid=3]
valid · impact low
The old GrafanaRuleLoader had key={key}. The replacement has no key while the sibling branches in the same map still set one, which causes React key warnings and positional reconciliation. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
Same issue as finding 4: the returnTo parameter was dropped compared with the deleted implementation. [grounded: tree public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx] [consensus 3/3: valid=3]
valid · impact low
The ruler-based abilities gated Export and Pause on rulerRuleType.grafana.rule, which includes recording rules. The new prom abilities use alertingRule only, and the list view now relies on them alone, so Grafana recording rules lose the Export action there. [grounded: tree public/app/features/alerting/unified/hooks/useAbilities.ts] [consensus 3/3: valid=3]
raw comments (9)
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:104
[P1] "Silence notifications" does nothing in the new list view `GrafanaRuleListItem` now passes only `promRule` to `RuleActionsButtons`. Because `useGrafanaPromRuleAbilities` grants `canSilence` for Grafana alerting rules, `AlertRuleMenu` shows the "Silence notifications" item. Clicking it calls `setShowSilenceDrawer(true)`, but the drawer only renders when `rulerRuleType.grafana.alertingRule(rule)` is true, and `rule` (the ruler rule) is always undefined here. So for every Grafana alerting rule in the list and filter views, the menu shows a silence action that silently does nothing.
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:123
[P2] Pause and Delete actions are no longer available from the rule list The new code works out `canPause`/`canDelete` from the prom rule so the list view can show these actions without ruler data. The menu items are still gated on the ruler rule, though: `canPause && rulerRuleType.grafana.rule(rulerRule)` for Pause and `canDelete && rulerRule` for Delete (around line 165). Since `GrafanaRuleListItem` and `GrafanaGroupLoader` no longer load or pass a ruler rule, users who have pause/delete permission no longer see these actions in the list or filter views, where they appeared before this change. Delete in V2 already goes through `showDeleteModal(identifier, groupIdentifier)`, which doesn't need the ruler rule.
public/app/features/alerting/unified/hooks/useAbilities.ts:222
[P2] Federated rule groups are no longer treated as immutable `useAllAlertRuleAbilities` used to compute `isFederated = isFederatedRuleGroup(rule.group)`. It now delegates to `useAllRulerRuleAbilities`, which hardcodes `isFederated = false`. `useAlertRuleAbility`/`useAlertRuleAbilities` (used by the legacy `RuleActionsButtons`, `RuleDetailsButtons`, etc.) therefore now report Update/Delete/Pause as supported for rules in Mimir federated groups (`source_tenants` set). Before this change those actions were blocked, so the legacy list now shows Edit/Delete for rules that can't be modified that way.
public/app/features/alerting/unified/rule-list/FilterView.tsx:157
[P3] Missing `key` on `GrafanaRuleListItem` in the filtered rule list The old `GrafanaRuleLoader` element had `key={key}`, but the replacement `GrafanaRuleListItem` inside `rules.map(...)` has no `key`, unlike the other branches. This triggers React's missing-key warning, and React falls back to index-based reconciliation, so item state (e.g. an open silence drawer or delete modal) can attach to the wrong rule as more pages of results load.
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:40
[P3] Rule detail link no longer includes `returnTo` The removed `GrafanaRuleListItem` built the link with `createRelativeUrl(\`/alerting/grafana/${uid}/view\`, { returnTo })`, using `createReturnTo()`. The new component drops `returnTo`, so going from the list (including a filtered search) to a rule's detail page and then back no longer returns to the previous list URL and filters.
PR-level
[P1] "Silence notifications" menu item does nothing in the list view public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:822-828 The list view (GrafanaRuleListItem) now passes only `promRule` to `RuleActionsButtons`, and `AlertRuleMenu` turns on `canSilence` from the new prom-rule abilities. The new GrafanaGroupLoader test also expects the Silence item to appear. Clicking it calls `setShowSilenceDrawer(true)`, but the drawer only renders when `rulerRuleType.grafana.alertingRule(rule)` is true, and `rule` (the ruler rule) is now always `undefined` in the list view. So for every Grafana alerting rule in the new list, the action is shown as available but clicking it does nothing. Either open the drawer using the prom rule's uid, or hide the item when there's no ruler rule.
PR-level
[P2] Grafana rule list items no longer get a React `key` in FilterView public/app/features/alerting/unified/rule-list/FilterView.tsx:157-162 The old `‹GrafanaRuleLoader key={key} …›` was replaced by `‹GrafanaRuleListItem …›` without carrying over `key={key}`. The other branches in the same `rules.map` still set a key. Filtered results are added a page at a time as the generator streams them in, so without a key React matches Grafana rule items by position. That causes key warnings and can attach per-item state (open silence drawer, delete modal, clone redirect) to the wrong rule when the list changes.
PR-level
[P2] View link in the list no longer includes `returnTo` public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:573 The deleted GrafanaRuleListItem in GrafanaRuleLoader.tsx built the link as `createRelativeUrl(`/alerting/grafana/${uid}/view`, { returnTo })` using `createReturnTo()`. The new component drops that parameter. `DataSourceRuleListItem` still passes `returnTo`, so this looks like an accidental change. Users opening a Grafana-managed rule from the list (including from a filtered search) lose the back-navigation to their filtered list state.
PR-level
[P2] Prom-rule abilities treat Grafana recording rules as unsupported for Export, Pause, Restore and DeletePermanently public/app/features/alerting/unified/hooks/useAbilities.ts:234-268 `useAllGrafanaPromRuleAbilities` uses `prometheusRuleType.grafana.alertingRule(rule)` to gate ModifyExport, Pause, Restore and DeletePermanently, even though the comment above it says all GrafanaPromRuleDTO rules are Grafana-managed. The ruler-based version it replaces in the list view used `rulerRuleType.grafana.rule`, which includes Grafana recording rules. Since the list view now relies only on these prom abilities, Grafana recording rules lose the Export menu item there, and any other caller would see Pause/Restore as unsupported for them. Use `prometheusRuleType.grafana.rule(rule)` for these actions and keep the alerting-only check for Silence.
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 medium ✓ exact
d3 medium ✗ —
valid · impact high
GrafanaRuleListItem now passes only promRule. The prom-rule abilities make canSilence true, so the Silence menu item appears. The drawer, however, still requires the ruler `rule`, which is now always undefined, so clicking Silence opens nothing. Before this change the ruler rule was passed and the drawer rendered. [grounded: tree public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx] [consensus 3/3: valid=3]
valid · impact high
Delete still requires rulerRule, and Pause still requires rulerRuleType.grafana.rule(rulerRule). The list view no longer passes a ruler rule, so neither item renders. The new test confirms this by expecting exactly 4 menu items, none of them Delete or Pause. Before this change rulerRule was passed, so this is a regression. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
valid · matches d1 · impact low
valid · impact low
The old component built the href with `{ returnTo }` from createReturnTo(). The new one drops it, so the view page loses its back-navigation context. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact medium
valid · impact high
Same issue as finding 1: Pause and Delete stay gated on a rulerRule that GrafanaRuleListItem no longer provides, so both actions disappear from the list-view menu. [grounded: tree public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx] [consensus 3/3: valid=3]
raw comments (6)
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:104
[P1] Silence action does nothing from the Grafana rule list GrafanaRuleListItem now renders `RuleActionsButtons` with only `promRule` (no `rule`). `AlertRuleMenu` now computes `canSilence` from the prom-rule abilities and shows "Silence notifications". But the drawer is only mounted when `rulerRuleType.grafana.alertingRule(rule)` is true, and `rule` is always undefined here. Clicking Silence sets `showSilenceDrawer` and nothing renders. This affects every Grafana alerting rule in the list view (both the group view and the filter view).
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:151
[P1] Delete and Pause menu items are never shown for Grafana rules in the list The new prom-rule abilities make `canDelete` and `canPause` true when the user has permission. The rendering is still gated on the ruler rule: Pause needs `rulerRuleType.grafana.rule(rulerRule)` and Delete needs `canDelete && rulerRule`. The list view no longer fetches or passes `rulerRule`, so both entries are silently dropped for all Grafana rules in the list. The `handleDelete(rulerRule, …)` signature also still requires a ruler rule. The ability changes are therefore dead code for these two actions, and users lose Delete and Pause from the list menu.
public/app/features/alerting/unified/rule-list/FilterView.tsx:157
[P2] Missing `key` on `GrafanaRuleListItem` in the filter view The `key={key}` prop was dropped when `GrafanaRuleLoader` was replaced by `GrafanaRuleListItem`. The grafana case inside `rules.map` now returns an unkeyed element, while the datasource and default branches still set it. React will warn about the missing key. When the filtered results are re-ordered or appended during streaming, items are reconciled by index, so item state such as the actions menu or delete modal can attach to the wrong rule.
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:573
[P3] Rule links lose the `returnTo` parameter The old `GrafanaRuleListItem` built the href with `createRelativeUrl(..., { returnTo: createReturnTo() })`. The new component calls `createRelativeUrl` without `returnTo`. Opening a Grafana rule from the list no longer lets the view page navigate back to the filtered or expanded list state. `DataSourceRuleListItem` still passes `returnTo`, so the two now behave inconsistently.
public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx:101
[P2] "Silence notifications" is shown in the list view but does nothing When `RuleActionsButtons` is rendered from `GrafanaRuleListItem` with only `promRule`, `rule` is undefined. `AlertRuleMenu` now computes `canSilence` from the new `useGrafanaPromRuleAbilities`, so it shows the "Silence notifications" item. Clicking it sets `showSilenceDrawer`, but the drawer only renders when `rulerRuleType.grafana.alertingRule(rule)` is true, and that is false for an undefined `rule`. The drawer therefore never opens for any Grafana rule in the list view. `SilenceGrafanaRuleDrawer` only needs the rule UID, so it could be driven from `promRule`.
public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:150
[P2] Delete and Pause are missing from the list-view menu for Grafana rules The menu now computes `canDelete` and `canPause` from `promRule` abilities, but both items are still gated on a ruler rule. Delete requires `canDelete && rulerRule`, and Pause requires `rerulerRuleType.grafana.rule(rulerRule)` (the `MenuItemPauseRule` condition). `GrafanaRuleListItem` passes no `rulerRule`, so neither item can render in the list view. Before this change the ruler rule was loaded and passed, so users could delete and pause Grafana rules from the list. The new `grafanaDeleteAbility` and `grafanaPauseAbility` checks are effectively dead code, and the actions are lost.
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 low ✓ off by one
d2 medium ✓ off by one
d3 medium ✓ off by one
valid · matches d3 · impact medium
valid · matches d2 · impact medium
valid · impact low
The deleted GrafanaRuleListItem built the view link as createRelativeUrl(`/alerting/grafana/${uid}/view`, { returnTo }) using createReturnTo(). The new component drops returnTo, so the viewer can no longer send users back to the filtered or grouped list they came from. This is a regression introduced by this change. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact low
raw comments (6)
public/app/features/alerting/unified/hooks/useAbilities.ts:228
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 1\. Federated rules become editable <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> <b><i>useAllAlertRuleAbilities</i></b> now delegates without the group metadata and <b><i>useAllRulerRuleAbilities</i></b> hardcodes <b><i>isFederated</i></b> to false. Federated data-source groups with ordinary update permission therefore receive an enabled Edit link even though federation previously made those rules immutable. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The refactored ability path discards the rule group's federation metadata, causing federated data-source rules to become editable. ## Fix Focus Areas - public/app/features/alerting/unified/hooks/useAbilities.ts[219-245] ## Recommended Fix Preserve the federation result when `useAllAlertRuleAbilities` delegates, such as by passing an immutable or federated flag into the shared ability implementation, and use it when calculating `immutableRule`. Add coverage proving a group with `source_tenants` does not receive the Update ability. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:47
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 2\. Grafana list users lose rule controls <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> <b><i>GrafanaRuleListItem</i></b> passes only <b><i>promRule</i></b> into <b><i>RuleActionsButtons</i></b>, while <b><i>AlertRuleMenu</i></b> and the silence drawer still require a ruler rule to render or execute actions that <b><i>useAllGrafanaPromRuleAbilities</i></b> permits. On the new Prometheus-only Grafana list path, authorized pause and delete controls remain hidden, while clicking the visible Silence notifications action only updates local state because the drawer rejects the undefined ruler rule. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description Grafana list items now supply only `GrafanaPromRuleDTO`, but pause, delete, and silence rendering or execution still depends on `RulerRuleDTO`. Make these actions work from the Prometheus-rule list path, or avoid advertising any action that cannot execute. ## Fix Focus Areas - public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[35-47] - public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[123-125] - public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[165-173] - public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx[99-106] - public/app/features/alerting/unified/hooks/useAbilities.ts[292-324] ## Recommended Fix Refactor pause, delete, and silence to operate from the Grafana rule identifier and/or `GrafanaPromRuleDTO` where sufficient, removing ruler-rule rendering gates for the Prometheus-only path. Where ruler data is fundamentally required, retain or lazily fetch the ruler rule before exposing and executing the action; keep ability checks, menu visibility, and drawer requirements aligned so no clickable but inert action is shown, and add a test that clicks Silence and verifies the drawer opens. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx:40
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 3\. Grafana rule links lose list context <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> <b><i>GrafanaRuleListItem</i></b> constructs its view URL without the <b><i>returnTo</i></b> value that the replaced loader added. Opening a Grafana rule from a filtered list or group view therefore makes the viewer&#x27;s back navigation use its <b><i>/alerting/list</i></b> fallback instead of the originating URL. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` Issue description The new Grafana rule list item omits the `returnTo` parameter when linking to the rule viewer. As a result, viewer navigation cannot restore the filtered or grouped list URL that opened the rule. Fix Focus Areas - public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[40-40] Recommended Fix Build the Grafana view URL with `createReturnTo()` and pass it as the `returnTo` query parameter, matching the prior Grafana loader and the datasource list-item link behavior. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
public/app/features/alerting/unified/rule-list/FilterView.tsx:161
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 4\. Grafana filter results reuse the wrong item <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> The Grafana branch in <b><i>FilterView</i></b> returns <b><i>GrafanaRuleListItem</i></b> without the stable <b><i>key</i></b> already generated for each result, unlike the datasource and unknown-result branches in the same <b><i>rules.map</i></b>. When filtered rules are inserted, removed, or reordered, React reconciles stateful action controls by position and can retain an open action menu, delete or silence modal, clone redirect state, or redirect state for a different rule. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description Filtered Grafana rule items omit their generated per-rule React key, allowing stateful row action controls to be reconciled against another rule when filtered results are inserted, removed, or reordered. ## Fix Focus Areas - public/app/features/alerting/unified/rule-list/FilterView.tsx[151-165] ## Recommended Fix Pass `key={key}` to `GrafanaRuleListItem`, using the existing `key` destructured from `ruleWithOrigin` and matching the datasource and unknown-result branches. Add or retain list-update coverage that inserts or removes a Grafana rule while row action state exists. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
PR-level
<h3>PR Summary by Qodo</h3> Use Prometheus rule data for Grafana alert list actions <code>✨ Enhancement</code> <code>🧪 Tests</code> <code>🕐 40+ Minutes</code> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <details> <summary>AI Description</summary> <dl> <dd> <br/> ><pre> >• Remove Grafana alert-list dependencies on Ruler API requests. >• Derive rule rendering and actions from Prometheus DTOs with folder-aware RBAC. >• Update RBAC and interaction tests for the Prometheus-only flow. ></pre> </dd> </dl> </details> <details> <summary>Diagram</summary> <dl> <dd> <br/> ```mermaid graph TD Views["Rule list views"] --> PromAPI["Prometheus API"] --> PromRules["Grafana Prom rules"] --> ListItem["Rule list item"] --> Actions["Action controls"] Actions --> Abilities["Prom rule abilities"] --> FolderRBAC["Folder RBAC"] ``` </dd> </dl> </details> <details> <summary>High-Level Assessment</summary> <dl> <dd> <br/> >The following are alternative approaches to this PR: <details> <summary><b>1. Retain dual Prometheus and Ruler loading</b></summary> <dl> <dd> - ➕ Preserves explicit creating and deleting transitional states - ➕ Reuses the existing Ruler-based authorization path - ➖ Maintains duplicate network requests and rule-matching logic - ➖ Increases latency and consistency failure modes in large rule lists </dd> </dl> </details> <details> <summary><b>2. Introduce a shared ability context model</b></summary> <dl> <dd> - ➕ Avoids duplicating Ruler and Prometheus ability calculations - ➕ Creates one authorization engine for multiple rule representations - ➖ Requires a broader domain-model refactor - ➖ Adds migration scope and risk beyond removing list-view Ruler calls </dd> </dl> </details> >**Recommendation:** The Prometheus-only list flow is the best incremental approach because it removes redundant Ruler traffic and matching logic while preserving action authorization through dedicated DTO-aware hooks. A shared normalized ability context may be worthwhile later to consolidate the parallel Ruler and Prometheus implementations. </dd> </dl> </details> <details> <summary> Files changed (13) <code> +542 / -268 </code> </summary> <dl> <dd> <br/> <details> <summary>Enhancement (6) <code> +323 / -76 </code></summary> <dl> <dd> <details> <summary>AlertRuleMenu.tsx<code>Resolve menu actions from Ruler or Prometheus rules</code> <code>+53/-24</code></summary> <br/> >Resolve menu actions from Ruler or Prometheus rules > ><pre> >• Checks pause, delete, duplicate, silence, and export abilities in batches for both Ruler and Grafana Prometheus rule representations. Menu actions are enabled when either applicable representation supports and permits them. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-89b802e6db042d03dbbf5274b7a803c74a8343cbfb9b27e872e35c8b83797a28'>public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx</a> </details> <details> <summary>useAbilities.ts<code>Add Grafana Prometheus rule ability evaluation</code> <code>+129/-43</code></summary> <br/> >Add Grafana Prometheus rule ability evaluation > ><pre> >• Introduces folder-aware ability hooks for GrafanaPromRuleDTO rules, including edit, removal, silence, export, pause, and duplicate checks. Refactors the legacy combined-rule hook through Ruler abilities and adds skip-token support for conditional Prometheus checks. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-9d113f692017ab6eb1395cde65f24fe40509cb6018725483c4d6a3faf42777a3'>public/app/features/alerting/unified/hooks/useAbilities.ts</a> </details> <details> <summary>GrafanaRuleListItem.tsx<code>Add Prometheus-backed Grafana rule list item</code> <code>+71/-0</code></summary> <br/> >Add Prometheus-backed Grafana rule list item > ><pre> >• Adds a standalone list item that renders Grafana alerting and recording rules directly from GrafanaPromRuleDTO fields. It supplies Prometheus-backed action controls and preserves health, state, location, provenance, and instance information. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-db281d21877df21cf49d951bc752ce47a61b35a69cc12eba37a5b9bba5edf40a'>public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx</a> </details> <details> <summary>RuleActionsButtons.V2.tsx<code>Support action controls without a Ruler rule</code> <code>+65/-9</code></summary> <br/> >Support action controls without a Ruler rule > ><pre> >• Allows controls to receive either a Ruler rule or Prometheus rule and derives identifiers and provenance from the available representation. Edit authorization combines both ability paths and invalid identifiers fail gracefully with a warning. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-ced28ca25c2781e52bb59c1224f46d5752e669d769fef78d56070af32970f21b'>public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx</a> </details> <details> <summary>rules.ts<code>Detect provisioned Prometheus rules</code> <code>+4/-0</code></summary> <br/> >Detect provisioned Prometheus rules > ><pre> >• Adds a helper that identifies provisioned Grafana Prometheus rules through their provenance metadata. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-8357d7d948d036ae48f2dfc214277ffd788775f64ae75f55ce53abdab823781f'>public/app/features/alerting/unified/utils/rules.ts</a> </details> <details> <summary>unified-alerting-dto.ts<code>Expose provenance on Grafana Prometheus rule DTOs</code> <code>+1/-0</code></summary> <br/> >Expose provenance on Grafana Prometheus rule DTOs > ><pre> >• Adds optional provenance metadata to the shared Grafana Prometheus rule DTO base for immutability and action checks. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-9184645c4966e8bd4df5f23a6cc59beadd5449a9f5ad046a148ae00d35a7d914'>public/app/types/unified-alerting-dto.ts</a> </details> </dd> </dl> </details> <details> <summary>Refactor (3) <code> +8 / -106 </code></summary> <dl> <dd> <details> <summary>FilterView.tsx<code>Render filtered Grafana rules without per-rule loading</code> <code>+4/-4</code></summary> <br/> >Render filtered Grafana rules without per-rule loading > ><pre> >• Replaces GrafanaRuleLoader with direct GrafanaRuleListItem rendering from the filtered Prometheus rule result. This avoids additional Ruler and Prometheus requests for each result. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-70a92729e13caebfd9230197ffd5d14562da2cf4f0a1ee227b6cd26572f04d95'>public/app/features/alerting/unified/rule-list/FilterView.tsx</a> </details> <details> <summary>GrafanaGroupLoader.tsx<code>Load Grafana groups exclusively from Prometheus</code> <code>+4/-94</code></summary> <br/> >Load Grafana groups exclusively from Prometheus > ><pre> >• Removes the Ruler group query, response matching, and synthetic creating/deleting rows. Grafana group rules are now rendered directly from the Prometheus group response. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-cb3a1b98d8a33a71f4431c83989936372dcb2a611a62c882d2ca7364e936fcd2'>public/app/features/alerting/unified/rule-list/GrafanaGroupLoader.tsx</a> </details> <details> <summary>prometheusGroupsGenerator.ts<code>Stop prefetching Grafana Ruler groups</code> <code>+0/-8</code></summary> <br/> >Stop prefetching Grafana Ruler groups > ><pre> >• Removes Ruler API cache prefetching while populating Grafana group caches. Only Prometheus group responses are now inserted for subsequent list rendering. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-2148f227b814f9b24efc23db5c80e6827fbdc102cd92f5a5b1e634ffb3db443f'>public/app/features/alerting/unified/rule-list/hooks/prometheusGroupsGenerator.ts</a> </details> </dd> </dl> </details> <details> <summary>Tests (3) <code> +211 / -84 </code></summary> <dl> <dd> <details> <summary>RuleDetails.test.tsx<code>Configure a concrete Mimir source for cloud-rule tests</code> <code>+4/-1</code></summary> <br/> >Configure a concrete Mimir source for cloud-rule tests > ><pre> >• Creates a Mimir data source fixture and associates it with the cloud rule used by RuleDetails RBAC tests. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-f2bf6972c46b59b149fc29bd7f872e00c8cd5045de66bbbd94ee634a0e1fc63a'>public/app/features/alerting/unified/components/rules/RuleDetails.test.tsx</a> </details> <details> <summary>RulesTable.test.tsx<code>Adapt table RBAC tests to dual ability hooks</code> <code>+89/-19</code></summary> <br/> >Adapt table RBAC tests to dual ability hooks > ><pre> >• Adds default mocks for singular and plural Ruler and Prometheus ability hooks. Updates Grafana and cloud rule scenarios to model permissions through the hooks now used by action buttons and menus. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-09d74a6005f3e17d27eda80a96282cf43a37311bcd3200e155692bcb61d75f6f'>public/app/features/alerting/unified/components/rules/RulesTable.test.tsx</a> </details> <details> <summary>GrafanaGroupLoader.test.tsx<code>Test Prometheus-backed rule actions and RBAC</code> <code>+118/-64</code></summary> <br/> >Test Prometheus-backed rule actions and RBAC > ><pre> >• Replaces Ruler/Prometheus matching and transitional-state tests with coverage for action controls, multiple rules, folder permissions, and menu contents. Test setup now grants explicit global and folder-level alerting permissions. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-2faa427f1ba73e786a153c2aa8addb952ea29461117f265b9927e8950b9115ee'>public/app/features/alerting/unified/rule-list/GrafanaGroupLoader.test.tsx</a> </details> </dd> </dl> </details> <details> <summary>Documentation (1) <code> +0 / -2 </code></summary> <dl> <dd> <details> <summary>grafana.json<code>Remove obsolete rule-loader translations</code> <code>+0/-2</code></summary> <br/> >Remove obsolete rule-loader translations > ><pre> >• Removes error messages that were only used by the deleted per-rule Grafana loader. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-76602a722513a133bc3afd59e0273d84c4ff16e6404cf0a2fb08d803777e5c44'>public/locales/en-US/grafana.json</a> </details> </dd> </dl> </details> </dd> </dl> </details>
PR-level
<h3>Code Review by Qodo</h3> <code>🐞 Bugs (4)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <br/> <img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> <details> <summary> 1. Federated rules become editable <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>useAllAlertRuleAbilities</i></b> now delegates without the group metadata and <b><i>useAllRulerRuleAbilities</i></b> >hardcodes <b><i>isFederated</i></b> to false. Federated data-source groups with ordinary update permission >therefore receive an enabled Edit link even though federation previously made those rules immutable. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[public/app/features/alerting/unified/hooks/useAbilities.ts[R227-228]](https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-9d113f692017ab6eb1395cde65f24fe40509cb6018725483c4d6a3faf42777a3R227-R228)</code> > >```diff >+ const groupIdentifierV2 = useMemo(() => groupIdentifier.fromCombinedRule(rule), [rule]); >+ return useAllRulerRuleAbilities(rule.rulerRule, groupIdentifierV2); >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >Federation is derived from <b><i>source_tenants</i></b>, but the delegated group identifier does not retain that >field. The resulting hardcoded false feeds <b><i>immutableRule</i></b>, while the legacy action buttons render >Edit from this ability. ></pre> > > <code>[public/app/features/alerting/unified/hooks/useAbilities.ts[219-250]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/hooks/useAbilities.ts/#L219-L250)</code> > <code>[public/app/features/alerting/unified/utils/rules.ts[368-375]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/utils/rules.ts/#L368-L375)</code> > <code>[public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx[52-59]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx/#L52-L59)</code> > <code>[public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx[84-100]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx/#L84-L100)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The refactored ability path discards the rule group's federation metadata, causing federated data-source rules to become editable. > >## Fix Focus Areas >- public/app/features/alerting/unified/hooks/useAbilities.ts[219-245] > >## Recommended Fix >Preserve the federation result when `useAllAlertRuleAbilities` delegates, such as by passing an immutable or federated flag into the shared ability implementation, and use it when calculating `immutableRule`. Add coverage proving a group with `source_tenants` does not receive the Update ability. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 2. Grafana list users lose rule controls <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>GrafanaRuleListItem</i></b> passes only <b><i>promRule</i></b> into <b><i>RuleActionsButtons</i></b>, while <b><i>AlertRuleMenu</i></b> and >the silence drawer still require a ruler rule to render or execute actions that ><b><i>useAllGrafanaPromRuleAbilities</i></b> permits. On the new Prometheus-only Grafana list path, authorized >pause and delete controls remain hidden, while clicking the visible Silence notifications action >only updates local state because the drawer rejects the undefined ruler rule. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[47]](https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-db281d21877df21cf49d951bc752ce47a61b35a69cc12eba37a5b9bba5edf40aR47-R47)</code> > >```diff >+ actions: <RuleActionsButtons promRule={rule} groupIdentifier={groupIdentifier} compact />, >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The new Grafana list item supplies <b><i>promRule</i></b> without <b><i>rulerRule</i></b>, so the forwarded ruler DTO is >undefined. The Grafana Prometheus ability checks can nevertheless grant pause, delete, and silence: >pause and delete remain absent because their menu branches independently require <b><i>rulerRule</i></b>, while >Silence renders but its click handler only sets state and the drawer remains gated on the missing >ruler rule. ></pre> > > <code>[public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[35-48]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx/#L35-L48)</code> > <code>[public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx[92-106]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx/#L92-L106)</code> > <code>[public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[123-131]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx/#L123-L131)</code> > <code>[public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[165-173]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx/#L165-L173)</code> > <code>[public/app/features/alerting/unified/hooks/useAbilities.ts[317-329]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/hooks/useAbilities.ts/#L317-L329)</code> > <code>[public/app/features/alerting/unified/components/silences/SilenceGrafanaRuleDrawer.tsx[11-23]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/silences/SilenceGrafanaRuleDrawer.tsx/#L11-L23)</code> > <code>[public/app/features/alerting/unified/hooks/useAbilities.ts[292-324]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/hooks/useAbilities.ts/#L292-L324)</code> > <code>[public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[94-131]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx/#L94-L131)</code> > <code>[public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[35-47]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx/#L35-L47)</code> > <code>[public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx[99-105]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx/#L99-L105)</code> > <code>[public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[66-87]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx/#L66-L87)</code> > <code>[public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[123-125]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx/#L123-L125)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >Grafana list items now supply only `GrafanaPromRuleDTO`, but pause, delete, and silence rendering or execution still depends on `RulerRuleDTO`. Make these actions work from the Prometheus-rule list path, or avoid advertising any action that cannot execute. > >## Fix Focus Areas >- public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[35-47] >- public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[123-125] >- public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx[165-173] >- public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx[99-106] >- public/app/features/alerting/unified/hooks/useAbilities.ts[292-324] > >## Recommended Fix >Refactor pause, delete, and silence to operate from the Grafana rule identifier and/or `GrafanaPromRuleDTO` where sufficient, removing ruler-rule rendering gates for the Prometheus-only path. Where ruler data is fundamentally required, retain or lazily fetch the ruler rule before exposing and executing the action; keep ability checks, menu visibility, and drawer requirements aligned so no clickable but inert action is shown, and add a test that clicks Silence and verifies the drawer opens. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <br/> <img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> <details> <summary> 3. Grafana rule links lose list context <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>GrafanaRuleListItem</i></b> constructs its view URL without the <b><i>returnTo</i></b> value that the replaced loader >added. Opening a Grafana rule from a filtered list or group view therefore makes the viewer&#x27;s back >navigation use its <b><i>/alerting/list</i></b> fallback instead of the originating URL. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[40]](https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-db281d21877df21cf49d951bc752ce47a61b35a69cc12eba37a5b9bba5edf40aR40-R40)</code> > >```diff >+ href: createRelativeUrl(`/alerting/grafana/${uid}/view`), >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The new URL has no return target, while the viewer explicitly defaults <b><i>returnTo</i></b> to the generic >alert list. Existing list-item URL construction demonstrates that list links preserve this >parameter. ></pre> > > <code>[public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[33-47]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx/#L33-L47)</code> > <code>[public/app/features/alerting/unified/components/rule-viewer/RuleViewer.tsx[96-97]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rule-viewer/RuleViewer.tsx/#L96-L97)</code> > <code>[public/app/features/alerting/unified/components/rule-viewer/RuleViewer.tsx[115-124]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/components/rule-viewer/RuleViewer.tsx/#L115-L124)</code> > <code>[public/app/features/alerting/unified/rule-list/DataSourceRuleListItem.tsx[36-42]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/DataSourceRuleListItem.tsx/#L36-L42)</code> > <code>[public/app/features/alerting/unified/rule-list/DataSourceRuleListItem.tsx[79-83]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/DataSourceRuleListItem.tsx/#L79-L83)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >Issue description >The new Grafana rule list item omits the `returnTo` parameter when linking to the rule viewer. As a result, viewer navigation cannot restore the filtered or grouped list URL that opened the rule. > >Fix Focus Areas >- public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[40-40] > >Recommended Fix >Build the Grafana view URL with `createReturnTo()` and pass it as the `returnTo` query parameter, matching the prior Grafana loader and the datasource list-item link behavior. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 4. Grafana filter results reuse the wrong item <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >The Grafana branch in <b><i>FilterView</i></b> returns <b><i>GrafanaRuleListItem</i></b> without the stable <b><i>key</i></b> already >generated for each result, unlike the datasource and unknown-result branches in the same ><b><i>rules.map</i></b>. When filtered rules are inserted, removed, or reordered, React reconciles stateful >action controls by position and can retain an open action menu, delete or silence modal, clone >redirect state, or redirect state for a different rule. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[public/app/features/alerting/unified/rule-list/FilterView.tsx[R157-161]](https://github.com/drape-io/crbench-qodo-2026-09/pull/91/files#diff-70a92729e13caebfd9230197ffd5d14562da2cf4f0a1ee227b6cd26572f04d95R157-R161)</code> > >```diff >+ <GrafanaRuleListItem >+ rule={rule} > groupIdentifier={groupIdentifier} > namespaceName={ruleWithOrigin.namespaceName} >+ showLocation={true} >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> ><b><i>FilterView</i></b> generates and extracts a stable key and applies it to the neighboring non-Grafana >branches, but the newly substituted <b><i>GrafanaRuleListItem</i></b> does not receive it. Each Grafana item >embeds <b><i>RuleActionsButtons</i></b>, whose local state includes action-menu, delete, silence, and clone or >redirect behavior, demonstrating why positional reconciliation can associate existing UI state with >another rule after the list changes. ></pre> > > <code>[public/app/features/alerting/unified/rule-list/FilterView.tsx[151-175]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/FilterView.tsx/#L151-L175)</code> > <code>[public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[35-48]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx/#L35-L48)</code> > <code>[public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx[41-49]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx/#L41-L49)</code> > <code>[public/app/features/alerting/unified/rule-list/FilterView.tsx[104-107]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/FilterView.tsx/#L104-L107)</code> > <code>[public/app/features/alerting/unified/rule-list/FilterView.tsx[151-173]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/FilterView.tsx/#L151-L173)</code> > <code>[public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx[35-47]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/GrafanaRuleListItem.tsx/#L35-L47)</code> > <code>[public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx[43-49]](https://github.com/drape-io/crbench-qodo-2026-09/blob/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx/#L43-L49)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >Filtered Grafana rule items omit their generated per-rule React key, allowing stateful row action controls to be reconciled against another rule when filtered results are inserted, removed, or reordered. > >## Fix Focus Areas >- public/app/features/alerting/unified/rule-list/FilterView.tsx[151-165] > >## Recommended Fix >Pass `key={key}` to `GrafanaRuleListItem`, using the existing `key` destructured from `ruleWithOrigin` and matching the datasource and unknown-result branches. Add or retain list-update coverage that inserts or removes a Grafana rule while row action state exists. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-context:start --> <details><summary><strong>Context sources</strong></summary> <div>Review mode: <code>🧠 Deep</code>: This is a broad, behavior-changing alerting refactor spanning permissions/RBAC, rule loading, UI actions, API usage, and multiple independent code paths, with substantial logic density and many opportunities for subtle regressions.</div> <!-- qodo-context:end --> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-daily-tip:start --> <details> <summary><strong>Tip of the day</strong></summary> <br/> <pre>💡 Did you know, you can reply &#x27;qodo&#x27; on any finding to push back, ask questions, or dig deeper</pre> <a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-daily-tip:end --> <!-- https://github.com/drape-io/crbench-qodo-2026-09/commit/2676fc90149a7690d1b5f0e98c073ed99f4bb1fb --> <a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>