Skip to content

OCPBUGS-86298: Fix missing Impersonate action on RoleBinding detail page#16783

Open
shahsahil264 wants to merge 1 commit into
openshift:mainfrom
shahsahil264:OCPBUGS-86298-fix-rolebinding-impersonate-action
Open

OCPBUGS-86298: Fix missing Impersonate action on RoleBinding detail page#16783
shahsahil264 wants to merge 1 commit into
openshift:mainfrom
shahsahil264:OCPBUGS-86298-fix-rolebinding-impersonate-action

Conversation

@shahsahil264

@shahsahil264 shahsahil264 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Analysis / Root cause:
The RoleBindings list page flatten() function (bindings.tsx) splits each binding into one row per subject, adding a subjectIndex property. The useBindingActions hook reads obj.subjectIndex to look up the subject and conditionally includes the "Impersonate" action only when subject?.kind === 'User' || subject?.kind === 'Group'. On the detail page, the raw K8s resource is passed without subjectIndex, so subjects?.[undefined] evaluates to undefined and the impersonate action is never included.

Solution description:
Modified useBindingActionsProvider in binding-provider.ts to default subjectIndex to 0 when it is not present on the resource object. This ensures the first subject is used for action generation on the detail page, making the Impersonate action (and other subject-specific actions like Duplicate and Edit Subject) work correctly.

Screenshots / screen recording:

Test setup:

  1. Navigate to User Management > RoleBindings (or ClusterRoleBindings)
  2. Find 'basic-users' binding

Test cases:

  • Verify "Impersonate Group system:authenticated" appears in the detail page Actions menu (previously missing)
  • Verify "Impersonate Group system:authenticated" still works from the list page kebab (regression check)
  • Verify Duplicate and Edit Subject actions also appear on the detail page

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
Jira: https://redhat.atlassian.net/browse/OCPBUGS-86298

Reproduced on cluster 5.0.0-0.ci-2026-07-20-062541 — detail page Actions menu shows only "Duplicate ClusterRoleBinding", "Edit ClusterRoleBinding subject", "Delete ClusterRoleBinding" with no Impersonate action.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed binding detail pages so subject-specific actions remain available when the subject index is missing.
    • Added a default subject selection to ensure binding actions display consistently.

The RoleBindings list page flatten() function sets subjectIndex on each
row, but the detail page passes the raw K8s resource without it. When
subjectIndex is undefined, subjects?.[undefined] evaluates to undefined
and the Impersonate action is skipped. Default subjectIndex to 0 in the
provider so the first subject is used on the detail page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 20, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@shahsahil264: This pull request references Jira Issue OCPBUGS-86298, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Analysis / Root cause:
The RoleBindings list page flatten() function (bindings.tsx) splits each binding into one row per subject, adding a subjectIndex property. The useBindingActions hook reads obj.subjectIndex to look up the subject and conditionally includes the "Impersonate" action only when subject?.kind === 'User' || subject?.kind === 'Group'. On the detail page, the raw K8s resource is passed without subjectIndex, so subjects?.[undefined] evaluates to undefined and the impersonate action is never included.

Solution description:
Modified useBindingActionsProvider in binding-provider.ts to default subjectIndex to 0 when it is not present on the resource object. This ensures the first subject is used for action generation on the detail page, making the Impersonate action (and other subject-specific actions like Duplicate and Edit Subject) work correctly.

Screenshots / screen recording:

Test setup:

  1. Navigate to User Management > RoleBindings (or ClusterRoleBindings)
  2. Find 'basic-users' binding

Test cases:

  • Verify "Impersonate Group system:authenticated" appears in the detail page Actions menu (previously missing)
  • Verify "Impersonate Group system:authenticated" still works from the list page kebab (regression check)
  • Verify Duplicate and Edit Subject actions also appear on the detail page

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
Jira: https://redhat.atlassian.net/browse/OCPBUGS-86298

Reproduced on cluster 5.0.0-0.ci-2026-07-20-062541 — detail page Actions menu shows only "Duplicate ClusterRoleBinding", "Edit ClusterRoleBinding subject", "Delete ClusterRoleBinding" with no Impersonate action.

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.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 473b77b3-50a3-4b79-88fc-0308500b78f6

📥 Commits

Reviewing files that changed from the base of the PR and between a70992e and d91be92.

📒 Files selected for processing (1)
  • frontend/packages/console-app/src/actions/providers/binding-provider.ts

Walkthrough

The binding actions provider now normalizes resources without a numeric subjectIndex by defaulting it to 0 before passing them to useBindingActions.

Changes

Binding actions

Layer / File(s) Summary
Normalize binding resource
frontend/packages/console-app/src/actions/providers/binding-provider.ts
A memoized resource copy defaults a missing numeric subjectIndex to 0, and the normalized resource is passed to useBindingActions.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, specific, and matches the main fix: restoring the missing Impersonate action on detail pages.
Description check ✅ Passed The description covers root cause, solution, test setup, test cases, and Jira context; screenshots and browser conformance are still unfilled.
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.
Stable And Deterministic Test Names ✅ Passed PR changes only binding-provider.ts; no Ginkgo tests or titles were added or modified.
Test Structure And Quality ✅ Passed PR only changes a React provider file; no Ginkgo test files or test code were modified, so the Ginkgo-specific quality check is not applicable.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests were added; the PR only changes a frontend hook in binding-provider.ts and contains no MicroShift-sensitive APIs or guards.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only a frontend TypeScript provider changed; no new Ginkgo e2e tests were added, so the SNO test check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Only a frontend action-provider changed; no manifests, controllers, or scheduling constraints were added or modified.
Ote Binary Stdout Contract ✅ Passed PR only changes a React hook in console-app; no main/init/TestMain/suite setup or stdout writes were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests were added; the PR only changes a frontend hook in binding-provider.ts.
No-Weak-Crypto ✅ Passed The patch only defaults subjectIndex for binding actions; no MD5/SHA/RC4/DES, custom crypto, or secret comparisons appear in the changed code.
Container-Privileges ✅ Passed Only binding-provider.ts changed; it’s frontend action logic, with no container/K8s manifest fields like privileged or hostNetwork present.
No-Sensitive-Data-In-Logs ✅ Passed The PR only adds a subjectIndex normalization in the provider; no new logging or sensitive-data exposure appears in the changed code.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
openshift-ci Bot requested review from spadgett and stefanonardo July 20, 2026 19:23
@openshift-ci openshift-ci Bot added the component/core Related to console core functionality label Jul 20, 2026
@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shahsahil264
Once this PR has been reviewed and has the lgtm label, please assign cajieh 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

@shahsahil264

Copy link
Copy Markdown
Contributor Author

/pipeline required

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-gcp-console
/test e2e-playwright

@shahsahil264

Copy link
Copy Markdown
Contributor Author

/retest

4 similar comments
@shahsahil264

Copy link
Copy Markdown
Contributor Author

/retest

@shahsahil264

Copy link
Copy Markdown
Contributor Author

/retest

@shahsahil264

Copy link
Copy Markdown
Contributor Author

/retest

@shahsahil264

Copy link
Copy Markdown
Contributor Author

/retest

@shahsahil264

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@shahsahil264: This pull request references Jira Issue OCPBUGS-86298, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

@shahsahil264

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@shahsahil264: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-playwright d91be92 link false /test e2e-playwright

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/core Related to console core functionality jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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