Skip to content

Six RDS/ElastiCache describes publish Marker and MaxRecords and implement neither #916

Closed

Description

@scttfrdmn

Found while auditing #887's pagination cursors. #887 fixed the cursor basis at the three operations that have one. These six have none at all: they return the whole listing, emit no Marker, and ignore a MaxRecords the caller sent.

This also corrects #887's own body, which said ElastiCache's "four [describes are] all under Marker/MaxRecords cursors". Only describeCacheClusters is.

Sites

Operation Site
RDS DescribeDBSnapshots emulator/rds_plugin.go:775
RDS DescribeDBSubnetGroups emulator/rds_plugin.go:897
RDS DescribeDBParameterGroups emulator/rds_plugin.go:996
ElastiCache DescribeReplicationGroups emulator/elasticache_plugin.go:363
ElastiCache DescribeCacheSubnetGroups emulator/elasticache_plugin.go:543
ElastiCache DescribeCacheParameterGroups emulator/elasticache_plugin.go:642

Every one of them publishes Marker and MaxRecords on its AWS page, with the same wording the three fixed operations carry: "the response includes only records beyond the marker, up to the value specified by MaxRecords", Default: 100, Constraints: minimum 20; maximum 100.

Why it matters

Two distinct consumer failures, and the second is the reason this is a defect rather than a gap.

  1. A MaxRecords a caller sends is ignored, so a test written against substrate never exercises its own paging loop — the first page is always the whole listing. The loop is dead code that has never run, and the first time it runs is against real AWS.
  2. A Marker a caller sends is ignored and the full listing is returned again. A consumer that pages defensively — request, take the Marker, request again while it is non-empty — terminates immediately here because no Marker comes back, which is benign. But a consumer that passes a marker it obtained elsewhere, or that asserts a marker appears when the set exceeds a page, sees no signal at all that pagination is unimplemented rather than unnecessary.

The half-implemented state is the worst of the three possible states: implemented, absent-and-refused, or silently ignored. Substrate is in the third.

Approach

#887 put the whole contract in emulator/query_marker_pagination.go — parseQueryMarker, queryMaxRecords, queryMarkerPage — precisely so the next site is a small change. Each of these six becomes:

cursor, cursorErr := parseQueryMarker(req.Params["Marker"])
if cursorErr != nil {
	return nil, cursorErr
}
prefix := "<kind>:" + scope + "/"
keys, err := p.state.List(goCtx, ns, prefix)
...
page, nextMarker := queryMarkerPage(keys, prefix, cursor, queryMaxRecords(req.Params["MaxRecords"]),
	func(key, id string) (item, bool) { ... })

so the six inherit the key-valued cursor, the base64 refusal of a marker substrate did not issue, and the truncate-on-next-matching-record rule, rather than each re-deriving them.

Two things to settle per operation while doing it, since they are not uniform:

  • The identifier the marker names. For a snapshot it is the snapshot identifier; for a subnet or parameter group, the group name. It must be the value the listing is keyed and sorted by, or the cursor is not well defined — which is the same trap Audit the remaining ~60 List call sites for an AWS-documented order that differs from lexicographic #887 fixed.
  • Whether the NotFound fault still fires. describeDBInstances checks len(page) == 0 against a filter identifier after paging. Any of these six with a single-resource filter parameter needs the same ordering, or a filtered request landing on page two would answer NotFound for a record that exists.

Acceptance criteria

Found while working on #887.

Activity

  1. added this to the v0.118.0 milestone on Sep 16, 2026
  2. added
    type: bug
    on Sep 16, 2026
  3. scttfrdmn commented on Sep 17, 2026

    @scttfrdmn
    OwnerAuthor

    Two corrections to this issue's own body before the work starts, both verified from the six pages rather
    than from the issue text, and one note on what #913 changed for the last criterion.

    1. The InvalidParameterValue provenance in AC 2 is wrong for one of the two pages it names

    AC 2 says the code is published for ElastiCache, citing API_DescribeReplicationGroups and
    API_DescribeCacheSubnetGroups
    . The second is not true. API_DescribeCacheSubnetGroups' Errors
    section, read in full, publishes exactly one fault:

    CacheSubnetGroupNotFoundFault — The requested cache subnet group name does not refer to an existing
    cache subnet group. HTTP Status Code: 400

    No InvalidParameterValue, and no InvalidParameterCombination. The split across the six is therefore
    two published, four substrate's reading, not "ElastiCache published, RDS unverified":

    Operation InvalidParameterValue Published errors
    ElastiCache DescribeReplicationGroups published, 400 InvalidParameterCombination/400, InvalidParameterValue/400, ReplicationGroupNotFoundFault/404
    ElastiCache DescribeCacheParameterGroups published, 400 CacheParameterGroupNotFound/404, InvalidParameterCombination/400, InvalidParameterValue/400
    ElastiCache DescribeCacheSubnetGroups absent CacheSubnetGroupNotFoundFault/400 only
    RDS DescribeDBSnapshots absent DBSnapshotNotFound/404 only
    RDS DescribeDBSubnetGroups absent DBSubnetGroupNotFoundFault/404 only
    RDS DescribeDBParameterGroups absent DBParameterGroupNotFound/404 only

    The conclusion does not change — one code still serves all six, so the cursor cannot be refused
    differently at different operations — but the provenance line in docs/services.md has to say four
    of the six are substrate's reading, and it cannot lean on the family boundary to decide which.

    2. The MaxRecords constraint wording is not identical across the six

    The body quotes Constraints: minimum 20; maximum 100 for all six. The three RDS pages publish it with
    different capitalisation and punctuation — Constraints: Minimum 20, maximum 100. — and the three
    ElastiCache pages publish Constraints: minimum 20; maximum 100. The numbers and the Default: 100 are
    identical everywhere, which is what matters, but a doc comment quoting one form for all six would be
    misquoting three pages.

    Also verified: all six publish a Marker request parameter with no Length Constraints and no
    Pattern, and all six publish a Marker response element. The two families word the response element
    differently — RDS repeats the request description, ElastiCache says only "Provides an identifier to allow
    retrieval of paginated results."
    — which is another statement of the same contract, not a different one.

    3. AC 7 is discharged by #913, and the approach snippet is now stale

    #913 has landed, so queryMaxRecords no longer coerces: it refuses a MaxRecords outside 20–100, and a
    non-integer, with InvalidParameterValue/400. These six therefore inherit the range check, not the
    permissiveness AC 7 hedges against, and the two issues cannot disagree.

    That changes the signature the approach section shows. It is no longer

    page, nextMarker := queryMarkerPage(keys, prefix, cursor, queryMaxRecords(req.Params["MaxRecords"]), ...)

    because queryMaxRecords now returns (int, *AWSError). Each of the six validates both parameters
    together, above the state read, as the three fixed operations now do:

    cursor, cursorErr := parseQueryMarker(req.Params["Marker"])
    if cursorErr != nil {
    	return nil, cursorErr
    }
    maxRecords, maxErr := queryMaxRecords(req.Params["MaxRecords"])
    if maxErr != nil {
    	return nil, maxErr
    }

    One consequence for AC 4's tests: a listing "larger than the page size" now means more than twenty
    records
    , because twenty is the smallest page AWS accepts. #913 recorded eleven existing request sites
    that paged at MaxRecords=2 for exactly this reason; the new tests here must not add a twelfth.

    4. Single-resource filter parameters, for AC 5

    Every one of the six has one, so AC 5 applies at all six rather than at some: DBSnapshotIdentifier,
    DBSubnetGroupName, DBParameterGroupName, ReplicationGroupId, CacheSubnetGroupName,
    CacheParameterGroupName. DescribeDBSnapshots additionally publishes DBInstanceIdentifier,
    DbiResourceId, SnapshotType, IncludePublic, IncludeShared and Filters.Filter.N (valid names
    db-instance-id, db-snapshot-id, dbi-resource-id, snapshot-type, engine) — so it is the one of
    the six where "filter, then page" has more than one filter to order against, and the ordering trap this
    issue names for the NotFound fault is correspondingly easier to get wrong there.

    Both RDS group describes publish Filters.Filter.N as "Not currently supported", which is worth
    recording: it is a parameter AWS declares and refuses to honour, so substrate ignoring it matches the
    page rather than diverging from it.

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

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions