fix: upload session events in FIFO order#1716
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR changes the local Room DAO query ordering so closed session scopes and their events are fetched in FIFO (oldest-first) order, aligning event up-sync with chronological upload rather than LIFO.
Changes:
- Update
SessionScopeRoomDao.loadClosed()to return closed scopes ordered oldest-first. - Update
EventRoomDaoqueries (loadAll,loadFromScope,loadEventJsonFromScope) to return events ordered oldest-first. - Add/extend DAO unit tests to assert FIFO ordering and limit behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| infra/events/src/main/java/com/simprints/infra/events/event/local/SessionScopeRoomDao.kt | Changes loadClosed query ordering to start_unixMs asc for FIFO retrieval of closed scopes. |
| infra/events/src/main/java/com/simprints/infra/events/event/local/EventRoomDao.kt | Changes event retrieval queries to createdAt_unixMs asc so events are fetched in FIFO order. |
| infra/events/src/test/java/com/simprints/infra/events/event/local/SessionScopeRoomDaoTest.kt | Adds tests verifying FIFO ordering and limit behavior for closed scopes. |
| infra/events/src/test/java/com/simprints/infra/events/event/local/EventRoomDaoTest.kt | Adds tests verifying FIFO ordering for scope event and event JSON retrieval. |
BurningAXE
reviewed
Jun 22, 2026
Change ORDER BY in SessionScopeRoomDao.loadClosed from DESC to ASC so older sessions are prioritised over newer ones during upload. Add SessionScopeRoomDaoTest to verify FIFO ordering is preserved.
26662a0 to
967bd0c
Compare
|
BurningAXE
approved these changes
Jun 23, 2026
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.



Same PR for release with minimum changes.