Repository navigation
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
There was a problem hiding this comment.
🔵 Needs a closer look
It changes the core module-selection gate that governs install behavior across the catalog, modules, install, and app layers, which warrants final human review.
Pull request overview
This PR closes the gap described in issue #160, where wso2 module install accepted a module version whose declared compatibility.shell range the running shell does not satisfy — install succeeded, module list reported it current, and it only failed at launch. The fix moves the shell-range check earlier so it is enforced at catalog selection (before anything is written) as well as at launch, mirroring how the protocol gate already works, and it surfaces incompatible installed modules in module list.
Changes:
internal/catalog/select.go: filters selectable versions by whether the declared shell range contains the shell's version, falling back to older satisfying versions and returning a distinctmodules.incompatible_shell(exit 69) refusal with a shell-update recovery when none qualify.internal/modules/resolve.go+internal/install/update.go: addsReceipt.CheckCompatibility(protocol, shell range, platform, in launch-gate order) and aStatus.Incompatibleflag computed for installed modules.internal/app/module.go: adds astateIncompatibleclassification so the update column showsincompatibleand the summary no longer calls an unlaunchable modulecurrent; docs and tests updated accordingly.
File summaries
| File | Description |
|---|---|
| internal/catalog/select.go | Adds the pre-install shell-range gate and the incompatibleShell diagnostic. |
| internal/catalog/select_test.go | Unit tests for refusal, protocol/shell distinction, and older-version fallback. |
| internal/modules/resolve.go | Adds Receipt.CheckCompatibility mirroring the launch gate order. |
| internal/modules/resolve_test.go | Tests each incompatibility code returned by CheckCompatibility. |
| internal/install/update.go | Adds Status.Incompatible and computes it in statuses. |
| internal/install/update_test.go | Verifies an out-of-range installed module is flagged incompatible. |
| internal/app/module.go | Adds stateIncompatible to the column/summary classification. |
| internal/app/module_internal_test.go | Covers incompatible cases in summary/column agreement tests. |
| internal/app/module_test.go | End-to-end product list incompatible-not-current test. |
| test/acceptance/moduleinstall_test.go | Acceptance tests pinning refusal and older-version selection. |
| test/acceptance/acceptance_test.go | Adds buildShellVersioned helper. |
| test/acceptance/catalog_fixture_test.go | Adds per-tag shellRanges override. |
| docs/reference/module-manifest.md, docs/guides/troubleshoot-module.md | Reflect that the shell range is now checked at selection. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
kanushka
left a comment
There was a problem hiding this comment.
Thanks, this covers all five acceptance criteria in #160 and the tests are solid. A few things to address before merge; inline comments cover the code. Not anchorable inline:
- Stale gate docs:
internal/devorigin/devorigin.go:221says the shell range is "checked only when the module is launched", anddocs/reference/module-catalog.md:27,docs/adr/0006-monorepo-modules-and-generated-catalog.md:44andtest/acceptance/moduleinstall_test.go:231still say the gate is protocol ∩ platform "and nothing else". Please update them to protocol ∩ shell range ∩ platform, keeping the point that the module's own version is never compared. docs/reference/commands.md(Module inventory): the example and UPDATE column description don't mention the newincompatiblevalue or its summary line.- PR description: the command is
wso2 product listnow, notwso2 module list.
|
@kanushka can u review this when u had a chance? |
|
Before merging, could you please:
|
| // stateOf classifies one module. The order matters: a module that is not | ||
| // installed has no pin or installed version for the rest to be about, and a | ||
| // pin overrides the channel (catalog.Policy documents that), so those two are | ||
| // installed has no pin or installed version for the rest to be about, an | ||
| // incompatible module cannot be launched regardless of channel or pin, and a | ||
| // pin overrides the channel (catalog.Policy documents that), so those are | ||
| // asked about first. |
There was a problem hiding this comment.
The comment says an incompatible module "cannot be launched regardless of channel or pin" and is asked about first, but the switch checks Pinned and Update before Incompatible. A pinned, incompatible module shows pinned to vX in the online module list and is counted as pinned in the summary, while moduleListOffline shows incompatible. Could Incompatible move above Pinned (with its precedence against Update settled), or the comment and docs be corrected?
There was a problem hiding this comment.
Addressed: moved Incompatible above Pinned while keeping Update first (so an updatable module surfaces the update command that resolves compatibility, while an un-updatable pinned module is properly flagged as incompatible and cannot be launched). Updated the doc comment, tests, and documentation accordingly.
Refuses module versions whose declared shell compatibility range is not satisfied by the running shell before downloading or installing artifacts. Falls back to older versions published in the catalog that satisfy the shell range. Marks incompatible installed modules as 'incompatible' in 'wso2 module list' rather than reporting them as 'current'. Closes wso2#160
…equire distinct shell ranges
…ity over pin Signed-off-by: kavix <kavix@yahoo.com>
82b768b to
dfbff13
Compare
|
Thanks @kanushka! Updated the branch with all requested changes:
|
kanushka
left a comment
There was a problem hiding this comment.
Thanks, this covers all five acceptance criteria in #160 and the stateOf precedence is fixed. Remaining before merge:
- Update offered, then refused.
Status.Updatecomes from the index alone and doesn't check whether the newer version is compatible. stateOf puts Update above Incompatible, soproduct listcan show "v0.2.0 available … runwso2 product update" for a module whose v0.2.0 is also out of range, andproduct updatethen fails withmodules.incompatible_shell. Either only set Update when the newer version passes the gate, or show both states. Whichever you choose, please document it indocs/reference/commands.md(the exception isn't documented yet). - The summary remedy is wrong in some cases (
internal/app/module.go:690-692).Incompatiblecomes fromCheckCompatibility(protocol, shell range, platform), but the summary always says "Update the WSO2 CLI". That's wrong when the CLI is too new for the module, or when the platform doesn't match (launch says reinstall for this OS/arch). Please word it so it covers all three cases, and name the command to run. - Stale wording:
internal/devorigin/devorigin.go:242still says "it would install and then refuse to launch". So do the comments atMakefile:179and around 218. After this PR, install refuses first.- The
negotiateProtocoldoc comment inresolve.gostill says the gate is protocol ∩ platform.
- Doc example order: in
commands.mdthe example shows the pinned line before the incompatible line, but the code emits incompatible first.
Nits:
- The
len(quoted)==0fallback inselect.gocan never be reached. checkShellCompatibilityhas no doc comment.- The PR body says the protocol refusal exits with 70, but it uses ModuleTrust (69).
… wording, and stale docs Signed-off-by: kavix <kavix@yahoo.com>
Summary
Fixes an issue where
wso2 product install <product>installed a module version whose declared shell compatibility range is not satisfied by the running shell, causing failures only when subsequently executing the module.Closes #160
Changes
Pre-install Shell Range Validation in
internal/catalog/select.go:Select(), evaluatesversion.Compatibility.Shellagainst the current shell semver usingsemver.ParseRange.incompatibleShelldiagnostic error (modules.incompatible_shell, Exit 69ModuleTrust) naming both the required range and the running shell version, with recovery:Update the module or the WSO2 CLI so the shell version is supported.protocolMismatch, Exit 69ModuleTrust).Compatibility Verification for Installed Modules (
internal/modules/resolve.go&internal/install/update.go):(Receipt).CheckCompatibility(ShellIdentity)validating protocol, shell range, and platform.Installer.statuseschecks installed modules usingreceipt.CheckCompatibility(i.Shell)and flagsStatus.Incompatible.Status Reporting in
wso2 product list(internal/app/module.go):incompatiblein the update column rather than reportingcurrent.vX.Y.Z available (incompatible).N product(s) incompatible with this shell and cannot be launched. Reinstall the product or update the WSO2 CLI so a compatible version is installed.) and inhibits reportingEvery installed product is current.when any installed module is incompatible.Documentation:
docs/reference/module-manifest.md,docs/guides/troubleshoot-module.md,docs/reference/commands.md,docs/reference/module-catalog.md, anddocs/adr/0006-monorepo-modules-and-generated-catalog.mdto reflect that the gate isprotocol ∩ shell range ∩ platform.