Skip to content

CONSOLE-5073: Bump redux-related shared modules to latest#16087

Open
logonoff wants to merge 2 commits intoopenshift:mainfrom
logonoff:CONSOLE-5073-shared-modules
Open

CONSOLE-5073: Bump redux-related shared modules to latest#16087
logonoff wants to merge 2 commits intoopenshift:mainfrom
logonoff:CONSOLE-5073-shared-modules

Conversation

@logonoff
Copy link
Member

@logonoff logonoff commented Mar 2, 2026

Version bumps:

  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
    • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
    • Enhanced internal code quality and type safety across test suites.
    • Removed unused test dependencies.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 2, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 2, 2026

@logonoff: This pull request references CONSOLE-5073 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 "4.22.0" version, but no target version was set.

Details

In response to this:

Version bumps:

  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

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.

@logonoff
Copy link
Member Author

logonoff commented Mar 2, 2026

/label px-approved
/label docs-approved

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels Mar 2, 2026
@openshift-ci openshift-ci bot requested review from Leo6Leo and TheRealJon March 2, 2026 14:50
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Mar 2, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff

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/dev-console Related to dev-console approved Indicates a PR has been approved by an approver from all required OWNERS files. component/knative Related to knative-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared labels Mar 2, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 2, 2026

@logonoff: This pull request references CONSOLE-5073 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 "4.22.0" version, but no target version was set.

Details

In response to this:

Version bumps:

  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
  • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
  • Enhanced internal code quality and type safety across test suites.
  • Removed unused test dependencies.

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
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

This pull request updates Redux ecosystem dependencies in the frontend package: react-redux from 8.1.3 to 9.2.0, redux from ^4.0.4 to ^5.0.1, and redux-thunk from 2.4.0 to 3.1.0, while removing redux-mock-store. Import statements for redux-thunk across test files are changed from default imports to named imports. Test mock variables are refactored with stricter TypeScript typing using jest.MockedFunction instead of generic jest.Mock casts. Generic type parameters in combineReducers calls are removed to rely on type inference. Release notes are updated to document these dependency changes. No runtime behavior changes are introduced.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: upgrading redux-related shared modules (react-redux, redux, redux-thunk) to their latest versions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx (1)

27-31: Add default useOLSConfigMock return in beforeEach to strengthen test isolation.

Tests at lines 33-36 and 38-41 don't set useOLSConfigMock, yet rely on it being in a default state. Since jest.clearAllMocks() preserves mockReturnValue implementations and only clears call history, tests become order-dependent: if a prior test sets useOLSConfigMock.mockReturnValue(true), that persists into tests expecting falsy behavior. Adding useOLSConfigMock.mockReturnValue(false) in beforeEach removes this fragility and ensures each test starts with a predictable, documented baseline.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx`
around lines 27 - 31, The tests are order-dependent because useOLSConfigMock's
mockReturnValue can leak between tests; update the beforeEach setup (the
beforeEach block that currently calls jest.clearAllMocks(),
useTranslationMock.mockReturnValue, and useDispatchMock.mockReturnValue) to also
set a clear default for useOLSConfigMock by calling
useOLSConfigMock.mockReturnValue(false) so each test starts with a predictable
falsy OLS config; keep the other mockReturnValue calls (useTranslationMock and
useDispatchMock) as-is and ensure mockDispatch remains used for useDispatchMock.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.md`:
- Line 14: The release note text incorrectly references the package name
"react-thunk"; update that string to "redux-thunk" so the line reads that
plugins must use `redux-thunk` v3 to remain compatible with Console (replace
"react-thunk" with "redux-thunk" in the release note content), ensuring
consistency with package.json/shared-modules-meta.ts and all imports referencing
redux-thunk.

---

Nitpick comments:
In
`@frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx`:
- Around line 27-31: The tests are order-dependent because useOLSConfigMock's
mockReturnValue can leak between tests; update the beforeEach setup (the
beforeEach block that currently calls jest.clearAllMocks(),
useTranslationMock.mockReturnValue, and useDispatchMock.mockReturnValue) to also
set a clear default for useOLSConfigMock by calling
useOLSConfigMock.mockReturnValue(false) so each test starts with a predictable
falsy OLS config; keep the other mockReturnValue calls (useTranslationMock and
useDispatchMock) as-is and ensure mockDispatch remains used for useDispatchMock.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 4a2ba98 and ce63f16.

⛔ Files ignored due to path filters (1)
  • frontend/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (16)
  • frontend/package.json
  • frontend/packages/console-app/src/components/detect-namespace/__tests__/namespace.spec.ts
  • frontend/packages/console-app/src/components/tour/__tests__/tour-context.spec.ts
  • frontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.md
  • frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sModels.spec.tsx
  • frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sWatchResource.spec.tsx
  • frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sWatchResources.spec.tsx
  • frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx
  • frontend/packages/console-shared/src/hooks/__tests__/useGetUserSettingConfigMap.spec.ts
  • frontend/packages/console-shared/src/hooks/__tests__/useUser.spec.ts
  • frontend/packages/console-shared/src/hooks/__tests__/useUserPreference.spec.ts
  • frontend/packages/console-shared/src/test-utils/unit-test-utils.tsx
  • frontend/packages/dev-console/src/utils/__tests__/usePerspectiveDetection.spec.ts
  • frontend/packages/knative-plugin/src/components/add/__tests__/EventSink.spec.tsx
  • frontend/public/components/utils/__tests__/firehose.spec.tsx
  • frontend/public/redux.ts

- Upgraded from `react-redux` v7 to v8. Plugins must use `react-redux` v8 to remain compatible with Console.
- Upgraded from `redux` v4 to v5. Plugins must use `redux` v5 to remain compatible with Console.
- Upgraded from `react-redux` v7 to v9. Plugins must use `react-redux` v9 to remain compatible with Console.
- Upgraded from `react-thunk` v2 to v3. Plugins must use `react-thunk` v3 to remain compatible with Console.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

redux-thunk package v2 to v3 migration npm

💡 Result:

redux-thunk v2 → v3 (v3.1.0) migration (npm)

1) Update the dependency

npm i redux-thunk@^3
# or: npm i redux-thunk@^3.1.0

v3.1.0 is the “latest v3” release and contains the breaking changes + a hotfix. [1]


2) Change imports: default export removed → named exports

Before (v2):

import thunk from 'redux-thunk'

const store = createStore(rootReducer, applyMiddleware(thunk))
thunk.withExtraArgument(api)

After (v3):

import { thunk, withExtraArgument } from 'redux-thunk'

const store = createStore(rootReducer, applyMiddleware(thunk))
applyMiddleware(withExtraArgument(api))

v3 removes the default export and exposes thunk + withExtraArgument as named exports. [1]

CommonJS (require) example:

const { thunk, withExtraArgument } = require('redux-thunk')

(If you were doing require('redux-thunk').default, that will no longer be correct because there is no default export.) [1]


3) If you used redux-thunk/extend-redux (TypeScript): remove it

Redux Thunk v3 removes the TS-only entrypoint redux-thunk/extend-redux that globally patched dispatch / bindActionCreators types. Use store-inferred AppDispatch typing instead. [1]
Redux’s TS docs show the recommended approach (derive AppDispatch from the store and use that in your app). [3]


4) Be aware of packaging changes (ESM-first)

v3 updates the published artifacts for improved ESM/CJS compatibility (modern exports setup; ESM is the primary artifact) and drops UMD builds. This can affect older tooling / unusual bundler setups. [1] [2]


🏁 Script executed:

cat -n frontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.md | head -20

Repository: openshift/console

Length of output: 1246


🏁 Script executed:

rg "react-thunk|redux-thunk" --type md --type json --type ts --type js --type yaml

Repository: openshift/console

Length of output: 1379


Fix package name in shared module compatibility guidance (line 14).

The package is redux-thunk, not react-thunk. The codebase (package.json, shared-modules-meta.ts, all imports) consistently uses redux-thunk v3. This release note will mislead plugin authors on required dependencies.

-- Upgraded from `react-thunk` v2 to v3. Plugins must use `react-thunk` v3 to remain compatible with Console.
+- Upgraded from `redux-thunk` v2 to v3. Plugins must use `redux-thunk` v3 to remain compatible with Console.
📝 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
- Upgraded from `react-thunk` v2 to v3. Plugins must use `react-thunk` v3 to remain compatible with Console.
- Upgraded from `redux-thunk` v2 to v3. Plugins must use `redux-thunk` v3 to remain compatible with Console.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.md` at line
14, The release note text incorrectly references the package name "react-thunk";
update that string to "redux-thunk" so the line reads that plugins must use
`redux-thunk` v3 to remain compatible with Console (replace "react-thunk" with
"redux-thunk" in the release note content), ensuring consistency with
package.json/shared-modules-meta.ts and all imports referencing redux-thunk.

@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch from ce63f16 to dfa923d Compare March 2, 2026 15:00
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 2, 2026

@logonoff: 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/e2e-gcp-console dfa923d link true /test e2e-gcp-console
ci/prow/frontend dfa923d 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/dev-console Related to dev-console component/knative Related to knative-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants