Skip to content

fix(release): v1.5.2 hotfix — migration crash + broken auto-update URL#141

Merged
RaheemJnr merged 3 commits intomainfrom
fix/release-1.5.2-migration-and-update-url
Apr 30, 2026
Merged

fix(release): v1.5.2 hotfix — migration crash + broken auto-update URL#141
RaheemJnr merged 3 commits intomainfrom
fix/release-1.5.2-migration-and-update-url

Conversation

@RaheemJnr
Copy link
Copy Markdown
Owner

@RaheemJnr RaheemJnr commented Apr 30, 2026

Summary

Emergency hotfix for two blockers discovered after v1.5.1 shipped.

1. v1.5.1 crashes on upgrade

Users upgrading from v1.5.0 (or any earlier version) hit:

```
java.lang.IllegalStateException: Migration didn't properly handle: transactions(...).
```

Two specific diffs:

Mismatch Cause Fix
`idx_tx_pending` in migrated DB, not in entity `MIGRATION_5_6` created it as raw-SQL partial index. The migration comment claimed Room ignored uncreated indices, which is not true. Declare it as `@Index` on `TransactionEntity`. Room compares by name + columns + orders, not WHERE clauses, so partial-from-migration matches non-partial-from-entity.
`transactions.walletId` has `DEFAULT ''`, entity has no annotation `MIGRATION_2_3` added the column with the SQL default; entity had only Kotlin default. Same shape on `balance_cache.walletId` and `dao_cells.walletId`. `@ColumnInfo(defaultValue = "''")` on all three fields.

The existing `MigrationTest` uses `inMemoryDatabaseBuilder` which creates a fresh schema without exercising migrations, which is why this wasn't caught in CI. Adding a proper instrumented `MigrationTestHelper` test (with `exportSchema = true`) is tracked as follow-up.

2. In-app auto-update notification never fires

`UpdateRepository` polled `api.github.com/repos/AgustaRC/ckb-wallet-gateway/releases/latest` which 404s, so every release check returned an exception that was silently logged. Users have never received an auto-update notification.

Fixed by pointing at `RaheemJnr/pocket-node`.

Important caveat: users on v1.5.0 / v1.5.1 are running code that polls the broken URL. They will not get an auto-update notification for v1.5.2 either; they have to grab it from the website or GitHub release manually once. From v1.5.2 onward, auto-update works.

Version

versionName 1.5.1 → 1.5.2
versionCode 7 → 8

Test plan

  • `assembleDebug` succeeds with the new annotations.
  • `testDebugUnitTest` passes (548 tests).
  • Smoke install over a clean v1.5.0 install on a real device. Confirm no crash on launch.
  • Confirm in-app update check actually fires the dialog when v1.5.3 (future) is released. (Will be validated naturally on the next release.)

Follow-ups

  • Enable Room `exportSchema = true` and add an instrumented `MigrationTestHelper` test that exercises every migration path with realistic v1 data and validates the resulting schema. (Open as separate issue.)
  • Update CLAUDE.md or a release-checklist doc to require a pre-merge smoke install over the previous release before tagging.

Communication plan after merge

  • Tag v1.5.2, build, upload APK to the release.
  • Update website download links to v1.5.2.
  • Forum + X post calling out: v1.5.0 / v1.5.1 users must manually grab v1.5.2 once.

Summary by CodeRabbit

Bug Fixes

  • Fixed app crash when upgrading from version 1.5.0 or earlier.
  • Fixed in-app update notifications to detect new releases correctly.
  • Users upgrading from v1.5.0 or v1.5.1 must manually install this release; subsequent updates will work automatically.

v1.5.1 crashed on launch when upgrading from v1.5.0 (or any earlier
version) with Room reporting a TableInfo mismatch with two specific diffs:

1. transactions table had idx_tx_pending in the migrated DB but the
   entity only declared idx_tx_wallet_network_time. MIGRATION_5_6
   created idx_tx_pending as a partial index in raw SQL because @Index
   cannot express WHERE clauses. The migration comment claimed Room
   ignores indices it didn't create, but Room's pragma-based
   introspection does see the index and validates it.

2. transactions.walletId column had DEFAULT '' from MIGRATION_2_3 but
   the entity field had no @ColumnInfo(defaultValue) annotation.
   balance_cache.walletId and dao_cells.walletId have the same shape.

Adds:
- @Index for idx_tx_pending on TransactionEntity (matches columns +
  name; Room compares by name/columns/orders, not WHERE clauses).
- @ColumnInfo(defaultValue = "''") on the three walletId columns.

Existing MigrationTest uses inMemoryDatabaseBuilder so it never
exercises real migration paths. Proper instrumented MigrationTestHelper
tests are tracked as follow-up.
UpdateRepository polled api.github.com/repos/AgustaRC/ckb-wallet-gateway
which 404s. The fork URL was in the v1.5.0 + v1.5.1 builds, so the
in-app 'new version available' notification never fired for any user.

Fix: poll RaheemJnr/pocket-node. Users on v1.5.0/v1.5.1 still won't
notice this fix until they manually grab v1.5.2 once; from v1.5.2
onward, auto-update works.
Hotfix for v1.5.1's migration crash and the broken auto-update URL.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pocket-node Ready Ready Preview, Comment Apr 30, 2026 10:24am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c843f33c-0aac-47b5-9867-5edbf2896175

📥 Commits

Reviewing files that changed from the base of the PR and between d94098d and e77abf9.

