test(llc): port the stream_chat_test algebra onto v11 - #2971
Draft
VelikovPetar wants to merge 112 commits into
Draft
VelikovPetar wants to merge 112 commits into
VelikovPetar wants to merge 112 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…Enabled Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts: # melos.yaml
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ream_chat_test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…at_test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…_test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…chat_test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…_state_test monolith Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…_test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…el role in emitted messages Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ation claims Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… config Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… whole 0.1.0 surface Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… instead of a default Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…client sendEvent Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… not an isolation boundary Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…API call Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…iry error Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…at other tests Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…sting guides Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…sts-to-algebra Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
…nto claude/stream-chat-flutter-test-migration-4e5041 # Conflicts: # packages/stream_chat/test/src/client/channel/channel_client_state_test.dart # packages/stream_chat/test/src/client/client_test.dart # packages/stream_chat/test/src/fakes.dart # packages/stream_chat/test/src/mocks.dart
… doubles Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ss client Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
stream_chat_test algebra onto v11stream_chat_test algebra onto v11
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Draft, and not expected to merge as-is. It exists to show that the
stream_chat_testalgebra ports onto
v11without losing coverage, and to let the port be reviewed before#2950 / #2954 land on
master. See Landing this for real.Brings
masterand thestream_chat_testtest algebra ontov11, and ports the migrated suiteto v11's
stream_core-based APIs.What this contains
Three things, in this order:
master→v11— a clean merge, no conflicts. Carries #2945 (SyncManager) and #2966 (FLU-791, the removed-member read-state fix)merge/master-to-v11-basestream_chat_testharness packagefeat/stream-chat-test-package)stream_chatsuite built on that harnesstest/migrate-llc-tests-to-algebra)…plus one commit of my own,
test(llc): port the stream_chat_test algebra onto the v11 APIs, whichresolves the merge and ports both the harness and the migrated tests to v11's APIs.
Step 1 is on its own branch (
merge/master-to-v11-base) rather than folded in, because it doublesas the coverage baseline every number below is measured against.
Related
stream_chat_testpackage #2950 —test(repo): add stream_chat_test package→masterstream_chattest suite to thestream_chat_testalgebra #2954 —test(llc): migrate the stream_chat test suite to the stream_chat_test algebra→master(built on test(repo): addstream_chat_testpackage #2950)feat(repo)!: v11→masterport/test-algebra-to-v11, which predates the reassembly of the migratedsuite back into the original test files.
The port
v11movedstream_chatontostream_coreacross #2956–#2963, so the migrated suite — writtenagainst
master's API — could not compile. The mapping was not invented:v11had already performedevery one of these ports once, on
master's version of the same files, andmigrations/v11-migration.mdrecords the symbol map. Each resolution replays that port onto the migrated test.
Harness (
packages/stream_chat_test/lib/, no conflicts but the load-bearing work):TokenManager()+setTokenOrProvider→TokenManager.unconfigured()+setTokenProvider(id, tokenProvider:)Token→UserToken;createTestTokennow builds thedevtoken-signed JWT itselflogLevel: Level.OFF→logConfig: StreamLogConfig(priority: verbose, handler: silent), plusaddTearDown(StreamLogger.reset)— the client configures the logger process-wideStreamChatNetworkError/ChatErrorCode→StreamApiException/StreamErrorCodecreateDefaultNetworkError'sretriable:flag is gone: on v11 retriability is read off thestatus code, so each call site names the status the endpoint answers with
registerChatFallbackValuesregisters one filter and one sort-list fallback per query surface —a filter carries its model in its type now, so a single
Filter.empty()no longer covers themTests — 14 conflicted files, 117 content hunks + 2 modify/delete. Highlights:
FilterandSortcompare by identity on v11 (stream_core's are notEquatable; master'sFilterwas). The harness's convention is exact-argument stubbing, so every stub carrying a filtersilently stops matching — it compiles and fails at runtime. Resolved with v11's
isSameFilterAs(moved into the harness, where
matchers.dartnow lives) plus a newisSameSortAssibling.test/src/fakes.dartandauth_interceptor_test.dartare the two modify/delete conflicts; bothresolve to the delete. Nothing imports
fakes.darton the migration branch, andAuthInterceptormoved to
stream_core..sendMessagetests usednotAllowederrors marked "retriable". On
masterisRetriablemeant "carries no response data"; on v11 it isread off the status code, and a 403 is a verdict. Those four now assert
sending → sendingFailedandverify the send happened once — a stronger claim than the old "queued and retried", and the one
v11's own rename ("should mark a refused send as failed") describes.
Evidence
packages/stream_chat/libis byte-identical betweenmerge/master-to-v11-baseand this branch(
git diffis empty), so the coverage rows are a valid line-by-line comparison.v11+master)lib/lines coveredreporter, not grep).
channel.configgetter on aninitialized and a non-initialized channel, the channel-with-persistence lifecycle, the retry queue
giving up when the policy declines, and the default REST wiring.
v11— the ones resolved here plusfakes.dart/matchers.dart(deleted, now in the harness). Every other file under
packages/stream_chat/test, includingfilter_registry_test.dart,sort_registry_test.dart,stream_chat_exception_test.dartand all themodel tests, is byte-identical to v11's.
One real loss, found by the coverage diff and fixed
channel.dart:867(state?.scheduleRetry) showed as baseline-only. Cause:v11had added five.sendMessagetests inside a group the migration rewrote wholesale, so the merge swallowed them.All five are restored, re-expressed on the harness with the same assertions —
queues a failed send for retry when the failure is retriable,does not queue a failed send when the failure is not retriable,should re-send the message through the retry queue when the failure is retriable,should not re-send the message when the failure is not retriable,should report a superseded send as a cancelled request.The two counts v11 wrote as
called(greaterThan(1))aretimes: 2here, which is stricter.Nothing was demoted to pass green
Two independent checks, because line coverage cannot see assertion strength.
Assertion-strength audit. Every removed assertion line has a one-for-one renamed replacement
(19
StreamChatNetworkError→StreamApiException, 12 error-code equals, 7StreamChatError→StreamClientException, 3 →StateError, 4 →StreamNetworkException). The only net assertionremoval in the whole merge is the three
expects inside the deleted.devTokentest. Zeroskip:anywhere.
.called(n)counts unchanged. All 26 addedany(are narrowing wrappers(
isSameFilterAs/isSameMessageAs) — no bareany()ever replaced an exact argument.Mutation battery — 25 mutations over the
lib/files v11 changed: 18 caught, 7 survived, and everysurvivor also survives on the baseline, so each is a gap
v11already had rather than one this mergeintroduced.
Caught: the retry-enqueue gate, cancelled-upload detection, the mark-read guards, the message-not-found
guard,
_removeMember's read pruning (#2966),_removeWatcher's pruning, the event handler'smember-lookup filter field, all three
ChannelDeliveryReporterentry points, bothclient.dartconnection guards, the sync refused-window branch, the quoted-message rewrite, the
muted/blockedmodel getters,
membersexact matching (#2963), connect-URI redaction, andeffectiveSort.Pre-existing
v11gaps this surfaced (not regressions — worth their own tickets)Each survives the mutation on both this branch and the baseline:
websocket.dart:403— the token-expiry refresh-and-reconnect path is never exercised.websocket.dart:404— nor is its static-token half (usesStaticProvider).channel.dart:273,280—Channel.blocked/blockedStream, added by v11, have no test at all.retry_queue.dart:86—retryIf's "not aStreamChatException⇒ do not retry" early return.client.dart:801—queryChannels' no-active-connectionStateError.master's test asserted astubbed throw rather than the real guard, so it was never covered on either side.
channel_model.dart:259-262—copyWith'ssafeCast<bool>fallback (the replacement path istested, the fallback-to-
thispath is not).channel.dart:820,921— the upload-failure message naming each attachment and its reason.Orphans — tests dropped because their subject left the package
Client … `.devToken`StreamChatClient.devTokenremoved on v11;Token/AuthTypearestream_core'sUserToken`onError` should pass through an error response that is not a token expiryAuthInterceptormoved tostream_core; v11 deletes the file.stream_http_client_test.dartstill pins that the interceptor is installed and correctly orderedEverything else the migration branch carries but this merge does not is a file v11 deleted outright
(
filter_test,sort_order_test,comparable_field_test,list_extensions_test,string_sort_normalizer_test,stream_chat_error_test,token_test,token_manager_test,system_environment_manager_test,in_flight_cache_test,stream_chat_dio_error_test) or a test v11itself renamed in a file this merge takes from v11 unchanged.
Checks
dart analyzeonpackages/stream_chat_test: clean.dart analyzeonpackages/stream_chat: 2 infos, both inlib/and both pre-existing on thebaseline (
sync_manager.dart:223,websocket.dart:436,cascade_invocations). They will trip--fatal-infosin CI but did not come from here.dart format --set-exit-if-changed: clean in both packages.packages/stream_chatsuite: 1,795 passing.packages/stream_chat_testself-tests: 31 passing.Landing this for real
The repo squash-merges, so this merge would not be an ancestor of tomorrow's
masterand the same14 files would conflict a second time. The plan is therefore: once #2950 and #2954 land on
master,branch off
v11,git merge origin/master, replay the resolutions from this branch, and re-run theevidence above. The thinking happens once; the second merge is mechanical.
🤖 Generated with Claude Code