Closes #931 - Support dynamic variable resolution in find_replace.find_value#1007
Draft
Copilot wants to merge 3 commits into
Draft
Closes #931 - Support dynamic variable resolution in find_replace.find_value#1007Copilot wants to merge 3 commits into
find_replace.find_value#1007Copilot wants to merge 3 commits into
Conversation
Copilot
AI
changed the title
[WIP] Add support for dynamic variable resolution in find_value
Closes #931 - Support dynamic variable resolution in May 31, 2026
find_replace.find_value
Contributor
|
@copilot The documentation is missing an example, maybe add it to the sample parameter file |
Contributor
Author
Implemented in commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This updates
find_replace.find_valueto support dynamic variable resolution with the same$workspace.*syntax used byreplace_value, while enforcing semantic constraints for unsupported cases.Runtime resolution in
extract_find_valueworkspace_objinput and dynamic resolution path before regex/literal evaluation.find_valuenow resolves$workspace.$id,$workspace.$name,$workspace.$name_encoded,$workspace.<name>, and$workspace.<name>.$idwhen workspace context is available.Guardrails for item-attribute variables in
find_value$items.<type>.<name>.$<attribute>now fails fast withInputError(same-workspace target attributes are invalid as search inputs).$workspace.<name>.$items.<type>.<name>.$<attribute>is allowed and resolved, with a warning that the referenced cross-workspace item must exist at deploy time.Call-site wiring
workspace_obj=selffromFabricWorkspace._replace_parametersso deployment-time replacements resolve dynamicfind_valueinputs.Validation/docs alignment
find_valuemay be$-prefixed for dynamic resolution.find_valuedynamic variables, cross-workspace caution, and explicit$items.*exclusion.find_valueusage ($workspace.Dev Workspace.$id) infind_replace.Changelog compliance
Linked Issue (REQUIRED)
Linked via PR title format.
Original prompt
Summary
Add support for dynamic variable resolution in the
find_valuefield of thefind_replaceparameter, following the same$workspace.*and$items.*variable syntax already supported byreplace_value.Background
Currently, dynamic replacement (e.g.
$workspace.<name>.$id,$items.<type>.<name>.$<attribute>) only works inreplace_value. This feature extends it tofind_valueso users can write parameters like:Variable Classification for
find_valueAfter careful analysis, the following rules apply:
✅ Allow silently (no warning)
These always resolve before deployment runs, and their values could legitimately be present in repository files:
$workspace.$id,$workspace.$name,$workspace.$name_encoded$workspace.<name>.$id/$workspace.<name>Cross-workspace item attributes could legitimately appear in files (e.g. a pipeline referencing another workspace's Lakehouse ID), but the item must already exist at deployment time:
$workspace.<name>.$items.<type>.<name>.$<attribute>Warning message to use:
Where
workspace_nameis extracted from the variable string (the part between$workspace.and.$items.).❌ Block with InputError
Same-workspace item attributes (
$items.*) are semantically impossible as afind_value— the target item's ID is what you're writing into the file; it can never be what you're searching for:$items.<type>.<name>.$<attribute>Error message to use:
Required Code Changes
1.
src/fabric_cicd/_parameter/_utils.py—extract_find_valueModify the function signature to accept an optional
workspace_objparameter, and add dynamic resolution logic before the regex/literal handling:After getting
find_valuefromparam_dictand before theis_regexcheck, add:2.
src/fabric_cicd/fabric_workspace.py—_replace_parametersPass
selfasworkspace_objtoextract_find_value:3.
src/fabric_cicd/_parameter/_parameter.py—_validate_required_valuesThe
find_valuevalidation currently checks thatfind_valueis a string (which$-prefixed variables satisfy), so no structural change is needed. However, add a note/comment thatfind_valuemay start with$for dynamic variable resolution.4. Tests —
tests/test_parameter_utils.pyAdd test cases for
extract_find_valuewithworkspace_obj:$workspace.$idasfind_value→ resolves to workspace ID → searched in file content$workspace.<name>.$idasfind_value→ resolves correctly$workspace.<name>.$items.<type>.<name>.$idasfind_value→ resolves with a warning logged$items.<type>.<name>.$idasfind_value→ raisesInputError5. Documentation —
docs/how_to/parameterization.mdUnder the Dynamic Replacement section, add a note that
find_valuealso supports dynamic variables, with the same supported variable list. Clearly document:$workspace.*variables are fully supported$workspace.<name>.$items.*variables are su...This pull request was created from Copilot chat.