refactor(providers): split remaining services out of app_providers.dart, close #4506#4556
Conversation
Wave summary —
|
| Batch | PR | app_providers.dart LoC |
Cumulative reduction |
|---|---|---|---|
| Original (audit baseline) | — | 2,918 | — |
| 9a (upload & media) | #4550 | 978 | 66% |
| 9b (repositories) | #4555 | 455 | 84% |
| 9c (this PR — social + foundation) | #4556 | 40 | 98.6% |
Each split file is under the 800-LoC cap per #4506's acceptance criteria. After 9c lands, app_providers.dart is a re-export barrel plus the lone createBlockedAuthorFilter helper — whose move alongside the remaining back-import cleanup is tracked under #4554.
This comment has been minimized.
This comment has been minimized.
…rt, close #4506 Final sub-batch (9c of 3) of #4506's split wave. Refs #4339 Wave 2. Moves the 15-entity social/foundation/collaborator cluster to lib/providers/social_providers.dart: - 3 legacy Provider<X> collaborator providers (response service, invite state store, confirmation repository) - pendingActionService, outgoingDmRetryService (offline-action and DM retry orchestration) - analyticsService (Kind 22236 view publisher) - hashtagCacheService, hashtagService (in-memory + persistent hashtag indexes) - draftStorageService, clipLibraryService (per-user content drafts/clips) - userDataCleanupService (sign-out / identity-change cleanup orchestrator) - socialService (NIP-51 Kind 30000 follow sets) - contentReportingService (NIP-56) - contentDeletionService (NIP-09) - bugReportService (NIP-17 encrypted bug reports + Blossom uploads) Migration pattern (mirrors 9a/9b): // app_providers.dart export 'social_providers.dart'; // keeps consumers' imports unchanged After this batch, app_providers.dart is essentially a barrel of re-exports plus the lone createBlockedAuthorFilter helper (which still has 3 callers across moderation, repository, and video providers — moving it is tracked under #4554 along with the rest of the back-import cleanup). Scope cleanup: - dart fix --apply removed 33 newly-unused imports from app_providers.dart. - Deleted app_providers.g.dart entirely — no @riverpod annotations remain in app_providers.dart, so the generated file has nothing to produce. Dropped the `part 'app_providers.g.dart';` directive. - Three section dividers removed (FOUNDATIONAL SERVICES, DEPENDENT SERVICES, "(Removed duplicate legacy provider for StreamUploadService)") since their content all moved out. Cumulative reduction: - app_providers.dart: 2,918 -> 40 LoC (98.6% reduction). - Domain files now own ~all provider declarations. Each provider file is under 800 LoC (#4506 acceptance criterion). Closes #4506. Test plan: - dart run build_runner build --delete-conflicting-outputs (clean) - flutter analyze lib test integration_test (No issues found) - flutter test test/screens/feed/pooled_video_feed_item_repo_swap_test.dart test/widgets/video_feed_item/feed_videos_repo_swap_test.dart test/providers/dm_repository_provider_test.dart test/providers/curated_list_repository_bridge_test.dart (10 passed)
7b9c084 to
26c20b6
Compare
|
Took over this PR and cleaned up the new provider split before merge. What changed:
Local verification on the updated branch:
This keeps the split behaviorally identical while avoiding new provider-barrel debt in the file introduced by this PR. |
Mobile PR PreviewPreview refreshed for Last refresh:
|
NotThatKindOfDrLiz
left a comment
There was a problem hiding this comment.
Final pass complete. The provider split is clean, the follow-up import cleanup is in place, there are no unresolved review threads, and all required checks are green.
|
Final pass on May 21, 2026:
No further code changes were needed after the takeover commit. This looks ready to merge. |
Summary
Final sub-batch (9c of 3) of #4506's split wave. Refs #4339 Wave 2.
Moves the 15-entity social/foundation/collaborator cluster to `lib/providers/social_providers.dart`. After this batch, `app_providers.dart` is essentially a barrel of re-exports plus a single helper function.
What moved
3 legacy `Provider(...)` collaborator providers:
Action/DM orchestration:
Analytics + view publishing:
Hashtags:
Per-user content:
Identity lifecycle:
Social / NIP-51:
Content management:
Diagnostics:
Migration pattern (mirrors 9a/9b)
```dart
// app_providers.dart
export 'social_providers.dart'; // keeps 20+ external consumers' imports unchanged
```
social_providers.dart now imports the owning sibling provider files directly (auth_providers, relay_providers, repository_providers, upload_media_providers, video_providers), so the new file does not depend on the app_providers.dart barrel.
Scope cleanup
Codegen moved: 15 `*Provider` chunks (~675 LoC) relocated from `app_providers.g.dart` into `social_providers.g.dart`.
What's left in `app_providers.dart`
After this batch, the file is 40 lines:
The helper still has 3 callers across `moderation_providers.dart`, `repository_providers.dart`, and `video_providers.dart`. Moving it (alongside the rest of the back-import cleanup) is tracked under #4554.
Cumulative reduction across the full wave
Each domain file:
Acceptance criteria for #4506
Closes #4506.
Test plan
Reviewer
Per established pattern, only @NotThatKindOfDrLiz will be added when CI turns green.