Skip to content

Nine routed EC2 describes publish MaxResults and NextToken and implement neither #1024

Closed

Description

@scttfrdmn

Nine routed EC2 describes publish MaxResults and NextToken and implement neither. Each answers its whole listing and discards both parameters, which is the state #917 removed from the other nine EC2 describes over three parts. #917 stopped where it did deliberately — its scope was the operations already carrying a paginator plus the ones whose listings a consumer walks most often — and its final act was to count what remained rather than leave the count implied. This is that count.

Of the three states a published parameter can be in — implemented, absent and refused, or accepted and ignored — these nine are in the third, which is the worst: a consumer's paging loop terminates on its first response against substrate and first executes for real against an account large enough to page, with no test covering it, and a NextToken from anywhere else is answered with the whole listing again rather than refused.

The audit was done against the dispatch switch (emulator/ec2_plugin.go:72-266, the only EC2 router) crossed with each operation's own AWS API reference page. All sixteen pages were read; none returned an empty body.

The nine

Operation Dispatch MaxResults valid range, verbatim
DescribeInstanceStatus ec2_plugin.go:84 Type Integer, no Valid Range line. Its page is the one of the nine that states the prohibition outright: "You cannot specify this parameter and the instance IDs parameter in the same request."
DescribeInternetGateways ec2_plugin.go:115 Valid Range: Minimum value of 5. Maximum value of 1000.
DescribeRouteTables ec2_plugin.go:125 Valid Range: Minimum value of 5. Maximum value of 100.
DescribeNatGateways ec2_plugin.go:201 Valid Range: Minimum value of 5. Maximum value of 1000.
DescribeInstanceTypes ec2_plugin.go:209 Valid Range: Minimum value of 5. Maximum value of 100.
DescribeInstanceTypeOfferings ec2_plugin.go:211 Valid Range: Minimum value of 5. Maximum value of 1000.
DescribeSpotPriceHistory ec2_plugin.go:213 Type Integer, no Valid Range line
DescribeLaunchTemplates ec2_plugin.go:218 Valid Range: Minimum value of 1. Maximum value of 200. — "This value can be between 1 and 200."
DescribeFleets ec2_plugin.go:233 Type Integer, no Valid Range line

Every one of them reads neither parameter today: outside ec2_describetags.go, ec2_launchtemplate_versions.go, ec2_pagination.go and ec2_plugin.go the strings MaxResults and NextToken do not appear in the EC2 files at all, and inside ec2_plugin.go every occurrence is in one of the paginating handlers. So this is silent acceptance rather than partial handling.

What is not in scope, recorded so the count is not read as larger than it is

Seven other routed Describe* operations publish neither parameter, and their handlers are correct as written: DescribeKeyPairs, DescribePlacementGroups, DescribeAvailabilityZones, DescribeAddresses, DescribeRegions, and the two single-attribute reads DescribeInstanceAttribute and DescribeSnapshotAttribute. Nothing to do at any of them.

This also corrects a figure docs/services.md carried from #917's first part: "roughly twenty other describes published both parameters and implemented neither". Against the routed set the number is nine, and the correction lands with this issue.

Acceptance criteria

  • All nine paginate on the shared helpers ec2MaxResults, ec2NextTokenOffset and ec2Page (emulator/ec2_pagination.go), so the count of paginator implementations stays at two — the flat one and ec2PageReservations — rather than rising.
  • The published range is applied per operation, not harmonised: 5–1000 at DescribeInternetGateways, DescribeNatGateways and DescribeInstanceTypeOfferings; 5–100 at DescribeRouteTables and DescribeInstanceTypes; 1–200 at DescribeLaunchTemplates; and ec2MinUnpublishedMaxResults with ec2NoMaxResultsCeiling at the three that publish no bound — DescribeInstanceStatus, DescribeSpotPriceHistory and DescribeFleets — per ec2: an invalid block device mapping is accepted instead of refused with InvalidBlockDeviceMapping #671's rule that only what the API model states is modelled. DescribeLaunchTemplates is the only one whose published floor is 1 rather than 5.
  • A MaxResults outside the applicable range is refused with InvalidParameterValue/400 rather than clamped, and a NextToken substrate did not issue is refused, both before any state is read.
  • ec2RefuseIDsWithMaxResults is applied where the operation takes an ID list. DescribeInstanceStatus is the one of the nine whose own page repeats the service-wide rule, so it applies verbatim there; at the others it rests on the Query Requests page's service-wide statement, as it already does at the nine converted operations.
  • An absent MaxResults answers the whole listing with no token element, unchanged from today's behaviour at all nine.
  • A full final page carries no token.
  • docs/services.md records the conversions, and the "roughly twenty" figure in One offset paginator, shared is corrected to the verified nine.
  • Tests are wire-level and walk each listing to exhaustion, comparing the walk element-for-element against the unpaginated answer.

