Repository navigation
fix(rds,elasticache): six describes published a cursor and implemented none of it (#916) - #1021
Merged
Merged
Conversation
…d none of it (#916) RDS DescribeDBSnapshots, DescribeDBSubnetGroups and DescribeDBParameterGroups, and ElastiCache DescribeReplicationGroups, DescribeCacheSubnetGroups and DescribeCacheParameterGroups each publish Marker and MaxRecords and honoured neither: every request answered the whole listing, emitted no Marker, and discarded the page size the caller asked for. Of the three states a published parameter can be in — implemented, absent and refused, or accepted and ignored — that is the worst, because a consumer's paging loop terminates on the first response here and so first executes against real AWS, and a Marker from anywhere else restarted the listing instead of being refused. All six now page through parseQueryMarker, queryMaxRecords and queryMarkerPage, so nine operations share one cursor and cannot diverge on its semantics. Both parameters are validated before any state is read. The refusal code is published for three of the nine and is substrate's reading for six, and the split is not the family boundary — which reverses this issue's own acceptance criteria, corrected on the record before the work. API_DescribeCacheSubnetGroups is ElastiCache and publishes CacheSubnetGroupNotFoundFault/400 alone, so each page's status is now stated individually rather than by family. The filter-plus-page ordering trap is closed by construction: the filter runs inside queryMarkerPage's record callback and a non-matching record consumes no page slot, so a single-resource filter always lands on page one however late its record sorts. A test asserts it at all six anyway, so a refactor that hoists a filter out of the callback fails rather than starts answering NotFound for records that exist. The six are asserted through one depth-based XML decoder rather than six near-identical structs, and no new test pages at MaxRecords=2 — the page size #913 recorded eleven pre-existing sites for. Five of the six publish a NotFound fault their handler does not answer; that is #1020.
Codecov Report❌ Patch coverage is
📢 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.
Closes #916.
Six describes publish
MarkerandMaxRecordsand honoured neither. Each answered its entirelisting, emitted no
Marker, and discarded the page size the caller asked for:DescribeDBSnapshots,DescribeDBSubnetGroups,DescribeDBParameterGroupsDescribeReplicationGroups,DescribeCacheSubnetGroups,DescribeCacheParameterGroupsOf the three states a published parameter can be in — implemented, absent and refused, or accepted
and ignored — this is the worst, and it is the one all six were in. A consumer's paging loop
terminates on the first response here, so the loop is dead code whose first real execution is
against AWS over a listing long enough to page; and with nothing decoding the parameter, a
Markerpersisted across a restart or copied from another operation was answered with the whole listing
again rather than refused.
All six now page through the same three helpers as the three operations #887 fixed —
parseQueryMarker,queryMaxRecordsandqueryMarkerPage— so nine operations share onecursor and cannot diverge on its semantics by construction rather than by nine sites agreeing.
A
Markersubstrate did not issue is refused, a full last page carries noMarker, #913's 20–100range applies here too, and both parameters are validated before any state is read.
Provenance — and a correction to #916's own acceptance criteria
AC 2 said the refusal code is published for ElastiCache and is substrate's reading for RDS,
naming
API_DescribeReplicationGroupsandAPI_DescribeCacheSubnetGroups. The second half isfalse, and the family boundary is not the rule. Read from the pages:
InvalidParameterValue/ 400API_DescribeCacheClustersInvalidParameterValueandInvalidParameterCombinationAPI_DescribeReplicationGroupsReplicationGroupNotFoundFault/404,InvalidParameterValue/400,InvalidParameterCombination/400API_DescribeCacheParameterGroupsCacheParameterGroupNotFound/404,InvalidParameterValue/400,InvalidParameterCombination/400API_DescribeCacheSubnetGroupsCacheSubnetGroupNotFoundFault/400 onlyAPI_DescribeDBInstancesDBInstanceNotFound/404 onlyAPI_DescribeDBClustersAPI_DescribeDBSnapshotsDBSnapshotNotFound/404 onlyAPI_DescribeDBSubnetGroupsDBSubnetGroupNotFoundFault/404 onlyAPI_DescribeDBParameterGroupsDBParameterGroupNotFound/404 onlyThree of nine published, six substrate's reading, and
API_DescribeCacheSubnetGroupsis whyit has to be stated per page: it is an ElastiCache page that does not publish the code. Recorded in
docs/services.md, in both helpers' doc comments, and in the CHANGELOG. This wascommented on the issue
before the work started rather than being reversed silently in a diff.
The
MaxRecordsrange is published identically on all nine, though not in identical words: the RDSpages write
Constraints: Minimum 20, maximum 100.and the ElastiCache pagesConstraints: minimum 20; maximum 100.The numbers are what one shared range depends on.The filter-plus-page ordering trap is closed by construction, and asserted anyway
Every one of the six publishes a single-resource filter parameter. A filter applied after a page
is cut would answer an empty page — or a NotFound fault — for a record that exists and merely sorts
late. It cannot happen here: the filter runs inside
queryMarkerPage's record callback and anon-matching record consumes no page slot, so a filtered listing is one record long however deep
into the unfiltered listing the record sits.
DescribeReplicationGroupsis the one of the six thatanswers a NotFound fault today, and its fault is therefore decided on a page that cannot be empty
for a group that exists. A test filters for a record sorting past position twenty at all six, so a
later refactor that hoists a filter out of the callback fails rather than quietly starts answering
NotFound for records that exist.
Tests
emulator/query_marker_six_describes_test.godrives all six over the wire through their own createcalls, using one depth-based XML decoder rather than six near-identical structs. All six
responses nest as
Response > Result > Wrapper > Item > Identifier, so an identifier is at depthfive and the result's own
Markerat depth three; matching on the element name alone would be aweaker assertion than the structs it replaces, since a record rendered into the wrong wrapper would
still be picked up.
Per operation: a listing inside one page (no
Marker), a listing of 21 paged at 20 (every recordexactly once, the
Markerpinned to the last record of the page rather than an offset), a 40-recordlisting whose full last page carries no
Marker, an unissuedMarkerrefused against an emptylisting so it is a parameter check rather than a data-dependent one, #913's
MaxRecordsrefusalcases, and the filter-past-page-one case. Plus a table-driven guard that a NotFound fault still
fires for a resource that does not exist over a listing long enough to page — which covers
DescribeReplicationGroupstoday and picks up the other five as #1020 gives them one, rather thanneeding a test written per operation.
No test in the new file pages at
MaxRecords=2, the page size #913 recorded eleven pre-existingsites for: the small cases fit inside the documented minimum of twenty and the paging cases create
21, 25 or 40 records.
Out of scope, on the record
Five of the six publish a NotFound fault their handler does not answer — a filtered request naming a
resource that does not exist gets an empty
200instead ofDBSnapshotNotFound/404,DBSubnetGroupNotFoundFault/404,DBParameterGroupNotFound/404,CacheSubnetGroupNotFoundFault/400 orCacheParameterGroupNotFound/404. That is a defect abouta request's result rather than about how a listing is cut into pages, and it is filed as #1020 for
the reason #887 kept
MaxRecordsout of its own diff.docs/services.md's hand-written ElastiCache operation table was also missing eight implementedoperations, including both group describes this change paginates; the rows are added in the same
pass.
Verification
The nine-command gate, all green, with coverage held at or above the 84.9% emulator / 84.4% total
baseline.