Skip to content

release notes: add ai generator for improvements and bug fixes - #22850

Merged
ti-chi-bot[bot] merged 41 commits into
pingcap:masterfrom
qiancai:release-notes-ai-generator
Aug 24, 2026
Merged

release notes: add ai generator for improvements and bug fixes#22850
ti-chi-bot[bot] merged 41 commits into
pingcap:masterfrom
qiancai:release-notes-ai-generator

Conversation

@qiancai

@qiancai qiancai commented May 6, 2026

Copy link
Copy Markdown
Collaborator

What is changed, added or deleted? (Required)

  • Add a standalone release note AI generation entrypoint for improvements and bug fixes: scripts/release_notes_generate_ai.py.
  • Add the scripts/release_notes_ai/ package for workbook preprocessing, scope filtering, duplicate release note reuse, AI/non-AI generation, Markdown rendering, and GitHub API helpers.
  • Keep the source workbook unchanged by writing processed workbook output separately.
  • Default generated Markdown to release-<version>.md when the release note file does not exist, and to release-<version>-updated-by-ai.md when it already exists.

Validation:

  • git diff --check
  • PYTHONPATH=scripts PYTHONDONTWRITEBYTECODE=1 python3 scripts/release_notes_generate_ai.py --help
  • PYTHONPATH=scripts PYTHONDONTWRITEBYTECODE=1 python3 - <<EOF check for default_output_release_file

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • New Features

    • Added AI-assisted release-note generation with Codex and Azure OpenAI support.
    • Added a two-phase workflow for processing Excel workbooks and exporting Markdown release notes.
    • Added GitHub integration for pull requests, issues, authors, changed files, retries, and rate limits.
    • Added scope filtering, duplicate detection and reports, component classification, documentation-impact tracking, and checkpointed processing.
    • Added structured Markdown formatting, response validation, error reporting, and safe workbook saving.
  • Documentation

    • Added comprehensive setup, usage, configuration, workflow, and output documentation.

@ti-chi-bot

ti-chi-bot Bot commented May 6, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. missing-translation-status This PR does not have translation status info. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 6, 2026
@qiancai qiancai changed the title release notes: add AI generator release notes: add ai generator for improvements and bug fixes May 6, 2026
@qiancai
qiancai marked this pull request as ready for review May 6, 2026 07:23
@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 6, 2026
@qiancai qiancai added translation/no-need No need to translate this PR. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 6, 2026
@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label May 6, 2026
@qiancai qiancai self-assigned this May 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new set of scripts to automate the generation of TiDB release notes using AI. The changes include modules for GitHub data fetching, Excel workbook processing, and AI prompt generation. Feedback provided includes suggestions for memory-efficient text processing and adding logging for truncated file summaries.



def tail_output(text: str, max_lines: int = 40, max_chars: int = 4000) -> str:
tail = "\n".join(text.strip().splitlines()[-max_lines:])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

For large text outputs, splitlines() can consume significant memory. Consider using a more memory-efficient approach if the output size is expected to be very large, although this is likely acceptable for release note generation.

lines: list[str] = []
page = 1
total_chars = 0
while len(lines) < max_files:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

The loop for paginating through pull request files is well-implemented. Consider adding a log or print statement if the number of files exceeds max_files to inform the user that the summary is truncated.

@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 6, 2026
@qiancai
qiancai force-pushed the release-notes-ai-generator branch from ee6c21e to 2750b34 Compare June 16, 2026 05:32
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0bfb6dda-684b-46ac-884e-195fe31f79df

📥 Commits

Reviewing files that changed from the base of the PR and between 4d69b6b and 08dcd25.

📒 Files selected for processing (6)
  • scripts/release-notes-ai-generator/cli.py
  • scripts/release-notes-ai-generator/excel_workbook.py
  • scripts/release-notes-ai-generator/markdown_writer.py
  • scripts/release-notes-ai-generator/models.py
  • scripts/release-notes-ai-generator/release-notes-generator-readme.md
  • scripts/release-notes-ai-generator/tests/test_markdown_export.py

📝 Walkthrough

Walkthrough

Adds a two-phase release-note generator. It processes Excel workbooks, filters release scope, retrieves GitHub data, generates and validates AI results, persists checkpoints, and exports grouped Markdown release notes.

Changes

Release Notes Generator

