Skip to content

UTS: keep realtime open in batch_presence restricted-key test - #586

Open
owenpearson wants to merge 1 commit into
mainfrom
fix/uts-batch-presence-restricted-key
Open

owenpearson wants to merge 1 commit into
mainfrom
fix/uts-batch-presence-restricted-key

Conversation

@owenpearson

Copy link
Copy Markdown
Member

Closes #548

What changed

In uts/rest/integration/batch_presence.md, test rest/integration/RSC24/restricted-key-channel-failure-1:

  • Moved AWAIT realtime.close() from Setup into Cleanup. Setup now has the same "keep realtime open" note as empty-channel-presence-2. Cleanup used to say "No cleanup needed" because the client was already closed; it now closes the client, like the two other tests in the file.
  • Replaced the stale comment in Test Steps. It said the restricted key "only has access to batch-allowed", but no channel by that name appears anywhere in the file. The new comment names the capability entry the test relies on, "channel6":["*"].

The Test ID and the assertions are unchanged.

Why

A presence member belongs to the connection that entered it. Closing the realtime client during setup removes member-1 before the REST batchPresence query runs, so the allowed channel's result has no presence key and success.presence.length == 1 can never pass. #548 has the sandbox measurements: 3 runs out of 3, checked at +0s, +1s and +3s after the close. This isn't a race. successCount, failureCount and the BGF2 failure-result assertions are not affected.

Correction to the issue's suggested fix

The issue suggested the comment "capability only for channel6". That's inaccurate. keys[2] in ably-common/test-resources/test-app-setup.json also grants channel0 to channel5 (channel4 and channel5 include presence). The new comment names the specific entry, "channel6":["*"], and says the key grants nothing on denied_channel.

npm run lint passes in build/.

🤖 Generated with Claude Code

rest/integration/RSC24/restricted-key-channel-failure-1 closed the
realtime connection during setup, then asserted that batchPresence finds
the member that connection entered. Closing the connection removes the
member, so the allowed channel's result came back with no presence.
Move the close into Cleanup, as the file's other two tests do.

Also replace the stale comment naming a "batch-allowed" channel with the
capability entry the test relies on, "channel6":["*"].

Closes #548

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

This branch was successfully deployed

1 active deployment
staging/pull/586 — 618a8407 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.

batch_presence.md's restricted-key test closes the connection that owns the presence member it then asserts on

1 participant