Skip to content

Remove unused dependencies; enforce the Gson version floor with a constraint#1945

Merged
bmander merged 3 commits into
mainfrom
chore/remove-unused-deps
Jul 18, 2026
Merged

Remove unused dependencies; enforce the Gson version floor with a constraint#1945
bmander merged 3 commits into
mainfrom
chore/remove-unused-deps

Conversation

@bmander

@bmander bmander commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Drops external dependencies that aren't referenced anywhere in app source, resources, or the manifest, and replaces the Gson "version pin via unused dependency" hack with a proper dependency constraint.

This came out of an audit that cross-referenced every catalog coordinate against real usage — necessary because neither the Kotlin compiler nor Android Lint flags an unused dependency (they analyze code correctness, not build-graph reachability), so this dead weight is invisible to the normal CI gates.

Removed (unused)

Dependency Why it's safe to drop
androidx.fragment:fragment-ktx No Fragment subclasses remain; app is fully Activity + Compose.
androidx.cardview:cardview Replaced by Compose Card; only doc-comment mentions of the legacy CardView remained.
androidx.constraintlayout:constraintlayout No app:layout_constraint* in any XML, no imports; layout is Compose.
org.apache.commons:commons-lang3 Zero references. (commons-io is used and is kept.)
androidx.concurrent:concurrent-futures + concurrent-listenablefuture (+ -callback) A ListenableFuture pin for WorkManager with no direct usage. The build's checkDuplicateClasses + dex merge pass without it, confirming it was not resolving a Guava/ListenableFuture conflict.

Gson: constraint instead of a phantom dependency

Gson had no call sites but was declared implementation(libs.gson) purely to force a transitive copy up. That's an unused library standing in for a version requirement. Replaced with a dependency constraint that floors the version only where Gson actually appears (transitively via firebase-firestore → io.grpc:grpc-core) without adding it to the classpath.

The old rationale was also stale: Gson isn't pulled in at 2.8.5 — it arrives at 2.10.1, already past the 2.8.9 CVE-2022-25647 fix. The constraint now honestly documents that it floors the transitive up to the catalog version (2.14.0) as forward protection against a future grpc/Firebase downgrade, not as a live-vuln patch.

Resolution is unchanged: Gson still resolves to 2.14.0 (now (c) / "By constraint" in dependencyInsight, no longer a direct edge).

Verification

  • assembleObaGoogleDebug -PwarningsAsErrors=trueBUILD SUCCESSFUL (green, no new warnings), including resource merge, checkDuplicateClasses, and dex merge.
  • After the Gson change the assemble is UP-TO-DATE, so the packaged APK is byte-identical — a behavior-preserving refactor.
  • Built the obaGoogle variant locally; CI covers the rest of the grid + lint.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Removed unused and unsupported dependency references.
    • Updated Compose dependencies and strengthened Gson version enforcement.
  • Tests

    • Migrated Compose UI tests to the newer unconfined test rule.
    • Added a shared test helper to preserve existing test behavior while removing deprecated rule usage.

bmander and others added 3 commits July 18, 2026 06:33
Six on-device Compose tests used the deprecated v1
`androidx.compose.ui.test.junit4.createComposeRule` behind a
`@Suppress("DEPRECATION")`, because the v2 rule's default
`StandardTestDispatcher` broke the `onGloballyPositioned` ->
`LaunchedEffect` -> `animateScrollTo` chains in EtaStrip/SlideBox when
#1792 was filed.

Route all six through a shared `createUnconfinedComposeRule()` helper
that calls the non-deprecated `v2.createComposeRule(...)` and pins
composition to an `UnconfinedTestDispatcher` via its `effectContext`
parameter, reproducing the old eager-execution semantics without any
deprecation suppression.

Investigated the original blocker: on the current stack
(compose-ui-test 1.11.4) plain v2 with StandardTestDispatcher now passes
all six tests on-device too — the rule's reworked waitUntil/idle
machinery pumps the dispatcher — so there is no upstream bug left to
file. Unconfined is retained only because SlideBoxTest is an @smoketest
on the API 23 floor emulator whose StandardTestDispatcher timing is
unvalidated.

