Skip to content

THRIFT-5973: Add gen-changes.py script and CI workflow to automate CHANGES.md generation#3521

Open
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:THRIFT-5973
Open

THRIFT-5973: Add gen-changes.py script and CI workflow to automate CHANGES.md generation#3521
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:THRIFT-5973

Conversation

@Jens-G
Copy link
Copy Markdown
Member

@Jens-G Jens-G commented May 23, 2026

Summary

  • Adds build/gen-changes.py — a script that generates a CHANGES.md draft by combining git commit history, JIRA ticket summaries (via the public JIRA REST API), and GitHub PR metadata (labels and commit→PR resolution via the GitHub API)
  • Adds .github/workflows/generate-changes.yml — a CI job that runs the script on every push to master and release/** branches (upstream repo only) and on manual workflow_dispatch with an optional jira_version input; uploads the result as a 3-day build artifact named changes-draft
  • Adds a .gitignore exception for build/gen-changes.py (matched by the existing gen-* pattern intended for compiler output directories)

How it works

The script has three complementary data sources:

  1. Git commits (always): walks the range from the last v* tag to the branch tip, extracts THRIFT-NNNN references, and groups ticket-less commits by their Client: trailer
  2. JIRA (primary when --jira-version is given): queries all tickets with that fixVersion for the authoritative release list
  3. GitHub PR labels (fallback): for commits without a Client: trailer, fetches PR labels to determine the CHANGES.md section; with --github-token, also resolves commit→PR links for commits whose subject lacks the standard (#NNN) suffix

Test plan

  • Run python3 build/gen-changes.py locally and review output
  • Run with --github-token to verify commit→PR link resolution and label fetching
  • Run with --jira-version 0.24.0 to verify JIRA fixVersion query
  • Confirm generate-changes workflow appears in Actions and produces a downloadable artifact after merge

🤖 Generated with Claude Code

@Jens-G Jens-G requested review from fishy and jimexist as code owners May 23, 2026 15:39
@mergeable mergeable Bot added build and general CI cmake, automake and build system changes github_actions Pull requests that update GitHub Actions code labels May 23, 2026
@Jens-G
Copy link
Copy Markdown
Member Author

Jens-G commented May 23, 2026

Code review

Found 5 issues:

  1. 6 commits instead of 1 squashed commit (AGENTS.md says "One commit per issue (squash before submitting)" and the §6 checklist requires a "Single squashed commit")

  2. Client: Compiler (general) silently falls through to "(No Section)"CLIENT_SECTION_MAP only contains the key "compiler", but historical commits use the form Compiler (general) which after .lower() becomes "compiler (general)" — not present in the map. 16 commits in the repo history use this exact form.

thrift/build/gen-changes.py

Lines 135 to 161 in f8246e5

CLIENT_SECTION_MAP = {
"all": "(All Languages)",
"build": "Build Process",
"c_glib": "C glib",
"cpp": "C++",
"d": "D",
"dart": "Dart",
"delphi": "Delphi",
"docker": "Build Process",
"erl": "Erlang",
"go": "Go",
"haskell": "Haskell",
"haxe": "Haxe",
"java": "Java",
"js": "JavaScript",
"lua": "Lua",
"netstd": "netstd",
"nodejs": "nodejs",
"perl": "Perl",
"php": "PHP",
"py": "Python",
"rb": "Ruby",
"rs": "Rust",
"rust": "Rust",
"swift": "Swift",
"ts": "nodets",
}

  1. Unauthenticated rate-limit delay is 40× too short — the code comment says unauthenticated GitHub requests are limited to 60 req/hr, but delay = 1.5 s/request permits ~2,400 req/hr. Staying within the limit requires 60 s/request. Any unauthenticated run against a repo with more than ~60 PRs will exhaust the limit and silently lose label data.

thrift/build/gen-changes.py

Lines 455 to 459 in f8246e5

# Authenticated requests get 5000 req/hr; unauthenticated only 60 req/hr.
delay = 0.1 if github_token else 1.5
result = {}

  1. CLIENT_SECTION_MAP is missing many historically-used Client: trailer values — values such as c# (73 commits in history), python (60), erlang (47), ruby (27), hx (Haxe, 13), csharp (13), hs (Haskell, 12), c++ (4), compiler (6 — covered, but compiler (general) is not) are absent. These silently fall to "(No Section)". By contrast, GITHUB_LABEL_MAP does include c#, c++, erlang, ruby, etc.

thrift/build/gen-changes.py

Lines 135 to 161 in f8246e5

CLIENT_SECTION_MAP = {
"all": "(All Languages)",
"build": "Build Process",
"c_glib": "C glib",
"cpp": "C++",
"d": "D",
"dart": "Dart",
"delphi": "Delphi",
"docker": "Build Process",
"erl": "Erlang",
"go": "Go",
"haskell": "Haskell",
"haxe": "Haxe",
"java": "Java",
"js": "JavaScript",
"lua": "Lua",
"netstd": "netstd",
"nodejs": "nodejs",
"perl": "Perl",
"php": "PHP",
"py": "Python",
"rb": "Ruby",
"rs": "Rust",
"rust": "Rust",
"swift": "Swift",
"ts": "nodets",
}

  1. --no-commits help text understates the flag's effect — the help string says "exclude ticket-less commits from output," but the implementation excludes all commit entries, including commits that reference a valid THRIFT ticket that simply was not found in the JIRA query (wrong fixVersion, not yet resolved, etc.). The inline comment at line 699 correctly describes this broader behavior, but the user-facing help text does not.

thrift/build/gen-changes.py

Lines 791 to 795 in f8246e5

parser.add_argument(
"--no-commits", action="store_true",
help="exclude ticket-less commits from output (default: include them)",
)
parser.add_argument(

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@Jens-G Jens-G force-pushed the THRIFT-5973 branch 2 times, most recently from 9b40e5f to b52afe8 Compare May 23, 2026 23:10
…neration

Client: build

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build and general CI cmake, automake and build system changes github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant