Skip to content

Fix part of #6106: Implement GenerateChangelogs script with Vertex AI integration#6313

Open
Sandesh282 wants to merge 13 commits into
developfrom
pr2.1/generate-changelogs-script
Open

Fix part of #6106: Implement GenerateChangelogs script with Vertex AI integration#6313
Sandesh282 wants to merge 13 commits into
developfrom
pr2.1/generate-changelogs-script

Conversation

@Sandesh282

@Sandesh282 Sandesh282 commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Fixes part of #6106

Explanation

Adds the GenerateChangelogs.kt script that automates changelog generation between release branches. The script collects commits and linked GitHub issues between two release branches, sends them to Vertex AI (Gemini) to generate a human-readable changelog, writes the output to config/changelogs/, and opens a GitHub PR with the result. Includes LLM fallback logic for when the API is unavailable.

Files modified

scripts/BUILD.bazel
scripts/src/java/org/oppia/android/scripts/release/BUILD.bazel 

Files created

scripts/src/java/org/oppia/android/scripts/release/FakeVertexAiClient-kt
scripts/src/java/org/oppia/android/scripts/release/GenerateChangelogs.kt 
scripts/src/java/org/oppia/android/scripts/release/GoogleVertexAiClient.kt 
scripts/src/java/org/oppia/android/scripts/release/VertexAiClient.kt 

Essential Checklist

  • The PR title starts with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The explanation section above starts with "Fixes #bugnum: " (If this PR fixes part of an issue, use instead: "Fixes part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

…eration

Introduces a narrow VertexAiClient interface abstracting Vertex AI text
generation calls, and a FakeVertexAiClient for unit testing.

The fake records all received prompts, supports a configurable shouldFail
flag (auto-resets after each throw), and exposes a reset() helper — matching
the same pattern as FakePlayConsoleClient and FakeCloudSigner.

Part of fix #6106 (M2 PR 2.1 — GenerateChangelogs script).
Implements VertexAiClient using OkHttp + Moshi to call the Vertex AI
generateContent REST endpoint. Auth is via a GCP Bearer token obtained
through Workload Identity Federation in CI.

Key details:
- Sends synchronous HTTP POST to the generateContent endpoint
- Parses candidates[0].content.parts[0].text from the JSON response
- Fails with a descriptive message on non-2xx status or empty response
- apiBaseUrl is a companion object var, overridable in tests to point
  at a local MockWebServer without subclassing

Part of fix #6106 (M2 PR 2.1 — GenerateChangelogs script).
…og PRs

Implements the GenerateChangelogs.kt script that:
1. Reads MAJOR/MINOR_VERSION from version.bzl to derive the previous version
   whose changelog needs to be generated (e.g. bump 0.17→0.18 generates 0.17)
2. Finds the commit range between the two most recent release branch merge-bases
3. Collects merged PRs (via 'git log --oneline') and parses Fixes/Closes #NNNN
   issue references from commit subjects
4. Invokes Vertex AI (Gemini) with a structured prompt to produce a 2-3 sentence
   user-facing summary of the release
5. Falls back to a raw commit list with a <!-- LLM generation failed --> marker
   if the Vertex AI call throws, so the PR is still created for human review
6. Creates/updates a PR on 'automated/changelog-<version>' branch via 'gh pr create'
   with links to all reference material in the PR body

Also adds Bazel library and binary targets for all new source files, following
the same visibility pattern as the existing release automation targets.

Part of fix #6106 (M2 PR 2.1 — GenerateChangelogs script).
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: de006571-858e-4062-a7fb-b4706bfc258d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr2.1/generate-changelogs-script

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sandesh282

Copy link
Copy Markdown
Collaborator Author

Will be adding unit test suite soon!

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Results

Number of files assessed: 4
Overall Coverage: 0.00%
Coverage Analysis: FAIL

Failure Cases

File Failure Reason Status
GoogleVertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/GoogleVertexAiClient.kt
No appropriate test file found for scripts/src/java/org/oppia/android/scripts/release/GoogleVertexAiClient.kt.
GenerateChangelogs.ktscripts/src/java/org/oppia/android/scripts/release/GenerateChangelogs.kt
No appropriate test file found for scripts/src/java/org/oppia/android/scripts/release/GenerateChangelogs.kt.
VertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/VertexAiClient.kt
No appropriate test file found for scripts/src/java/org/oppia/android/scripts/release/VertexAiClient.kt.
FakeVertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/FakeVertexAiClient.kt
No appropriate test file found for scripts/src/java/org/oppia/android/scripts/release/FakeVertexAiClient.kt.

To learn more, visit the Oppia Android Code Coverage wiki page

@oppiabot

oppiabot Bot commented Jul 19, 2026

Copy link
Copy Markdown

Hi @Sandesh282, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you! If you're unsure how to reassign this PR to a reviewer, please make sure to review the wiki page that details the Guidance on submitting PRs.

@oppiabot oppiabot Bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Jul 19, 2026
@oppiabot oppiabot Bot removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Results

Number of files assessed: 11
Overall Coverage: 94.11%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
UploadBinaryToPlayConsole.ktscripts/src/java/org/oppia/android/scripts/release/UploadBinaryToPlayConsole.kt
99.00% 99 / 100 70%
CloudKmsSigner.ktscripts/src/java/org/oppia/android/scripts/release/CloudKmsSigner.kt
96.25% 77 / 80 70%
FakePlayConsoleClient.ktscripts/src/java/org/oppia/android/scripts/release/FakePlayConsoleClient.kt
100.00% 53 / 53 70%
PlayConsoleService.ktscripts/src/java/org/oppia/android/scripts/release/remote/PlayConsoleService.kt
100.00% 2 / 2 70%
VersionInversionChecker.ktscripts/src/java/org/oppia/android/scripts/release/VersionInversionChecker.kt
100.00% 39 / 39 70%
GooglePlayConsoleClient.ktscripts/src/java/org/oppia/android/scripts/release/GooglePlayConsoleClient.kt
96.55% 84 / 87 70%
GenerateChangelogs.ktscripts/src/java/org/oppia/android/scripts/release/GenerateChangelogs.kt
88.26% 203 / 230 70%
GoogleVertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/GoogleVertexAiClient.kt
92.59% 50 / 54 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
FakeVertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/FakeVertexAiClient.kt
This file is exempted from having a test file; skipping coverage check.
VertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/VertexAiClient.kt
This file is exempted from having a test file; skipping coverage check.
PlayConsoleClient.ktscripts/src/java/org/oppia/android/scripts/release/PlayConsoleClient.kt
This file is exempted from having a test file; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

@Sandesh282 Sandesh282 removed their assignment Jul 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Results

Number of files assessed: 11
Overall Coverage: 94.22%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
FakeVertexAiClient.ktscripts/src/javatests/org/oppia/android/scripts/release/FakeVertexAiClient.kt
100.00% 13 / 13 70%
UploadBinaryToPlayConsole.ktscripts/src/java/org/oppia/android/scripts/release/UploadBinaryToPlayConsole.kt
99.00% 99 / 100 70%
CloudKmsSigner.ktscripts/src/java/org/oppia/android/scripts/release/CloudKmsSigner.kt
96.25% 77 / 80 70%
FakePlayConsoleClient.ktscripts/src/java/org/oppia/android/scripts/release/FakePlayConsoleClient.kt
100.00% 53 / 53 70%
PlayConsoleService.ktscripts/src/java/org/oppia/android/scripts/release/remote/PlayConsoleService.kt
100.00% 2 / 2 70%
VersionInversionChecker.ktscripts/src/java/org/oppia/android/scripts/release/VersionInversionChecker.kt
100.00% 39 / 39 70%
GooglePlayConsoleClient.ktscripts/src/java/org/oppia/android/scripts/release/GooglePlayConsoleClient.kt
96.55% 84 / 87 70%
GenerateChangelogs.ktscripts/src/java/org/oppia/android/scripts/release/GenerateChangelogs.kt
88.26% 203 / 230 70%
GoogleVertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/GoogleVertexAiClient.kt
92.59% 50 / 54 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
VertexAiClient.ktscripts/src/java/org/oppia/android/scripts/release/VertexAiClient.kt
This file is exempted from having a test file; skipping coverage check.
PlayConsoleClient.ktscripts/src/java/org/oppia/android/scripts/release/PlayConsoleClient.kt
This file is exempted from having a test file; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

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.

3 participants