Skip to content

feat: implement recursive placeholder resolution in Default parameters#1013

Open
AshokThangavel wants to merge 16 commits intointersystems:mainfrom
AshokThangavel:feat/unified-variable-interpolation
Open

feat: implement recursive placeholder resolution in Default parameters#1013
AshokThangavel wants to merge 16 commits intointersystems:mainfrom
AshokThangavel:feat/unified-variable-interpolation

Conversation

@AshokThangavel
Copy link
Contributor

Support Recursive Placeholder Resolution in Module Parameter

Description

This PR introduces deeply nested variables or chained configuration settings where one ${variable} depends on another.
with a safety handle complex dependencies and prevent infinite loops in the case of circular references.

fixes: #1009

Changes

  • Recursive Logic: Updated ResolvePlaceholders to use a while loop that continues as long as substitutions are being made.
  • Efficiency: The loop exits immediately if a pass results in no changes, ensuring no performance penalty for simple configurations.

Testing Performed

  1. Unit Tests: Verified with complex nested strings:
  • ${A} -> ${B} -> ${C} -> FinalValue.
  1. Integration Test: Added a new integration test class Test.PM.Integration.Module that:
  • Generates a module.xml from XData.
  • Writes it to the filesystem.
  • Executes an IPM load command to verify the full lifecycle of the variable resolution.

Test Execution Results: Test.PM.Integration.Module

Counter Action Status Description
1 LogMessage passed start Loading the demo-module1 module
2 AssertStatusOK passed Directory created /home/irisowner/zpm/tests/integration_tests/Test/PM/Integration/_data/varresolver/
3 AssertStatusOK passed module.xml File created on /home/irisowner/zpm/tests/integration_tests/Test/PM/Integration/_data/varresolver/
4 AssertStatusOK passed Created the xml file on /home/irisowner/zpm/tests/integration_tests/Test/PM/Integration/_data/varresolver/
5 AssertStatusOK passed Loaded varresolver module successfully from /home/irisowner/zpm/tests/integration_tests/Test/PM/Integration/_data/varresolver/
6 AssertTrue passed Module demo-module1 exists in IPM and version is 1.0.0
7 LogMessage passed List all modules
8 AssertStatusOK passed uninstalled module demo-module1 successfully.
9 AssertStatusOK passed Deleted the module.xml file from /home/irisowner/zpm/tests/integration_tests/Test/PM/Integration/_data/varresolver/
10 LogMessage passed Duration of execution: 1.193466 sec.

Copy link
Collaborator

@isc-dchui isc-dchui left a comment

Choose a reason for hiding this comment

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

A few comments and questions

Copy link
Collaborator

@isc-dchui isc-dchui left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! Here's another pass of comments/questions

…xpression

- Adopted %EvaluateSystemExpression for system variable resolution to align with existing APIs.
- Retained multi-pass logic to handle nested and "Frankenstein" placeholders.
- Implemented a priority gate: customParams take precedence over system defaults.
- Hardened maxLevels condition using an explicit guard clause for better robustness.
Copy link
Collaborator

@isc-dchui isc-dchui left a comment

Choose a reason for hiding this comment

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

Just a few more things, thanks!

@isc-dchui
Copy link
Collaborator

This needs a pull from main and an update for the changelog entry to 0.10.7 and then we're good to go.

@AshokThangavel
Copy link
Contributor Author

I’ve pulled the latest changes from main and resolved the conflicts in CHANGELOG.md. The new entry has been updated to 0.10.7. Thank you!

isc-dchui
isc-dchui previously approved these changes Mar 9, 2026
isc-dchui
isc-dchui previously approved these changes Mar 9, 2026
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.

Allow ${variables} in Default parameters

2 participants