fix: scope Zoekt changelog updates to Unreleased - #1563
Conversation
This comment has been minimized.
This comment has been minimized.
WalkthroughThe AWK changelog update now inserts entries only within ChangesZoekt changelog insertion
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Removed entry about fixing automated Zoekt changelog updates.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In @.github/scripts/testZoektSync.sh:
- Around line 166-168: Update the changelog assertions around the existing
entry_count check to count “sourcebot/pull/42” specifically within the fixture
block from “## [Unreleased]” through the next “## ” heading, while retaining the
full-fixture count assertion to verify uniqueness. Ensure the assertions confirm
the entry appears exactly once and only under Unreleased.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: aa9a350e-8a10-4bf3-99e3-61862621922c
📒 Files selected for processing (3)
.github/scripts/addZoektSyncChangelogEntry.sh.github/scripts/testZoektSync.shCHANGELOG.md
| entry_count=$(grep -Fc "sourcebot/pull/42" "$changelog_fixture") | ||
| assert_equals "$entry_count" 1 \ | ||
| "the changelog helper should add the PR entry only to Unreleased" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the entry location, not only the total count.
This assertion scans the full fixture. It passes if the helper inserts the entry once in a released ### Changed section. Count the entry inside the block from ## [Unreleased] to the next ## heading, and keep the total-count assertion to verify both scope and uniqueness.
Proposed assertion
entry_count=$(grep -Fc "sourcebot/pull/42" "$changelog_fixture")
assert_equals "$entry_count" 1 \
"the changelog helper should add the PR entry only to Unreleased"
+unreleased_entry_count=$(awk '
+ $0 == "## [Unreleased]" { in_unreleased = 1; next }
+ in_unreleased && /^## / { exit }
+ in_unreleased && /sourcebot\/pull\/42/ { count++ }
+ END { print count + 0 }
+' "$changelog_fixture")
+assert_equals "$unreleased_entry_count" 1 \
+ "the changelog helper should place the PR entry inside Unreleased"As stated in the PR objectives, the generated entry must be scoped to Unreleased.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| entry_count=$(grep -Fc "sourcebot/pull/42" "$changelog_fixture") | |
| assert_equals "$entry_count" 1 \ | |
| "the changelog helper should add the PR entry only to Unreleased" | |
| entry_count=$(grep -Fc "sourcebot/pull/42" "$changelog_fixture") | |
| assert_equals "$entry_count" 1 \ | |
| "the changelog helper should add the PR entry only to Unreleased" | |
| unreleased_entry_count=$(awk ' | |
| $0 == "## [Unreleased]" { in_unreleased = 1; next } | |
| in_unreleased && /^## / { exit } | |
| in_unreleased && /sourcebot\/pull\/42/ { count++ } | |
| END { print count + 0 } | |
| ' "$changelog_fixture") | |
| assert_equals "$unreleased_entry_count" 1 \ | |
| "the changelog helper should place the PR entry inside Unreleased" |
🤖 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/testZoektSync.sh around lines 166 - 168, Update the
changelog assertions around the existing entry_count check to count
“sourcebot/pull/42” specifically within the fixture block from “## [Unreleased]”
through the next “## ” heading, while retaining the full-fixture count assertion
to verify uniqueness. Ensure the assertions confirm the entry appears exactly
once and only under Unreleased.
Summary
Testing
Note
Low Risk
Changes are limited to CI changelog automation and its shell tests; no runtime app or security paths are affected.
Overview
Fixes the Zoekt changelog helper so automated Updated the bundled Zoekt version lines are written only under ## [Unreleased], not into ### Changed sections on older release headers.
The awk script now always ends the Unreleased scope when it hits a
##version header (e.g.## [1.0.0]), instead of only doing that when it still needed to create a Changed section. That stops follow-on### Changedblocks in historical releases from being treated as Unreleased.testZoektSync.shadds a fixture with multiple released versions that already have Changed sections and asserts the PR link appears exactly once after the helper runs.Reviewed by Cursor Bugbot for commit e273e60. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Documentation