Skip to content

Comments

Add chat integration tests to match stream-chat-go test parity#79

Merged
daksh-r merged 20 commits intocha-1578_openapi-refactor-codegenfrom
match-chat-test-parity-codegen
Feb 23, 2026
Merged

Add chat integration tests to match stream-chat-go test parity#79
daksh-r merged 20 commits intocha-1578_openapi-refactor-codegenfrom
match-chat-test-parity-codegen

Conversation

@daksh-r
Copy link

@daksh-r daksh-r commented Feb 23, 2026

Summary

  • Adds comprehensive chat integration tests to the auto-generated SDK (getstream-go) covering all chat functionality tested in the hand-written SDK (stream-chat-go)
  • Regenerates SDK to remove ChannelBatchUpdate (still behind Ignore+Beta) and expose QueryTeamUsageStats
  • Adds deleteUsersWithRetry helper to handle rate limiting across concurrent test cleanup

Coverage

All chat tests from stream-chat-go are covered: channels, messages, users, reactions, bans, mutes, flags, permissions, roles, devices, blocklists, commands, channel types, threads, unread counts, app settings, export channels/users, custom events, restore users, shadow bans, delivery receipts, live locations, reminders, polls, rate limits, token creation, file/image uploads, and team usage stats (including multi-tenant).

Intentionally excluded (not in the generated spec)

  • ChannelBatchUpdate — still behind Ignore: true + Beta: true in the backend
  • DraftsCreateDraft is client-side only
  • QueryFlagReports / CreatePermission — hidden in spec (Ignore: true)

Test plan

  • CI passes with STREAM_API_KEY / STREAM_API_SECRET
  • Multi-tenant tests pass with STREAM_MULTI_TENANT_KEY / STREAM_MULTI_TENANT_SECRET
  • Tests skip gracefully when endpoints aren't available on the test app

Daksh and others added 16 commits February 19, 2026 12:49
- GetReplies: pass empty Sort slice to avoid nil→"null" serialization
- DeleteChannelType: sleep 6s + retry 5x (matching stream-chat-go)
- QueryThreads: filter by channel_cid, fix CreatedByUserID assertion
- UpdateApp: toggle EnforceUniqueUsernames instead of WebhookUrl
- CreateGuest: handle disabled guest access with early return

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…issions, export, and more

Tests cover: bans (global + channel), user mutes (with/without timeout),
channel mutes, flagging (v2 moderation API), roles/permissions CRUD,
channel export with async task, custom events, user restore after soft
delete, member partial update, pending messages, and message history.
All assertions match stream-chat-go test patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Messages need time to be indexed before they can be fetched in batch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive integration tests matching every implementable test from
stream-chat-go, covering channels, messages, users, polls, bans, mutes,
flags, permissions, threads, event hooks, delivery receipts, reminders,
live location, shadow bans, and more. Also documents 7 codegen gaps where
APIs exist in stream-chat-go but not in the generated SDK.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…te, and permission tests

- Regenerate all SDK files from chat backend with Ignore/Beta/ClientSideOnly
  flags removed (branch feature/cha-0-remove-openapi-ignore-flags)
- New SDK methods: ChannelBatchUpdate, CreateDraft, QueryDrafts, QueryFlagReports,
  FlagReportReview, QueryTeamUsageStats, CreatePermission
- Add TestChatDraftsIntegration (5 subtests: CRUD, thread, query, pagination)
- Add TestChatChannelBatchUpdateIntegration (3 subtests: AddMembers,
  RemoveMembers, Archive) matching stream-chat-go polling/verification pattern
- Add TestChatCreatePermissionIntegration (ListAndGetPermission passing,
  CreatePermission skipped due to codegen bug with path tag)
- Fix multipart upload for UploadChannelFile/Image requests
- Fix UndeleteMessageRequest usage after struct change (UndeletedBy field)
- Update CODEGEN_GAPS.md documenting remaining codegen bugs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Regenerate the full SDK from the backend spec that includes:
- CreatePermissionRequest now has `id` field (was missing due to
  path:"id" tag causing spec generator to drop it from body)
- FlagReportReview now takes `id` as path parameter (was missing
  because field was uuid.UUID without path:"id" tag)

Test changes:
- TestChatCreatePermissionIntegration: remove skip, add ID field,
  matches stream-chat-go TestPermissions_PermissionEndpoints
- TestChatQueryFlagReportsAndReviewIntegration: new test matching
  stream-chat-go TestClient_QueryFlagReportsAndReview

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ePermission

Regenerate SDK from updated backend spec:
- QueryFlagReports and FlagReportReview moved from ChatClient to
  ModerationClient (now at /api/v2/moderation/reports)
- FlagReportReview now takes id path parameter
- CreatePermission reverted (id field stays hidden from spec)

Test changes:
- TestChatQueryFlagReportsAndReviewIntegration: use
  client.Moderation().QueryFlagReports/FlagReportReview
- TestChatCreatePermissionIntegration: restore skip for CreateAndList,
  keep ListAndGetPermission passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…in spec)

Regenerate from backend with CreatePermission, QueryFlagReports, and
FlagReportReview restored to Ignore: true. These endpoints need
discussion with the moderation team before exposing.

Removes:
- TestChatQueryFlagReportsAndReviewIntegration (endpoints hidden)
- TestChatCreatePermissionIntegration (endpoint hidden)
- CreatePermission, QueryFlagReports, FlagReportReview from SDK

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tests

Regenerate from backend with CreateDraft restored to ClientSideOnly.

Removes:
- TestChatDraftsIntegration (CreateDraft is ClientSideOnly, not in
  server-side SDK)
- TestChatCreatePermissionIntegration (CreatePermission hidden from spec)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Skip device test when push providers not configured
- Retry DeleteUsers on rate limit (429) with exponential backoff
- Skip ChannelBatchUpdate tests when feature flag not enabled

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use context.Background() for individual HTTP calls so the client's own
timeout governs each request. Poll up to 30 times with 1s sleep instead
of relying on a caller-provided deadline context that would kill in-flight
HTTP requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
stream-chat-go uses synchronous DELETE /users/{id} which isn't
rate-limited. Our SDK only has the batch POST /users/delete endpoint
which is limited to ~6 calls/min. Increase retry to 10 attempts with
3s multiplied backoff to survive CI where many tests call DeleteUsers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Match the same 10 attempts / 3s multiplier pattern used in RestoreUsers
to handle CI rate limiting on the batch DeleteUsers endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract deleteUsersWithRetry helper and use it in all t.Cleanup
calls that invoke DeleteUsers. This prevents rate limit failures
when multiple test cleanups fire concurrently.

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

// waitForTask polls a task until it completes.
func waitForTask(t *testing.T, client *Stream, ctx context.Context, taskID string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci-lint] reported by reviewdog 🐶
func waitForTask is unused (unused)

@daksh-r daksh-r temporarily deployed to feeds-enabled-shard February 23, 2026 13:09 — with GitHub Actions Inactive
Daksh and others added 2 commits February 23, 2026 14:24
Covers all subtests from stream-chat-go: valid responses with
no params/month/date range/pagination, input validation errors
(invalid month, wrong length, bad dates, over max limit), and
past month empty results. Skips gracefully on apps where the
endpoint isn't deployed yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers all subtests from stream-chat-go:
- Basic API tests (10 subtests): valid responses with no params/month/
  date range/pagination, input validation errors, past month empty.
  Skips gracefully on apps where the endpoint isn't deployed yet.
- Multi-tenant integration tests (9 subtests): verifies teams data,
  pagination with cursor, limit correctness, metric field access,
  non-negative totals. Requires STREAM_MULTI_TENANT_KEY/SECRET env vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@daksh-r daksh-r temporarily deployed to feeds-enabled-shard February 23, 2026 13:26 — with GitHub Actions Inactive
@daksh-r daksh-r changed the title Match chat test parity codegen Add chat integration tests to match stream-chat-go test parity Feb 23, 2026
@daksh-r daksh-r marked this pull request as ready for review February 23, 2026 13:36
@daksh-r daksh-r requested a review from tbarbugli as a code owner February 23, 2026 13:36
@daksh-r daksh-r merged commit 0044a89 into cha-1578_openapi-refactor-codegen Feb 23, 2026
4 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