Skip to content

Fix broadcast "list all channels" to use /all-channels endpoint#240

Merged
kylebrowning merged 1 commit into
mainfrom
fix/broadcast-all-channels
Jun 26, 2026
Merged

Fix broadcast "list all channels" to use /all-channels endpoint#240
kylebrowning merged 1 commit into
mainfrom
fix/broadcast-all-channels

Conversation

@kylebrowning

Copy link
Copy Markdown
Owner

Problem

The .listAll broadcast operation targeted /1/apps/{bundleID}/channels, but Apple's channel-management API exposes "read all channels" on a distinct endpoint: GET /1/apps/{bundleID}/all-channels. Against real APNs, readAllChannelIDs() was hitting the wrong path and would not return the channel list.

This was masked by the mock APNSTestServer, which treated any GET …/channels without a channel-id header as "list" — mirroring the client's incorrect assumption, so the existing test passed.

Ref: Sending channel management requests to APNs.

Changes

  • Route .listAll to /all-channels in APNSBroadcastRequest.Operation.path.
  • Update APNSTestServer:
    • serve GET /1/apps/{bundleID}/all-channels for listing
    • require the apns-channel-id header on GET /channels so it can no longer silently mirror the old behaviour (a regression would now fail the test).
  • Add testOperationPaths pinning the path contract for create/read/delete/listAll.

Testing

swift test --filter APNSBroadcastClientTests — 10 tests pass, including the existing testListAllChannels/testListAllChannels_empty now exercising /all-channels.

The `.listAll` broadcast operation was targeting `/1/apps/{bundleID}/channels`,
but Apple exposes "read all channels" on a distinct endpoint:
`GET /1/apps/{bundleID}/all-channels`. Against real APNs the old path is not the
list endpoint, so `readAllChannelIDs()` would not return the channel list.

- Route `.listAll` to `/all-channels` in APNSBroadcastRequest.
- Update APNSTestServer to serve `/all-channels` for listing and to require the
  `apns-channel-id` header on `GET /channels` (so it can no longer silently mirror
  the old, incorrect behaviour and mask a regression).
- Add `testOperationPaths` pinning the path contract for every operation.
@kylebrowning
kylebrowning merged commit 88a430c into main Jun 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant