Skip to content

Fix non-deterministic map iteration in manifest resolver#52

Closed
Copilot wants to merge 2 commits into
refactor/extract-function-to-fetch-secretsfrom
copilot/sub-pr-51
Closed

Fix non-deterministic map iteration in manifest resolver#52
Copilot wants to merge 2 commits into
refactor/extract-function-to-fetch-secretsfrom
copilot/sub-pr-51

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

The resolveManifestItems function iterated over a secrets map, causing non-deterministic behavior when multiple manifest items mapped to the same environment variable. Map iteration order is randomized in Go, so "last one wins" semantics were unpredictable.

Changes:

  • Iterate over manifestItems.Items in order instead of the secrets map
  • Removed now-unnecessary envVarSecretMap intermediary
  • Updated test to verify deterministic "last one wins" behavior

Before:

for key, value := range secrets {
    if envVar, ok := envVarSecretMap[key]; ok {
        result.AppendItem(envVar, value)
    }
}

After:

for _, item := range manifestItems.Items {
    if value, ok := secrets[item.Name]; ok {
        result.AppendItem(item.Env, value)
    }
}

When multiple manifest entries target the same environment variable, the last entry in the manifest now consistently wins.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: tonitienda-rovtech <228456790+tonitienda-rovtech@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor function to fetch secrets for .env source Fix non-deterministic map iteration in manifest resolver Feb 27, 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.

2 participants