fix: Map expansion now matches nested child steps (gt-8tmz.33)

The map rule was only iterating over top-level steps, missing nested
children. Now uses buildStepMap to include all steps at any depth.

Added test case for map expansion over nested children.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-25 12:07:48 -08:00
parent 2f9d423ac8
commit de1a9559fa
3 changed files with 75 additions and 3 deletions

View File

@@ -112,10 +112,12 @@ func ApplyExpansions(steps []*Step, compose *ComposeRules, parser *Parser) ([]*S
return nil, fmt.Errorf("map: %q has no template steps", rule.With)
}
// Find all matching steps
// Find all matching steps (including nested children - gt-8tmz.33)
// Rebuild stepMap to capture any changes from previous expansions
stepMap = buildStepMap(result)
var toExpand []*Step
for _, step := range result {
if MatchGlob(rule.Select, step.ID) && !expanded[step.ID] {
for id, step := range stepMap {
if MatchGlob(rule.Select, id) && !expanded[id] {
toExpand = append(toExpand, step)
}
}