Persist + sync review logs (streak foundation)#15
Merged
Conversation
added 9 commits
June 5, 2026 09:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sub-project 1 of 2 for the streak system. Persists every FSRS review as an immutable
ReviewLogand syncs them to Firestore — fixing the gap whereStudyViewModel.onRatecomputedScheduleResult.logand discarded it. This gives the app a real per-review history (the data the streak — and later stats/heatmap — will derive from) plus a synced backup.review_logstable +ReviewLogDao,AzriDatabase→ v2 with an additiveMigration(1,2)(CREATE TABLE matched byte-for-byte to Room's generated schema — verified againstAzriDatabase_Impl.kt; no destructive wipe).ReviewLog/ReviewLogDtogainid/cardId(defaulted —SchedulingService.schedule()stays pure);ReviewLogRepository.append()assigns a UUID + marks the row dirty.onRatenow persistsresult.log(best-effort, fire-and-forget — never blocks rating).users/{uid}/reviewLogs/{logId}(each carryingcardId), append-only union — push dirty logs then clear; pull inserts only ids not already local (@Insert(OnConflictStrategy.IGNORE)), no last-write-wins since logs are immutable. The existing card/deck/folder sync is untouched.Out of scope (sub-project 2): the streak itself (will consume
ReviewLogRepository.observeLogs()); the iOScards/{id}/historysubcollection; log pruning; backfilling history for already-rated cards.Test plan
ReviewLogDtoTest,ReviewLogMapperTest(incl. null state/due) — id/cardId/all fields round-trip domain ↔ entity ↔ DTO.ReviewLogRepositoryTest—appendassigns the injected id + cardId + dirty.StudyViewModelTest— rating appends exactly one log with the right cardId/rating.SyncManagerTest— dirty logs pushed then cleared; pull unions remote logs and SyncManager's own filter skips an already-present id (asserted via inserted-batch capture, not just DAO dedup).:app:assembleDebugBUILD SUCCESSFUL.review_logsfills; signed-in sync →users/{uid}/reviewLogspopulates and a repeat sync adds no duplicates.🤖 Generated with Claude Code