Skip to content

fix(aws): preserve error chain with errors.Join, copy tags for goroutines#651

Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/cluster-error-chain
Feb 13, 2026
Merged

fix(aws): preserve error chain with errors.Join, copy tags for goroutines#651
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/cluster-error-chain

Conversation

@ArangoGutierrez
Copy link
Collaborator

Summary

  • Replace %v with errors.Join for instance creation error aggregation, preserving error chain
  • Copy p.Tags before goroutine loop to prevent potential data race

Audit Findings

Changes

  • pkg/provider/aws/cluster.go: Use errors.Join for error aggregation, copy tags before goroutine loop

Test plan

  • gofmt — no formatting issues
  • go build — compiles
  • go test ./pkg/... — all tests pass

…ines

Instance creation errors were formatted with %v, breaking the error
chain. Use errors.Join so callers can inspect individual errors.
Also copy p.Tags before the goroutine loop to prevent a future data
race if Tags is ever modified during creation.

Audit findings NVIDIA#11 (MEDIUM), NVIDIA#15 (MEDIUM).

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Copilot AI review requested due to automatic review settings February 12, 2026 20:06
Copy link

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

This PR updates the AWS provider’s multinode instance creation path to (1) preserve underlying error chains when multiple instance creations fail, and (2) avoid sharing the provider’s tag slice across goroutines.

Changes:

  • Copy p.Tags before spawning instance-creation goroutines to avoid sharing the same slice across concurrent workers.
  • Aggregate instance creation errors via errors.Join and wrap with %w to preserve error unwrapping (errors.Is/As).

@@ -427,7 +432,7 @@ func (p *Provider) createInstances(
instanceName := fmt.Sprintf("%s-%s-%d", p.ObjectMeta.Name, role, index)
// Filter out the Name tag from p.Tags to avoid duplicates
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

The comment says it filters out the Name tag from p.Tags, but the loop now iterates over tagsCopy. Update the comment to match the code so it stays accurate for future maintenance.

Suggested change
// Filter out the Name tag from p.Tags to avoid duplicates
// Filter out the Name tag from tagsCopy to avoid duplicates

Copilot uses AI. Check for mistakes.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 21962400672

Details

  • 0 of 6 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 47.465%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/provider/aws/cluster.go 0 6 0.0%
Totals Coverage Status
Change from base Build 21955389842: -0.04%
Covered Lines: 2500
Relevant Lines: 5267

💛 - Coveralls

@ArangoGutierrez ArangoGutierrez merged commit 71f1388 into NVIDIA:main Feb 13, 2026
25 checks passed
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.

3 participants