Repository navigation
feat(ec2): five describes with a published 5-floor range page (#1024) - #1054
Merged
Merged
Conversation
DescribeInternetGateways, DescribeNatGateways, DescribeRouteTables, DescribeInstanceTypes and DescribeInstanceTypeOfferings published MaxResults and NextToken and read neither, so each answered its whole listing with no nextToken. All five convert onto #917's shared paginator; a caller that sends neither parameter sees no wire change. The published ceiling is per operation and two of the five disagree with the other three about the same value: MaxResults=1000 is accepted at DescribeNatGateways and refused at DescribeRouteTables, which publishes 100, as does DescribeInstanceTypes. The ceiling is therefore two constants named for their values rather than one "published maximum" a later edit could collapse invisibly (#671). Two of the five gain no InvalidParameterCombination: the offerings page has no list parameter at all, and DescribeInstanceTypes' InstanceType.N names catalog members rather than resources the account holds. The count is five, not the four this release's plan predicted — the split of the remaining nine is 3 + 5 + 1, and DescribeLaunchTemplates alone remains. Refs #1024.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 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.
Refs #1024.
Part two of three.
DescribeInternetGateways,DescribeNatGateways,DescribeRouteTables,DescribeInstanceTypesandDescribeInstanceTypeOfferingspublishedMaxResultsandNextTokenand read neither, so each answered its whole listing with no
nextToken— the divergence apaginating caller cannot see, since the loop terminates on the first page here and finds a second in
production. All five convert onto #917's shared paginator; a caller that sends neither parameter sees
no wire change at any of them.
The count is five, not four
The plan for this release split the remaining nine as three unbounded / four with a floor of five /
DescribeLaunchTemplates, which is eight. The audit of sixteen was right and the arithmetic waswrong: the split is 3 + 5 + 1. This PR is the five, and
DescribeLaunchTemplatesalone remains —a third part rather than a sixth row of this one, because its published floor is 1, not 5.
Published ranges, verified on the pages
Valid RangeAPI_DescribeInternetGatewaysInternetGatewayId.NAPI_DescribeNatGatewaysNatGatewayId.NAPI_DescribeRouteTablesRouteTableId.NAPI_DescribeInstanceTypesInstanceType.Nis not an ID listAPI_DescribeInstanceTypeOfferingsAll five have an empty
Errorssection, soInvalidParameterValue/400 rests on the service-wideQuery Requests page — the reading
ec2_pagination.goalready records.The ceiling is per operation (#671)
MaxResults=1000is now accepted atDescribeNatGatewaysand refused atDescribeRouteTables,two calls a caller makes in the same breath while wiring a VPC;
DescribeInstanceTypes(100) sitsbeside
DescribeInstanceTypeOfferings(1000) the same way. So the ceiling is two constants named fortheir values —
ec2MaxPublishedMaxResults1000andec2MaxPublishedMaxResults100, followingGetSpotPlacementScores' own per-operation pair — rather than one "published maximum" that a lateredit could collapse invisibly. The floor stays a single constant: the published sentence is literally
the same sentence at eight pages now, one fact rather than eight that agree.
Harmonising either pair would make substrate accept a request AWS rejects, which is the direction
that costs a consumer real time.
Two gain no
InvalidParameterCombinationThe service-wide rule is stated against "a list of IDs".
DescribeInstanceTypeOfferingshas no list parameter at all —DryRun,Filter.N,LocationType,MaxResults,NextToken— so there is nothing to apply it to.DescribeInstanceTypeshasInstanceType.N, a stronger parameter thanDescribeSpotPriceHistory's namesake: it asserts the types exist, so an unknown one is refused withInvalidInstanceType. It is still not an ID list, because it names catalog members rather thanresources the account holds. Refusing the combination would extend a published rule to a parameter
it does not name.
That the two are read together is asserted, not assumed — a sweep is exactly where a published rule
gets applied one operation too far.
Tests
Three rows join the shared table in
ec2_pagination_test.go(DescribeInternetGateways,DescribeNatGateways,DescribeRouteTables), which is what makes the boundary cases prove the boundis per operation rather than per family from one row set.
The two catalog describes cannot join it, for the reason
DescribeSpotPriceHistorycould not: everycase there begins by creating the listing it walks, and these listings are the instance-type catalog
— crossed with the request's locations at the offerings operation — so both exist in a fresh account
at a size no test chose.
ec2_catalog_pagination_test.goasserts the same properties against thosefixed listings, plus two the table cannot reach: that the offset is stable over a listing built from
no state at all (
buildEC2InstanceTypeCatalog's fixed slice, notStateManager.List's order, #865),and that neither page has an ID list for
MaxResultsto conflict with.Two details worth stating:
because an offering is what the answer's items are. The pagination parameters are read before
LocationTypeand before the filter names, so a malformed token is refused identically whicheverlocation a caller asked for.
DescribeRouteTablesis the one converted describe whose listing is not empty before a testcreates anything:
CreateVpcmints the VPC's main route table, a genuine member of the answer. Thehelper reads that table back and creates n−1 more. The first draft assumed the opposite and the
boundary cases caught it by counting one row too many.
Verification
The nine-command gate is green (
gofmt/build/vet,golangci-lint,make test, the same underGOTOOLCHAIN=go1.26.6, coverage, the docs and authz reference checks, the docs site build, and thee2e vet+test). Coverage holds the floor.
Mutation-checked: swapping
DescribeInstanceTypes' ceiling to 1000 failsMaxResultsOutsideTheRangeIsRefusedat both the ceiling and the explicita page of 1000case;dropping either
ec2Pagecall or its offset argument fails to compile.