Skip to content

CONSOLE-5065: Align Console useResolvedExtensions hook with upstream plugin SDK#16815

Open
vojtechszocs wants to merge 1 commit into
openshift:mainfrom
vojtechszocs:improve-useResolvedExtensions
Open

CONSOLE-5065: Align Console useResolvedExtensions hook with upstream plugin SDK#16815
vojtechszocs wants to merge 1 commit into
openshift:mainfrom
vojtechszocs:improve-useResolvedExtensions

Conversation

@vojtechszocs

@vojtechszocs vojtechszocs commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Analysis / Root cause

Align Console useResolvedExtensions hook with changes in openshift/dynamic-plugin-sdk#313

  • Console useExtensions hook (not exposed via plugin API) accepts a single predicate
  • Console useResolvedExtensions hook updated to accept a single predicate, which follows the upstream hook signature

Important

Consumers should call this hook once per each distinct extension type to avoid complexity associated with unions of distinct extension objects.

Solution description

Modify Console useResolvedExtensions hook and its types according to the above analysis.

Additional changes

  • Replace ExtensionTypeGuard with ExtensionPredicate from @openshift/dynamic-plugin-sdk
  • Fix console-app/src/components/nodes/node-dashboard/InventoryCard.tsx to use Console hook
  • Bump @openshift/dynamic-plugin-sdk version to 9.0.0
  • Bump @openshift/dynamic-plugin-sdk-webpack version to 5.3.0

Summary by CodeRabbit

  • Breaking Changes

    • Updated dynamic plugin extension resolution hook to accept a single predicate instead of multiple predicates.
    • Extension resolution results now use the newer loaded-and-resolved format.
    • Call the hook separately for each distinct extension type rather than combining predicates.
  • Chores

    • Upgraded dynamic plugin SDK packages to newer versions.
    • Updated related shared hook and type definitions to match the new resolution format.
    • Adjusted app components and tests to use the updated hook import path.
  • Tests

    • Updated Inventory card unit test mocks to align with the new hook usage.

@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

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The dynamic plugin SDK dependencies were upgraded, and extension resolution APIs now accept a single predicate and return loaded-and-resolved extension types. Related consumer typings, imports, tests, and release notes were updated.

Changes

Extension Resolution API

Layer / File(s) Summary
SDK and extension type contracts
frontend/package.json, frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts, frontend/packages/console-dynamic-plugin-sdk/src/types.ts
SDK versions and exported extension type contracts now support single-predicate resolution and loaded-and-resolved extensions.
Single-predicate resolution hook
frontend/packages/console-dynamic-plugin-sdk/src/api/useResolvedExtensions.ts, frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md
useResolvedExtensions now accepts one predicate, obtains extensions through useExtensions, and delegates resolution to useResolvedExtensionsSDK; release notes document the breaking API change.
Consumer wiring and type alignment
frontend/packages/console-shared/src/hooks/useDetailsItemExtensionsForResource.ts, frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx, frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/InventoryCard.spec.tsx
Consumer imports, Jest mocks, and resource detail hook typings use the console resolution hook and LoadedAndResolvedExtension.

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

Suggested reviewers: cajieh, leo6leo

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
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 The only changed spec file uses static Jest test titles; no dynamic values appear in any It/Describe/Context/When names.
Test Structure And Quality ✅ Passed Only a React/Jest spec changed; no Ginkgo tests, cluster waits, or resource cleanup issues were introduced.
Microshift Test Compatibility ✅ Passed No new or changed Ginkgo e2e tests were added; the only test change is a Jest/RTL unit test in TSX, so MicroShift compatibility is not implicated.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the only test change is a Jest unit spec in a frontend .tsx path, so SNO topology checks are not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The diff only touches frontend TypeScript/MD/package files; no deployment manifests, operator code, or controllers were modified, so no topology scheduling risk.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes or suite-setup changes were introduced; the PR only updates hooks, types, imports, and Jest mocks.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; changed files are frontend code and a Jest unit test, with no IPv4 assumptions or external connectivity.
No-Weak-Crypto ✅ Passed PR only updates hook/type signatures and dependency versions; diff scan found 0 weak-crypto tokens in added lines.
Container-Privileges ✅ Passed PR only changes TS/MD/package files; no container/K8s manifests or privileged/root settings appear in the diff.
No-Sensitive-Data-In-Logs ✅ Passed No new logging or sensitive-data exposure appears in the PR diff; changes are hook/type updates and dependency bumps only.
Title check ✅ Passed The title clearly matches the main change: aligning useResolvedExtensions with the upstream plugin SDK.
Description check ✅ Passed The core analysis and solution are present, but several template sections like test setup, test cases, browser conformance, and reviewers are missing.
✨ 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 Leo6Leo and cajieh July 23, 2026 18:41
@openshift-ci openshift-ci Bot added the component/sdk Related to console-plugin-sdk label Jul 23, 2026
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vojtechszocs

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added component/shared Related to console-shared approved Indicates a PR has been approved by an approver from all required OWNERS files. plugin-api-changed Categorizes a PR as containing plugin API changes labels Jul 23, 2026
@vojtechszocs vojtechszocs changed the title Align Console useResolvedExtensions hook with upstream plugin SDK CONSOLE-5065: Align Console useResolvedExtensions hook with upstream plugin SDK Jul 23, 2026
> with unions of distinct extension objects.

- **Type breaking**: Replace `ExtensionTypeGuard` with `ExtensionPredicate` from `@openshift/dynamic-plugin-sdk` ([#16115], [CONSOLE-5065])
- **Breaking**: `useResolvedExtensions` hook now accepts a single predicate parameter (TODO)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still don't know how I feel about making a runtime breaking change in this release, even if most plugins won't be affected...

@vojtechszocs vojtechszocs Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looking at git history, Console useExtensions initially supported multiple predicates and then it was aligned with upstream useExtensions to use a single predicate.

Console useResolvedExtensions should have been aligned accordingly, but we missed that and doing it now would yield a potentially breaking change. That said, most (if not all) consumers should not use >1 predicate since doing otherwise results in additional complexity (due to dealing with object type unions).

I'd rather do this change now than wait for the next release, but if others think we must avoid breaking changes (regardless of how big or small they are) then I can keep the glue code for evaluating multiple predicates.

@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 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@vojtechszocs: This pull request references CONSOLE-5065 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 story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Analysis / Root cause

Align Console useResolvedExtensions hook with changes in openshift/dynamic-plugin-sdk#313

  • Console useExtensions hook (not exposed via plugin API) accepts a single predicate
  • Console useResolvedExtensions hook updated to accept a single predicate, which follows the upstream hook signature

[!IMPORTANT]
Consumers should call this hook once per each distinct extension type to avoid complexity associated with unions of distinct extension objects.

Solution description

Modify Console useResolvedExtensions hook and its types according to the above analysis.

Additional changes

  • Replace ExtensionTypeGuard with ExtensionPredicate from @openshift/dynamic-plugin-sdk
  • Bump @openshift/dynamic-plugin-sdk version to 9.0.0
  • Bump @openshift/dynamic-plugin-sdk-webpack version to 5.3.0

Summary by CodeRabbit

  • Breaking Changes

  • Updated dynamic plugin extension APIs to accept a single predicate instead of multiple predicates.

  • Extension results now use the newer loaded-and-resolved format.

  • Consumers using multiple predicates must call the hook separately for each extension type.

  • Chores

  • Updated dynamic plugin SDK packages to newer versions.

  • Updated related extension type definitions and documentation.

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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

Inline comments:
In `@frontend/package.json`:
- Around line 68-69: Pin the dependency versions for
`@openshift/dynamic-plugin-sdk` and `@openshift/dynamic-plugin-sdk-webpack` exactly
instead of using caret ranges, update the lockfile while preserving integrity
metadata, and run the repository’s OSV/SCA check against the resolved dependency
graph to identify any known CVEs.

In `@frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md`:
- Around line 15-20: Update the useResolvedExtensions breaking-change entry in
CHANGELOG-core.md to state that its public return type changed from
ResolvedExtension[] to LoadedAndResolvedExtension[]; remove “(TODO)” and change
“once per each” to “once for each,” while preserving the existing
predicate-arity and ExtensionTypeGuard details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 38f06436-5add-4737-8850-43f71ca7733c

📥 Commits

Reviewing files that changed from the base of the PR and between 88f2840 and 8becdb0.

⛔ Files ignored due to path filters (1)
  • frontend/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • frontend/package.json
  • frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md
  • frontend/packages/console-dynamic-plugin-sdk/src/api/useResolvedExtensions.ts
  • frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts
  • frontend/packages/console-dynamic-plugin-sdk/src/types.ts
  • frontend/packages/console-shared/src/hooks/useDetailsItemExtensionsForResource.ts
💤 Files with no reviewable changes (1)
  • frontend/packages/console-dynamic-plugin-sdk/src/types.ts

Comment thread frontend/package.json
Comment on lines +68 to +69
"@openshift/dynamic-plugin-sdk": "^9.0.0",
"@openshift/dynamic-plugin-sdk-webpack": "^5.3.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Pin the upgraded SDK packages exactly.

^9.0.0 and ^5.3.0 permit future resolutions to change the SDK and transitive dependency graph. Use exact versions and ensure the lockfile retains integrity metadata; run the repository’s OSV/SCA check for the resolved graph.

As per path instructions, package manifests must pin exact versions, verify hashes where supported, and flag known CVEs.

Proposed fix
-    "`@openshift/dynamic-plugin-sdk`": "^9.0.0",
-    "`@openshift/dynamic-plugin-sdk-webpack`": "^5.3.0",
+    "`@openshift/dynamic-plugin-sdk`": "9.0.0",
+    "`@openshift/dynamic-plugin-sdk-webpack`": "5.3.0",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@openshift/dynamic-plugin-sdk": "^9.0.0",
"@openshift/dynamic-plugin-sdk-webpack": "^5.3.0",
"`@openshift/dynamic-plugin-sdk`": "9.0.0",
"`@openshift/dynamic-plugin-sdk-webpack`": "5.3.0",
🤖 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 `@frontend/package.json` around lines 68 - 69, Pin the dependency versions for
`@openshift/dynamic-plugin-sdk` and `@openshift/dynamic-plugin-sdk-webpack` exactly
instead of using caret ranges, update the lockfile while preserving integrity
metadata, and run the repository’s OSV/SCA check against the resolved dependency
graph to identify any known CVEs.

Source: Path instructions

Comment on lines +15 to +20
> This release removes support for passing multiple predicates to `useResolvedExtensions` hook.
> Consumers should call this hook once per each distinct extension type to avoid complexity associated
> with unions of distinct extension objects.

- **Type breaking**: Replace `ExtensionTypeGuard` with `ExtensionPredicate` from `@openshift/dynamic-plugin-sdk` ([#16115], [CONSOLE-5065])
- **Breaking**: `useResolvedExtensions` hook now accepts a single predicate parameter (TODO)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document the complete breaking change before publishing.

The public return type also changed from ResolvedExtension[] to LoadedAndResolvedExtension[], but this note only covers predicate arity and the renamed type guard. Add that return-type change, remove (TODO), and change “once per each” to “once for each.”

🤖 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 `@frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md` around lines
15 - 20, Update the useResolvedExtensions breaking-change entry in
CHANGELOG-core.md to state that its public return type changed from
ResolvedExtension[] to LoadedAndResolvedExtension[]; remove “(TODO)” and change
“once per each” to “once for each,” while preserving the existing
predicate-arity and ExtensionTypeGuard details.

@vojtechszocs
vojtechszocs force-pushed the improve-useResolvedExtensions branch from 8becdb0 to 6d9f709 Compare July 23, 2026 19:48
@openshift-ci openshift-ci Bot added the component/core Related to console core functionality label Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md (1)

15-20: 📐 Maintainability & Code Quality | 🟡 Minor

Complete the breaking-change note before publishing.

This entry still leaves (TODO), says “once per each,” and omits the return-type change from ResolvedExtension[] to LoadedAndResolvedExtension[].

🤖 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 `@frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md` around lines
15 - 20, The changelog entry for useResolvedExtensions must be
publication-ready: remove “(TODO)”, correct the wording to “once for each
distinct extension type,” and explicitly document the return-type change from
ResolvedExtension[] to LoadedAndResolvedExtension[].
🤖 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.

Duplicate comments:
In `@frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md`:
- Around line 15-20: The changelog entry for useResolvedExtensions must be
publication-ready: remove “(TODO)”, correct the wording to “once for each
distinct extension type,” and explicitly document the return-type change from
ResolvedExtension[] to LoadedAndResolvedExtension[].

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 3e9068ef-4a0d-49be-9b3a-02a448e7d94e

📥 Commits

Reviewing files that changed from the base of the PR and between 8becdb0 and 6d9f709.

⛔ Files ignored due to path filters (1)
  • frontend/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • frontend/package.json
  • frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx
  • frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/InventoryCard.spec.tsx
  • frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md
  • frontend/packages/console-dynamic-plugin-sdk/src/api/useResolvedExtensions.ts
  • frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts
  • frontend/packages/console-dynamic-plugin-sdk/src/types.ts
  • frontend/packages/console-shared/src/hooks/useDetailsItemExtensionsForResource.ts
💤 Files with no reviewable changes (1)
  • frontend/packages/console-dynamic-plugin-sdk/src/types.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/package.json
  • frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@vojtechszocs: The following tests 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/analyze 6d9f709 link true /test analyze
ci/prow/frontend 6d9f709 link true /test frontend

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

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/sdk Related to console-plugin-sdk component/shared Related to console-shared jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. plugin-api-changed Categorizes a PR as containing plugin API changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants