Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"dependencies": {
"@monaco-editor/react": "^4.7.0",
"@openshift/api-types": "^1.0.0",
"@openshift/dynamic-plugin-sdk": "^8.2.0",
"@openshift/dynamic-plugin-sdk-webpack": "^5.2.0",
"@openshift/dynamic-plugin-sdk": "^9.0.0",
"@openshift/dynamic-plugin-sdk-webpack": "^5.3.0",
Comment on lines +68 to +69

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

"@patternfly/patternfly": "~6.6.0",
"@patternfly/quickstarts": "~6.6.0",
"@patternfly/react-catalog-view-extension": "~6.5.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ComponentType, FC } from 'react';
import { useMemo, useContext } from 'react';
import { useResolvedExtensions } from '@openshift/dynamic-plugin-sdk';
import { Card, CardBody, CardHeader, CardTitle, Stack, StackItem } from '@patternfly/react-core';
import { useTranslation } from 'react-i18next';
import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts';
import { useResolvedExtensions } from '@console/dynamic-plugin-sdk/src/api/useResolvedExtensions';
import type { NodeInventoryExtensionItem } from '@console/dynamic-plugin-sdk/src/extensions/node';
import { isNodeInventoryItem } from '@console/dynamic-plugin-sdk/src/extensions/node';
import { useFlag } from '@console/dynamic-plugin-sdk/src/utils/flags';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useResolvedExtensions } from '@openshift/dynamic-plugin-sdk';
import { render, screen } from '@testing-library/react';
import { useResolvedExtensions } from '@console/dynamic-plugin-sdk/src/api/useResolvedExtensions';
import { useFlag } from '@console/dynamic-plugin-sdk/src/utils/flags';
import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook';
import type { NodeKind } from '@console/internal/module/k8s';
import InventoryCard from '../InventoryCard';
import { NodeDashboardContext } from '../NodeDashboardContext';

jest.mock('@openshift/dynamic-plugin-sdk', () => ({
...jest.requireActual('@openshift/dynamic-plugin-sdk'),
jest.mock('@console/dynamic-plugin-sdk/src/api/useResolvedExtensions', () => ({
...jest.requireActual('@console/dynamic-plugin-sdk/src/api/useResolvedExtensions'),
useResolvedExtensions: jest.fn(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ table in [Console dynamic plugins README](./README.md).

## 4.23.0-prerelease.5 - TBD

- **Type breaking**: Renamed `ExtensionTypeGuard` type to `ExtensionPredicate` ([#16115], [CONSOLE-5065])
> 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
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.

Comment on lines +15 to +20

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.


## 4.23.0-prerelease.4 - 2026-07-14

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import type { UseResolvedExtensionsOptions as UseResolvedExtensionsOptionsSDK } from '@openshift/dynamic-plugin-sdk';
import type { Extension, ExtensionPredicate } from '@openshift/dynamic-plugin-sdk';
import { useResolvedExtensions as useResolvedExtensionsSDK } from '@openshift/dynamic-plugin-sdk';
import { useExtensions } from '@console/plugin-sdk/src/api/useExtensions';
import type { UseResolvedExtensions } from '../extensions/console-types';
import type { Extension, ExtensionPredicate, ResolvedExtension } from '../types';

const hookOptions: UseResolvedExtensionsOptionsSDK = {
useExtensionsImpl: useExtensions,
};

export const useResolvedExtensions: UseResolvedExtensions = <E extends Extension>(
...predicates: ExtensionPredicate<E>[]
): [ResolvedExtension<E>[], boolean, any[]] => {
const predicate =
predicates.length === 1
? predicates[0]
: predicates.length > 1
? (extension: Extension): extension is E => predicates.some((guard) => guard(extension))
: undefined;
return useResolvedExtensionsSDK(predicate, hookOptions);
predicate: ExtensionPredicate<E>,
) => {
const extensions = useExtensions(predicate);

return useResolvedExtensionsSDK(extensions);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import type {
ElementType,
} from 'react';
import type { K8sResourceCommon, ObjectMetadata } from '@openshift/api-types';
import type {
Extension,
ExtensionPredicate,
LoadedAndResolvedExtension,
} from '@openshift/dynamic-plugin-sdk';
import type { QuickStartContextValues } from '@patternfly/quickstarts';
import type { CodeEditorProps as PfCodeEditorProps } from '@patternfly/react-code-editor';
import type { AlertVariant, ButtonProps } from '@patternfly/react-core';
Expand All @@ -28,10 +33,8 @@ import type {
PrometheusEndpoint,
PrometheusLabels,
PrometheusValue,
ResolvedExtension,
Selector,
} from '../api/common-types';
import type { Extension, ExtensionPredicate } from '../types';
import type { CustomDataSource } from './dashboard-data-source';

/* eslint-disable no-barrel-files/no-barrel-files */
Expand Down Expand Up @@ -263,8 +266,8 @@ export type UseK8sWatchResources = <R extends ResourcesObject>(
) => WatchK8sResults<R>;

export type UseResolvedExtensions = <E extends Extension>(
...predicates: ExtensionPredicate<E>[]
) => [ResolvedExtension<E>[], boolean, any[]];
predicate: ExtensionPredicate<E>,
) => [LoadedAndResolvedExtension<E>[], boolean, any[]];

export type GetSegmentAnalytics = () => {
// TODO: use proper Segment Analytics API type
Expand Down
1 change: 0 additions & 1 deletion frontend/packages/console-dynamic-plugin-sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export type {
EncodedCodeRef,
Extension,
ExtensionFlags,
ExtensionPredicate,
LoadedAndResolvedExtension as ResolvedExtension,
LoadedExtension,
MapCodeRefsToValues as ResolvedCodeRefProperties,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useCallback, useMemo } from 'react';
import type { LoadedAndResolvedExtension, ExtensionPredicate } from '@openshift/dynamic-plugin-sdk';
import { useResolvedExtensions } from '@console/dynamic-plugin-sdk/src/api/useResolvedExtensions';
import type { K8sResourceCommon } from '@console/dynamic-plugin-sdk/src/extensions/console-types';
import type {
DetailsItem,
DetailsItemColumn,
} from '@console/dynamic-plugin-sdk/src/extensions/details-item';
import { isDetailsItem } from '@console/dynamic-plugin-sdk/src/extensions/details-item';
import type { ResolvedExtension, ExtensionPredicate } from '@console/dynamic-plugin-sdk/src/types';
import { referenceFor, referenceForExtensionModel } from '@console/internal/module/k8s/k8s';

/**
Expand Down Expand Up @@ -52,4 +52,4 @@ export const useDetailsItemExtensionsForResource: UseDetailsItemExtensionsForRes
type UseDetailsItemExtensionsForResource = (
obj: K8sResourceCommon,
column: DetailsItemColumn,
) => ResolvedExtension<DetailsItem>[];
) => LoadedAndResolvedExtension<DetailsItem>[];
31 changes: 19 additions & 12 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3139,13 +3139,13 @@ __metadata:
languageName: node
linkType: hard

"@openshift/dynamic-plugin-sdk-webpack@npm:^5.2.0":
version: 5.2.0
resolution: "@openshift/dynamic-plugin-sdk-webpack@npm:5.2.0"
"@openshift/dynamic-plugin-sdk-webpack@npm:^5.3.0":
version: 5.3.0
resolution: "@openshift/dynamic-plugin-sdk-webpack@npm:5.3.0"
dependencies:
lodash: "npm:^4.17.23"
semver: "npm:^7.7.3"
yup: "npm:^1.7.1"
zod: "npm:^3.25.67"
peerDependencies:
"@rspack/core": ^2.0.8
webpack: ^5.100.0
Expand All @@ -3154,21 +3154,21 @@ __metadata:
optional: true
webpack:
optional: true
checksum: 10c0/8ccd43d74c4de9c76b0583ee35b919be4327ffe8101343b88e5245ffb287d71a7a17d0c264dfd9bfe88b6361147d3c0e7641aeea97990ee26b7e06dc0640493b
checksum: 10c0/7294d01156d86eab453a88fe663145c8c769e1886e0e517159fe7b008827274ab53fe70788c343bbe93cf2e0c20098fb9b59313409e72c9a7060a2c1288ada30
languageName: node
linkType: hard

"@openshift/dynamic-plugin-sdk@npm:^8.2.0":
version: 8.2.0
resolution: "@openshift/dynamic-plugin-sdk@npm:8.2.0"
"@openshift/dynamic-plugin-sdk@npm:^9.0.0":
version: 9.0.0
resolution: "@openshift/dynamic-plugin-sdk@npm:9.0.0"
dependencies:
lodash: "npm:^4.17.23"
semver: "npm:^7.7.3"
uuid: "npm:^8.3.2"
yup: "npm:^1.7.1"
zod: "npm:^3.25.67"
peerDependencies:
react: ^18 || ^19
checksum: 10c0/a9e3e1a145014a13310acd4630c7a2b7a7545b6c089e1d41e99ceaec061c1a270051d44bd26ddd09ec61bb02533ecfab55663cedb41a20d63acf824067eb63ab
checksum: 10c0/29de4ecd6811d621d0b83c55aec3e04371f94f26f33b1544bedcf20c9c4e6ed825d1cf3d6190c7292f840c35490f2c84450220874b43c01a29edf03d500b17cd
languageName: node
linkType: hard

Expand Down Expand Up @@ -16290,8 +16290,8 @@ __metadata:
"@kubernetes/client-node": "npm:^1.4.0"
"@monaco-editor/react": "npm:^4.7.0"
"@openshift/api-types": "npm:^1.0.0"
"@openshift/dynamic-plugin-sdk": "npm:^8.2.0"
"@openshift/dynamic-plugin-sdk-webpack": "npm:^5.2.0"
"@openshift/dynamic-plugin-sdk": "npm:^9.0.0"
"@openshift/dynamic-plugin-sdk-webpack": "npm:^5.3.0"
"@patternfly/patternfly": "npm:~6.6.0"
"@patternfly/quickstarts": "npm:~6.6.0"
"@patternfly/react-catalog-view-extension": "npm:~6.5.0"
Expand Down Expand Up @@ -22222,6 +22222,13 @@ __metadata:
languageName: node
linkType: hard

"zod@npm:^3.25.67":
version: 3.25.76
resolution: "zod@npm:3.25.76"
checksum: 10c0/5718ec35e3c40b600316c5b4c5e4976f7fee68151bc8f8d90ec18a469be9571f072e1bbaace10f1e85cf8892ea12d90821b200e980ab46916a6166a4260a983c
languageName: node
linkType: hard

"zod@npm:^4.1.11":
version: 4.4.3
resolution: "zod@npm:4.4.3"
Expand Down