Skip to content

UTS: repair broken rest/unit fixtures - #536

Open
owenpearson wants to merge 1 commit into
mainfrom
fix/uts-broken-fixtures
Open

owenpearson wants to merge 1 commit into
mainfrom
fix/uts-broken-fixtures

Conversation

@owenpearson

Copy link
Copy Markdown
Member

Fixes the four broken fixtures in uts/rest/unit reported in #528.

BLOCKING fixes (made their tests unsatisfiable for a conforming SDK)

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 holding any 17-byte-plus PKCS#7-padded plaintext, so it can never decrypt/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 changed the type-only assertion to assert the decrypted value.

Derivation/validation: with the fixture's own key WUP6u0K7MXI5Zeo0VppPwg==, the new ciphertext is 48 bytes (multiple of 16), 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). Verified locally with cryptography.

2. encoding/message_encoding.md — invalid base64 fixture (RSL6b/unrecognized-encoding-preserved-0)
The old payload encrypted-data-here has 17 alphabet chars (≡1 mod 4) — a residue class no base64 string can occupy, so the base64 decode the test asserts can never succeed. Replaced with ZW5jcnlwdGVkLWRhdGEtaGVyZQ== (base64 of encrypted-data-here) and strengthened the assertion to check the decoded bytes. Added a separate RSL6b failure-branch test (invalid-base64-preserved-1) with a deliberately invalid payload (@@@invalid@@@) asserting the message is delivered with the last successful decoding — data unchanged and encoding == "custom-encryption/base64" — which previously had no coverage in uts/rest/unit.

Validation: ZW5jcnlwdGVkLWRhdGEtaGVyZQ== has length 28 (≡0 mod 4), decodes to encrypted-data-here, and round-trips. @@@invalid@@@ has 7 alphabet chars (≡3 mod 4) and fails strict RFC4648 decode.

Cosmetic fixes (tests already pass; fixtures were stale)

3. stats.md — pre-2.1 stats shape (RSC6a/returns-paginated-stats-0)
Replaced the deleted all nested-counter blocks with the TS12r entries Dict<String, Int> map and added assertions on entries so TS12r is actually exercised (it previously had no unit coverage).

4. types/options_types.md — pre-REC1 hostnames (TO/endpoint-affects-host-0)
Updated the "Expected Rest Host" table to the REC1a/REC1b4 forms: main.realtime.ably.net, test.realtime.ably.net, custom-env.realtime.ably.net.

Files changed

  • uts/rest/unit/presence/rest_presence.md
  • uts/rest/unit/encoding/message_encoding.md
  • uts/rest/unit/stats.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).

Closes #528

🤖 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>

This branch was successfully deployed

1 active deployment
staging/pull/536 65daaac2 Deployed Sep 21, 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.

Four broken fixtures in uts/rest/unit — two make their tests unsatisfiable, two encode superseded specification text

1 participant