ADFA-3879 resilient LastChange table#1302
Conversation
…; never crash regardless of LastChange table
📝 WalkthroughRelease NotesFeatures & Improvements
Technical Details
Risks & Best Practice Concerns
WalkthroughThis PR centralizes database version/last-change resolution by introducing a new ChangesDatabase Version Resolution and Integration
Tooltip Screenshot Testing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
common/src/androidTest/java/com/itsaky/androidide/utils/DatabaseVersionResolverTest.kt (1)
42-52: ⚡ Quick winConsider adding a test case for multiple
wholedbrecords.The current test verifies that a single
wholedbrecord is returned correctly. To ensure the query returns the latest record when multiplewholedbentries exist (especially after addingORDER BY changeTime DESCas suggested), consider adding a test case that inserts multiplewholedbrecords with different timestamps and verifies the most recent one is returned.🧪 Example test case
`@Test` fun returnsLatestWholedbRow_whenMultiplePresent() { createTable() insertRow("wholedb", "2026-05-01 10:00:00", "alice") insertRow("wholedb", "2026-05-09 02:00:20", "hal") insertRow("wholedb", "2026-05-03 14:30:00", "bob") assertEquals( "2026-05-09 02:00:20 hal", DatabaseVersionResolver.resolveDatabaseVersion(db), ) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@common/src/androidTest/java/com/itsaky/androidide/utils/DatabaseVersionResolverTest.kt` around lines 42 - 52, Add a new test in DatabaseVersionResolverTest (e.g., returnsLatestWholedbRow_whenMultiplePresent) that uses createTable() and insertRow() to insert multiple "wholedb" rows with different changeTime values, then assert DatabaseVersionResolver.resolveDatabaseVersion(db) returns the most recent record (timestamp + author); reference the existing returnsWholedbRow_whenPresent test for structure and ensure the inserted timestamps exercise the ORDER BY changeTime DESC behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/debug/AndroidManifest.xml`:
- Line 7: Remove the android:exported="true" attribute from the debug-only test
activity declaration (the activity launched by ActivityScenario.launch()) so the
activity is not exported to other apps; edit the debug AndroidManifest entry for
that test activity and either delete the android:exported attribute or set it to
false to restrict visibility.
In `@common/src/main/java/com/itsaky/androidide/utils/DatabaseVersionResolver.kt`:
- Around line 12-17: The QUERY_WHOLEDB SQL constant currently selects LIMIT 1
from LastChange without ordering, which can return non-deterministic rows;
update the QUERY_WHOLEDB constant to include an ORDER BY changeTime DESC
(matching QUERY_FALLBACK_LATEST) so the latest wholedb record is
deterministically returned when using LIMIT 1.
---
Nitpick comments:
In
`@common/src/androidTest/java/com/itsaky/androidide/utils/DatabaseVersionResolverTest.kt`:
- Around line 42-52: Add a new test in DatabaseVersionResolverTest (e.g.,
returnsLatestWholedbRow_whenMultiplePresent) that uses createTable() and
insertRow() to insert multiple "wholedb" rows with different changeTime values,
then assert DatabaseVersionResolver.resolveDatabaseVersion(db) returns the most
recent record (timestamp + author); reference the existing
returnsWholedbRow_whenPresent test for structure and ensure the inserted
timestamps exercise the ORDER BY changeTime DESC behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 016fc624-892c-440f-a64b-02ad7f47ea54
📒 Files selected for processing (7)
app/src/androidTest/kotlin/com/itsaky/androidide/idetooltips/TooltipDebugDialogScreenshotTest.ktapp/src/debug/AndroidManifest.xmlapp/src/debug/java/com/itsaky/androidide/idetooltips/TooltipScreenshotHostActivity.ktapp/src/main/java/com/itsaky/androidide/localWebServer/WebServer.ktcommon/src/androidTest/java/com/itsaky/androidide/utils/DatabaseVersionResolverTest.ktcommon/src/main/java/com/itsaky/androidide/utils/DatabaseVersionResolver.ktidetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt
…reenshotHostActivity.kt
…ooltipDebugDialogScreenshotTest.kt
Handle missing documentation.db LastChange wholedb record by fallback
Never crash regardless of LastChange table