Skip to content

DE-2923: Enhance YAML support by allowing hydration of sequences (arrays)#6

Open
suraj-swaroop-alida wants to merge 1 commit intomasterfrom
aiml-datalake
Open

DE-2923: Enhance YAML support by allowing hydration of sequences (arrays)#6
suraj-swaroop-alida wants to merge 1 commit intomasterfrom
aiml-datalake

Conversation

@suraj-swaroop-alida
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings April 22, 2026 19:10
@alidabot-dev
Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enhances YAML hydration so secrets nested within YAML sequences (arrays) can be resolved during recursive traversal.

Changes:

  • Add []interface{} handling to recurse into array elements that are maps.
  • Convert YAML-decoded map[interface{}]interface{} elements inside arrays into map[string]interface{} before hydration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pstore.go
Comment on lines +207 to +224
case []interface{}:
for i, item := range v {
switch elem := item.(type) {
case map[string]interface{}:
if err := ps.hydrateMapRecursively(elem, append(path, key)); err != nil {
return err
}
case map[interface{}]interface{}:
ee := map[string]interface{}{}
for k, val := range elem {
ee[k.(string)] = val
}
v[i] = ee
if err := ps.hydrateMapRecursively(ee, append(path, key)); err != nil {
return err
}
}
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

This sequence handling only recurses into elements that are maps; scalar elements (e.g., a YAML list of strings like ["$SECRET:foo"]) will be left unhydrated even though the PR goal is “hydration of sequences”. If you intend to support secrets in arrays, add handling for string elements (at least for the $SECRET:<param> form, since $SECRET/$$ have no per-item key to infer).

Copilot uses AI. Check for mistakes.
Comment thread pstore.go
Comment on lines +215 to +218
ee := map[string]interface{}{}
for k, val := range elem {
ee[k.(string)] = val
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The conversion of YAML-decoded maps inside sequences uses k.(string) for each key. YAML allows non-string keys, so this can panic at runtime if a key is not a string. Consider using a checked type assertion and returning a descriptive error (including the full path), or converting keys via fmt.Sprint(k) if non-string keys are acceptable here.

Copilot uses AI. Check for mistakes.
Comment thread pstore.go
Comment on lines +210 to +222
case map[string]interface{}:
if err := ps.hydrateMapRecursively(elem, append(path, key)); err != nil {
return err
}
case map[interface{}]interface{}:
ee := map[string]interface{}{}
for k, val := range elem {
ee[k.(string)] = val
}
v[i] = ee
if err := ps.hydrateMapRecursively(ee, append(path, key)); err != nil {
return err
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

When recursing into sequence elements, the path passed to hydrateMapRecursively does not include the element index. If hydration fails, the wrapped error will point to ...<key>.<field> without identifying which array item caused it. Consider including the index in the path element (e.g., fmt.Sprintf("%s[%d]", key, i)) to make errors actionable.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

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

LGTM.

Thanks for the nice throwback to my old gig. Good luck! 🎉

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.

4 participants