Files
floci/src/main/java/io/github
Feyikemi Ogunsanya 6c4d63b0a9 fix(s3vectors): route ListVectors instead of falling through to S3 (#2285)
* fix(s3vectors): add listVectors service method with cursor pagination

ListVectors had no backing service method. Add one modeled on
listCertificates' cursor-based pagination (base64 JSON cursor over the
last returned key), sorted by vector key for stable ordering across
pages.

* fix(s3vectors): route ListVectors instead of falling through to S3

S3VectorsController declared routes for twelve S3 Vectors operations
but not ListVectors, so requests fell through to the S3 REST-XML
controller and came back as a misleading S3 InvalidArgument XML error
instead of a ListVectors response.

Add the route, request/response records (modeled on GetVectors'
returnData/returnMetadata shape), and wire it to the new
S3VectorsService.listVectors.

Fixes #2161

* test(s3vectors): add regression tests for ListVectors

Reproduces #2161: before the route existed, ListVectors fell through
to the S3 controller and returned an XML InvalidArgument error instead
of a JSON ListVectors response. Covers the basic list (with
returnData/returnMetadata) and cursor pagination via maxResults +
nextToken across two pages.

* fix(s3vectors): resolve ListVectors by indexArn and fix cursor encoding

Two issues flagged in review on #2285:

- listVectors ignored indexArn and passed it through as an unused
  request field, so an ARN-only ListVectors call (a form the input
  contract explicitly allows) resolved a null bucket name and 404'd.
  Add resolveIndex to parse "<bucketArn>/index/<indexName>" and fall
  back to it when indexName is absent.
- encodeToken/decodeToken hand-built a JSON string around the cursor
  key without escaping, so a vector key containing a double quote
  truncated the cursor and repeated or skipped pages. Drop the JSON
  wrapping entirely — the cursor only ever holds one opaque value, so
  base64-encoding the raw key round-trips any key correctly.

* fix(s3vectors): pass indexArn through to listVectors

Wire ListVectorsRequest.indexArn() into the new
S3VectorsService.listVectors(bucketName, indexName, indexArn, ...)
signature so ARN-only requests actually resolve the index instead of
being silently dropped.

* test(s3vectors): add regression tests for indexArn and quoted keys

Reproduces both issues flagged in review on #2285: confirmed
listVectorsByIndexArnOnly failed with 404 and
listVectorsPaginationRoundTripsKeysWithQuotes returned the wrong page
against the prior code, before the resolveIndex and cursor-encoding
fixes.

* fix(s3vectors): resolve indexArn using its own region, not the request's

Flagged in review on #2285: resolveIndex parsed the bucket/index names
out of indexArn with manual substring slicing but discarded the ARN's
region entirely, doing the lookup in whatever region the ListVectors
request itself was signed for. A valid cross-region indexArn (or any
request not signed for the same region as the index) silently 404'd or
could resolve a same-named index in the wrong region.

Use AwsArnUtils.parse instead of manual slicing, validate the ARN is
an s3vectors ARN, and look up the index in the region encoded in the
ARN itself.

* test(s3vectors): add regression test for cross-region indexArn lookup

Reproduces the issue flagged in review on #2285: confirmed this test
failed with 404 against the prior region-ignoring resolveIndex, using
an index created under a us-west-2 credential scope and a ListVectors
request with no Authorization header (default region).
2026-08-15 19:09:13 -04:00
..