Skip to content

Fix: Selectively undeploying classes within a package - #835

Merged
isc-jlechtne merged 17 commits into
mainfrom
fix-823-2
Jul 7, 2025
Merged

isc-jlechtne merged 17 commits into
mainfrom
fix-823-2

Conversation

@isc-jlechtne

@isc-jlechtne isc-jlechtne commented Jun 6, 2025 •

Copy link
Copy Markdown
Collaborator

Fixes #823

  • Issue seems to happen in %IPM.ResourceProcessor.Default.Document::OnPhase() when pPhase="Reload"
  • In this scenario, the if statement: "If ##class(%IPM.Utils.File).Exists(.tResourcePath)" evaluates to true for the package level resource.
    - This stops us from reaching the "If ..ResourceReference.Deploy" code block, where the deployed files are loaded in.
    - Since at least one class isn't deployed, the class directory exists so stops execution. Issue is there are other resources in the
    package that are deployed that we didn't handle

Fix:

  • Swapped order of if-statements in OnPhase() to run steps if deployed whether or not the resource path exists to account for this case described above.
  • 2 passes over the resource list in %Reload(). First pass: to split up resources between deployed and not deployed. Second pass: Process the resources--deployed first then not deployed.
    - Loading a non-deployed resource should override anything that was one with deployed resources

@isc-jlechtne

Copy link
Copy Markdown
Collaborator Author

Was hoping I was going to be able to get away with just swapping the order of those if-statements but that is not the case. Worked for my loading package case but not install.

@isc-jili

Copy link
Copy Markdown
Collaborator

Looks good to me! I know there was talk about unit tests so I'll check back for those at a later time!

@isc-eneil isc-eneil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@isc-jlechtne Left a couple of comments. Logic looks good to me!

Comment thread src/cls/IPM/Lifecycle/Base.cls Resolved
Comment thread src/cls/IPM/Lifecycle/Base.cls Resolved
isc-jili
isc-jili previously approved these changes Jun 16, 2025
@isc-eneil
isc-eneil requested a review from isc-pbarton June 18, 2025 17:37

@isc-kiyer isc-kiyer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@isc-jlechtne left a few comments. Also, for the tests, include some other resource types as well to show there is no adverse effect on them. Also, this ordering should also be applied more generally to all lifecycle phases (not just Reload) and in ExecutePhases or else the processing sequence is different for just reload.

Comment thread src/cls/IPM/Lifecycle/Base.cls Outdated
Set tResource = ..Module.Resources.GetNext(.tKey)
Quit:tKey=""
If $IsObject(tResource.Processor) {
Set depth = $LENGTH(tResource.Name, ".")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I forget where we had this discussion (over call or in a teams chat) but we should only process Document resources this way since other types of resources may depend on the ordering (although the ideally shouldn't but we want to keep backwards compatibility). So should check if the Processor class extends %IPM.ResourceProcessor.Default.Document and only if so, process it in this way. Otherwise, store resources in a separate array which is sequential

Comment thread src/cls/IPM/Lifecycle/Base.cls Resolved

@isc-kiyer isc-kiyer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@isc-jlechtne few small comments and a question. To get this done and merged, I recommend creating a separate issue and PR for generalizing this lifecycle processing order

Comment thread src/cls/IPM/Lifecycle/Base.cls Resolved
Comment thread src/cls/IPM/Lifecycle/Base.cls Resolved

@isc-eneil isc-eneil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@isc-jlechtne Looks good! I don't think this should stop the merge, but there's a little difference in style (your changes all use lowercase ObjectScript, but the IPM codebase capitalizes commands).

@isc-jlechtne
isc-jlechtne merged commit 118d8cc into main Jul 7, 2025
@isc-jlechtne
isc-jlechtne deleted the fix-823-2 branch July 7, 2025 18:39
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.

Selectively undeploying classes within a package fails with IPM 0.10.x

4 participants