Repository layer over Room and DataStore #5

Closed
opened 2026-08-18 02:14:37 -05:00 by null · 0 comments
Owner

Once core/database and core/datastore exist, nothing should reach them directly. PRODUCT_PLAN.md §44 sets the flow as UI → ViewModel → use case / prediction engine → repository → Room / DataStore, and the repository is the seam that keeps the prediction engine ignorant of Android.

Build a CycleRepository and a PreferencesRepository that:

  • expose Flows of domain types from domain/cycle, not Room entities — the entity is a storage detail and leaking it makes the domain module depend on Android by the back door
  • recompute derived cycles rather than storing them (List<PeriodRecord>.toCycles() already exists in domain/cycle)
  • are the only things that touch a DAO

Depends on the Room and DataStore issues in this batch. Doing it first means inventing the types twice.

Verify: ./gradlew test passes with repository tests using an in-memory Room database, and grep -rn "androidx.room" app/src domain/ returns nothing — no module above or beside the repository imports Room.

Once `core/database` and `core/datastore` exist, nothing should reach them directly. PRODUCT_PLAN.md §44 sets the flow as UI → ViewModel → use case / prediction engine → repository → Room / DataStore, and the repository is the seam that keeps the prediction engine ignorant of Android. Build a `CycleRepository` and a `PreferencesRepository` that: - expose `Flow`s of domain types from `domain/cycle`, not Room entities — the entity is a storage detail and leaking it makes the domain module depend on Android by the back door - recompute derived cycles rather than storing them (`List<PeriodRecord>.toCycles()` already exists in `domain/cycle`) - are the only things that touch a DAO Depends on the Room and DataStore issues in this batch. Doing it first means inventing the types twice. Verify: `./gradlew test` passes with repository tests using an in-memory Room database, and `grep -rn "androidx.room" app/src domain/` returns nothing — no module above or beside the repository imports Room.
null added this to the Batch 01 — Foundation milestone 2026-08-18 02:14:37 -05:00
null closed this issue 2026-08-18 02:41:08 -05:00
Sign in to join this conversation.
No Label
P0
P1
P2
release-blocker
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: null/Privacy-Period-Tracker#5
No description provided.