Skip to content

Improve changelog automation prompt#9091

Merged
amyblais merged 2 commits into
masterfrom
amyblais-changelogfix
Jul 13, 2026
Merged

Improve changelog automation prompt#9091
amyblais merged 2 commits into
masterfrom
amyblais-changelogfix

Conversation

@amyblais

Copy link
Copy Markdown
Member

Summary

  • Expanded system prompt with new instructions: blank-line rules between headings and content, DM/GM abbreviation expansion (DMDirect Message, GMGroup Message), one-section-per-note rule, and a new instruction Test image #10 ("Focus")
  • Added normalize_go_version() and extract_previous_go_version() helpers so the Go Version section always shows a concrete version number (looked up from the existing changelog when GO_VERSION is not provided)
  • Feature release anchor/heading now uses the -feature-release suffix to match the ESR pattern, and includes the full release-policy URL
  • CHANGELOG_PATH env var is now read in main() before building the Go section
  • go_section output changed from a bullet point to a bare sentence matching Mattermost changelog convention

@amyblais
amyblais marked this pull request as ready for review July 10, 2026 11:59
Copilot AI review requested due to automatic review settings July 10, 2026 11:59
@amyblais amyblais added the 1: Dev Review Requires review by a core commiter label Jul 10, 2026
@amyblais
amyblais requested a review from NARSimoes July 10, 2026 11:59
@github-actions

Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 84f0dbd

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The changelog generator’s prompt rules and release-note parsing are refined. Feature releases now normalize Go versions, read prior versions from a configurable changelog path, and use updated anchors, headings, and Go-version text.

Changes

Changelog generation

Layer / File(s) Summary
Release-note prompt instructions
.github/scripts/generate_changelog.py
The system prompt defines updated config.json formatting, terminology, Markdown spacing, content structure, and proofreading requirements.
Release-note parsing and AI fallback
.github/scripts/generate_changelog.py
Release-note extraction handles normalized fenced blocks and filters NONE; missing anthropic support falls back to raw bullet notes.
Go version resolution and feature-release output
.github/scripts/generate_changelog.py
Go versions are normalized or extracted from the configured changelog, while feature-release headings, insertion paths, and Go-version text use the updated behaviour.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant generate_changelog.py
  participant CHANGELOG.md
  Environment->>generate_changelog.py: Provide GO_VERSION and CHANGELOG_PATH
  generate_changelog.py->>CHANGELOG.md: Read previous Go version when GO_VERSION is absent
  CHANGELOG.md-->>generate_changelog.py: Return documented Go version
  generate_changelog.py->>generate_changelog.py: Normalize Go version and generate feature-release content
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the prompt-focused changelog automation changes, though it is broader than the full set of updates.
Description check ✅ Passed The description is clearly related to the changelog automation and Go version formatting changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch amyblais-changelogfix

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.

Copilot AI 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.

Pull request overview

This PR updates the changelog generation script used by the docs repo workflow to produce Mattermost release-note entries with tighter formatting/terminology rules and more consistent Go version output.

Changes:

  • Expanded the AI system prompt rules (formatting, terminology expansion for DM/GM, and “one section per note” guidance).
  • Added helpers to normalize Go versions and to extract the previously documented Go version from the existing changelog when GO_VERSION isn’t provided.
  • Adjusted feature-release anchors/headings to use the -feature-release suffix and updated the release-policy URL; moved CHANGELOG_PATH lookup earlier so Go version extraction can use it.

Comment thread .github/scripts/generate_changelog.py
Comment thread .github/scripts/generate_changelog.py Outdated
Comment thread .github/scripts/generate_changelog.py Outdated

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/generate_changelog.py (1)

298-321: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add encoding="utf-8" to file operations in insert_changelog_entry.

Lines 302 and 319 open changelog_path without specifying encoding="utf-8", while extract_previous_go_version (line 290) correctly specifies it. On systems where the default encoding is not UTF-8, this could cause UnicodeDecodeError when reading or produce garbled output when writing, especially since the changelog contains emoji and special characters from the generated entries.

🔧 Proposed fix
     if os.path.exists(changelog_path):
-        with open(changelog_path, "r") as f:
+        with open(changelog_path, "r", encoding="utf-8") as f:
             existing = f.read()
@@ -316,2 +316,2 @@
-    with open(changelog_path, "w") as f:
+    with open(changelog_path, "w", encoding="utf-8") as f:
         f.write(new_content)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/generate_changelog.py around lines 298 - 321, Add
encoding="utf-8" to both open calls within insert_changelog_entry: the read
operation loading existing changelog content and the write operation saving
new_content, matching extract_previous_go_version’s file handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/scripts/generate_changelog.py:
- Around line 298-321: Add encoding="utf-8" to both open calls within
insert_changelog_entry: the read operation loading existing changelog content
and the write operation saving new_content, matching
extract_previous_go_version’s file handling.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 100257d9-145d-43ea-ad9a-92a1f919b9e4

📥 Commits

Reviewing files that changed from the base of the PR and between 84f0dbd and 3d444df.

📒 Files selected for processing (1)
  • .github/scripts/generate_changelog.py

@github-actions

Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 3d444df

@amyblais
amyblais merged commit 05e3a61 into master Jul 13, 2026
7 checks passed
@amyblais
amyblais deleted the amyblais-changelogfix branch July 13, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1: Dev Review Requires review by a core commiter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants