Skip to content

feat(ec2): five describes with a published 5-floor range page (#1024) - #1054

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/1024-ec2-published-range-maxresults
Sep 18, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/1024-ec2-published-range-maxresults

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Refs #1024.

Part two of three. DescribeInternetGateways, DescribeNatGateways, DescribeRouteTables,
DescribeInstanceTypes and DescribeInstanceTypeOfferings published MaxResults and NextToken
and read neither, so each answered its whole listing with no nextToken — the divergence a
paginating 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 was
wrong: the split is 3 + 5 + 1. This PR is the five, and DescribeLaunchTemplates alone 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

Operation Valid Range ID-list parameter
API_DescribeInternetGateways 5–1000 InternetGatewayId.N
API_DescribeNatGateways 5–1000 NatGatewayId.N
API_DescribeRouteTables 5–100 RouteTableId.N
API_DescribeInstanceTypes 5–100 none — InstanceType.N is not an ID list
API_DescribeInstanceTypeOfferings 5–1000 none at all

All five have an empty Errors section, so InvalidParameterValue/400 rests on the service-wide
Query Requests page — the reading ec2_pagination.go already records.

The ceiling is per operation (#671)

MaxResults=1000 is now accepted at DescribeNatGateways and refused at DescribeRouteTables,
two calls a caller makes in the same breath while wiring a VPC; DescribeInstanceTypes (100) sits
beside DescribeInstanceTypeOfferings (1000) the same way. So the ceiling is two constants named for
their values — ec2MaxPublishedMaxResults1000 and ec2MaxPublishedMaxResults100, following
GetSpotPlacementScores' own per-operation pair — rather than one "published maximum" that a later
edit 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 InvalidParameterCombination

The service-wide rule is stated against "a list of IDs".

  • DescribeInstanceTypeOfferings has no list parameter at all — DryRun, Filter.N,
    LocationType, MaxResults, NextToken — so there is nothing to apply it to.
  • DescribeInstanceTypes has InstanceType.N, a stronger parameter than
    DescribeSpotPriceHistory's namesake: it asserts the types exist, so an unknown one is refused with
    InvalidInstanceType. It is still not an ID list, because it names catalog members rather than
    resources 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 bound
is per operation rather than per family from one row set.

The two catalog describes cannot join it, for the reason DescribeSpotPriceHistory could not: every
case 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.go asserts the same properties against those
fixed 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, not StateManager.List's order, #865),
and that neither page has an ID list for MaxResults to conflict with.

Two details worth stating:

  • At the offerings operation the offset counts offerings — type × location pairs — not types,
    because an offering is what the answer's items are. The pagination parameters are read before
    LocationType and before the filter names, so a malformed token is refused identically whichever
    location a caller asked for.
  • DescribeRouteTables is the one converted describe whose listing is not empty before a test
    creates anything: CreateVpc mints the VPC's main route table, a genuine member of the answer. The
    helper 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 under
GOTOOLCHAIN=go1.26.6, coverage, the docs and authz reference checks, the docs site build, and the
e2e vet+test). Coverage holds the floor.

Mutation-checked: swapping DescribeInstanceTypes' ceiling to 1000 fails
MaxResultsOutsideTheRangeIsRefused at both the ceiling and the explicit a page of 1000 case;
dropping either ec2Page call or its offset argument fails to compile.

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

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 251cca7 into main Sep 18, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the feat/1024-ec2-published-range-maxresults branch September 18, 2026 03:32
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.

1 participant