Splitting this by page family rather than doing all nine at once is reasonable — the three with no published bound are one group, the four 5-bounded ones another, and DescribeLaunchTemplates sits alone.

Activity

  1. added this to the v0.119.0 milestone on Sep 17, 2026
  2. added
    type: bug
    priority: medium
    on Sep 17, 2026
  3. scttfrdmn commented on Sep 18, 2026

    @scttfrdmn
    OwnerAuthor

    Verified this issue against main before starting. The nine are the right nine, all nine still read neither parameter, the seven excluded operations are correctly excluded, and every published range in the table reproduces. Four corrections and one finding that makes the work smaller than the issue implies.

    The finding: there is no signature obstacle here, unlike #1025

    All nine handlers already take *AWSRequest:

    Operation Switch arm Handler
    DescribeInstanceStatus ec2_plugin.go:84 ec2_plugin.go:1443
    DescribeInternetGateways :115 :2199
    DescribeRouteTables :125 :2389
    DescribeNatGateways :201 :5633
    DescribeInstanceTypes :209 :5815
    DescribeInstanceTypeOfferings :211 :5901
    DescribeSpotPriceHistory :213 :5991
    DescribeLaunchTemplates :221 :6354
    DescribeFleets :236 ec2_fleet.go:795

    So each conversion is confined to its own handler: no call site changes, nothing to sequence, and the nine are independent of each other. That is the opposite of #1025's shape, where the cost was the signatures and the six had to land two at a time. The suggested split by page family is still the right one, but for review size rather than necessity.

    Two dispatch line numbers have drifted, and one handler is in another file

    DescribeLaunchTemplates dispatches at :221, not :218, and DescribeFleets at :236, not :233. The other seven are exact. The switch runs to :276, not :266 as the audit note says.

    More usefully: describeFleets is not in ec2_plugin.go at all — it is ec2_fleet.go:795. A sweep that greps only the router's file will convert eight and miss one.

    The "roughly twenty" correction is half done, and the remaining half is in the code

    The issue says the figure lands with it. docs/services.md was already corrected under #917's own audit — the sentence at docs/services.md:8596 now reads "audited, rather than the 'roughly twenty' this paragraph used to estimate", and the nine remaining operations are already tabulated there with their verified published ranges (which is where the ranges in this issue's table were confirmed against).

    What survives is ec2_pagination.go:12: "Roughly twenty other describes publish MaxResults and NextToken and implemented neither", in the file comment that exists precisely to state the count once. Correcting that comment — and the "from two to twenty" sentence two lines below it — is what remains of that criterion.

    The test table cannot express these ranges as it stands

    ec2PagedOp (ec2_pagination_test.go:47) carries a published bool column, documented as true when the page publishes "Valid Range: Minimum value of 5. Maximum value of 1000." That was sufficient for #917's nine, where every publishing page published the same pair of numbers. It is not sufficient here: 5–100 appears at two of the nine while a sibling publishes 5–1000, and DescribeLaunchTemplates publishes 1–200 — a floor of 1 rather than 5, the only one in the set. A boolean would force the three ranges to collapse into one, which is exactly the harmonisation the second acceptance criterion forbids.

    So the column becomes a min/max pair, with the unpublished case expressed as ec2MinUnpublishedMaxResults / ec2NoMaxResultsCeiling rather than as published: false. That is a change to the existing nine operations' rows too, so it is worth doing in the first of the split PRs rather than the last.

    Every helper the first acceptance criterion names exists and is unchanged: ec2MaxResults (ec2_pagination.go:94), ec2NextTokenOffset (:126), ec2Page (:159), ec2PageReservations (:189), ec2RefuseIDsWithMaxResults (:244), and the two unpublished-bound constants at :56 and :60.

  4. added a commit that references this issue on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ec2priority: mediumtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions