UTS: align token-expiry tests with RSA4a2/RSA4b (local detection is optional) - #540
Open
owenpearson wants to merge 1 commit into
Open
owenpearson wants to merge 1 commit into
owenpearson wants to merge 1 commit into
Conversation
Local token-expiry detection (RSA4b1) is optional and offset-gated, so tests must not require it. Rewrites expired-token-no-renewal to reach 40171 via a server token error (RSA4a2), retargets the pre-emptive-renewal test at RSA4b (renewal on 401), and adds a queryTime-gated RSA4b1 test for the optional pre-emptive path. Closes #529 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ruling: option (a) — fix the tests, not the spec
Issue #529 documents two REST unit tests that require the client to detect token expiry locally before issuing a request. Per
features.md, RSA4b1 licenses this only as an option, and only when a server-time offset has been persisted (RSA10k). A spec-compliant client that declines the option fails both tests.The normative ruling recorded on the issue is option (a): loosen the tests so they do not require local detection. No
features.mdchange and no SDK change is required.What changed
uts/rest/unit/auth/auth_scheme.md—rest/unit/RSA4a2/expired-token-no-renewal-0401with an Ably token-error body (code: 40142) instead of200, so the client reaches40171via RSA4a2 (server token error + no means of renewal).ASSERT captured_requests.length == 0— with a real 401 the client legitimately makes a request. KeptASSERT error.code == 40171.uts/rest/unit/auth/token_renewal.md— retargetedRSA4b1/preemptive-renewal-0→RSA4b/renewal-on-token-error-0401token error and the retry with the renewed token gets200.rest/unit/RSA4b/renewal-on-token-error-0, since it now tests RSA4b (renewal on server 401), not RSA4b1's optional pre-emptive path.callback_count == 2and a successfulBearer fresh-tokenhistory request hold via RSA4b.uts/rest/unit/auth/token_renewal.md— newRSA4b1/preemptive-renewal-with-offset-0queryTime: true, stubs/time(returns an array[server_time_ms]per protocol) so the client persists a server-time offset per RSA10k, then asserts the client renews pre-emptively — callback called twice, one history request withBearer fresh-token, and the expired token never reaching the API.Notes
features.mdor SDK change required.uts/rest/unit/auth/token_renewal.mdwith the already-open PR UTS: drive the RSA4b renewal test off a normal request instead of /time #533 (RSA4b renewal-msgpack). Rebase this branch after UTS: drive the RSA4b renewal test off a normal request instead of /time #533 merges.Closes #529
🤖 Generated with Claude Code