Skip to content

Recognize existing Twitch EventSub subscriptions whose conditions list empty fields - #1698

Merged
kevmo314 merged 1 commit into
mainfrom
agent/eventsub-exists
Oct 24, 2026
Merged

kevmo314 merged 1 commit into
mainfrom
agent/eventsub-exists

Conversation

@kevmo314

Copy link
Copy Markdown
Contributor

Every subscribe reconcile re-POSTs channel.raid (both directions) and channel.channel_points_custom_reward_redemption.add/.update, and Twitch answers 409 (logged as twitch eventsub create outcome exists), costing 2-4 extra Helix requests per subscribe.

Root cause: Twitch lists every condition field of a type, filling unused ones with "". A read-only listing for channel 20135059 returns:

channel.raid  {"from_broadcaster_user_id": "", "to_broadcaster_user_id": "20135059"}
channel.raid  {"from_broadcaster_user_id": "20135059", "to_broadcaster_user_id": ""}
channel.channel_points_custom_reward_redemption.add     {"broadcaster_user_id": "20135059", "reward_id": ""}
channel.channel_points_custom_reward_redemption.update  {"broadcaster_user_id": "20135059", "reward_id": ""}

Our desired conditions omit those keys, so reflect.DeepEqual never matched. The same mismatch let these types slip past the legacy-callback gate.

Fix: compare conditions with sameCondition, which treats empty values as absent, in both the callback gate and the match.

Test: TestReconcileTwitchRecognizesEmptyConditionFields feeds reconcile a Helix-shaped listing with the empty fields and expects a single GET with no POSTs. It fails on main. TestSameCondition covers the comparison itself.

This branch was successfully deployed

2 active deployments
android-internal — a8048372 Deployed Oct 24, 2026 by kevmo314 via android / apkaab #1754
ios-testflight — a8048372 Deployed Oct 24, 2026 by kevmo314 via ios / ipa #1754
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