Also correct a stale BOM version comment in build.gradle.kts
(2026.05.00/1.11.2 -> 2026.06.01/1.11.4).

Verified: androidTest compiles clean under -PwarningsAsErrors=true, and
all 12 tests across the six classes pass on-device (Pixel 7 Pro).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… commons-lang3, concurrent-futures)

None of these are referenced in app source, resources, or the manifest:

- androidx.fragment:fragment-ktx — no Fragment subclasses remain; the app is
  fully Activity + Compose.
- androidx.cardview:cardview — replaced by Compose Card; only doc-comment mentions
  of the legacy CardView remained.
- androidx.constraintlayout:constraintlayout — no app:layout_constraint* in any XML
  and no imports; layout is Compose.
- org.apache.commons:commons-lang3 — zero references (commons-io is still used and
  is kept).
- androidx.concurrent:concurrent-futures + concurrent-listenablefuture
  (+ -callback) — a ListenableFuture pin for WorkManager with no direct usage; the
  build's checkDuplicateClasses + dex merge pass without it, confirming it was not
  resolving a Guava/ListenableFuture conflict.

gson is intentionally kept: it has no call sites but is a deliberate version pin
forcing a transitive Gson up off 2.8.5 (see the comment at its dependency line).

Verified with assembleObaGoogleDebug -PwarningsAsErrors=true (green).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…dency

The Gson version floor was expressed by declaring `implementation(libs.gson)` even
though no app source references Gson — an unused library on the classpath standing
in for a version requirement. Replace it with a dependency constraint, which floors
the version only where Gson actually appears (transitively) without adding it as a
direct dependency.

Also corrects the stale rationale: Gson is not pulled in at 2.8.5. It arrives at
2.10.1 via firebase-firestore -> io.grpc:grpc-core, which is already past the 2.8.9
CVE-2022-25647 fix. The constraint floors that transitive up to the catalog version
(2.14.0) so a future grpc/Firebase bump can't drag it back down.

Resolution is unchanged: gson still resolves to 2.14.0 (now marked `(c)` / "By
constraint" in dependencyInsight, no longer a direct edge), and
assembleObaGoogleDebug is UP-TO-DATE, so the packaged APK is byte-identical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ebabb60-e0da-470c-b0e2-816314ac5a19

📥 Commits

Reviewing files that changed from the base of the PR and between 07adb02 and 3ed5221.

📒 Files selected for processing (9)
  • gradle/libs.versions.toml
  • onebusaway-android/build.gradle.kts
  • onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/ArrivalAlertIndicatorTest.kt
  • onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/EtaStripJustifyTest.kt
  • onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/RouteArrivalRowLongPressTest.kt
  • onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/compose/ComposeTestRules.kt
  • onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/compose/components/SlideBoxTest.kt
  • onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/home/arrivals/ServiceAlertsDialogTest.kt
  • onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/home/map/FocusBannerTest.kt
💤 Files with no reviewable changes (1)
  • gradle/libs.versions.toml

📝 Walkthrough

Walkthrough

The PR removes unused Gradle catalog entries, updates dependency constraints and the Compose BOM, adds a shared unconfined Compose test rule, and migrates seven UI tests from the deprecated Compose rule.

Changes

Dependency and Compose test updates

Layer / File(s) Summary
Gradle dependency catalog and wiring
gradle/libs.versions.toml, onebusaway-android/build.gradle.kts
Unused AndroidX and Commons Lang entries are removed, Gson is pinned through a dependency constraint, and the Compose BOM is updated.
Unconfined Compose rule helper
onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/compose/ComposeTestRules.kt
Adds createUnconfinedComposeRule() using the Compose v2 rule with UnconfinedTestDispatcher.
Compose test rule migration
onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/*Test.kt, onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/compose/components/SlideBoxTest.kt, onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/home/*/*Test.kt
Migrates seven Compose UI tests to the shared rule and removes deprecated-rule suppressions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

🚥 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 reflects the two main changes: unused dependency removal and switching Gson pinning to a constraint.
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.
✨ 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 chore/remove-unused-deps

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.

@bmander
bmander merged commit 92a4d02 into main Jul 18, 2026
3 checks passed
@bmander
bmander deleted the chore/remove-unused-deps branch July 18, 2026 07:20
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