Repository navigation
Description
Summary
ListTagsForStream publishes a cursor over the tag key and substrate implements neither half of it: Limit and ExclusiveStartTagKey are decoded by nothing, and HasMoreTags is the literal false on every call. A consumer paging a stream's tags gets one page and a false that says there is nothing more, whatever the truth.
Substrate's handler (emulator/kinesis_plugin.go:~700) decodes only StreamName, flattens the tag map and answers {"Tags": [...], "HasMoreTags": false}.
What AWS publishes
API_ListTagsForStream, verbatim.
Request parameters:
ExclusiveStartTagKey— "The key to use as the starting point for the list of tags. If this parameter is set,ListTagsForStreamgets all tags that occur afterExclusiveStartTagKey." Type: String. Length Constraints: Minimum length of 1. Maximum length of 128. Required: No.
Limit— "The number of tags to return. If this number is less than the total number of tags associated with the stream,HasMoreTagsis set totrue. To list additional tags, setExclusiveStartTagKeyto the last key in the response." Type: Integer. Valid Range: Minimum value of 1. Maximum value of 50. Required: No.
Response elements:
HasMoreTags— "If set totrue, more tags are available. To request additional tags, setExclusiveStartTagKeyto the key of the last tag returned." Type: Boolean.
Tags— "A list of tags associated withStreamName, starting with the first tag afterExclusiveStartTagKeyand up to the specifiedLimit." Type: Array of Tag objects. Array Members: Minimum number of 0 items. Maximum number of 200 items.
Also note StreamARN is a published alternative to StreamName ("you must use either the StreamARN or the StreamName parameter, or both"), which substrate does not accept on this operation — named for completeness, and not in scope here.
Why this is not the same issue as #946
#946 sorted the five tag-read sites that flattened a map into a list, this one included, so the order is now stable. That is the prerequisite for a cursor and not a substitute for one: ExclusiveStartTagKey says a tag "occurs after" a key, which is only meaningful over a stable order — a cursor over Go's map order can skip a tag or return it twice, which is the argument #865 made for MemoryStateManager.List and #915 made for a token substrate never issued.
This is the tag-cursor member of the pagination cluster (#913, #915, #916, #917): a parameter published, decoded by nothing, and a truthful-looking false in the response that a caller's paging loop reads as "done".
What is missing
Limitis not read, so every call returns every tag. AWS caps it at 50 and refuses outside 1–50 (InvalidArgumentException/400 — "A specified parameter exceeds its restrictions, is not supported, or can't be used").ExclusiveStartTagKeyis not read, so there is no second page to fetch even if a caller has a key to fetch it from.HasMoreTagsis hardcodedfalse. It must betrueexactly whenLimittruncated the set, which is the condition AWS states underLimit.- The
Tagsarray's published maximum is 200 items whileLimit's maximum is 50 — worth recording, since it means a full page is not the whole set even at the maximumLimit.
Acceptance criteria
-
Limitis read, defaults to returning everything, and a value outside 1–50 answersInvalidArgumentException/400. -
ExclusiveStartTagKeyis read and the response begins with the first tag whose key sorts strictly after it, per "gets all tags that occur afterExclusiveStartTagKey". -
HasMoreTagsistrueexactly when tags were withheld, andfalseotherwise. - A test writes at least six tags and walks them at
Limit: 2over the wire, asserting every tag is reported exactly once with no repeat and no omission, and that the final page reportsHasMoreTags: false— the cursor-correctness case, which a single-page assertion cannot make. - A test asserts a
Limitof 0 and of 51 are refused. -
docs/services.mdrecords the walk order as substrate's reading (AWS names no order; its own sample response is unsorted) andCHANGELOG.mdnotes the compatibility change: a caller that received every tag regardless ofLimitnow receives at mostLimit.
Provenance
Every quotation is verbatim from API_ListTagsForStream, fetched while fixing #946. The absence of Limit/ExclusiveStartTagKey handling is read from the tree.
Activity
fix(tagging): five tag-read operations emit tags sorted by key (#946) (…
fix(kinesis): a stream can be named by its ARN (#966) (#998)
fix(kinesis): enforce both published tag limits on AddTagsToStream (#965