Skip to content

ci: report Java to Kotlin migration progress on pull requests - #850

Merged
nickolas-dimitrakas merged 2 commits into
docs/kotlin-migration-playbookfrom
ci/kotlin-migration-progress
Oct 7, 2026
Merged

nickolas-dimitrakas merged 2 commits into
docs/kotlin-migration-playbookfrom
ci/kotlin-migration-progress

Conversation

@nickolas-dimitrakas

Copy link
Copy Markdown
Contributor

Summary

Implements the progress report and the "no new Java" ratchet that the migration playbook describes.

  • scripts/kotlin_migration_progress.py measures android-core/src/main and android-kit-base/src/main and reports, per module and in total: Kotlin LOC, Java LOC, Java that stays by design, Java left to convert, Kotlin share, and conversion progress against the 16,550-line baseline measured at 4ee3ba4c. Line counts match wc -l, so the numbers agree with the tracker.
  • scripts/kotlin-migration-facades.txt lists the 65 Java files that stay Java (the public API customers and kit authors compile against, per the playbook's Scope section, plus every package-info.java). At main they total 11,287 LOC.
  • New job Kotlin Migration Progress runs on every pull request: it measures the head and the base branch (the base with the head's facade list, so editing the list cannot masquerade as progress), posts a sticky comment with the table, and fails when the pull request adds Java to the published modules unless it carries the allow-new-java label. It is not in the required-check set.
  • scripts/test_kotlin_migration_progress.py covers the counting, the facade exclusion, the renderers and the clamping; CI runs it first.
  • TRACKER.md gains the 0.8 row and a "Checkpoints and expected numbers" table with the Java-left, conversion-progress and estimated Kotlin-share values expected at each stack and checkpoint; PLAYBOOK.md and AGENTS.md mention the job.

Verification

  • Unit tests: 5 passing.
  • Against main (4ee3ba4c): Java left 16,550, facade 11,287, Kotlin share 12.0%, conversion progress 0.0%.
  • The measure step's arithmetic was exercised locally against a main checkout as the base; on this stack it correctly reports the seams added by test: expose explicit test seams for package-private core internals #845 as new Java, which is the expected ratchet signal for that change.

Follow-up

The allow-new-java label does not exist yet and needs creating in the repository settings, alongside api-change-approved from #843.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Kotlin migration progress

No change to the Java left to convert.

Module Kotlin LOC Java LOC Java staying (facade) Java left to convert Kotlin share
android-core 3,238 22,515 9,636 12,879 12.6%
android-kit-base 557 5,380 1,651 3,729 9.4%
Total 3,795 27,895 11,287 16,608 12.0%

Conversion progress: 0.0% (16,608 of 16,550 baseline Java LOC left to convert). 132 Java files and 36 Kotlin files in scope.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

📦 SDK Size Impact Report

What the SDK adds to a minified release APK.

Measured against an empty baseline app. Unlike the Rokt kit, android-core ships no Compose and no resources, so there is nothing here that a host app would already provide.

mParticle Core SDK

Metric Target branch This PR Change
APK size 119.79 KB 119.79 KB -1 bytes
Download size 117.60 KB 117.60 KB +3 bytes
Dex bytes 213.75 KB 213.75 KB 0 bytes

➡️ SDK size impact change is minimal.

Raw measurements

Target branch:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2512, "baseline_install_bytes": 7528, "core_dex_bytes": 218884, "core_download_bytes": 122936, "core_install_bytes": 130189}

This PR:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2511, "baseline_install_bytes": 7528, "core_dex_bytes": 218884, "core_download_bytes": 122938, "core_install_bytes": 130188}

Measured 86c46f6 merged into c2e7df5

@nickolas-dimitrakas
nickolas-dimitrakas added this pull request to stack #851 September 24, 2026 05:47
@nickolas-dimitrakas nickolas-dimitrakas self-assigned this Sep 24, 2026
@nickolas-dimitrakas
nickolas-dimitrakas marked this pull request as ready for review October 6, 2026 18:21
@nickolas-dimitrakas
nickolas-dimitrakas requested a review from a team as a code owner October 6, 2026 18:21
@cursor

cursor Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
The changes only add CI reporting scripts, workflow jobs, and documentation without affecting SDK production runtime code.

Overview
Adds tooling and CI automation to track the Java-to-Kotlin migration progress across android-core and android-kit-base.

Introduces scripts/kotlin_migration_progress.py and unit tests to measure Java and Kotlin lines of code, conversion progress against baseline, and overall Kotlin share. Files defined in scripts/kotlin-migration-facades.txt are counted separately as designated Java facades that remain in Java by design.

Adds the Kotlin Migration Progress GitHub Actions workflow job to .github/workflows/pull-request.yml. The job posts sticky progress comments on pull requests and enforces a ratchet step that fails PRs introducing new Java without the allow-new-java label. Also updates migration documentation and checkpoints in PLAYBOOK.md, TRACKER.md, and AGENTS.md.

Reviewed by Cursor Bugbot for commit 76c157c. Bugbot is set up for automated code reviews on this repo. Configure here.

@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the ci/kotlin-migration-progress branch 2 times, most recently from 2caa271 to 6ade310 Compare October 6, 2026 20:43

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/pull-request.yml Outdated
@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the ci/kotlin-migration-progress branch from 6ade310 to e31d469 Compare October 6, 2026 21:04

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e31d469. Configure here.

Comment thread .github/workflows/pull-request.yml Outdated
@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the ci/kotlin-migration-progress branch 3 times, most recently from 01f50f5 to 76c157c Compare October 6, 2026 21:50
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Binary compatibility

  • ✅ android-core is compatible with 6.1.5 (115 classes compared, 1 with additions only).
  • ✅ android-kit-base is compatible with 6.1.5 (44 classes compared, 0 with additions only).

Compares the release AAR against the same artifact at the last version published to Maven Central; R8-renamed classes and members are excluded (see the script docstring). Full japicmp HTML/XML reports are attached as the api-compat-reports workflow artifact. This check is not in the required-check set yet, so a red result here does not block merging.

jamesnrokt
jamesnrokt previously approved these changes Oct 7, 2026

@jamesnrokt jamesnrokt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved and re-ran checks

nickolas-dimitrakas and others added 2 commits October 7, 2026 15:06
Adds scripts/kotlin_migration_progress.py, which measures android-core and
android-kit-base main sources and reports Java left to convert, the Kotlin
share and conversion progress against the baseline, with the public-facade
files that stay Java listed in scripts/kotlin-migration-facades.txt. A new
Kotlin Migration Progress job posts the numbers on every pull request,
measuring the base branch with the head's facade list, and fails when a pull
request adds Java to the published modules without the allow-new-java label.
The tracker gains the expected numbers at each checkpoint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The sticky-comment headline and the ratchet step disagreed in two cases:
when Java left to convert dropped but total Java still grew, the headline
said "converts N lines" with no hint the ratchet would fail the job; and
when Java left to convert increased but total Java did not, the headline
fell through to "No change," which was simply false, and the ratchet never
catches that case either since it only checks total Java.

Moved the headline decision out of untested inline bash and into a new
render_headline() in kotlin_migration_progress.py (plus a --headline CLI
mode), with delta_java checked first so the headline can never contradict
the ratchet, and an explicit branch for the previously-silent regression.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the ci/kotlin-migration-progress branch from 2ca9ca4 to 86c46f6 Compare October 7, 2026 19:06
@nickolas-dimitrakas
nickolas-dimitrakas merged commit e58595a into main Oct 7, 2026
91 of 92 checks passed
@nickolas-dimitrakas
nickolas-dimitrakas deleted the ci/kotlin-migration-progress branch October 7, 2026 19:49
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.

2 participants