Repository navigation
[skills] Diff platform API when bumping a platform revision - #13663
Conversation
Context: #13388 Context: #13661 Context: https://issuetracker.google.com/issues/584834598 #13388 bumped `platform-37.2_r01` to `platform-37.2_r02` and changed only the hash. r02 removed public API that `src/Mono.Android/Profiles/api-37.2.xml` still bound, and nobody saw it until #13661. The removed APIs had no `@SystemApi`, `@FlaggedApi`, or `@hide` in r01, so an annotation filter would not catch this. A diff of the two `android.jar` files does. Add `scripts/diff_platform_api.cs` to the `update-androidsdk-packages` skill: dotnet run .github/skills/update-androidsdk-packages/scripts/diff_platform_api.cs -- \ <old-zip-url> <old-sha256> <new-zip-url> <new-sha1> <new-size> It checks the old zip against the SHA-256 pinned in `androidsdk.targets` and the new zip against the manifest SHA-1 and size. It hashes every `.class` in both `android.jar` files, runs `javap -protected` on the removed, added, and changed classes, and prints a Markdown report with the new SHA-256. Package-private types are ignored. `javap` does not show parameter names, so a parameter rename is not reported. New hard rule 8: every revision bump of an existing `_PlatformPackage` entry puts the report in the PR description. If public API was removed or changed, the PR still opens, but its description starts with a "Do not merge" warning to update `api-<level>.xml` first. skill-runner can only change `Configuration.props` and `androidsdk.targets`, so it cannot fix the binding itself; stopping would hide the change in the tracking issue. `skill-runner.md` (lock recompiled), `package-catalog.md`, and a new eval follow the same rule. Validation, with the .NET 11.0.100 SDK and JDK 17 on Windows: * `platform-37.2_r01` -> `platform-37.2_r02`: exit 0, binding follow-up required. 88 removed types; removed members on `Notification`, `Notification.Builder`, `StatusBarManager`, and `NotificationListenerService.Ranking`; `PolicyIdentifier` is no longer `final`; added `Manifest.permission.READ_UPDATE_ENGINE_LOGS` and `ViewGroup.requestChildRectangleOnScreen(View, Rect, boolean, int)`. The printed SHA-256 matches the r02 hash in #13661. * `platform-37.2_r02` against itself: exit 0, no changes. * Wrong pinned SHA-256: exit 1 with a mismatch error. * No temp directory remains after each run. * `gh aw compile skill-runner`: succeeded. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The API diff can miss Android API changes because javap may inspect host JDK classes instead of the downloaded archives and omits constant values, potentially leaving bindings stale.
2 open issues
What changed in this PR
This PR adds platform API comparison to the Android SDK package-refresh process, addressing the gap exposed by the API removals in platform 37.2 r02.
Changes:
- Adds a script that verifies both archives, compares their Java APIs, and reports the new SHA-256.
- Requires API reports for platform revision bumps and a “Do not merge” warning when binding follow-up is needed.
- Updates workflow guidance and adds an evaluation for the r01 → r02 scenario.
| File | Description |
|---|---|
.github/workflows/skill-runner.md |
Carries required API reports and warnings into PRs and tracking reports. |
.github/workflows/skill-runner.lock.yml |
Updates the compiled workflow’s body hash. |
.github/skills/update-androidsdk-packages/SKILL.md |
Adds the mandatory API-diff rule and command. |
.github/skills/update-androidsdk-packages/scripts/diff_platform_api.cs |
Verifies archives and generates a Markdown API comparison. |
.github/skills/update-androidsdk-packages/references/package-catalog.md |
Links platform revision updates to the API-diff requirement. |
.github/skills/update-androidsdk-packages/evals/evals.json |
Adds an evaluation for detecting removals and warning before merge. |
Review effort: Balanced
With `-cp android.jar`, `javap` reads `java.*` classes such as `java.lang.Thread` from the host JDK, so the old and new output came from the same JDK class. Pass `jar:file:...!/...class` URLs instead. Add `-constants` so a changed constant value shows in the diff. Re-ran platform-37.2_r01 -> r02: 88 removed types, 7 changed types, binding follow-up required. Constants now show values. Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "169.254.169.254"See Network Configuration for more information.
|
There was a problem hiding this comment.
⚠️ Needs Changes — CI is red; no new must-fix code defect identified
Reviewed all six changed files at d90c22c8d5, including the complete committed script and workflow, and checked the report logic against the binding metadata reader. Inline findings: 0 errors, 0 warnings, 2 suggestions (document annotation/deprecation limitations and cover the resolved JDK-lookup/constant-value bugs with regression scenarios).
The checksum verification is fail-closed, extraction targets an explicit filename, process failures are surfaced, and temporary-directory cleanup is reported separately. The explicit jar: URLs and -constants address the two previously resolved review findings. The caution banner is carried into both the generated PR description and tracking report without expanding the workflow's write scope.
CI: All 38 returned checks are completed. CLA, the three platform builds, and the Android Tools checks passed, but Azure build 1690959 and six test lanes failed: Windows MSBuild 5/6, macOS MSBuild 6/7, macOS APKs 2, and Linux MSBuild 2. Azure build/timeline queries were attempted, but the CLI required authentication and the parallel timeline query encountered an initialization error. Root-cause classification is therefore incomplete; these failures are not established as either PR regressions or flakes, and CI cannot be called green.
Review limits: origin/main...HEAD has no merge base in this checkout, so the GitHub diff was used. The restored working-tree configuration differs from the PR, including an absent script, so changed files were read from HEAD rather than reviewing those unrelated workspace changes. .NET 11.0.100 is available, but javap -version execution was denied; I did not independently rerun the archive comparisons reported in the PR description. No repository files were modified.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
169.254.169.254
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "169.254.169.254"See Network Configuration for more information.
Generated by Android PR Reviewer for #13663 · copilot · gpt61 · 53.3 AIC · ⌖ 12.1 AIC · ⊞ 20.3K
Comment /review to run again
| <old-zip-url> <old Hash from androidsdk.targets> <new-zip-url> <manifest-sha1> <manifest-size> | ||
| ``` | ||
|
|
||
| It does not report parameter-name changes. |
There was a problem hiding this comment.
🤖 💡 Documentation — Could we also mention that this compares declarations and constant values, not annotation/deprecation metadata? javap -protected -constants does not print those attributes, so an annotation-only change can change the class hash but leave the compared lines identical, producing Binding follow-up required: no. Our bytecode-to-XML pipeline consumes deprecation and nullability metadata (XmlClassDeclarationBuilder), so documenting this limitation would prevent readers from treating the report as a complete binding-API comparison.
{Rule: Document actual behavior and limitations}
| "expected_output": "platform-37.2_r01 is updated in place to platform-37.2_r02 with the SHA-256 from diff_platform_api.cs. The script reports 88 removed types and removed members on Notification, Notification.Builder, StatusBarManager, and NotificationListenerService.Ranking. The PR opens, starts with the Do not merge warning about src/Mono.Android/Profiles/api-37.2.xml, and contains the full script output.", | ||
| "assertions": [ | ||
| "diff_platform_api.cs runs with the old pinned SHA-256 and the new manifest SHA-1 and size.", | ||
| "The PR description starts with the Do not merge warning and contains the full API diff." |
There was a problem hiding this comment.
🤖 💡 Testing — Consider adding regression scenarios for the two fixes in the latest commit: an Android java.* member that differs from the host JDK, and a public constant whose value changes without changing its declaration. This eval covers the original 37.2 removal incident, but explicit assertions for those cases would protect the jar: lookup and -constants behavior from regressing while the main removal report still looks correct.
{Rule: Specific regression coverage for bug fixes}
|
CI triage for build 1690959:
These failures appear unrelated to this PR, which changes the SDK-update skill and skill-runner workflow rather than the Android build or tests. CI is still red; retrying the affected jobs is reasonable, but may not resolve the Gradle failure. |

Context: #13388
Context: #13661
Context: https://issuetracker.google.com/issues/584834598
#13388 bumped
platform-37.2_r01toplatform-37.2_r02and changed only the hash. r02 removed public API thatsrc/Mono.Android/Profiles/api-37.2.xmlstill bound, and nobody saw it until #13661. The removed APIs had no@SystemApi,@FlaggedApi, or@hidein r01, so an annotation filter would not catch this. A diff of the twoandroid.jarfiles does.Add
scripts/diff_platform_api.csto theupdate-androidsdk-packagesskill:It checks the old zip against the SHA-256 pinned in
androidsdk.targetsand the new zip against the manifest SHA-1 and size. It hashes every.classin bothandroid.jarfiles, runsjavap -protected -constantson the removed, added, and changed classes (read throughjar:URLs, sojava.*classes are not taken from the host JDK), and prints a Markdown report with the new SHA-256. Package-private types are ignored.javapdoes not show parameter names, so a parameter rename is not reported.New hard rule 8: every revision bump of an existing
_PlatformPackageentry puts the report in the PR description. If public API was removed or changed, the PR still opens, but its description starts with a "Do not merge" warning to updateapi-<level>.xmlfirst. skill-runner can only changeConfiguration.propsandandroidsdk.targets, so it cannot fix the binding itself; stopping would hide the change in the tracking issue.skill-runner.md(lock recompiled),package-catalog.md, and a new eval follow the same rule.Validation, with the .NET 11.0.100 SDK and JDK 17 on Windows:
platform-37.2_r01->platform-37.2_r02: exit 0, binding follow-up required. 88 removed types; removed members onNotification,Notification.Builder,StatusBarManager, andNotificationListenerService.Ranking;PolicyIdentifieris no longerfinal; addedManifest.permission.READ_UPDATE_ENGINE_LOGSandViewGroup.requestChildRectangleOnScreen(View, Rect, boolean, int). The printed SHA-256 matches the r02 hash in [Mono.Android] Remove APIs dropped in API-37.2 platform r02 #13661.platform-37.2_r02against itself: exit 0, no changes.gh aw compile skill-runner: succeeded.