Skip to content

persists tags and readme content#84

Merged
maazm7d merged 4 commits intomainfrom
room-impl
Mar 5, 2026
Merged

persists tags and readme content#84
maazm7d merged 4 commits intomainfrom
room-impl

Conversation

@maazm7d
Copy link
Copy Markdown
Owner

@maazm7d maazm7d commented Mar 5, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Tools now support tags and readme metadata
    • Readme content is dynamically retrieved and cached for offline access
  • Improvements

    • Enhanced database structure with optimized data synchronization
    • Database schema updated to version 5 for improved data integrity

maazm7d added 4 commits March 6, 2026 00:36
Implement TypeConverters for Room database to handle List<String> serialization and deserialization using Moshi.
Added 'tags' and 'readme' properties to ToolEntity.
Refactor tool entity insertion to use batch insert and preserve readme.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Upgrades Room database schema from version 4 to 5, introduces type conversion support for List fields using Moshi, adds tags and readme columns to ToolEntity, and refactors ToolRepositoryImpl to use batch inserts with lazy readme fetching from remote sources when missing locally.

Changes

Cohort / File(s) Summary
Database Schema & Type Conversion
app/src/main/java/com/maazm7d/termuxhub/data/local/AppDatabase.kt, app/src/main/java/com/maazm7d/termuxhub/data/local/Converters.kt
Bumps Room database version to 5, adds @TypeConverters annotation to AppDatabase. Introduces new Converters class with Moshi-based TypeConverter methods to serialize/deserialize List<String> to/from JSON.
Data Model Extension
app/src/main/java/com/maazm7d/termuxhub/data/local/entities/ToolEntity.kt
Adds two new nullable persistent fields: tags (List<String>?) and readme (String?) mapped to database columns.
Repository Logic Refactoring
app/src/main/java/com/maazm7d/termuxhub/data/repository/ToolRepositoryImpl.kt
Replaces per-item inserts with batch operations using insertAll(), adds null-safe mapping with mapNotNull, extends entity mapping to include publishedAt, tags, and readme. Introduces lazy readme retrieval in getToolDetails() that fetches from remote only if local readme is blank and persists to database.

Sequence Diagram

sequenceDiagram
    actor Client
    participant Repo as Repository
    participant LocalDB as Local Database
    participant RemoteAPI as Remote API
    
    Client->>Repo: getToolDetails(toolId)
    Repo->>LocalDB: Query ToolEntity
    LocalDB-->>Repo: ToolEntity (readme may be blank)
    
    alt readme is blank or empty
        Repo->>RemoteAPI: Fetch tool details
        RemoteAPI-->>Repo: Tool data with readme
        Repo->>Repo: Extract readme content
        Repo->>LocalDB: Update ToolEntity with readme
        LocalDB-->>Repo: Update confirmed
    end
    
    Repo->>Repo: Construct ToolDetails with readme
    Repo-->>Client: Return ToolDetails
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 In the warren of schemas, we hop with delight,
Type converters and batches now nestled just right!
Tags and readmes bloom forth from our database store,
Lazy loading the wisdom we didn't have before!
Schema version five dances—our data's in flight!

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'persists tags and readme content' accurately and concisely summarizes the main changes across the pull request, which focus on adding database persistence for tags and readme fields.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch room-impl

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

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

@maazm7d maazm7d merged commit cd767ce into main Mar 5, 2026
1 of 2 checks passed
@maazm7d maazm7d deleted the room-impl branch March 5, 2026 19:18
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