Skip to content

Retrofit Migration - #25

Open
caleb-bit wants to merge 3 commits into
caleb/vmfrom
caleb/retrofit
Open

Retrofit Migration#25
caleb-bit wants to merge 3 commits into
caleb/vmfrom
caleb/retrofit

Conversation

@caleb-bit

@caleb-bit caleb-bit commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Overview

Migrated to Retrofit and fixed parameter names.

Test Coverage

  • Tested on Emulator

Next Steps

  • Migrate to Compose

Summary by CodeRabbit

  • New Features

    • Added more reliable course, tracking, session, notification, and search data handling.
    • Improved network communication for loading and updating course information.
    • Added safer handling for unreadable notification data.
  • Bug Fixes

    • Corrected course titles, catalog numbers, tracking indicators, and session details across the app.
    • Improved session expiration handling to support longer-lasting sessions.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 25f357d7-be96-435d-95d8-513142f9f992

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ee5d820f-4704-44db-b679-1650f72cfbc7

📥 Commits

Reviewing files that changed from the base of the PR and between 6025c86 and 8ba8ea3.

📒 Files selected for processing (20)
  • app/build.gradle
  • app/src/main/java/com/cornellappdev/coursegrab/CourseDetailsActivity.kt
  • app/src/main/java/com/cornellappdev/coursegrab/LoginViewModel.kt
  • app/src/main/java/com/cornellappdev/coursegrab/MainActivity.kt
  • app/src/main/java/com/cornellappdev/coursegrab/NotificationModal.kt
  • app/src/main/java/com/cornellappdev/coursegrab/NotificationService.kt
  • app/src/main/java/com/cornellappdev/coursegrab/SearchActivity.kt
  • app/src/main/java/com/cornellappdev/coursegrab/models/ApiResponse.kt
  • app/src/main/java/com/cornellappdev/coursegrab/models/Course.kt
  • app/src/main/java/com/cornellappdev/coursegrab/models/CourseNotification.kt
  • app/src/main/java/com/cornellappdev/coursegrab/models/SearchContainer.kt
  • app/src/main/java/com/cornellappdev/coursegrab/models/SearchResult.kt
  • app/src/main/java/com/cornellappdev/coursegrab/models/TrackingContainer.kt
  • app/src/main/java/com/cornellappdev/coursegrab/models/UserSession.kt
  • app/src/main/java/com/cornellappdev/coursegrab/networking/CourseGrabRepository.kt
  • app/src/main/java/com/cornellappdev/coursegrab/networking/CourseGrabService.kt
  • app/src/main/java/com/cornellappdev/coursegrab/networking/Endpoint.kt
  • app/src/main/java/com/cornellappdev/coursegrab/networking/NetworkModule.kt
  • app/src/main/java/com/cornellappdev/coursegrab/networking/UserEndpoints.kt
  • build.gradle
💤 Files with no reviewable changes (2)
  • app/src/main/java/com/cornellappdev/coursegrab/networking/Endpoint.kt
  • app/src/main/java/com/cornellappdev/coursegrab/networking/UserEndpoints.kt

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The app migrates backend communication from direct OkHttp and Gson handling to Retrofit with Kotlin serialization. Models now expose camelCase properties while preserving existing snake_case JSON fields. Repositories, notifications, session handling, and UI adapters use the updated models.

Changes

Networking and serialization migration

Layer / File(s) Summary
Serialization contracts and build setup
build.gradle, app/build.gradle, app/src/main/java/com/cornellappdev/coursegrab/models/*
The build enables Kotlin serialization and Retrofit. API models gain serialization support. Kotlin properties use camelCase names with serialized snake_case mappings where required.
Retrofit service and dependency wiring
app/src/main/java/com/cornellappdev/coursegrab/networking/CourseGrabService.kt, app/src/main/java/com/cornellappdev/coursegrab/networking/NetworkModule.kt
The app adds typed Retrofit endpoints and Hilt providers for JSON, OkHttp, Retrofit, and CourseGrabService.
Repository delegation and response handling
app/src/main/java/com/cornellappdev/coursegrab/networking/CourseGrabRepository.kt
The repository delegates session, course, tracking, device-token, and notification operations to CourseGrabService. It maps response success flags and exceptions to Result values.
Session, notification, and UI model access
app/src/main/java/com/cornellappdev/coursegrab/LoginViewModel.kt, app/src/main/java/com/cornellappdev/coursegrab/NotificationService.kt, app/src/main/java/com/cornellappdev/coursegrab/*Activity.kt, app/src/main/java/com/cornellappdev/coursegrab/NotificationModal.kt
Session, notification, and UI code now reads camelCase model properties. Notification payloads use Kotlin serialization and log unreadable payloads.
Estimated code review effort: 4 (Complex) ~45 minutes

Merge Risk: ⚪ Minimal · up to 8ba8e

This PR migrates the networking implementation to Retrofit and updates related parameter names; no actionable merge-blocking risk remains based on the supplied evidence.

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant CourseGrabRepository
  participant CourseGrabService
  participant Retrofit
  participant Backend
  App->>CourseGrabRepository: request session, course, tracking, or notification operation
  CourseGrabRepository->>CourseGrabService: call typed suspend endpoint
  CourseGrabService->>Retrofit: serialize request and create HTTP call
  Retrofit->>Backend: send authenticated request
  Backend-->>Retrofit: return serialized ApiResponse
  Retrofit-->>CourseGrabService: deserialize response with Json
  CourseGrabService-->>CourseGrabRepository: return ApiResponse
  CourseGrabRepository-->>App: return Result
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes an overview, emulator test coverage, and next steps. It omits the required Changes Made section and does not provide implementation details for the Retrofit migration or param… Add a Changes Made section that describes the Retrofit service, serialization, dependency, networking-module, repository, and model updates. Keep the emulator test details and state whether Related PRs or Screenshots & Videos are not applic…
Docstring Coverage ⚠️ Warning Docstring coverage is 6.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 16 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: migration to Retrofit. It is concise and related to the changeset.
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.
Full details: Description check

Explanation

The description includes an overview, emulator test coverage, and next steps. It omits the required Changes Made section and does not provide implementation details for the Retrofit migration or parameter-name fixes.

Resolution

Add a Changes Made section that describes the Retrofit service, serialization, dependency, networking-module, repository, and model updates. Keep the emulator test details and state whether Related PRs or Screenshots & Videos are not applicable by deleting those sections if appropriate.

Full details: Docstring Coverage

Explanation

Docstring coverage is 6.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 16 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch caleb/retrofit

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.

@caleb-bit
caleb-bit requested a lite review from Copilot August 29, 2026 21:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@caleb-bit
caleb-bit requested a review from conniecliu August 29, 2026 21:38
) No newline at end of file
@SerialName("session_token") val sessionToken: String? = null,
@SerialName("update_token") val updateToken: String? = null,
@SerialName("session_expiration") val sessionExpiration: Long? = null

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does backend send a JSON number instead of numeric string now?

}

private companion object {
const val TAG = "NotificationService"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: I'm pretty sure this is ok but curious - do we expect another TAG value other than "NotificationService"? I'm wondering what the difference between this v.s. just passing in the value directly to the log on line 46.

@conniecliu conniecliu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Aside from the two comments I think everything else lgtm!

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.

3 participants