📒 Files selected for processing (6)
  • android/app/build.gradle.kts
  • android/app/src/main/java/com/rjnr/pocketnode/data/database/entity/BalanceCacheEntity.kt
  • android/app/src/main/java/com/rjnr/pocketnode/data/database/entity/DaoCellEntity.kt
  • android/app/src/main/java/com/rjnr/pocketnode/data/database/entity/TransactionEntity.kt
  • android/app/src/main/java/com/rjnr/pocketnode/data/update/UpdateRepository.kt
  • fastlane/metadata/android/en-US/changelogs/8.txt

📝 Walkthrough

Walkthrough

The Android app version is incremented from 1.5.1 to 1.5.2. Room entity walletId columns are annotated with @ColumnInfo(defaultValue = "''") to align with database migrations. The update-check endpoint is redirected from the old repository to the correct GitHub project. A changelog documenting the fixes is added.

Changes

Cohort / File(s) Summary
Version Updates
android/app/build.gradle.kts, fastlane/metadata/android/en-US/changelogs/8.txt
Increment versionCode from 7 to 8 and versionName from 1.5.1 to 1.5.2; add release notes for v1.5.2 describing Room schema migration fix and correct GitHub update endpoint.
Room Entity Schema Fixes
android/app/src/main/java/com/rjnr/pocketnode/data/database/entity/BalanceCacheEntity.kt, DaoCellEntity.kt, TransactionEntity.kt
Annotate walletId columns with @ColumnInfo(defaultValue = "''") to align entity definitions with migrated database schema; TransactionEntity also adds new idx_tx_pending index to entity metadata.
Update Repository
android/app/src/main/java/com/rjnr/pocketnode/data/update/UpdateRepository.kt
Redirect GitHub API endpoint from outdated AgustaRC/ckb-wallet-gateway to correct RaheemJnr/pocket-node releases URL; add comment documenting historical behavior change at v1.5.2.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Poem

🐰 Version bumps and schemas align,
Wallets now default with a shine,
The update flows to the right repo today,
Migrations fixed—now we're on our way! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: a hotfix addressing two critical blockers (migration crash and broken auto-update URL) in v1.5.2, matching the changeset content.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-1.5.2-migration-and-update-url

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@RaheemJnr RaheemJnr merged commit 79fa614 into main Apr 30, 2026
5 checks passed
@RaheemJnr RaheemJnr deleted the fix/release-1.5.2-migration-and-update-url branch April 30, 2026 10:30
RaheemJnr added a commit that referenced this pull request Apr 30, 2026
…) (#147)

* test(db): walking-migration regression guard + Room schema export (#142)

The pre-existing MigrationTest used Room.inMemoryDatabaseBuilder which
creates the schema directly from the current entity declarations and
never exercises Migration.migrate code paths. So when v1.5.1's entity
declarations drifted from what the migrations produced, the in-memory
test passed but real upgraders crashed at launch (#141, #143).

Adds:

1. Room schema export (exportSchema = true + ksp arg pointing at
   app/schemas/). Generates a versioned JSON dump per @database
   version. v9 committed in this PR. Future schema drift becomes
   visible in PR diffs.

2. WalkingMigrationTest: bootstraps a SQLite file at v8 with a known
   historical shape, opens it via Room.databaseBuilder, and lets Room
   run MIGRATION_8_9 + validate the result against entity declarations.
   Two test methods cover the divergent v8 shapes that existed in the
   wild after v1.5.1:
     - Path A (upgrade-from-v1.5.0): walletId DEFAULT '' + partial
       idx_tx_pending already on disk.
     - Path B (fresh-install-on-v1.5.1): neither.
   Both must converge to v9 successfully.

3. Regression-guard test that registers a no-op MIGRATION_8_9 (what
   the first cut of #143 shipped) and asserts path B fails with the
   exact 'Migration didn't properly handle' exception that surfaced
   in production. Permanent in-codebase guard against the test losing
   its detection power.

Note on scope: the JVM/Robolectric harness here covers the v8→v9
upgrade path because that is where the historical fork lives.
Walking from v1 forward is harder without an exported schema for v1
and is tracked in #144 Phase 2 (instrumented MigrationTestHelper).

* fix(ci): don't commit Room schema JSONs (kotlinx-serialization conflict)

CI's clean build hit AbstractMethodError in Room's
SchemaBundle.$serializer because Room 2.8.4's bundled
kotlinx-serialization-core is binary-incompatible with the project's
kotlinx-serialization-json:1.8.0 on a fresh classpath. Local builds
didn't repro because of cached classloaders.

When a schema JSON exists at the target version, Room's processor
deserializes it to diff against the new export. With no JSON present,
Room only writes a new one, no deserialize path, no crash.

Workaround: don't commit the JSONs. They're still generated on every
build (locally and in CI), they just don't get persisted. The
walking-migration test doesn't depend on them — it validates against
entity declarations directly.

Trade-off lost: schema diffs aren't visible in PR review. We get them
back when we either upgrade Room to a version compiled against
kotlinx-serialization 1.8.x, or downgrade kotlinx-serialization-json to
1.7.x. Tracked alongside #142.

* fix(ci): turn Room exportSchema off; track re-enable in #149

Same AbstractMethodError surfaced even after .gitignore'ing the JSONs:
Room's deserialize path runs on every KSP cycle, not only when an
existing schema file is present. The dep conflict between Room 2.8.4
and kotlinx-serialization 1.8.0 needs a real fix before exportSchema
can be on.

Reverts the @database exportSchema flag and the room.schemaLocation
KSP arg. The walking-migration test under src/test/ still validates
schema-vs-entity drift via Room's onMigrate path, so #142's
regression-guard value is unaffected.

Re-enabling tracked in #149.
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.

1 participant