Skip to content

chore(release): refresh metadata to v9.0.43 and fix RFC3966 backtracking for 2.1.4 - #459

Merged
iziz merged 1 commit into
masterfrom
metadata-v9-0-43
Nov 7, 2026
Merged

iziz merged 1 commit into
masterfrom
metadata-v9-0-43

Conversation

@iziz

@iziz iziz commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Refresh the bundled Google libphonenumber metadata from v9.0.42 to v9.0.43, and set every Xcode project and podspec to the patch version 2.1.4.
  • Port Google's fix for catastrophic regular-expression backtracking in the RFC3966 phone-context domain-name check (google/libphonenumber#4070), along with its test testParseRfc3966PhoneContextDomain.
  • These fix both failing jobs in Upstream Drift run 42329942884. Metadata freshness failed because v9.0.43 was available. Google master parity failed because the upstream test was missing locally.

RFC3966 backtracking fix

The domain-label patterns [alnum]+((\-)*[alnum])* and [alpha]+((\-)*[alnum])* are ambiguous. On a long, invalid phone-context such as aa.aa.…aa! or a-a-…a!, the regex engine backtracks exponentially. NBPhoneNumberUtil.m now uses the upstream forms:

  • domainLabel: [alnum]+(\-+[alnum]+)*
  • topLabel: [alpha][alnum]*(\-+[alnum]+)*

Each hyphen run must now be followed by an alphanumeric, so the set of accepted domains does not change. With the old pattern, the ported test did not finish within a 120-second timeout. With the new pattern it passes in about 7 ms.

Upstream / Metadata

  • Google libphonenumber ref: metadata from v9.0.43 (86ea33cee5c2); logic from master (981600cc587f, #4070)
  • Metadata updated: yes
    • Phone-number metadata: changes affect BJ, CN, DE, EC, ET, GE, LA, RO, and ZW.
    • Carrier data: grows from 32,099 to 32,255 prefix rows.
    • Unchanged: short-number and testing metadata.
    • Timezone data: rows are byte-identical; only the recorded upstream_ref changes.
  • Geocoding metadata updated: yes, en.db and zh.db only.
    • en.db: Zimbabwe (263) rows change, and the Australian prefix 61261069 is dropped.
    • zh.db: three corrupted 86 descriptions are fixed.
    • Both match the upstream resources/geocoding diff.
    • The other 32 databases were regenerated with identical contents and left at their committed bytes.

Parity Checks

  • swift scripts/checkUpstreamTestParity.swift --upstream-ref v9.0.43: 173 upstream / 182 local, passed
  • swift scripts/checkUpstreamTestParity.swift --upstream-ref master: 174 upstream / 182 local, passed
  • swift scripts/checkUpstreamAPIParity.swift --upstream-ref v9.0.43 and --upstream-ref master: 66 upstream / 93 local, passed
  • swift scripts/checkMetadataFreshness.swift --current-ref v9.0.43 --fail-on-update: up to date

Tests

  • swift test: 232 XCTest cases and 43 Swift Testing tests passed
  • LC_ALL=ko_KR.UTF-8 LANG=ko_KR.UTF-8 swift test: same counts, passed
  • swift build -c release
  • swift test --sanitize=thread: not run; no shared state or facade entry point changed
  • xcodebuild test -scheme libPhoneNumber (iPhone 18 Pro / iOS 27.0): 151 tests passed
  • xcodebuild test -scheme libPhoneNumberGeocoding: 20 tests passed
  • xcodebuild test -scheme libPhoneNumberShortNumber: 31 tests passed
  • git diff --check

The generated Objective-C gzip array decodes exactly to generatedJSON/PhoneNumberMetaData.json (254 regions, 351,979 bytes). SQLite integrity_check passes for the carrier, timezone, en, and zh databases.

Changelog

  • CHANGELOG.md has a ## 2.1.4 section, following previous release PRs. Details are in docs/METADATA_UPDATE_LOG.md.

Notes

  • Intentional ObjC/API naming differences: none.
  • Upstream behavior intentionally not ported: none.
  • swift scripts/publishPodspecs.swift --lint has not been run for this PR yet.
  • Until Google tags a release that includes #4070, the soft-signal source-drift job will keep reporting phonenumberutil.js and phonenumberutil_test.js against master. This PR already ports that change.

Refresh bundled Google libphonenumber metadata from v9.0.42 to v9.0.43
(upstream commit 86ea33cee5c22ab7e23b3de368e7cc7fa439a2b7) and set every
Xcode project and podspec version to the patch 2.1.4.

Phone-number changes affect BJ, CN, DE, EC, ET, GE, LA, RO, and ZW.
Carrier data grows from 32,099 to 32,255 prefix rows. Geocoding changes
are limited to en.db (Zimbabwe rows and one Australian prefix) and zh.db
(three corrupted Chinese descriptions). Short-number and testing metadata
are unchanged, and the timezone rows are byte-identical with only the
recorded upstream_ref advancing.

Also port Google's fix for catastrophic backtracking in the RFC3966
phone-context domain-name check (google/libphonenumber#4070), along with
the upstream testParseRfc3966PhoneContextDomain test. Before the fix the
test did not finish within 120 seconds; it now passes in milliseconds.
@iziz
iziz merged commit 91fcc74 into master Nov 7, 2026
11 checks passed
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