Skip to content

Introduced Room Migration Tests - Tests added for Migration 9 -> 10#4787

Draft
atharvyadav22 wants to merge 7 commits intokiwix:mainfrom
atharvyadav22:test/migration
Draft

Introduced Room Migration Tests - Tests added for Migration 9 -> 10#4787
atharvyadav22 wants to merge 7 commits intokiwix:mainfrom
atharvyadav22:test/migration

Conversation

@atharvyadav22
Copy link
Copy Markdown
Contributor

Fixes: #4784

This PR focuses on migration tests for 9 to 10 which introduced

@TypeConverters(PauseReasonConverter::class)
 val pauseReason: PauseReason = PauseReason.NONE,

atharvyadav22 and others added 7 commits March 5, 2026 18:31
…oad is ongoing.

* Introduced event-based scroll handling instead of relying on condition-based list position changes. This separates scroll behavior from list changes and makes the architecture more clear and maintainable.
* The list now scrolls to the top only when a fresh set of items is fetched from the online source (e.g., after applying search, filters, category, or language changes).
* The current scroll position is preserved during download progress updates and pagination (load more).
@atharvyadav22 atharvyadav22 marked this pull request as draft March 22, 2026 14:00
@atharvyadav22
Copy link
Copy Markdown
Contributor Author

This commit is all about setup would add tests later

@kelson42
Copy link
Copy Markdown
Collaborator

What is the status here?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Room schema export artifacts and Gradle wiring intended to support validating the MIGRATION_9_10 change (new pauseReason column) via Room migration tests.

Changes:

  • Enabled Room schema export for KiwixRoomDatabase and committed schema snapshots for versions 9 and 10.
  • Configured the core module to expose the schema directory as androidTest assets and added the Room testing dependency.
  • Added a roomTesting dependency coordinate to buildSrc Libs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/src/main/java/org/kiwix/kiwixmobile/core/data/KiwixRoomDatabase.kt Enables exportSchema so Room can emit schema JSON for migration validation.
core/schemas/org.kiwix.kiwixmobile.core.data.KiwixRoomDatabase/9.json Adds Room schema snapshot for DB version 9.
core/schemas/org.kiwix.kiwixmobile.core.data.KiwixRoomDatabase/10.json Adds Room schema snapshot for DB version 10 (includes pauseReason).
core/build.gradle.kts Adds room-testing, wires schemas into androidTest assets, and sets Room schema export location.
buildSrc/src/main/kotlin/Libs.kt Introduces Libs.roomTesting constant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/build.gradle.kts
Comment on lines 26 to +72
@@ -62,4 +68,11 @@ dependencies {
implementation(Libs.kotlinx_coroutines_android)
implementation(Libs.zxing)
testImplementation(Libs.TURBINE_FLOW_TEST)
androidTestImplementation(Libs.roomTesting)
}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title/description indicate migration tests were introduced, but there are no androidTest sources in this module (and no usages of MigrationTestHelper / runMigrationsAndValidate found in the repo). As-is, this adds schema assets and the room-testing dependency but doesn't actually validate MIGRATION_9_10. Either add the migration test(s) (e.g., under core/src/androidTest/...) or adjust the PR title/description to reflect that this PR only enables schema export and adds schema snapshots.

Copilot uses AI. Check for mistakes.
Comment thread core/build.gradle.kts
}
plugins {
`android-library`
kotlin("kapt")
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kotlin("kapt") is redundant here because KiwixConfigurationPlugin already applies kotlin-kapt (and kotlin-android) to all modules. Applying kapt directly in the plugins block without also applying the Kotlin Android plugin can also fail depending on plugin application order. Consider removing this line and relying on the convention plugin, keeping only the kapt { arguments { ... } } block below.

Suggested change
kotlin("kapt")

Copilot uses AI. Check for mistakes.
@atharvyadav22
Copy link
Copy Markdown
Contributor Author

@kelson42
I was working on that but kiwix prioritize focus towards migration and releated things so i was busy with that work. will update on this soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce MigrationTestHelper Infrastructure to Validate Data Survival Across Room Schema Migrations

4 participants