Repository navigation
Description
Found while implementing #620. Not a blocker for it, so it is filed rather than folded in.
What happens
ServiceQuotasPlugin.HandleRequest discards its *RequestContext:
// emulator/servicequotas_plugin.go
func (p *ServiceQuotasPlugin) HandleRequest(_ *RequestContext, req *AWSRequest) (*AWSResponse, error) {so the three operations that persist per-account state have no caller to file it under, and each hardcodes a placeholder with the same comment:
accountID := "000000000000" // Use a placeholder account ID since RequestContext is not passed here.That appears in requestServiceQuotaIncrease, listRequestedServiceQuotaChangesByService and getRequestedServiceQuotaChange. The state keys are built from it — increaseKey(accountID, id) is "quota_increase:" + accountID + "/" + id.
Why it matters
Every quota-increase request from every account lands in one shared bucket. Two consequences, neither of which raises an error:
- A test that vends or assumes into a second account sees the first account's quota-increase requests in
ListRequestedServiceQuotaChangesByService. Against real AWS the two accounts are isolated, so a multi-account governance test passes locally for the wrong reason. - The stored requests are attributed to an account that does not exist. Anything that later joins quota-increase history to a real account ID — an inspection of the event log, or a
CaseId-style correlation — cannot.
It also blocks the natural extension of #620: L-E619E033 (accounts per organization) is adjustable, and the interesting story is a per-organization ceiling that a management account raises. That story is per-account by definition.
Fix
Thread the context through, as every other plugin does. HandleRequest already receives it; the three handlers need it passed down, and the placeholder plus its three comments go away. Compare emulator/organizations_plugin.go, where each handler takes (reqCtx *RequestContext, req *AWSRequest).
The existing keys are the migration question: state written under 000000000000 by an older run is not readable under a real account ID afterwards. Since substrate's state is per-run test state rather than durable data, dropping it is almost certainly right — worth stating in the changelog rather than silently changing.
Acceptance criteria
-
HandleRequestpasses*RequestContextto the handlers that need it -
RequestServiceQuotaIncreasefiles the request underreqCtx.AccountID -
ListRequestedServiceQuotaChangesByServiceandGetRequestedServiceQuotaChangeread the caller's own requests only - A test asserting two accounts do not see each other's quota-increase requests
- The
000000000000placeholder and all three of its comments are gone - The key-format change is noted in
CHANGELOG.md
Activity