Skip to content

Give spored's provenance S3 client the instance's region, and never lose an output to a provenance failure (#1094) - #1096

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/provenance-imds-region
Oct 17, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/provenance-imds-region

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1094

On v0.132.0, every task output upload failed on a real instance with Invalid region, so outputs were lost and the run was reported as output_delivery_error. The live test that found it is in #1094.

  1. Region: the three provenance subcommands load their config via provAWSConfig, which adds config.WithEC2IMDSRegion(). That is the same option pkg/agent/queue_runner.go already uses.
  2. Never lose an output: if spored provenance upload fails for any reason, the wrapper uploads with plain aws s3 cp, untagged. Untagged means kept.

Gates: each fails against a revert that compiles.

  • TestProvAWSConfigTakesTheRegionFromIMDS: a fake IMDS serving the identity document, with AWS_REGION, AWS_DEFAULT_REGION, the profile and both config files cleared. Reverted to plain LoadDefaultConfig(ctx), it gets region "".
  • TestProvenanceSubcommandsUseProvAWSConfig: an AST check that no subcommand calls LoadDefaultConfig directly, and that all three use the helper.
  • TestWrapperFallsBackWhenTheProvenanceUploadFails: the wrapper run under bash with a fake spored whose upload exits 1. Without the fallback, the test reports the output lost and state=failed retry_class=output_delivery_error.

Local checks: go vet ./..., the full short suite, all 9 nested modules, staticcheck (GOOS=linux) and semgrep all pass.

Ships as v0.132.1, a PATCH that also carries #1092.

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/spored/provenance.go 40.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 561b5dd into main Oct 17, 2026
8 checks passed
@scttfrdmn scttfrdmn mentioned this pull request Oct 17, 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.

v0.132.0: every task output fails to upload on an instance (spored provenance S3 client has no region)

1 participant