Skip to content

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

Open
nickolas-dimitrakas wants to merge 1 commit into
docs/kotlin-migration-playbookfrom
ci/kotlin-migration-progress
Open

nickolas-dimitrakas wants to merge 1 commit 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.78 KB -5 bytes
Download size 117.60 KB 117.60 KB -5 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": 2510, "baseline_install_bytes": 7526, "core_dex_bytes": 218884, "core_download_bytes": 122935, "core_install_bytes": 130188}

This PR:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2515, "baseline_install_bytes": 7531, "core_dex_bytes": 218884, "core_download_bytes": 122935, "core_install_bytes": 130188}

Measured 76c157c merged into 5fcb2ae

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

headline=":warning: This pull request **adds ${delta_java} lines** of Java to the published modules."
else
headline="No change to the Java left to convert."
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Headline hides warning when ratchet will fire

Low Severity

The headline branches on delta_left (non-facade Java) first, but the ratchet checks delta_java (all Java including facades). When delta_left < 0 and delta_java > 0 — e.g., a PR converts some non-facade Java while also growing a facade file — the headline cheerfully says "converts N lines" while the ratchet step fails the job. The PR comment gives no hint that the ratchet will fire, creating a confusing disconnect between the sticky comment and the red CI status.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6ade310. Configure here.

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

headline=":warning: This pull request **adds ${delta_java} lines** of Java to the published modules."
else
headline="No change to the Java left to convert."
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Headline misreports when Java-left increases silently

Low Severity

The headline logic has a gap: when delta_left > 0 (Java left to convert increased) but delta_java <= 0 (total Java didn't grow), the else branch fires and reports "No change to the Java left to convert," which is factually wrong. The ratchet also doesn't catch this because it only checks delta_java > 0. A realistic trigger is extracting code from a facade file into a new non-facade internal class — total Java stays flat, but convertible Java rises. Neither the headline nor the ratchet flags the regression.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e31d469. Configure here.

@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the ci/kotlin-migration-progress branch 2 times, most recently from 72ce820 to 01f50f5 Compare October 6, 2026 21:45
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>
@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the ci/kotlin-migration-progress branch from 01f50f5 to 76c157c Compare October 6, 2026 21:50
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