Skip to content

UTS: repair broken rest/unit fixtures - #536

Open
owenpearson wants to merge 5 commits into
mainfrom
fix/uts-broken-fixtures
Open

owenpearson wants to merge 5 commits into
mainfrom
fix/uts-broken-fixtures

Conversation

@owenpearson

@owenpearson owenpearson commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Fixes the broken fixtures in uts/rest/unit reported in #528. The stats fixture is left to #508 (see below).

Fixes that made tests unsatisfiable

1. presence/rest_presence.md: truncated cipher fixture (RSP5/decode-cipher-channel-7)
The old ciphertext HO4cYSP8LybPYBPZPHQOtuD53yrD3YV3NBoTEYBh4U0= decodes to 32 bytes (16-byte IV + a single AES-CBC block), one block short of any 17-byte-plus PKCS#7-padded plaintext, so it can never decrypt and unpad cleanly. Replaced with the full 48-byte interop ciphertext from ably-common test-resources/crypto-data-128.json (line 41), corrected the comment to {"example":{"json":"Object"}}, and asserted the decrypted value instead of only its type.

#507 fixes the same fixture, so this hunk is now byte-identical to #507's and the two merge cleanly in either order.

Validation: with the fixture's own key WUP6u0K7MXI5Zeo0VppPwg==, the new ciphertext is 48 bytes, its first 16 bytes equal the crypto-data-128.json iv, and AES-128-CBC decrypt + PKCS#7 unpad yields {"example":{"json":"Object"}} (pad byte 0x03).

Fixes to RSL6b tests

2. encoding/message_encoding.md: RSL6b/unrecognized-encoding-preserved-0
The payload encrypted-data-here is replaced with ZW5jcnlwdGVkLWRhdGEtaGVyZQ== (standard, padded base64 of encrypted-data-here), and the assertion now checks the decoded bytes. #528 called the old payload undecodable for any SDK. That was too strong: it is valid unpadded base64url. But it relies on the decoder accepting the URL-safe alphabet without padding, so a standard padded payload is the safer fixture.

3. encoding/message_encoding.md: new RSL6b/no-cipher-delivers-encrypted-1
Covers RSL6b's own worked example. A message with encoding utf-8/cipher+aes-128-cbc/base64 (item 0 of crypto-data-128.json) is received on a channel with no cipher. The test asserts that the message is delivered with the base64 decoded, the payload still encrypted (binary), encoding == "utf-8/cipher+aes-128-cbc", and an error logged.

An earlier revision of this PR tested the invalid-base64 branch with an @@@invalid@@@ payload. That test fails on ably-js on Node, whose base64 decoder never fails. Whether RSL6b requires strict base64 validation is a question for the spec owners, so this PR no longer takes a position on it and tests the worked example instead.

Stale fixtures (tests already passed)

4. types/options_types.md: pre-REC1 hostnames

  • TO/endpoint-affects-host-0: the "Expected Rest Host" table now uses the REC1a/REC1b4 forms: main.realtime.ably.net, test.realtime.ably.net, custom-env.realtime.ably.net.
  • TO3/client-options-attributes-0: the restHost default is now "main.realtime.ably.net" (the ClientOptions IDL default for TO3k2, the REC1a primary domain), not "rest.ably.io".

5. stats.md: left to #508
#508 replaces the pre-2.1 RSC6a/returns-paginated-stats-0 fixture with the TS12r entries shape. Its change is a superset of what this PR had. This PR no longer touches stats.md, so the two PRs don't conflict. With this PR alone, #528's stats item is not fixed; #508 fixes it.

Files changed

  • uts/rest/unit/presence/rest_presence.md
  • uts/rest/unit/encoding/message_encoding.md
  • uts/rest/unit/types/options_types.md

No specifications/ change required.

Merge order

PR 4 of 7. Merge after the publish-body PR (shares encoding/message_encoding.md) and coordinate with the presence PR (shares presence/rest_presence.md). Merges cleanly with #507 and #508 in any order (checked locally against current main).

Part of #528. #528 can be closed once this PR and #508 are both merged.

🤖 Generated with Claude Code

Replaces a truncated (unsatisfiable) cipher fixture and an invalid-length base64
fixture with valid ones, and refreshes a stale stats fixture and pre-REC1 hostnames.

Closes #528

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
owenpearson and others added 4 commits November 27, 2026 13:14
The invalid-base64-preserved-1 test asserted that an '@@@invalid@@@'
payload is detected as invalid base64. Whether RSL6b requires a strict
base64 decoder is an open question: ably-js on Node decodes any string
without error. Replace it with RSL6b's own example, an encrypted message
received on a channel with no cipher, which every SDK handles the same
way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TO3k2's restHost (optional, deprecated) defaults to the REC1a primary
domain, main.realtime.ably.net, per the ClientOptions IDL; the table
still showed the pre-REC1 rest.ably.io.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#507 fixes the same truncated RSP5g cipher fixture. Use its hunk byte for
byte so the two PRs merge cleanly in either order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#508 replaces the same pre-2.1 RSC6a stats fixture with a superset of
this change (schema, appId, intervalTime and the TS12 header). Matching it
byte for byte would carry its Time( constructor where the file uses
DateTime(, and any difference on those lines conflicts whichever PR merges
second, so drop this PR's stats.md change and let #508 fix it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
staging/pull/536 — 59cd5ba3 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

Development

Successfully merging this pull request may close these issues.

1 participant