Layer / File(s) Summary
Data contracts and shared rules
scripts/release-notes-ai-generator/models.py, constants.py, utils.py, prompts/*, requirements.txt
Adds typed models, shared constants, normalization helpers, prompt templates, and runtime requirements.
GitHub access and scope filtering
scripts/release-notes-ai-generator/github_client.py, scope_filter.py
Adds authenticated GitHub retrieval with retries, pull-request reference parsing, release-branch lookup, and workbook scope filtering.
AI generation and response validation
scripts/release-notes-ai-generator/ai_client.py
Adds Codex and Azure OpenAI clients, structured schemas, prompt rendering, JSON extraction, validation, and repair retries.
Workbook processing and result persistence
scripts/release-notes-ai-generator/excel_workbook.py
Adds worksheet preparation, duplicate and author handling, row merging, concurrent GitHub prefetching, AI generation, documentation-impact persistence, and component classification.
CLI workflow and Markdown export
scripts/release-notes-ai-generator/cli.py, __main__.py, markdown_writer.py, tests/*, release-notes-generator-readme.md
Adds generate and export-markdown commands, checkpointed atomic saves, Markdown rendering, documentation, and integration tests.

Estimated code review effort: 5 (Critical) | ~120 minutes

Mergeability Score: 🟡 Moderate · up to 08dcd

This PR adds an AI release-note generator, but the current implementation can misclassify pull requests, write workbook data under the wrong columns, fail or misreport AI generation, accept vulnerable dependency versions, and use the wrong default output filename. These bounded correctness and security risks should be fixed or explicitly accepted before merging.

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant CLI
  participant ExcelWorkbook
  participant GitHubClient
  participant AIClient
  participant MarkdownWriter
  Operator->>CLI: run generate
  CLI->>ExcelWorkbook: load and preprocess workbook
  ExcelWorkbook->>GitHubClient: fetch issues and pull requests
  GitHubClient-->>ExcelWorkbook: return cached metadata
  ExcelWorkbook->>AIClient: generate validated row result
  AIClient-->>ExcelWorkbook: return release note and documentation impact
  ExcelWorkbook-->>CLI: save processed workbook
  Operator->>CLI: run export-markdown
  CLI->>ExcelWorkbook: collect Markdown entries
  ExcelWorkbook-->>CLI: return entries
  CLI->>MarkdownWriter: write release file
  MarkdownWriter-->>Operator: write Markdown output
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding an AI generator for release notes covering improvements and bug fixes.
Description check ✅ Passed The description covers the main changes, affected version, validation, and output behavior, but omits optional template checklist sections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

Actionable comments posted: 15


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0a49cb05-195e-4962-b6fe-265fa8d63f52

📥 Commits

Reviewing files that changed from the base of the PR and between c14e4fa and 35c1341.

📒 Files selected for processing (16)
  • scripts/release-notes-ai-generator/__main__.py
  • scripts/release-notes-ai-generator/ai_client.py
  • scripts/release-notes-ai-generator/cli.py
  • scripts/release-notes-ai-generator/constants.py
  • scripts/release-notes-ai-generator/excel_workbook.py
  • scripts/release-notes-ai-generator/github_client.py
  • scripts/release-notes-ai-generator/markdown_writer.py
  • scripts/release-notes-ai-generator/models.py
  • scripts/release-notes-ai-generator/prompts/doc-impact.md
  • scripts/release-notes-ai-generator/prompts/generation.md
  • scripts/release-notes-ai-generator/prompts/release-note.md
  • scripts/release-notes-ai-generator/release-notes-generator-readme.md
  • scripts/release-notes-ai-generator/requirements.txt
  • scripts/release-notes-ai-generator/scope_filter.py
  • scripts/release-notes-ai-generator/tests/test_doc_impact.py
  • scripts/release-notes-ai-generator/utils.py

Comment thread scripts/release-notes-ai-generator/ai_client.py Outdated
Comment thread scripts/release-notes-ai-generator/ai_client.py Outdated
Comment thread scripts/release-notes-ai-generator/cli.py
Comment thread scripts/release-notes-ai-generator/cli.py
Comment thread scripts/release-notes-ai-generator/excel_workbook.py
Comment thread scripts/release-notes-ai-generator/release-notes-generator-readme.md Outdated
Comment thread scripts/release-notes-ai-generator/requirements.txt Outdated
Comment thread scripts/release-notes-ai-generator/scope_filter.py Outdated
Comment thread scripts/release-notes-ai-generator/scope_filter.py
Comment thread scripts/release-notes-ai-generator/utils.py Outdated

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a7ce6cf7-7a91-433e-938a-6bea1264a09e

📥 Commits

Reviewing files that changed from the base of the PR and between 35c1341 and 4d69b6b.

📒 Files selected for processing (5)
  • scripts/release-notes-ai-generator/__main__.py
  • scripts/release-notes-ai-generator/cli.py
  • scripts/release-notes-ai-generator/excel_workbook.py
  • scripts/release-notes-ai-generator/release-notes-generator-readme.md
  • scripts/release-notes-ai-generator/tests/test_doc_impact.py

Comment thread scripts/release-notes-ai-generator/excel_workbook.py Outdated
@CLAassistant

CLAassistant commented Aug 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@qiancai

qiancai commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

/approve

@qiancai qiancai added the lgtm label Aug 24, 2026
@ti-chi-bot

ti-chi-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiancai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the approved label Aug 24, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit ff98075 into pingcap:master Aug 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. translation/no-need No need to translate this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants