Skip to content

kinesis: ListTagsForStream publishes Limit and ExclusiveStartTagKey, implements neither, and answers HasMoreTags: false unconditionally #954

Closed

Description

@scttfrdmn

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, ListTagsForStream gets all tags that occur after ExclusiveStartTagKey." 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, HasMoreTags is set to true. To list additional tags, set ExclusiveStartTagKey to 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 to true, more tags are available. To request additional tags, set ExclusiveStartTagKey to the key of the last tag returned." Type: Boolean.

Tags — "A list of tags associated with StreamName, starting with the first tag after ExclusiveStartTagKey and up to the specified Limit." 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

  1. Limit is 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").
  2. ExclusiveStartTagKey is not read, so there is no second page to fetch even if a caller has a key to fetch it from.
  3. HasMoreTags is hardcoded false. It must be true exactly when Limit truncated the set, which is the condition AWS states under Limit.
  4. The Tags array's published maximum is 200 items while Limit's maximum is 50 — worth recording, since it means a full page is not the whole set even at the maximum Limit.

Acceptance criteria

  • Limit is read, defaults to returning everything, and a value outside 1–50 answers InvalidArgumentException/400.
  • ExclusiveStartTagKey is read and the response begins with the first tag whose key sorts strictly after it, per "gets all tags that occur after ExclusiveStartTagKey".
  • HasMoreTags is true exactly when tags were withheld, and false otherwise.
  • A test writes at least six tags and walks them at Limit: 2 over the wire, asserting every tag is reported exactly once with no repeat and no omission, and that the final page reports HasMoreTags: false — the cursor-correctness case, which a single-page assertion cannot make.
  • A test asserts a Limit of 0 and of 51 are refused.
  • docs/services.md records the walk order as substrate's reading (AWS names no order; its own sample response is unsorted) and CHANGELOG.md notes the compatibility change: a caller that received every tag regardless of Limit now receives at most Limit.

Provenance

Every quotation is verbatim from API_ListTagsForStream, fetched while fixing #946. The absence of Limit/ExclusiveStartTagKey handling is read from the tree.

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