Repository navigation
Conversation
This was referenced Oct 15, 2026
#939) spawn burst loaded its AWS config with a bare config.LoadDefaultConfig, and registry.EnsureTable did the same, so burst ran in the ambient region whatever --region, --profile or SPORE_REGION said: the AMI lookup, the registry table and every member landed where AWS_REGION or the shared AWS config pointed. Same shape as #276 (launch) and #774 (autoscale). Burst now loads one config through cmd's loadAWSConfig, a thin wrapper over spawnaws.NewClientWithRegion (explicit region > shared spore config > ambient, with the shared profile), and passes it to EnsureTable, which now takes an aws.Config. Burst refuses to run with no region at all. The gate, TestCommandsLoadAWSConfigThroughTheSharedLoader, parses every non-test file of package cmd and fails on any call to the SDK config package's LoadDefaultConfig, matched by resolved import path so aliases are caught and comments are not. Its first run found 22 more call sites in bot, cancel, completion, cost, extend, fsx, onboard, service, sweep_pricing, team and validate. All go through loadAWSConfig now; with no flags or SPORE_* set they resolve exactly as before. Also fixes #963: NewPeerRegistry, the client spored registers and heartbeats through, used a bare default config. On EC2 that has no region (the unit sets no AWS_REGION and the SDK does not read IMDS for it), so burst members never registered. It now uses identity.Region. Tests: burst run through the real root command against a recording HTTP client (no network, RunInstances refused) for --region vs AWS_REGION, SPORE_REGION vs AWS_REGION, and --profile's region; EnsureTable and NewPeerRegistry region tests. Each watched failing against a compiling revert. Fixes #939 Fixes #963 (#939)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #939
Fixes #963
Stacked on #940 (fix/924, on #934, on #926). Review after those; the diff here is only this branch.
What was wrong
spawn burstbuilt its AWS config with a bareconfig.LoadDefaultConfig(ctx), and so didregistry.EnsureTable. Nothing on the burst path read the root's--region/--profile(recorded byspawnconfig.SetSharedFlags) orSPORE_REGION. The AMI lookup, the registry table and every member went wherever the ambient chain pointed.The fix
cmd/awsconfig.go:loadAWSConfig(ctx, region), a wrapper overspawnaws.NewClientWithRegion. That is the resolutionspawn launchuses since spawn launch --region ignored; ambient AWS_REGION/resolution wins → instance in wrong region #276: explicit region, then the shared spore config (--region,SPORE_REGION,AWS_REGION, config.toml), then the SDK default chain, with the shared profile.EnsureTable(ctx, cfg)and the members. It refuses to start with no region.registry.EnsureTablenow takes anaws.Config.pkg/registryis not public surface, so the snapshot does not change.The gate
TestCommandsLoadAWSConfigThroughTheSharedLoaderparses every non-test file in packagecmd, with no list, and fails on any call togithub.com/aws/aws-sdk-go-v2/config.LoadDefaultConfig. The call is matched by resolved import path, soawsconfig./sdkcfg.aliases are caught and comments are not (TestBareSDKConfigLoadsMatchesTheCallUnderAnyNamecovers the matcher).WithRegiondoes not exempt a call, because it still ignores--profile. If the package has no files, the test fails.On its first run it found 22 more sites: bot (8), cancel (2, including the sweep instance terminate), completion, cost, extend, fsx (3), onboard (whose help says "run with credentials for the account... profile"), service and sweep dry-run pricing, team (2) and validate. All of them now go through
loadAWSConfig. With no flag and noSPORE_*set, they resolve exactly as before.Also: #963
registry.NewPeerRegistryis the client spored registers and heartbeats through. It also used a bare default config. On EC2 that config has no region: the unit sets noAWS_REGION, and the SDK does not read the region from IMDS. SoRegisterfailed and burst members never appeared in the registry their local nodes read. It now usesidentity.Region.Tests (no AWS, nothing launched)
TestBurstHonoursTheRegionFlag,...SporeRegionand...TheProfileFlagrunspawn burstthrough the real root command with a recordingHTTPClient. Nothing reaches the network, and RunInstances gets a 403. Each test asserts that DescribeTable and RunInstances were sent, and that every regional request went to the expected region:--regionbeatsAWS_REGION,SPORE_REGIONbeatsAWS_REGION, and--profiletakes its profile's region.TestBurstRefusesToRunWithNoRegion: it makes zero AWS calls.TestEnsureTableUsesTheCallersRegion,TestEnsureTableRefusesAConfigWithNoRegion,TestNewPeerRegistryUsesTheMembersRegion.Each test was run against a revert that compiles:
loadAWSConfigreturning a bareconfig.LoadDefaultConfig(ctx): all three burst tests fail, and every call goes toeu-west-1(the ambient region).EnsureTableignoring its cfg: fails, "made no DynamoDB request".NewPeerRegistrywithout the region: fails, region"".sdkcfg.LoadDefaultConfig(ctx)(aliased import) put back in burst.go: the gate fails atburst.go:119.make check: all packages pass except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested: all 9 nested modules clean.Caveats
cmd. Somepkg/code that commands call still loads ambient config:dns.NewClient(spawn dns) and thepkg/costpricer. Filed as spawn dns and spawn cost still sign with the ambient AWS profile, ignoring --profile #967.pkg/integration/orchestrator_test.go(integration tag) still callsEnsureTable(ctx). It has not compiled sincepkg/orchestratorwas removed, and Remove the stale orchestrator integration test, and gate module tidiness (#907) #914 on main deletes it, so I left it alone to avoid a rebase conflict.hybrid_test.gois updated and vets under-tags integration.