mirror of
https://github.com/Monkopedia/rouse-context.git
synced 2026-12-03 03:44:54 +00:00
Replace the six synchronous DataStore reads that required runBlocking on
the main/Koin thread with suspending APIs and a live-snapshot holder.
This removes a long-standing violation of the project's coroutine rules
("test and main() only") and fixes the detail-screen staleness that
came from one-shot preference reads.
Changes:
- IntegrationStateStore, NotificationSettingsProvider, and
IntegrationSettingsStore now expose suspend reads and
Flow-returning observers; synchronous getters are gone.
- New PreferencesSnapshotHolder aggregates every UI-facing preference
into a single StateFlow, collected WhileSubscribed via appScope.
Compose and ViewModels read from .snapshot.value / observeX flows
instead of blocking DataStore.
- IntegrationProviderRegistry caches enabled IDs in a StateFlow
launched eagerly in appScope, preserving its synchronous
ProviderRegistry contract for FCM and foreground-service callers.
- OutreachIntegration mirrors the DIRECT_LAUNCH toggle into a StateFlow
so the canLaunchDirectly tool-call predicate stays non-suspending.
- DeviceRegistrationStatus starts false and transitions asynchronously
once the cert store has been read.
- New OAuthHostnameProvider resolves the metadata hostname lazily in
a suspend context; the McpSession starts with the "localhost"
fallback that the Host header will override in real traffic.
- PerCallObserver.onToolCallRecorded is now suspend so
PerToolCallNotifier can await NotificationSettingsProvider.settings().
- CI guardrail grep added to .github/workflows/ci.yml (lint job) that
fails on any new production runBlocking. Commented KDoc references
and the synchronous-API bridge in TlsAcceptor.kt (InputStream.read /
OutputStream.write, non-suspending by java.io contract) are
explicitly excluded.
Tests:
- New PreferencesSnapshotHolderTest exercises the snapshot flow.
- Existing store tests rewrap assertions in runBlocking (allowed in
tests per project rules).
- MockK call sites for suspend methods migrated from every/verify
to coEvery/coVerify as required.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| ISSUE_TEMPLATE | ||
| workflows | ||