Files
floci/compatibility-tests/sdk-test-java/src
floverfelt 846e78db12 feat(cloudwatch): Adds support for orderBy, pagination, limit in DescribeLogStreams response (#2362)
* feat(cloudwatch): support orderBy, descending, limit and nextToken in DescribeLogStreams

DescribeLogStreams previously ignored orderBy, descending, limit and
nextToken: it always returned every stream in the group sorted
ascending by name, so the common SDK idiom for locating the most
recently active stream (orderBy LastEventTime, descending, limit 1)
silently returned the alphabetically-first stream instead.

Sort by lastEventTimestamp when orderBy=LastEventTime (streams without
events sort oldest, name as tie-break), honor descending, and page with
the same integer-offset nextToken idiom DescribeSubscriptionFilters
uses (limit capped at 50, defaulting to 50). Reject the
LastEventTime + logStreamNamePrefix combination and unknown orderBy
values with InvalidParameterException, matching real AWS.

* test(compat): cover DescribeLogStreams ordering, limit and pagination via the Java SDK

Exercises the new orderBy/descending/limit/nextToken support over the
real wire protocol (AWS SDK for Java 2.52.0): orderBy LastEventTime
descending with limit 1 returns the most recently active stream, the
SDK paginator walks every stream exactly once and terminates, and
LastEventTime combined with logStreamNamePrefix is rejected with
InvalidParameterException as on real AWS.

* fix(cloudwatch): make DescribeLogStreams nextToken a stable cursor and reject malformed tokens

Review feedback on the integer-offset token: a non-numeric nextToken was
silently reset to zero, re-serving the first page and making custom
pagination loops duplicate results or stall; and a positional offset
applied to a freshly scanned collection skipped or repeated streams
whenever creates, deletes, or PutLogEvents reordering shifted positions
between page requests.

The token now encodes the sort key of the last returned stream
(base64 of order, direction, lastEventTimestamp, name) and resumption
takes the first stream strictly after that key in the effective
ordering, so mutations between pages cannot shift the resume point.
Malformed tokens and tokens replayed against a different
orderBy/descending combination throw InvalidParameterException.

* fix(cloudwatch): paginate DescribeLogStreams over a snapshot so reordered streams are never skipped

Review feedback on the sort-key cursor: when an unreturned stream
receives a newer event between descending LastEventTime pages, the next
request sorts it ahead of the saved cursor and skips it, so the
paginator terminates without ever returning the stream. No stateless
token can survive that reordering, so the token now references a
server-side snapshot of the sorted stream names taken when the first
page is served, plus a position in it.

Later pages walk the frozen ordering and re-read each stream live:
streams deleted since the snapshot are dropped and attributes are
current, so every stream that existed when pagination started is
returned exactly once regardless of interleaved creates, deletes or
PutLogEvents. Snapshots are TTL-evicted after 15 minutes; unknown,
expired or malformed tokens, and tokens replayed against a different
group, prefix or ordering, throw InvalidParameterException.
2026-08-18 09:28:19 -04:00
..