Skip to content

OU-1465: feat: add deny button on run detail view#117

Open
jgbernalp wants to merge 1 commit into
openshift:mainfrom
jgbernalp:add-deny-button
Open

OU-1465: feat: add deny button on run detail view#117
jgbernalp wants to merge 1 commit into
openshift:mainfrom
jgbernalp:add-deny-button

Conversation

@jgbernalp

@jgbernalp jgbernalp commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This PR is a follow up from refactoring the detail view to match the UX mockups.

It adds the "Deny" button.

Screenshot 2026-07-13 at 12 59 32 Screenshot 2026-07-13 at 13 06 30 Screenshot 2026-07-13 at 13 00 16

@openshift-ci-robot

openshift-ci-robot commented Jul 13, 2026

Copy link
Copy Markdown

@jgbernalp: This pull request references OU-1465 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This PR is a follow up from refactoring the detail view to match the UX mockups.

It adds the "Deny" button.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 3 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.

How can I continue?

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

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7fec3627-e801-4376-85dd-11b93ea10798

📥 Commits

Reviewing files that changed from the base of the PR and between b2d66a7 and 7002ced.

📒 Files selected for processing (5)
  • locales/en/plugin__lightspeed-agentic-console-plugin.json
  • src/components/ApprovalGatedButton.tsx
  • src/components/runs/RunDetailPage.tsx
  • src/components/runs/detail/RemediationOptionCard.tsx
  • src/hooks/useAgenticRun.ts
📝 Walkthrough

Walkthrough

Agentic run approval and denial now use localized messages, shared permission-gated buttons, and confirmation modals. Timeline labels and mutation errors are translated, while denial moves from remediation cards to the run detail page.

Changes

Agentic run approval and denial

Layer / File(s) Summary
Localized approval and run messages
locales/en/plugin__lightspeed-agentic-console-plugin.json
Adds and updates approval, denial, execution-status, remediation, permission, and timeline strings.
Localized timeline and execution mutations
src/hooks/useAgenticRun.ts
Localizes timeline labels and approval/denial errors, including unavailable resources and failed Kubernetes patches.
Permission-gated approval and denial controls
src/components/ApprovalGatedButton.tsx, src/components/runs/RunDetailPage.tsx, src/components/runs/detail/RemediationOptionCard.tsx
Adds shared approval gating, moves denial to the proposed-run view, and connects approval and denial confirmation modals to mutation state.

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant RunDetailPage
  participant ConfirmationModal
  participant useAgenticRun
  participant KubernetesAPI
  Operator->>RunDetailPage: Select Deny
  RunDetailPage->>ConfirmationModal: Open confirmation
  Operator->>ConfirmationModal: Confirm denial
  ConfirmationModal->>RunDetailPage: Invoke denial action
  RunDetailPage->>useAgenticRun: denyExecution()
  useAgenticRun->>KubernetesAPI: Patch execution state
  KubernetesAPI-->>useAgenticRun: Return mutation result
  useAgenticRun-->>RunDetailPage: Update mutation state or error
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a deny button to the run detail view.
Description check ✅ Passed The description is directly related to the changeset and accurately states that the PR adds the Deny button.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci Bot requested review from raptorsun and xrajesh July 13, 2026 09:54
@openshift-ci

openshift-ci Bot commented Jul 13, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign raptorsun for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jgbernalp jgbernalp force-pushed the add-deny-button branch 2 times, most recently from 18fb24e to b2d66a7 Compare July 13, 2026 10:52
@jgbernalp

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/hooks/useAgenticRun.ts (1)

430-465: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated precondition/mutation-lifecycle logic between approveExecution and denyExecution.

Both callbacks repeat the same !canApprove → error, !run || !approval → error, setMutationInProgress/setMutationError bracketing, and catch/fallback pattern. Extracting a shared helper (e.g., runApprovalMutation(patchData, fallbackErrorKey)) would remove ~25 lines of duplication and prevent the two paths from drifting apart on future changes.

♻️ Sketch of a shared helper
+  const runApprovalMutation = useCallback(
+    async (patchData: unknown, fallbackErrorKey: string): Promise<boolean> => {
+      if (!canApprove) {
+        setMutationError(t('You do not have permission to approve or deny runs.'));
+        return false;
+      }
+      if (!run || !approval) {
+        setMutationError(t('Approval resource is not available yet.'));
+        return false;
+      }
+      setMutationInProgress(true);
+      setMutationError(undefined);
+      try {
+        await k8sPatch({
+          model: LightspeedAgenticRunApprovalModel,
+          resource: { metadata: { name: run.metadata?.name, namespace } },
+          data: patchData,
+        });
+        return true;
+      } catch (err) {
+        setMutationError((err as Error)?.message || t(fallbackErrorKey));
+        return false;
+      } finally {
+        setMutationInProgress(false);
+      }
+    },
+    [run, approval, namespace, canApprove, t],
+  );

Also applies to: 467-496

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/useAgenticRun.ts` around lines 430 - 465, Extract the shared
precondition checks, mutation state lifecycle, and error handling from
approveExecution and denyExecution into a helper such as runApprovalMutation.
Have both callbacks build only their operation-specific patch data and delegate
to that helper, preserving the existing permission/resource validation and
operation-specific fallback error messages.
locales/en/plugin__lightspeed-agentic-console-plugin.json (1)

124-125: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Near-duplicate permission strings.

"You do not have permission to approve or deny runs." (line 124, used in useAgenticRun.ts mutation errors) and "You don't have permission to approve or deny runs." (line 125, used in ApprovalGatedButton.tsx tooltip) differ only by contraction. Consumers see one wording in the tooltip and a different one in the error banner for the same underlying condition. Consolidate to a single string/key reused in both places to avoid translator duplication and inconsistent voice.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@locales/en/plugin__lightspeed-agentic-console-plugin.json` around lines 124 -
125, Consolidate the two approval-permission translation entries into one
canonical string/key, then update the references in useAgenticRun and
ApprovalGatedButton to reuse it. Preserve the existing permission-denied
behavior while ensuring the tooltip and mutation error display identical
wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@locales/en/plugin__lightspeed-agentic-console-plugin.json`:
- Around line 124-125: Consolidate the two approval-permission translation
entries into one canonical string/key, then update the references in
useAgenticRun and ApprovalGatedButton to reuse it. Preserve the existing
permission-denied behavior while ensuring the tooltip and mutation error display
identical wording.

In `@src/hooks/useAgenticRun.ts`:
- Around line 430-465: Extract the shared precondition checks, mutation state
lifecycle, and error handling from approveExecution and denyExecution into a
helper such as runApprovalMutation. Have both callbacks build only their
operation-specific patch data and delegate to that helper, preserving the
existing permission/resource validation and operation-specific fallback error
messages.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5d40b411-c684-4f0c-a437-09b6cfa918eb

📥 Commits

Reviewing files that changed from the base of the PR and between 6d638b8 and b2d66a7.

📒 Files selected for processing (5)
  • locales/en/plugin__lightspeed-agentic-console-plugin.json
  • src/components/ApprovalGatedButton.tsx
  • src/components/runs/RunDetailPage.tsx
  • src/components/runs/detail/RemediationOptionCard.tsx
  • src/hooks/useAgenticRun.ts

Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants