Skip to content

fix(#1086): ListSchedules refuses a token it could not have issued - #1228

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1086-scheduler-token
Sep 20, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1086-scheduler-token

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

The ninth of #1086's ten sites. EventBridge Scheduler's ListSchedules carried the pre-#915 idiom — base64.StdEncoding.DecodeString then strconv.Atoi, both errors discarded — so a NextToken substrate could not have minted left the offset at zero and the operation answered a well-formed page one. That is the one wrong answer a paginating caller cannot detect: a loop running until the token comes back empty is handed the first page again, so it spins or reprocesses the same schedules, and nothing in the response says so.

The decode is now decodeOffsetPaginationToken, which defines issuability as a round trip through the encoder, and the cut is pageByOffsetToken, which is what the handler had written out by hand.

The code, and where the condition comes from

ValidationException / 400, published in this operation's own Errors section and glossed "The input fails to satisfy the constraints specified by an AWS service." — the page's own vocabulary, not a sibling's, which is what #671's scope decision requires. It is also already this plugin's only refusal for an input that fails a constraint, so the message carries which input failed, in the 1 validation error detected: … shape every other Scheduler refusal renders, with the member spelled nextToken as AWS's own validation messages spell members:

1 validation error detected: Value at 'nextToken' failed to satisfy constraint: Member must be a token returned by a previous ListSchedules request

The footing for the condition is the request parameter's own sentence, not the Errors section. API_ListSchedules describes NextToken as "The token returned by a previous call to retrieve the next set of results." — the page states where a token comes from, so a token no previous call returned is not the thing the parameter is documented to accept. What remains substrate's reading is only that this input problem is the one that gloss covers: the page publishes no code AWS attributes to a pagination token. The published Length of 1–2048 is subsumed by the round trip, and its minimum of 1 is why an empty NextToken is an absent token rather than an invalid one.

The token is decoded above the name-index load, which is #887's criterion. There is no required member on this operation and no schedule to resolve, so unlike the three Scheduler operations that check Name first, nothing competes for precedence. Asserted by sealing the state store against reads: Scheduler's index loader propagates a store failure, so the seal can tell the two orderings apart (Athena needed a counting state for the opposite reason).

This is the only one of the ten sites whose token travels in a query string, so the round-trip half of the test also proves the encoding survives URL encoding — the fixture sends the token through url.Values.Encode, because a raw + in a query string decodes to a space and the test would otherwise be asserting about a string the caller never sent. Fixtures are built through real POST /schedules/<name> calls per #765.

What this does not claim, and what it does not fix

  • It refuses a token this service could not have minted. It does not make a token portable between two listings of different shape: the token carries an offset and nothing else, so one issued for a given ScheduleGroup, NamePrefix or State decodes cleanly against another and indexes into a listing the caller never asked for. Every offset paginator in the tree has that property; recorded because the refusal's name invites the stronger reading.
  • A past-the-end offset still clamps to a final empty page rather than being refused, because a token substrate issued over a listing that has since shrunk is still a token it issued. Asserted, since decodeOffsetPaginationToken accepts it and only pageByOffsetToken decides what it means.
  • The State filter is applied after the page is cut, so a state-filtered request can be answered a page shorter than MaxResults while still carrying a NextToken, where AWS publishes State as a filter on the listing. Left as it was and to be filed separately: fixing it changes which schedules a page contains rather than which tokens are accepted.
  • MaxResults above the published maximum of 100 is clamped, not refused, and zero or below is silently ignored in favor of substrate's own default of 20 (recorded under EventBridge Scheduler ListSchedules reads all five query parameters under names the page does not publish #1226). Refusing an out-of-range page size is its own class.

Boundary

Batch's one shared paginator behind DescribeComputeEnvironments, DescribeJobQueues and DescribeJobDefinitions remains, so this does not resolve #1086. The docs table of remaining sites is narrowed to Batch alone, and the stale claim in the Scheduler row it replaced — that "the only constraint published on the token is Length 1–2048" — is corrected: the page does publish where a token comes from, and that sentence is the footing this refusal stands on.

Verification

Full nine-step gate green locally, including make test, the Go 1.26.6 run, make coverage (86.1% emulator / 85.6% total, above the 85.5/85.0 floor), the docs targets and the Docusaurus build.

EventBridge Scheduler's single pagination site carried the pre-#915 idiom —
DecodeString then Atoi with both errors discarded — so a token substrate could
not have minted left the offset at zero and the operation answered a well-formed
page one. That is the one wrong answer a paginating caller cannot detect.

The decode is now decodeOffsetPaginationToken and the cut is pageByOffsetToken,
which is what the handler had written out by hand. The refusal is
ValidationException/400, published in the operation's own Errors section; the
footing for the condition is the request parameter's own sentence, "The token
returned by a previous call to retrieve the next set of results.", not an Errors
entry. Decoded above the index load per #887, asserted by sealing the store.

Ninth of #1086's ten sites and the only one whose token travels in a query
string. Batch's shared paginator behind three describes remains.
@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 8f887f4 into main Sep 20, 2026
18 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1086-scheduler-token branch September 20, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fifteen offset-token sites still answer page one for a token substrate never issued

1 participant