Skip to content

chore(deps): drop Google's libphonenumber, use the Android port everywhere - #1272

Merged
bmc08gt merged 1 commit into
code/cashfrom
claude/drop-google-libphonenumber
Aug 20, 2026
Merged

chore(deps): drop Google's libphonenumber, use the Android port everywhere#1272
bmc08gt merged 1 commit into
code/cashfrom
claude/drop-google-libphonenumber

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Why

The app depended on two libphonenumber artifacts:

Artifact Used by
io.michaelrocks:libphonenumber-android (the Android port) :shared:phone, :shared:onramp:coinbase
com.googlecode.libphonenumber:libphonenumber (Google's desktop artifact) :shared:onramp:coinbase, plus 3 dead declarations

Each ships its own copy of the metadata, so any version skew between them meant the two could disagree on whether a number is valid. The port lags upstream, so it always set the ceiling — which is why the catalog carried a "keep these pinned together" comment and a Dependabot group rule. In practice that just blocked routine bumps: #1259 was a Google-only 9.0.37 that the port had not published yet.

Dropping the Google artifact removes the skew risk and the pin.

What changed

Three of the four Google declarations were dead. :services:flipcash, :services:flipcash-compose and :services:opencode each declared it, but have no Kotlin imports of it and no references to i18n/phonenumbers anywhere in their compiled output (build/tmp/kotlin-classes, build/intermediates/javac, build/generated). The catalog comment claimed "the services modules validate with Google's artifact" — that code does not exist. Removed.

The one real consumer is ported. PhoneRegion.regionFromPhone in :shared:onramp:coinbase moves to the Android artifact. That artifact loads its metadata from the AAR's assets instead of exposing a static getInstance(), so it needs a Context — the top-level function becomes an injectable PhoneRegionResolver, mirroring PhoneUtils in :shared:phone, lazy PhoneNumberUtil included so the metadata blob is parsed on first use rather than during construction on the main thread.

The test moves to Robolectric for that Context. Its 13 cases and their expected values are deliberately unchanged — they are the parity check that the port agrees with Google's artifact on every number covered.

With the Google artifact gone, the Dependabot group rule that kept the two aliases in lockstep is no longer needed.

Verification

  • :shared:onramp:coinbase:test :shared:phone:test :services:flipcash:testBUILD SUCCESSFUL; PhoneRegionTest reports tests="13" failures="0" errors="0"
  • :apps:flipcash:app:assembleDebugBUILD SUCCESSFUL
  • Resolved debugRuntimeClasspath: zero com.googlecode.libphonenumber entries; io.michaelrocks:libphonenumber-android:9.0.36 only

Note on regionFromPhone

It currently has no production callers — only its own test. CoinbaseOnrampApi has the matching subdivision query param, so it was built for a call that was never wired up. Ported rather than deleted, to keep that option open.

Relationship to #1269

#1269 added an ignore rule for com.googlecode.libphonenumber:libphonenumber 9.0.37 as a stopgap, and has since merged. This PR removes that rule along with the group rule — with the artifact gone from the build entirely, there is nothing left for either to act on.

@bmc08gt
bmc08gt requested a review from jeffyanta as a code owner August 20, 2026 15:05
…where

The app depended on two libphonenumber artifacts: the Android port
(io.michaelrocks:libphonenumber-android) and Google's desktop artifact
(com.googlecode.libphonenumber:libphonenumber). Each ships its own copy of the
metadata, so any version skew between them meant the two could disagree on
whether a number is valid — and since the port lags upstream, it always set the
ceiling and blocked routine bumps of the Google artifact.

Three of the four declarations were dead: :services:flipcash,
:services:flipcash-compose and :services:opencode declared the Google artifact
but had no Kotlin imports and no references to i18n/phonenumbers in their
compiled output. Removed.

The one real consumer, PhoneRegion in :shared:onramp:coinbase, is ported onto
the Android artifact. That artifact loads its metadata from the AAR's assets
rather than exposing a static instance, so it needs a Context — regionFromPhone
becomes an injectable PhoneRegionResolver, mirroring PhoneUtils in
:shared:phone (including the lazy PhoneNumberUtil so the metadata blob is parsed
on first use rather than during construction on the main thread).

The test moves to Robolectric for the Context. Its 13 cases and their expected
values are unchanged on purpose: they are the parity check that the port agrees
with Google's artifact on every number covered.

With the Google artifact gone, the dependabot group rule that kept the two
aliases in lockstep is no longer needed.
@bmc08gt
bmc08gt force-pushed the claude/drop-google-libphonenumber branch from 5668443 to e5c73c5 Compare August 20, 2026 16:08
@github-actions github-actions Bot added area: network gRPC, connectivity, API, exchange rates area: onramp Deposit, purchase, Coinbase, fiat on-ramp area: build-system Gradle, convention plugins, build-logic type: chore Maintenance, config, CI/CD labels Aug 20, 2026
@bmc08gt
bmc08gt merged commit 70e39e6 into code/cash Aug 20, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the claude/drop-google-libphonenumber branch August 20, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic area: network gRPC, connectivity, API, exchange rates area: onramp Deposit, purchase, Coinbase, fiat on-ramp type: chore Maintenance, config, CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant