Skip to content

UTS: assert authorize() supersedes stored authOptions (key not preserved) - #541

Open
owenpearson wants to merge 2 commits into
fix/uts-spec-point-referencesfrom
fix/uts-authorize-key-superseded
Open

owenpearson wants to merge 2 commits into
fix/uts-spec-point-referencesfrom
fix/uts-authorize-key-superseded

Conversation

@owenpearson

@owenpearson owenpearson commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Ruling

Closes #531. Rules in favour of Reading 2 — the key is superseded. Per the plain reading of RSA8e and RSA10j, passing an AuthOptions argument to authorize() supersedes the stored AuthOptions in their entirety (AuthOptions#key included), so a key configured on the constructor is discarded when the argument omits one. This is what both ably-python and ably-js already do, so no features.md change and no SDK change are required.

What the section used to claim vs what it now asserts

The section RSA10i - authorize() preserves key from constructor (rest/unit/RSA10i/authorize-preserves-key-0) asserted, in prose, that the constructor key is preserved across an authOptions argument — a behaviour features.md does not state (features.md:262 RSA10i is merely a pointer into RSA8, not a preservation rule). Its assertions block was three comments with no ASSERT, i.e. silently zero coverage.

It is now retitled RSA10j - authorize() authOptions argument supersedes stored key, with Test ID rest/unit/RSA10j/authorize-supersedes-authoptions-key-0, and asserts the specified superseding behaviour: after authorize(authOptions: AuthOptions(authUrl: ...)) with no key, the constructor key is gone; a further authorize(authOptions: AuthOptions()) — leaving no key, authUrl or authCallback — fails with 40101 / statusCode 401 ("No key specified"), as raised by ably-js in this situation.

Test ID renumbering

With the preserves-key test moved to RSA10j, the error-propagation test that #539 files as rest/unit/RSA10i/authorize-error-propagated-1 is the only RSA10i test left in the file. This PR renumbers it to rest/unit/RSA10i/authorize-error-propagated-0, and adds RSA10j to the file's spec points and to the RSA10 row of uts/docs/completion-status.md.

Old to new, for SDK repos (on top of #539's table):

Old New
rest/unit/RSA10i/authorize-preserves-key-0 rest/unit/RSA10j/authorize-supersedes-authoptions-key-0
rest/unit/RSA10i/authorize-error-propagated-1 (from #539) rest/unit/RSA10i/authorize-error-propagated-0

Merge order

Stacked on #539: this PR's base is fix/uts-spec-point-references. Merge #539 first; GitHub then retargets this PR to main. It also shares uts/rest/unit/auth/authorize.md with #534, so rebase after that merges if it conflicts.

🤖 Generated with Claude Code

owenpearson added a commit that referenced this pull request Nov 27, 2026
Test IDs are copied into derived tests in several SDKs, so a rename has a
downstream cost. Keep the renames where the old id names a different
requirement, and revert those where the old id is coarse but not wrong:
the type-level ids TD1, TK1 and TE1, and the parent-family ids TI and
RSL1k. Their section headings keep the more specific spec point.

File the authOptions test under RSA10e rather than RSA10j. It asserts that
an authCallback in the authOptions argument is used to obtain the token,
which is RSA10e's text, and it avoids a second RSA10j/...-0 id once #541
lands. RSA10j is no longer tested in this file, so it leaves the spec
points list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owenpearson and others added 2 commits November 27, 2026 13:35
Per RSA8e/RSA10j a provided AuthOptions replaces the stored options wholesale, so a
constructor key does not survive an authOptions argument that omits one. Replaces the
empty (comment-only) assertions block with concrete assertions that a subsequent
key-requiring operation fails with 40101, and retitles the mislabelled RSA10i section.

Closes #531

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
With the preserves-key test moved to RSA10j, the error-propagation test
is the only RSA10i test in the file, so it takes index 0. RSA10j joins
the file's spec points and the completion matrix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@owenpearson
owenpearson force-pushed the fix/uts-authorize-key-superseded branch from e258fd1 to e5bb584 Compare November 27, 2026 13:38
@owenpearson
owenpearson changed the base branch from main to fix/uts-spec-point-references November 27, 2026 13:38

This branch was successfully deployed

1 active deployment
staging/pull/541 — e5bb5845 Deployed Nov 27, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant