chore: clean up unused code and add CI checks#33
Conversation
WalkthroughAdds a GitHub Actions CI workflow. Removes multiple Dart/Flutter services, providers, widgets, and utilities across core, chat, server, and shared modules. Updates pubspec.yaml by removing four dependencies. No other files are modified. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant GH as GitHub
participant Runner as Actions Runner (ubuntu-latest)
participant Flutter as Flutter SDK 3.35.0
participant Repo as Repository
GH->>Runner: Trigger CI (push to main / PR)
Runner->>Repo: actions/checkout
Runner->>Flutter: setup-flutter (stable 3.35.0)
Runner->>Flutter: flutter pub get
Runner->>Flutter: dart analyze
Runner->>Flutter: dependency_validator
Runner->>Flutter: dart_code_metrics: metrics analyze lib
alt tests directory exists
Runner->>Flutter: flutter test
else no tests
Runner->>Runner: echo "No tests found"
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (6)
.github/workflows/ci.yml (6)
13-17: Confirm Flutter version or follow latest stable; enable SDK cachingPinning to '3.35.0' is fine if that version exists in releases. If not, the job will fail. Either verify the version is available or omit flutter-version to always pull latest on the stable channel. Also enable caching in the action for faster runs.
Option A (keep pin, add caching):
- uses: subosito/flutter-action@v2 with: flutter-version: '3.35.0' channel: 'stable' + cache: trueOption B (track latest stable, plus caching):
- uses: subosito/flutter-action@v2 with: - flutter-version: '3.35.0' channel: 'stable' + cache: true
26-28: Consider switching to the maintained DCM CLI and/or broaden analysis scopeIf you’ve migrated to the newer “dcm” CLI, prefer it; otherwise the current invocation is OK. Also consider including test and tool directories if applicable.
Examples:
- Keep as-is (no action needed).
- Or migrate:
- name: Run code metrics run: | dart pub global activate dcm dart pub global run dcm analyze lib # Optionally: add test tool # dart pub global run dcm analyze lib test
3-9: Add workflow concurrency to auto-cancel superseded runsPrevents wasting CI minutes on outdated commits, especially for PRs.
on: push: branches: [main] pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs:
3-9: Tighten default permissions (principle of least privilege)Unless you need write permissions (e.g., for release or labels), set minimal read permissions.
on: push: branches: [main] pull_request: +permissions: + contents: read + jobs:
11-19: Cache Pub packages to speed up installsCaching ~/.pub-cache cuts “pub get” time significantly across runs.
steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: flutter-version: '3.35.0' channel: 'stable' + cache: true + - name: Cache Pub cache + uses: actions/cache@v4 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub- - name: Install dependencies run: flutter pub get
19-20: Optional: fail CI on infos/warnings from the analyzerIf you want stricter gates, enable fatal-infos and fatal-warnings.
- - name: Run analyzer - run: dart analyze + - name: Run analyzer + run: dart analyze --fatal-infos --fatal-warnings
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pubspec.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
.github/workflows/ci.yml(1 hunks)lib/core/services/deep_link_service.dart(0 hunks)lib/core/services/error_handling_service.dart(0 hunks)lib/core/services/error_recovery_service.dart(0 hunks)lib/core/services/focus_management_service.dart(0 hunks)lib/core/services/navigation_state_service.dart(0 hunks)lib/features/chat/providers/attachment_cache_provider.dart(0 hunks)lib/features/chat/widgets/conversation_components.dart(0 hunks)lib/features/chat/widgets/file_viewer_dialog.dart(0 hunks)lib/features/chat/widgets/folder_management_dialog.dart(0 hunks)lib/features/chat/widgets/message_batch_widget.dart(0 hunks)lib/features/chat/widgets/tag_management_dialog.dart(0 hunks)lib/features/server/providers/server_providers.dart(0 hunks)lib/shared/utils/keyboard_utils.dart(0 hunks)lib/shared/widgets/cached_image.dart(0 hunks)lib/shared/widgets/empty_states.dart(0 hunks)lib/shared/widgets/error_widgets.dart(0 hunks)pubspec.yaml(0 hunks)
💤 Files with no reviewable changes (17)
- pubspec.yaml
- lib/features/chat/widgets/file_viewer_dialog.dart
- lib/features/server/providers/server_providers.dart
- lib/features/chat/widgets/message_batch_widget.dart
- lib/features/chat/providers/attachment_cache_provider.dart
- lib/core/services/focus_management_service.dart
- lib/shared/widgets/cached_image.dart
- lib/features/chat/widgets/folder_management_dialog.dart
- lib/core/services/navigation_state_service.dart
- lib/shared/widgets/error_widgets.dart
- lib/core/services/error_recovery_service.dart
- lib/core/services/deep_link_service.dart
- lib/core/services/error_handling_service.dart
- lib/features/chat/widgets/conversation_components.dart
- lib/shared/utils/keyboard_utils.dart
- lib/features/chat/widgets/tag_management_dialog.dart
- lib/shared/widgets/empty_states.dart
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/ci.yml
12-12: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🔇 Additional comments (1)
.github/workflows/ci.yml (1)
29-35: Nice: conditional tests prevent false-negative failures when no tests existThe guard on the test directory aligns with the repo’s current lack of tests and avoids red CI for “directory not found.”
| analyze-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 |
There was a problem hiding this comment.
Upgrade checkout action to v4 to avoid runner compatibility issues
actionlint flagged actions/checkout@v3 as too old for current runners. Switch to v4.
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - uses: actions/checkout@v3 | |
| - uses: actions/checkout@v4 |
🧰 Tools
🪛 actionlint (1.7.7)
12-12: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents
In .github/workflows/ci.yml around line 12 the workflow uses actions/checkout@v3
which actionlint flagged as outdated; update the step to use actions/checkout@v4
by changing the version reference to v4 so the workflow runs on current GitHub
runners without compatibility issues and commit the updated workflow file.
| - name: Check unused dependencies | ||
| run: | | ||
| dart pub global activate dependency_validator | ||
| dependency_validator |
There was a problem hiding this comment.
Fix dependency_validator invocation to avoid PATH pitfalls
Running the binary name directly can fail if ~/.pub-cache/bin isn’t on PATH in the runner. Use “dart pub global run …” which does not rely on PATH.
- name: Check unused dependencies
run: |
- dart pub global activate dependency_validator
- dependency_validator
+ dart pub global activate dependency_validator
+ dart pub global run dependency_validator📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Check unused dependencies | |
| run: | | |
| dart pub global activate dependency_validator | |
| dependency_validator | |
| - name: Check unused dependencies | |
| run: | | |
| dart pub global activate dependency_validator | |
| dart pub global run dependency_validator |
🤖 Prompt for AI Agents
.github/workflows/ci.yml around lines 21 to 24: the workflow invokes the
dependency_validator binary directly which can fail if ~/.pub-cache/bin is not
on PATH in the runner; instead, after activating the package, call it via "dart
pub global run dependency_validator" so it runs through dart and does not rely
on PATH; update the run steps to use dart pub global run (keeping the activate
step) and ensure the command exits non‑zero on issues as before.
Summary
Testing
dart pub getdart analyze~/.pub-cache/bin/dependency_validatorflutter test(fails: Test directory "test" not found.)https://chatgpt.com/codex/tasks/task_e_68a8b49d0e608324a1c4c89019bae0de
Summary by CodeRabbit
Refactor
Chores