Skip to content

Bump dependencies for OCP 4.23/5.0 and add test infrastructure - #118

Draft
razo7 wants to merge 3 commits into
mainfrom
deps/ocp-4.23-combined-update
Draft

Bump dependencies for OCP 4.23/5.0 and add test infrastructure#118
razo7 wants to merge 3 commits into
mainfrom
deps/ocp-4.23-combined-update

Conversation

@razo7

@razo7 razo7 commented Jul 26, 2026

Copy link
Copy Markdown
Member

What

Combined dependency update for OCP 4.23/5.0 compatibility with test infrastructure
to prevent regressions.

Why

  • The plugin needs to target OCP 4.23/5.0 which ships PatternFly 6.6.x and
    react-router 7.18.x
  • Six open dependabot PRs are superseded by this combined update
  • PR Bump react-router from 7.13.2 to 7.15.1 #104 (react-router) was blocked by SDK peer dep conflict on 4.22
  • The project had zero test infrastructure to catch dependency breakage

Changes

  • Bump @patternfly/react-core, react-icons, react-table, react-tokens from ~6.4.x to ~6.6.0
  • Bump react-router from ~7.13.1 to ~7.18.1
  • Bump @openshift-console/dynamic-plugin-sdk* to ^4.23.0-prerelease.4
  • Add .npmrc with legacy-peer-deps for SDK peerOptional conflict
  • Regenerate package-lock.json (absorbs ws, fast-uri, http-proxy-middleware,
    websocket-driver, shell-quote security fixes)
  • Add vitest test framework with data layer unit tests and dependency
    import smoke tests (84 tests)
  • Add test step to pre-submit CI workflow

Supersedes: #104, #112, #113, #114, #116, #117

Test plan

  • npm run lint passes (0 errors)
  • npm run test passes (84 tests, 6 files)
  • make docker-build succeeds
  • CI pre-submit workflow passes
  • Plugin loads correctly on OCP 4.23 cluster

@openshift-ci

openshift-ci Bot commented Jul 26, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci

openshift-ci Bot commented Jul 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: razo7

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

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Vitest is added with runtime configuration, dependency compatibility settings, data-layer test suites, utility fixes, local test commands, and pre-submit test execution.

Changes

Vitest testing

Layer / File(s) Summary
Test runtime and dependencies
.npmrc, package.json, vitest.config.ts, vitest.setup.ts, webpack.config.ts
Configures Vitest, aliases, CSS handling, legacy npm peer dependency resolution, updated development dependencies, and shared-module validation settings.
Dependency export compatibility tests
src/data/__tests__/dependency-imports.test.ts
Checks that required PatternFly and react-router exports are available.
Data utility and validation tests
src/data/__tests__/*.test.ts, src/data/model.ts, src/data/nodeRoles.ts, src/data/parseErrors.ts, src/data/remediator.ts
Tests model helpers, node roles, parse errors, remediation utilities, and validation regular expressions while covering the associated utility and documentation updates.
Local and CI test execution
Makefile, .github/workflows/pre-submit.yaml
Adds a Makefile test target and runs tests during pre-submit after linting.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PreSubmit
  participant Makefile
  participant Npm
  participant Vitest
  PreSubmit->>Makefile: run make test
  Makefile->>Npm: run npm run test
  Npm->>Vitest: run vitest
  Vitest-->>PreSubmit: report test results
Loading

Suggested reviewers: batzionb

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main changes: dependency bumps and added test infrastructure.
Description check ✅ Passed The description is clearly related to the dependency updates and new testing workflow and test suites.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deps/ocp-4.23-combined-update

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

@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.

Actionable comments posted: 3

🤖 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 `@src/data/__tests__/model.test.ts`:
- Around line 49-51: Update the parseApiVersion test for the bare "v1" input to
expect the core-group representation used by the existing empty-group cases,
rather than undefined. Ensure parseApiVersion and its downstream converters
continue accepting core Kubernetes resources while preserving rejection of
genuinely invalid version strings.

In `@src/data/__tests__/nodeRoles.test.ts`:
- Around line 64-88: Update getNodeRolesText to use the "-" fallback when its
computed role string is empty by replacing the nullish fallback with a
falsy-value fallback. Add a regression test in the getNodeRolesText suite for a
node with no role labels, asserting it returns "-".

In `@src/data/__tests__/parseErrors.test.ts`:
- Around line 28-30: Update isParseError to safely handle null input and return
false instead of dereferencing it or throwing; revise the null test expectation
in parseErrors.test.ts accordingly while preserving true results for valid parse
errors.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 57cfde5c-11ba-4d4b-b177-cafc6a9ad824

📥 Commits

Reviewing files that changed from the base of the PR and between dc65403 and 234c8f2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • .github/workflows/pre-submit.yaml
  • .npmrc
  • Makefile
  • package.json
  • src/data/__tests__/dependency-imports.test.ts
  • src/data/__tests__/model.test.ts
  • src/data/__tests__/nodeRoles.test.ts
  • src/data/__tests__/parseErrors.test.ts
  • src/data/__tests__/remediator.test.ts
  • src/data/__tests__/validationSchema.test.ts
  • vitest.config.ts
  • vitest.setup.ts

Comment thread src/data/__tests__/model.test.ts Outdated
Comment on lines +64 to +88
describe("getNodeRolesText", () => {
it("joins sorted unique roles", () => {
const node = {
metadata: {
labels: {
"node-role.kubernetes.io/worker": "",
"node-role.kubernetes.io/infra": "",
},
},
};
expect(getNodeRolesText(node)).toBe("infra, worker");
});

it("deduplicates roles", () => {
const node = {
metadata: {
labels: {
"node-role.kubernetes.io/control-plane": "",
"node-role.kubernetes.io/master": "",
},
},
};
expect(getNodeRolesText(node)).toBe("control-plane");
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cover and fix the empty-role fallback.

getNodeRolesText returns "" for a node without roles because "" ?? "-" does not use the fallback. Add the missing regression case and use || in the helper.

Proposed fix
-  return uniq(getNodeRoles(node)).sort().join(", ") ?? "-";
+  return uniq(getNodeRoles(node)).sort().join(", ") || "-";
+  it("returns a fallback when no roles exist", () => {
+    expect(getNodeRolesText({ metadata: { labels: {} } })).toBe("-");
+  });
🤖 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/data/__tests__/nodeRoles.test.ts` around lines 64 - 88, Update
getNodeRolesText to use the "-" fallback when its computed role string is empty
by replacing the nullish fallback with a falsy-value fallback. Add a regression
test in the getNodeRolesText suite for a node with no role labels, asserting it
returns "-".

Comment thread src/data/__tests__/parseErrors.test.ts Outdated

@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 (1)
webpack.config.ts (1)

79-82: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Prevent this workaround from permanently disabling shared-module validation.

Lines [79-82] disable validation for every Console-provided shared module, not just react-router. A future incompatible shared dependency could therefore pass the build and fail at runtime. Tie this bypass to the known SDK prerelease, and restore validation once the SDK peer range is corrected; add an upgrade/CI follow-up so this setting is not forgotten.

🤖 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 `@webpack.config.ts` around lines 79 - 82, Update the ConsoleRemotePlugin
configuration to bypass shared-module validation only for the known SDK 4.23
prerelease/react-router peer-range mismatch, rather than disabling validation
globally. Restore normal validation when that SDK peer range is corrected, and
add an upgrade or CI follow-up tied to the workaround so it cannot remain
enabled unnoticed.
🤖 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 `@webpack.config.ts`:
- Around line 79-82: Update the ConsoleRemotePlugin configuration to bypass
shared-module validation only for the known SDK 4.23 prerelease/react-router
peer-range mismatch, rather than disabling validation globally. Restore normal
validation when that SDK peer range is corrected, and add an upgrade or CI
follow-up tied to the workaround so it cannot remain enabled unnoticed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d350a9ae-a23d-4baa-ba64-2f58321eb3b3

📥 Commits

Reviewing files that changed from the base of the PR and between 234c8f2 and b139ec4.

📒 Files selected for processing (1)
  • webpack.config.ts

@razo7
razo7 force-pushed the deps/ocp-4.23-combined-update branch from c7706de to bacf710 Compare July 26, 2026 13:27

@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.

Actionable comments posted: 1

🤖 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 `@src/data/__tests__/remediator.test.ts`:
- Around line 92-101: Extend the positive test coverage for
isRemediationTemplateSelected with a named SNRTemplate whose namespace is an
empty string. Keep the non-empty name and other existing template fields, and
assert that the function returns true to lock in namespace-independent
selection.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 087b8bb1-bd33-403d-8de3-749425316720

📥 Commits

Reviewing files that changed from the base of the PR and between c7706de and bacf710.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (15)
  • .github/workflows/pre-submit.yaml
  • .npmrc
  • Makefile
  • package.json
  • src/data/__tests__/dependency-imports.test.ts
  • src/data/__tests__/model.test.ts
  • src/data/__tests__/nodeRoles.test.ts
  • src/data/__tests__/parseErrors.test.ts
  • src/data/__tests__/remediator.test.ts
  • src/data/__tests__/validationSchema.test.ts
  • src/data/parseErrors.ts
  • src/data/remediator.ts
  • vitest.config.ts
  • vitest.setup.ts
  • webpack.config.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • .github/workflows/pre-submit.yaml
  • vitest.setup.ts
  • vitest.config.ts
  • src/data/tests/model.test.ts
  • Makefile
  • .npmrc
  • src/data/tests/validationSchema.test.ts
  • src/data/tests/parseErrors.test.ts
  • webpack.config.ts
  • src/data/parseErrors.ts
  • package.json

Comment on lines +92 to +101
it("returns true when template has name", () => {
expect(
isRemediationTemplateSelected({
apiVersion: "v1",
kind: "SNRTemplate",
name: "self-node-remediation-automatic-strategy-template",
namespace: "openshift-operators",
})
).toBe(true);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Test a named template without a namespace.

The positive case includes a namespace, so it would also pass under the old contract. Add a case with a non-empty name and namespace: "" to lock in the documented behavior.

Proposed test
+  it("returns true when template has a name but no namespace", () => {
+    expect(
+      isRemediationTemplateSelected({
+        apiVersion: "v1",
+        kind: "SNRTemplate",
+        name: "self-node-remediation-template",
+        namespace: "",
+      })
+    ).toBe(true);
+  });
📝 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
it("returns true when template has name", () => {
expect(
isRemediationTemplateSelected({
apiVersion: "v1",
kind: "SNRTemplate",
name: "self-node-remediation-automatic-strategy-template",
namespace: "openshift-operators",
})
).toBe(true);
});
it("returns true when template has name", () => {
expect(
isRemediationTemplateSelected({
apiVersion: "v1",
kind: "SNRTemplate",
name: "self-node-remediation-automatic-strategy-template",
namespace: "openshift-operators",
})
).toBe(true);
});
it("returns true when template has a name but no namespace", () => {
expect(
isRemediationTemplateSelected({
apiVersion: "v1",
kind: "SNRTemplate",
name: "self-node-remediation-template",
namespace: "",
})
).toBe(true);
});
🤖 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/data/__tests__/remediator.test.ts` around lines 92 - 101, Extend the
positive test coverage for isRemediationTemplateSelected with a named
SNRTemplate whose namespace is an empty string. Keep the non-empty name and
other existing template fields, and assert that the function returns true to
lock in namespace-independent selection.

@razo7
razo7 force-pushed the deps/ocp-4.23-combined-update branch from bacf710 to 5278794 Compare July 26, 2026 14:41

@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.

Actionable comments posted: 1

🤖 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 `@Makefile`:
- Around line 28-31: Update the Makefile test target so it runs npm ci before
npm run test, matching the dependency-installation behavior of the lint target
and allowing make test to work from a clean checkout.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 41ba1cc2-6907-401f-8060-8890cbeaa465

📥 Commits

Reviewing files that changed from the base of the PR and between bacf710 and 5278794.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • .github/workflows/pre-submit.yaml
  • .npmrc
  • Makefile
  • package.json
  • src/data/__tests__/dependency-imports.test.ts
  • src/data/__tests__/model.test.ts
  • src/data/__tests__/nodeRoles.test.ts
  • src/data/__tests__/parseErrors.test.ts
  • src/data/__tests__/remediator.test.ts
  • src/data/__tests__/validationSchema.test.ts
  • src/data/model.ts
  • src/data/nodeRoles.ts
  • src/data/parseErrors.ts
  • src/data/remediator.ts
  • vitest.config.ts
  • vitest.setup.ts
  • webpack.config.ts
🚧 Files skipped from review as they are similar to previous changes (13)
  • .github/workflows/pre-submit.yaml
  • .npmrc
  • vitest.setup.ts
  • src/data/tests/nodeRoles.test.ts
  • webpack.config.ts
  • src/data/tests/validationSchema.test.ts
  • src/data/remediator.ts
  • src/data/tests/dependency-imports.test.ts
  • src/data/parseErrors.ts
  • vitest.config.ts
  • src/data/tests/remediator.test.ts
  • src/data/tests/parseErrors.test.ts
  • package.json

Comment thread Makefile
Comment on lines +28 to +31
# Run tests
.PHONY: test
test:
npm run test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the standalone test target install its dependencies.

make test fails in a clean checkout because it skips npm ci, unlike make lint.

Proposed fix
 test:
-	npm run test
+	npm ci && npm run test
📝 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
# Run tests
.PHONY: test
test:
npm run test
# Run tests
.PHONY: test
test:
npm ci && npm run test
🤖 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 `@Makefile` around lines 28 - 31, Update the Makefile test target so it runs
npm ci before npm run test, matching the dependency-installation behavior of the
lint target and allowing make test to work from a clean checkout.

razo7 and others added 3 commits July 27, 2026 06:53
Add vitest as the project's first test framework with 98 tests
covering data layer utilities: model helpers, validation regexes,
parse error handling, node role functions, remediator logic, and
PatternFly/react-router import smoke tests.

Fix isParseError type guard crash on null input, support core-group
apiVersions in parseApiVersion, fix getNodeRolesText empty-role
fallback, and correct isRemediationTemplateSelected docstring.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update PatternFly 6.4→6.6, react-router 7.13→7.18, and SDK to
4.23.0-prerelease.4, matching the OCP console release-4.23 stack.

Add .npmrc with legacy-peer-deps for SDK peer dep mismatch and
disable validateSharedModules until SDK publishes a corrected
prerelease.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Absorbs transitive security fixes from dependabot PRs #104, #112,
#113, #114, #116, #117 (ws, fast-uri, http-proxy-middleware,
websocket-driver, shell-quote).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@razo7
razo7 force-pushed the deps/ocp-4.23-combined-update branch from 5278794 to 2a38070 Compare July 27, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant