Repository navigation
refactor(alias): remove lazy/eager template expansion branching - #2110
Merged
Merged
Conversation
Alias expansion always happens at execution time (in AliasExecCtx::run), so the lazy/eager distinction for vars.* was unnecessary — the "lazy" path round-tripped context_json back to the same HashMap that was serialized from context_map. Template freshness for vars.* comes from the template engine reading git config at expansion time, not from the context map. Remove the intermediate HashMap<&str, &str>, the is_pipeline field, and the template_references_var branching. Both dry-run and execution paths now route through expand_shell_template, making it the canonical expansion path for all three consumers (hooks, aliases, pipelines). Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Apr 12, 2026
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
tests/integration_tests/step_alias.rs:683-686 still describes test_alias_pipeline_lazy_vars as exercising "the lazy re-expansion path in AliasExecCtx::run (which only triggers when is_pipeline && template references vars.)." That path no longer exists after this PR — the test still verifies the right behavior, but the docstring (and arguably the _lazy_ in the test name and the alias_lazy.txt marker) is now misleading. Happy to push a follow-up commit if useful.
The test no longer exercises a "lazy re-expansion path" — update the name and docstring to describe what it actually verifies. Co-Authored-By: Claude <[email protected]>
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.
The lazy/eager distinction in alias template expansion was unnecessary — alias expansion always happens at execution time (in
AliasExecCtx::run), sovars.*references naturally read fresh values from git config without special handling. The "lazy" path was round-trippingcontext_jsonback to the sameHashMapthat was serialized fromcontext_map.Removes the intermediate
HashMap<&str, &str>, theis_pipelinefield, and thetemplate_references_varbranching. Both dry-run and execution paths now route throughexpand_shell_template, making it the canonical expansion path for all three consumers (hooks, aliases, pipelines).Follow-up to #2095 and #2103.