OCPBUGS-84338: Update resolveDynamicModuleMaps to skip unavailable packages#16340
OCPBUGS-84338: Update resolveDynamicModuleMaps to skip unavailable packages#16340vojtechszocs wants to merge 1 commit intoopenshift:mainfrom
Conversation
📝 WalkthroughWalkthroughThe changes refactor dependency validation logic in the webpack plugin infrastructure by introducing a reusable dependency-existence predicate. The 🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/packages/console-dynamic-plugin-sdk/src/webpack/DynamicModuleImportPlugin.ts (1)
53-55: Add regression coverage for the unavailable-package short-circuit.Please add tests for both paths: predicate
false(package skipped) and default behavior (package processed), so this fix stays locked.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/packages/console-dynamic-plugin-sdk/src/webpack/DynamicModuleImportPlugin.ts` around lines 53 - 55, Add two unit tests covering the short-circuit in DynamicModuleImportPlugin: one test where isPackageAvailable(pkgName) is stubbed/mocked to return false and asserts that the package is skipped (acc unchanged / no import created), and one test where isPackageAvailable returns true and asserts the default processing happens (package is added/processed). Target the code path that contains the if (!isPackageAvailable(pkgName)) return acc; check by invoking the function/method that iterates packages in DynamicModuleImportPlugin and use assertions on the returned accumulator or side-effects to validate both behaviors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@frontend/packages/console-dynamic-plugin-sdk/src/webpack/DynamicModuleImportPlugin.ts`:
- Around line 53-55: Add two unit tests covering the short-circuit in
DynamicModuleImportPlugin: one test where isPackageAvailable(pkgName) is
stubbed/mocked to return false and asserts that the package is skipped (acc
unchanged / no import created), and one test where isPackageAvailable returns
true and asserts the default processing happens (package is added/processed).
Target the code path that contains the if (!isPackageAvailable(pkgName)) return
acc; check by invoking the function/method that iterates packages in
DynamicModuleImportPlugin and use assertions on the returned accumulator or
side-effects to validate both behaviors.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: a9958391-d71d-4bbb-9720-76a462a6d167
📒 Files selected for processing (2)
frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.tsfrontend/packages/console-dynamic-plugin-sdk/src/webpack/DynamicModuleImportPlugin.ts
📜 Review details
🔇 Additional comments (4)
frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts (3)
47-48: Good extraction of dependency-presence check.This helper centralizes package-availability logic and avoids relying on truthy version strings.
144-144: Nice consistency between deprecation warnings and shared-module validation.Using the same predicate in both paths removes drift and makes behavior predictable.
Also applies to: 163-163
382-386: Correctly wires package availability into dynamic module map resolution.Passing the predicate here directly addresses the noisy “Cannot resolve base path” scenario for unused packages.
frontend/packages/console-dynamic-plugin-sdk/src/webpack/DynamicModuleImportPlugin.ts (1)
37-38: Backward-compatible API extension looks solid.Defaulting
isPackageAvailableto() => truepreserves existing callers while enabling selective resolution.
|
/retitle OCPBUGS-84338: Update resolveDynamicModuleMaps to skip unavailable packages |
|
@vojtechszocs: This pull request references Jira Issue OCPBUGS-84338, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff, vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Tested by removing data view from monitoring plugin and applying this patch locally in node modules - confusing message no longer present /verified by @logonoff |
|
@logonoff: This PR has been marked as verified by DetailsIn response to this:
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. |
|
@vojtechszocs: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |

Analysis / Root cause
When a Console plugin does not install all packages in
dynamicModulePatternFlyPackages(default list) or all packages inConsoleRemotePluginsettingsharedDynamicModuleSettings.packageSpecs(override list) then it causes a confusing message during the webpack build:In other words, if a Console plugin does not use e.g.
@patternfly/react-data-viewthen we should not attempt to process dynamic modules for that vendor package.Solution description
Update
resolveDynamicModuleMapsfunction to skip unavailable vendor packages.Screenshots / screen recording
When building Console Networking plugin
Test setup
Clone Console Networking plugin and run
npm run buildto see the above message.Reviewers and assignees
/assign @logonoff
Summary by CodeRabbit