Skip to content

feat(lifecycle): add automatic orphaned module cleanup to update command#1059

Open
AshokThangavel wants to merge 2 commits intointersystems:mainfrom
AshokThangavel:feat-remove-stale-dependencies-on-update
Open

feat(lifecycle): add automatic orphaned module cleanup to update command#1059
AshokThangavel wants to merge 2 commits intointersystems:mainfrom
AshokThangavel:feat-remove-stale-dependencies-on-update

Conversation

@AshokThangavel
Copy link
Contributor

Description

This PR introduces automatic management of orphaned dependencies during the update command. When a module is updated and its new version no longer requires certain dependencies, those "orphaned" modules are now automatically uninstalled to maintain namespace hygiene. A new flag, -keep-orphans (-ko), has been added to allow users to override this behavior.
fixes: #868

2. New Command Flag

  • Flag: -keep-orphans Alias -ko
  • Behavior: When present, the UninstallOrphanedDependencies method is skipped, leaving all previously installed dependencies intact.

output

zpm:USER>list
IPM (zpm)                              0.10.6-SNAPSHOT
demo-module1                           1.0.0
irisjwt                                1.0.0
iris-LocalizationLab (localizationlab) 1.0.0
objectscript-math                      0.0.5
zpm:USER>update demo-module1 -p /usr/irissys/mgr/user/mod1/

Building dependency graph...Done.
[USER|demo-module1]     Initialize START
[USER|demo-module1]     Initialize SUCCESS
[USER|demo-module1]     Reload START (/usr/irissys/mgr/user/mod1/)
[USER|demo-module1]     Reload SUCCESS
[demo-module1]  Module object refreshed.
[USER|demo-module1]     Validate START
[USER|demo-module1]     Validate SUCCESS
[USER|demo-module1]     Compile START
[USER|demo-module1]     Compile SUCCESS
[USER|demo-module1]     Activate START
[USER|demo-module1]     Configure START
[USER|demo-module1]     Configure SUCCESS
[USER|demo-module1]     Activate SUCCESS
[USER|demo-module1]     ApplyUpdateSteps START
[USER|demo-module1]     ApplyUpdateSteps SUCCESS
Uninstalling orphaned dependencies
[USER|irisjwt]  Clean START
[USER|irisjwt]  Unconfigure START
[USER|irisjwt]  Unconfigure SUCCESS
[USER|irisjwt]  Clean SUCCESS
Module installed successfully! To start call USER>Do ##class(Package.Class).Run()

zpm:USER>list
IPM (zpm)                              0.10.6-SNAPSHOT
demo-module1                           1.0.0
iris-LocalizationLab (localizationlab) 1.0.0
objectscript-math                      0.0.5

- Implement logic to identify and uninstall dependencies removed in new module versions.
- Introduce -keep-orphans (-ko) flag to allow users to opt-out of cleanup.
- Ensure cleanup logic is scoped strictly to the 'update' command.
- Add integration tests in Test.PM.Unit.OrphanCleanup to verify flag behavior.
- Update command metadata and help text for 'update'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update framework enhancement: remove dependencies that don't exist in a new version of a module

1 participant