Repository navigation
feat(elb): DescribeAccountLimits answers, with seedable limits (#885) - #899
Merged
Merged
Conversation
scttfrdmn
force-pushed
the
feat/elb-describe-account-limits
branch
from
September 15, 2026 22:25
e8a1fd9 to
b3b8dba
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The action was authorizable but not dispatched: substrate's generated authorization reference already carried `elasticloadbalancing:DescribeAccountLimits` with an empty resource list, while `ELBPlugin.HandleRequest`'s switch had no arm for it — so a caller could be granted a permission substrate then answered `InvalidAction` for. It was also the one shared action name of nine that routed nowhere, correcting #844. Substrate enforces no ELB quota anywhere, so a bare constant here would be a number that does not come from where it appears to. The limits are instead seedable via POST/DELETE /v1/elb/account-limits, keyed by limit name or the "*" wildcard with specific-then-wildcard resolution, following the `ec2FleetShortfall` shape. AWS's published defaults become the default seed value, so the constant becomes the thing a caller polls the operation for. `docs/services.md` states explicitly that nothing in substrate enforces the number reported, seeded or defaulted. Provenance is recorded rather than smoothed over. The shape is the API model's, with `Max` a String per `API_Limit`. The names are not: classic's 2012-06-01 `API_Limit` enumerates exactly three, v2's enumerates none, so the 23 v2 names are taken from the AWS CLI v2 reference's example output for the operation and labelled an example rather than the model. Their values come from the three quota user guides, which win where they disagree with the example. `NextMarker` is absent when exhausted, following v2's documented null rather than classic's documented empty string; the difference is recorded for #844. `PageSize` outside the documented 1–400 falls back to the default, matching the Query-protocol paginators (RDS, ElastiCache, CloudWatch) rather than EC2 `DescribeTags`'s refusal, because the operation publishes no operation-specific error to refuse with. Closes #885.
A store failure during the seed lookup must propagate rather than be answered as a successful set of defaults. Falling back silently is the worse failure: a harness that seeded "every limit is 0" to drive its at-quota branch would be handed 50, its assertion would pass vacuously, and the seed would look armed when it was not — the failure mode #413 filed against the SQS consistency seed. Adds elbLimitFaultState, following sqsAlwaysFailState, scoped to the elb-limits-ctrl namespace so a fault cannot break the server's own per-request bookkeeping and make the request fail for the wrong reason. It also separates a store error from a successful read of bytes that are not a seed (state written by an older substrate, or by hand), which decodes to a JSON error and is not the same signal. The sweep case seeds over the wire with only Delete faulted, so no field is mutated after the server is serving — that would be a race the detector would flag.
scttfrdmn
force-pushed
the
feat/elb-describe-account-limits
branch
from
September 15, 2026 22:43
4509319 to
82af3fa
Compare
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.
ELBPlugin.HandleRequest's action switch had noDescribeAccountLimitsarm, so the call fell tounknownActionError— while substrate's own authorization data already carriedelasticloadbalancing:DescribeAccountLimitswith an empty resource list (emulator/authz_reference_gen.go:1424, verified against the tree). A caller could be authorized for an action substrate then refused to perform. It was also the one shared action name of nine that routed nowhere, correcting #844's claim that all nine reach v2.Closes #885.
What AWS publishes, per generation
All four API-reference pages fetched successfully; none returned an empty body.
elasticloadbalancing-2012-06-01)elasticloadbalancingv2-2015-12-01)MarkerPageSizeLimits.member.NLimitLimitNextMarkerLimit.Nameclassic-listeners,classic-load-balancers,classic-registered-instancesLimit.MaxSources:
API_DescribeAccountLimits(v2),API_Limit(v2),API_DescribeAccountLimits(classic),API_Limit(classic).One handler, v2 shapes, per the issue's note that dispatch generation follows #844. Classic's three names are therefore deliberately absent.
Provenance
This splits three ways and the split is the substance, not a footnote.
From the API model (authoritative): the response shape,
Maxas a String rather than the integer it looks like,NextMarker's two different documented semantics,PageSize1–400, and the fact that the Errors section is Common Errors only.From an AWS-published example, not the model: the 23 v2 limit names. v2's
API_Limitenumerates none of them. The three quota user guides it points at were fetched and publish human-readable quota names ("Application Load Balancers per Region"), not the API'sLimit.Nametokens — so the user guides do not carry the names either. The tokens were sourced from the example output on the AWS CLI v2 reference page for the operation, the only AWS page found that renders them at all. That page is an illustrative example, and both the source comment anddocs/services.mdlabel it as such rather than presenting it as the published API model.From the quota user guides: the values, since a guide is AWS's normative statement of a default and the CLI example is an illustration AWS does not keep in step with it. ALB, NLB, GWLB. Every entry cites its guide row on its own line in
emulator/elb_account_limits.go. Two divergences are recorded rather than hidden:condition-wildcards-per-alb-rule— the ALB guide says 6, the CLI example says 5. The guide wins.target-groups-per-action-on-network-load-balancer— the CLI example says 1; the NLB guide's nearest row is "Target groups per listener rule action" at 5, and whether that row is this token could not be established, so the example's 1 stands and the line says why.Could not be sourced authoritatively:
target-id-registrations-per-application-load-balancerappears in no quota user guide at all; it keeps the CLI example's1000and the line says so. That is the one value in the set with no normative source.Seeding, and the fact that nothing enforces these numbers
Substrate enforces no ELB quota anywhere — no operation counts a load balancer, target group, listener or rule against one, and none is planned to. A bare constant would therefore be a number that does not come from where it appears to, which is the defect class the previous release was spent removing. Per the maintainer's settled decision (option 2), the limits are reported and seedable, with AWS's published defaults as the default seed value:
Namespace constant, key builder,
resolveAccountLimitMaxtrying the specific key then"*", and the two control handlers — theec2FleetShortfallshape (emulator/ec2_fleet_control.go:14-46, verified), registered beside the existing routes inemulator/server.go.maxis a string in the seed too, so the seed and the wire stay in the same units as the published member type. A seed with nomaxis refused rather than stored, since an emptyMaxresolves to "no seed applies" and would silently do nothing.docs/services.mdstates explicitly, in the hand-written region and citing #885 rather than any version: nothing in substrate enforces the number this operation reports, seeded or defaulted. That sentence is what makes choosing option 2 honest rather than merely plausible.PageSize, and a finding: substrate's paginators disagreeThe acceptance criteria say to handle an out-of-range
PageSizethe way substrate's other ELB paginators handle theirs. ELBv2 has no other paginator — there is noMarker/PageSizehandling anywhere inemulator/elb_plugin.go, so there was no ELB precedent to match. Going wider, the tree's paginators do diverge from each other:MaxRecordsand CloudWatch's take any positive integer, quietly substitute their default for anything else, and enforce no maximum.DescribeTagsgoes the other way: aMaxResultsoutside 5–1000 is refused withInvalidParameterValue, "not clamped: a caller who asked for 2000 asked for something the operation cannot do" (docs/services.md).Reported rather than resolved by inventing a third behaviour. This handler follows the first, which is the Query-protocol
Markerfamily it actually belongs to, and the decider is documentary:DescribeAccountLimitspublishes no operation-specific error on either generation's page, so refusing would mean inventing a code AWS does not publish for it — a thing EC2'sDescribeTagsdid not have to do. Because the default page size is the documented maximum (400), aPageSizeabove 400 is answered indistinguishably from a clamp, and an unparameterized call returns the whole set in one page.Markeris a decimal offset into a fixed, name-ordered set, so a paged walk returns each limit exactly once. An unparseableMarkerrestarts the walk, an offset past the end answers an empty last page — as RDS's and ElastiCache's cursors do, neither being an error the operation publishes a code for.NextMarkeris absent when exhausted, following v2's documented null rather than classic's documented empty element. The difference is recorded in the source against #844.Authorization
No authorization-reference change: the action was already present, and
make authz-reference-checkpasses untouched. Worth noting for the reviewer, since the task description expected ap.authorize(...)line — no ELB handler has one. Every ELB request is decided centrally byAuthController.CheckAccessatemulator/server.go:810, before dispatch, so matching the sibling handlers means adding nothing. That central check is also precisely why the gap existed: authorization passed and the switch then refused.Tests
emulator/elb_account_limits_test.go,package emulator_test, all through the housenewELBTestServer(t)helper (a realhttptestserver overemulator.NewServer, which is what every other ELB test uses and which registers the control-plane routes) with real wire calls — noputTest*direct state writes, no network, no wall-clock dependence.<DescribeAccountLimitsResponse xmlns=…>,<DescribeAccountLimitsResult>) and on the whole member —<member><Max>50</Max><Name>application-load-balancers</Name></member>— because botocore looks the wrapper up and raisesKeyErroron a mismatch, and a decoded struct can neither distinguish an absent member from an empty one nor reject an invented third member.NextMarker's absence is asserted on the bytes for the same reason."*"wildcard, specific-beats-wildcard resolution, an omitted name resolving to the wildcard, bothDELETEforms, and the endpoint's refusals.Markerround-trip walking the set atPageSize=5and asserting each of the 23 limits is returned exactly once, in order.PageSize(absent, 1, 2, 23, 400, 0, -5, 401, non-numeric) andMarkeredges (unparseable, negative, past the end, exactly the end).No pre-existing test asserted the old refusal, so nothing had to be relaxed.
A second commit covers the store-failure paths, following
sqsAlwaysFailState. A store failure during the seed lookup propagates rather than being answered as a successful set of defaults: silently falling back would be the worse failure, since a harness that seeded "every limit is 0" to drive its at-quota branch would be handed 50, its assertion would pass vacuously, and the seed would look armed when it was not — the failure mode #413 filed against the SQS consistency seed. The fault double is scoped to theelb-limits-ctrlnamespace so it cannot break the server's own per-request bookkeeping and make a request fail for the wrong reason, and it separates a store error from a successful read of bytes that are not a seed (state written by an older substrate, or by hand), which is a JSON error and not the same signal. The sweep case seeds over the wire with onlyDeletefaulted, so no field is mutated once the server is serving — that would be a race the detector would flag. The one branch left uncovered is thejson.Marshalguard on a struct of two strings, which cannot fail; it is kept becauseec2_fleet_control.go:104-108keeps the identical guard, and dropping it would mean discarding an error.Verification
Run from the repo root; all clean.
npm --prefix docs run buildwas skipped:docs/node_modulesis git-ignored, so it exits 127 in a fresh worktree. CI covers the docs build.