Skip to content

Conversation

@xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Sep 16, 2025

Summary by CodeRabbit

  • Chores

    • Cleaned imports and removed diagnostic instrumentation from generated types.
  • Refactor

    • Simplified internal paged-value implementations and toString outputs.
  • Bug Fixes

    • Resolved a naming/symbol conflict that could affect some build/test scenarios.
  • Tests

    • Added test fakes and setup/teardown scaffolding to mock recording behavior during widget tests.

No user-facing behavior changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

Walkthrough

Updated an import to hide Flutter's Key, removed diagnostic mixins/overrides and simplified toString methods in a freezed-generated file, and added a FakeRecordPlatform plus test harness changes to replace RecordPlatform.instance in several widget tests. No public API signatures changed.

Changes

Cohort / File(s) Summary
Import adjustment
packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart
Replaced package:flutter/foundation.dart import and consolidated widgets import to import 'package:flutter/widgets.dart' hide Key; to avoid symbol conflict with a generic Key.
Freezed-generated diagnostics removal
packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart
Removed DiagnosticableTreeMixin from _$PagedValue, Success, Loading, and Error; removed debugFillProperties overrides; changed toString signatures to String toString(); Success ctor now calls super._(); equality/hash unchanged.
Test fakes & harness updates
packages/stream_chat_flutter/test/src/fakes.dart, packages/stream_chat_flutter/test/src/edit_message_sheet_test.dart, packages/stream_chat_flutter/test/src/message_actions_modal/message_actions_modal_test.dart, packages/stream_chat_flutter/test/src/message_input/message_input_test.dart
Added FakeRecordPlatform implementing RecordPlatform; tests call TestWidgetsFlutterBinding.ensureInitialized() and setUp/tearDown replace RecordPlatform.instance with the fake, restoring original after tests.
Formatting-only
sample_app/lib/firebase_options.dart
Minor formatting: split androidClientId/iosClientId values across lines and restored trailing newline; no value changes.

Sequence Diagram(s)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • renefloor

Poem

I twitch my nose and hop about,
Hiding Keys so names don't shout.
Mixins trimmed and tests made light,
Fake records hum through day and night.
A rabbit fixed the code — all right 🐰

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "chore(core, ui): fix lints and failing tests" succinctly and accurately captures the main intent of the changeset: addressing lint issues and test failures. The raw summary shows import/generator adjustments (removing DiagnosticableTreeMixin, hiding Key) and test scaffolding additions (FakeRecordPlatform and RecordPlatform overrides) which directly relate to fixing lints and failing tests. The title is concise, follows conventional-commit style, and is informative for teammates reviewing history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/analysis-and-tests

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dcbc5e1 and 1031662.

📒 Files selected for processing (1)
  • sample_app/lib/firebase_options.dart (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • sample_app/lib/firebase_options.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: build (ios)
  • GitHub Check: build (android)
  • GitHub Check: test
  • GitHub Check: analyze
  • GitHub Check: analyze_legacy_versions
  • GitHub Check: stream_chat_flutter
  • GitHub Check: stream_chat_localizations
  • GitHub Check: stream_chat_flutter_core
  • GitHub Check: stream_chat_persistence

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart (1)

1-1: Prefer selective show over hide for clarity and narrower surface

Hiding Key fixes the lint, but importing only what’s used keeps the namespace clean and avoids future surprises.

-import 'package:flutter/widgets.dart' hide Key;
+import 'package:flutter/widgets.dart' show ValueListenableBuilder, ValueNotifier;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 62e2956 and 78db0d9.

📒 Files selected for processing (1)
  • packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: update_goldens
  • GitHub Check: stream_chat_persistence
  • GitHub Check: stream_chat
  • GitHub Check: stream_chat_localizations
  • GitHub Check: stream_chat_flutter
  • GitHub Check: stream_chat_flutter_core
  • GitHub Check: build (android)
  • GitHub Check: build (ios)
  • GitHub Check: test
  • GitHub Check: analyze
  • GitHub Check: analyze_legacy_versions

@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.77%. Comparing base (41fedfb) to head (1031662).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2376      +/-   ##
==========================================
- Coverage   63.80%   63.77%   -0.04%     
==========================================
  Files         412      412              
  Lines       25824    25824              
==========================================
- Hits        16478    16469       -9     
- Misses       9346     9355       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/stream_chat_flutter/test/src/fakes.dart (1)

134-136: Return a real temp file from stop() to avoid downstream file-existence assumptions.

Some code paths may File(path).existsSync() or try to read metadata. Safer to create an empty temp file and return its path.

Apply this diff within stop:

-  Future<String?> stop(String recorderId) async {
-    return 'path';
-  }
+  Future<String?> stop(String recorderId) async {
+    final ts = DateTime.now().microsecondsSinceEpoch;
+    final file = File('${Directory.systemTemp.path}/fake_record_$ts.m4a');
+    if (!await file.exists()) {
+      await file.create(recursive: true);
+    }
+    return file.path;
+  }

Add this import (outside the selected range):

import 'dart:io';
packages/stream_chat_flutter/test/src/message_input/message_input_test.dart (1)

16-19: Initialize test binding at start of main for consistency.

Other suites call TestWidgetsFlutterBinding.ensureInitialized();. Add it here to avoid sporadic platform-channel init issues on some runners.

 void main() {
+  TestWidgetsFlutterBinding.ensureInitialized();
   final originalRecordPlatform = RecordPlatform.instance;
   setUp(() => RecordPlatform.instance = FakeRecordPlatform());
   tearDown(() => RecordPlatform.instance = originalRecordPlatform);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9c95213 and ee0d207.

⛔ Files ignored due to path filters (30)
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_option_reorderable_list_view_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_option_reorderable_list_view_error_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_option_reorderable_list_view_error_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_option_reorderable_list_view_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_question_text_field_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_question_text_field_error_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_question_text_field_error_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/poll_question_text_field_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/stream_poll_creator_dialog_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/stream_poll_creator_dialog_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/stream_poll_creator_full_screen_dialog_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/creator/goldens/ci/stream_poll_creator_full_screen_dialog_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/poll_option_reorderable_list_view_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/poll_option_reorderable_list_view_error.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/poll_option_reorderable_list_view_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/poll_question_text_field_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/poll_question_text_field_error.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/poll_question_text_field_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/stream_poll_creator_dialog_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/stream_poll_creator_dialog_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/stream_poll_creator_full_screen_dialog_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/goldens/ci/stream_poll_creator_full_screen_dialog_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_add_comment_dialog_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_add_comment_dialog_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_add_comment_dialog_with_initial_value_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_add_comment_dialog_with_initial_value_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_suggest_option_dialog_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_suggest_option_dialog_light.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_suggest_option_dialog_with_initial_option_dark.png is excluded by !**/*.png
  • packages/stream_chat_flutter/test/src/poll/interactor/goldens/ci/poll_suggest_option_dialog_with_initial_option_light.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • packages/stream_chat_flutter/test/src/bottom_sheets/edit_message_sheet_test.dart (1 hunks)
  • packages/stream_chat_flutter/test/src/fakes.dart (2 hunks)
  • packages/stream_chat_flutter/test/src/message_actions_modal/message_actions_modal_test.dart (1 hunks)
  • packages/stream_chat_flutter/test/src/message_input/message_input_test.dart (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: update_goldens
  • GitHub Check: stream_chat_flutter
  • GitHub Check: stream_chat_localizations
  • GitHub Check: stream_chat_flutter_core
  • GitHub Check: stream_chat
  • GitHub Check: stream_chat_persistence
  • GitHub Check: test
  • GitHub Check: build (ios)
  • GitHub Check: format
  • GitHub Check: analyze
  • GitHub Check: build (android)
  • GitHub Check: analyze_legacy_versions
🔇 Additional comments (13)
packages/stream_chat_flutter/test/src/fakes.dart (3)

4-4: LGTM — correct dependency on the platform interface.

Using record_platform_interface for the fake keeps tests decoupled from the concrete plugin.


106-143: Solid platform fake; token-safe and covers common calls.

MockPlatformInterfaceMixin ensures the token check passes when swapping RecordPlatform.instance.


106-143: Verify FakeRecordPlatform implements any RecordPlatform methods the real AudioRecorder will call (e.g. start / amplitude APIs)

  • FakeRecordPlatform is defined at packages/stream_chat_flutter/test/src/fakes.dart; tests set RecordPlatform.instance = FakeRecordPlatform() in:
    packages/stream_chat_flutter/test/src/message_input/message_input_test.dart,
    packages/stream_chat_flutter/test/src/message_actions_modal/message_actions_modal_test.dart,
    packages/stream_chat_flutter/test/src/bottom_sheets/edit_message_sheet_test.dart.
  • AudioRecorder usage is in packages/stream_chat_flutter/lib/src/message_input/audio_recorder/audio_recorder_controller.dart (calls _recorder.hasPermission(), start(...), stop(), cancel(), dispose()); the controller tests use a MockAudioRecorder so they don’t hit the platform stub.

If any tests or runtime code instantiate the real AudioRecorder (AudioRecorder()) or exercise recording flows, add no-op stubs for RecordPlatform.start and any amplitude-related platform APIs to FakeRecordPlatform; otherwise no change needed.

packages/stream_chat_flutter/test/src/bottom_sheets/edit_message_sheet_test.dart (3)

5-5: LGTM — importing package:record/record.dart is appropriate for accessing RecordPlatform.


8-8: LGTM — centralizing fakes via ../fakes.dart keeps tests DRY.


13-18: Good harness for platform swap; isolation is preserved.

ensureInitialized, per-test override, and teardown back to the original instance are all correct.

packages/stream_chat_flutter/test/src/message_input/message_input_test.dart (2)

8-8: LGTM — record import added.


12-12: LGTM — shared fake import.

packages/stream_chat_flutter/test/src/message_actions_modal/message_actions_modal_test.dart (5)

4-4: LGTM — record import added.


8-8: LGTM — fake import wired.


12-13: LGTM — explicit test binding init.


16-18: LGTM — harmless formatting change in registerFallbackValue.


22-25: Good per-test platform override and restoration.

Keeps tests isolated and avoids bleed-through across groups.

xsahil03x and others added 4 commits September 17, 2025 14:51
This commit introduces a mock for `RecordPlatform` to be used in various tests.

The `FakeRecordPlatform` provides default implementations for the `RecordPlatform` interface methods, ensuring that tests relying on audio recording functionality can run without needing actual platform-specific recording capabilities.

This mock has been integrated into the following test files:
- `message_input_test.dart`
- `edit_message_sheet_test.dart`
- `message_actions_modal_test.dart`

In each of these files, the `FakeRecordPlatform` is set as the `RecordPlatform.instance` during `setUp` and restored to the original platform during `tearDown`.
@xsahil03x xsahil03x force-pushed the fix/analysis-and-tests branch from ee0d207 to dcbc5e1 Compare September 17, 2025 12:51
@xsahil03x xsahil03x merged commit 741fa33 into master Sep 17, 2025
18 of 19 checks passed
@xsahil03x xsahil03x deleted the fix/analysis-and-tests branch September 17, 2025 13:36
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.

3 participants