Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When prepping a release, combine the dependency bump changelog entries. #2181

Merged
merged 7 commits into from
Oct 24, 2024

Conversation

SpicyLemon
Copy link
Contributor

@SpicyLemon SpicyLemon commented Oct 15, 2024

Description

This PR updates the prep-release.sh script. It will now combine the version bump entries in the dependencies changelog section for a given library. It also fixes the script to properly create RELEASE_CHANGELOG.md. (instead of RELEASE_NOTES.md) and updates our documentation to have the correct filename.

E.g. before this PR, the v1.20.0-rc1 changelog entry had these lines:

* `golang.org/x/sys` bumped to v0.22.0 (from v0.20.0) [PR 2107](https://github.com/provenance-io/provenance/pull/2107).
* `golang.org/x/sys` bumped to v0.23.0 (from v0.22.0) [PR 2142](https://github.com/provenance-io/provenance/pull/2142).
* `golang.org/x/sys` bumped to v0.24.0 (from v0.23.0) [PR 2157](https://github.com/provenance-io/provenance/pull/2157).

After this PR, it would instead have just this line:

* `golang.org/x/sys` bumped to v0.24.0 (from v0.20.0) ([PR 2107](https://github.com/provenance-io/provenance/pull/2107), [PR 2142](https://github.com/provenance-io/
provenance/pull/2142), [PR 2157](https://github.com/provenance-io/provenance/pull/2157))

This only combines "bumped to" lines (for now). It won't try to do anything with the "added at" or "removed at" entries (they still come through the way they did before).


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Added relevant changelog entries under .changelog/unreleased (see Adding Changes).
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new RELEASE_CHANGELOG.md for improved release note management.
    • Added a script to combine multiple dependency changelog entries into a single line for better readability.
  • Improvements

    • Enhanced scripts for generating and managing changelog entries with better error handling and verbose output.
    • Updated contribution guidelines to clarify the process and requirements for submitting pull requests.
  • Documentation

    • Revised the CONTRIBUTING.md file for improved clarity and navigation.

…Update prep-release to use it. Also apply a couple fixes that are alread in the release branch (and will be in main shortly). Also tweak the step 4 and 5 names to provide more context, and fix the verbose output header when recombining the sections.
@SpicyLemon SpicyLemon requested a review from a team as a code owner October 15, 2024 22:12
Copy link
Contributor

coderabbitai bot commented Oct 15, 2024

Walkthrough

The pull request introduces several updates primarily focused on changelog management and dependency tracking within scripts. Key changes include the renaming of the release notes file to RELEASE_CHANGELOG.md, enhancements to scripts for generating and combining dependency changelogs, and improvements to the contribution guidelines. The modifications aim to clarify processes, improve usability, and ensure consistency in documentation and script outputs.

Changes

File Change Summary
.changelog/README.md Updated instructions for changelog management, including new naming conventions and directory management.
.changelog/combine-dep-lines.awk New script added to combine multiple dependency changelog entries into a single line.
.changelog/get-dep-changes.sh Enhanced functionality with verbose output, improved error handling, and refined changelog entry generation.
.changelog/prep-release.sh Modified to create/update RELEASE_CHANGELOG.md, added dependency handling, and improved logging.
.changelog/unreleased/improvements/2181-combine-changelog-dep-lines.md New changelog entry for updating the prep-release script to combine dependency changelog entries.
CONTRIBUTING.md Expanded and clarified contribution guidelines, including updates to the release procedure and changelog instructions.

Possibly related PRs

Suggested reviewers

  • iramiller
  • Taztingo

Poem

In the land of code where rabbits play,
Changelogs bloom in a bright array.
With each new script, our paths align,
Dependencies dance, all neatly combined.
Hops of progress, we cheer and sing,
For every change, a joyful spring! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

…uld actually be RELEASE_CHANGELOG.md. The SDK uses _NOTES but only puts a blurb in there, so it's not a changelog. But we include a changelog, so it makes sense to keep it named that way.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (7)
.changelog/README.md (3)

243-246: LGTM: Clear instructions for changelog updates

The added instructions provide clear guidance on how to handle changelog updates and where specific files should exist. This helps maintain consistency and prevents confusion.

Consider adding a brief explanation of why changelog entry files should not be updated (e.g., "to preserve the original context of the changes"). This could help reinforce the importance of this instruction.


246-246: Consider consolidating redundant information

The information about 'RELEASE_CHANGELOG.md' and version directories existing only in the .x branch is important. However, it's somewhat redundant with the content in the previous paragraph.

Consider consolidating this information into a single, clear statement to avoid repetition and improve readability. For example:

If you need to make tweaks or clarifications to the content, make the changes in the `RELEASE_CHANGELOG.md` file first, then copy/paste those into the `CHANGELOG.md` file. Do NOT update the changelog entry files. Note that the `RELEASE_CHANGELOG.md` file and `.changelog/<version>` directories should only exist on the `.x` branch, not on `main`, to maintain a clear separation between released and unreleased content.

Line range hint 1-300: LGTM: Comprehensive update to changelog management instructions

The changes throughout the file consistently reflect the update from 'RELEASE_NOTES.md' to 'RELEASE_CHANGELOG.md' and provide clear, detailed instructions for both automated and manual changelog management processes. These updates align well with the PR objectives and should improve the overall changelog management workflow.

For future consideration, it might be beneficial to add a section on best practices for writing good changelog entries. This could include guidelines on clarity, conciseness, and how to effectively communicate the impact of changes to users and developers. This addition would further enhance the value of this documentation for contributors.

CONTRIBUTING.md (2)

Line range hint 36-70: LGTM: Enhanced contribution guidelines

The expanded "Contributing" section provides a clearer step-by-step guide for contributors. The emphasis on issue tracking and collaboration, along with specific instructions for submitting pull requests, will help streamline the contribution process.

Consider adding a note about the importance of keeping pull requests focused on single issues to make the review process more manageable.


Line range hint 115-149: LGTM: Updated forking and dependency management instructions

The revised "Forking" and "Dependencies" sections provide clearer and more up-to-date information for contributors. The instructions for managing forks and the mention of Go Modules for dependency management are particularly helpful.

Consider adding a brief explanation of why go mod tidy might be necessary in case of broken builds due to third-party dependencies.

.changelog/get-dep-changes.sh (1)

Line range hint 345-350: Handle unexpected cases by exiting the script instead of adding a 'TODO' to the changelog

In the else block starting at line 345, the script writes a 'TODO' entry into the changelog when an unexpected state is encountered. Adding such entries can cause confusion and should be avoided. Instead, consider displaying an error message and exiting the script to alert the user.

Consider modifying the code as follows:

 else
     # It shouldn't be possible to see this, but it's here just in case things go wonky.
     [[ -n "$verbose" ]] && printf '[%d/%d]: Unexpected state encountered.\n' "$i" "${#libs[@]}"
-    printf '* `%s` TODO: Could not identify dependency change details, fix me.\n' "$lib" >> "$changes"
+    printf 'Error: Could not identify dependency change details for `%s`.\n' "$lib" >&2
+    exit 1
 fi

This change ensures that unexpected cases are handled appropriately and prevents invalid or incomplete entries from being added to the changelog.

.changelog/prep-release.sh (1)

607-611: Prevent potential overwriting of summary.md

Copying summary.md back into unreleased without checking may overwrite an existing summary. To avoid accidental data loss, consider verifying if summary.md already exists and handle it accordingly.

Apply this diff to check for an existing summary.md before copying:

if [[ -n "$v_rc" ]]; then
    # If this was an rc, copy the summary back into unreleased.
    [[ -n "$verbose" ]] && printf 'Copying summary.md back into unreleased.\n'
+   if [[ -f "$unreleased_sum_file" ]]; then
+       mv "$unreleased_sum_file" "${unreleased_sum_file}.backup"
+       [[ -n "$verbose" ]] && printf 'Existing summary.md backed up as summary.md.backup.\n'
+   fi
    cp "${new_ver_dir}/summary.md" "$unreleased_sum_file" || clean_exit 1
fi
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 488b8a7 and eb2a728.

📒 Files selected for processing (6)
  • .changelog/README.md (2 hunks)
  • .changelog/combine-dep-lines.awk (1 hunks)
  • .changelog/get-dep-changes.sh (1 hunks)
  • .changelog/prep-release.sh (7 hunks)
  • .changelog/unreleased/improvements/2181-combine-changelog-dep-lines.md (1 hunks)
  • CONTRIBUTING.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changelog/unreleased/improvements/2181-combine-changelog-dep-lines.md
🧰 Additional context used
🔇 Additional comments (16)
.changelog/README.md (2)

233-234: LGTM: Improved file naming for release changelog

The change from 'RELEASE_NOTES.md' to 'RELEASE_CHANGELOG.md' is a good improvement. It makes the purpose of the file clearer and aligns well with the changelog management process.


250-251: LGTM: Updated manual instructions for consistency

The change to refer to 'RELEASE_CHANGELOG.md' in the manual creation instructions maintains consistency with the earlier file name update. This ensures that both automated and manual processes are aligned.

CONTRIBUTING.md (3)

Line range hint 1-35: LGTM: Improved introduction and document structure

The expanded introduction and refined table of contents provide better context and navigation for contributors. This change enhances the overall usability of the document.


Line range hint 71-114: LGTM: Improved PR requirements and review process

The updated PR requirements and review process provide clear expectations for both contributors and reviewers. The inclusion of signed commits, approval requirements, and GitHub action checks enhances the overall quality control of contributions.


313-314: LGTM: Significantly improved release procedure

The expanded "Release Procedure" section provides a comprehensive guide for creating and managing releases. The addition of detailed steps for creating release branches, updating changelogs, and managing tags will lead to more consistent and well-documented releases.

The use of the .changelog/prep-release.sh script to automate the changelog update process is a notable improvement. This should help ensure consistency in release documentation.

.changelog/combine-dep-lines.awk (4)

32-43: Ensure LibCount is reset appropriately in printPrevLib function

The printPrevLib function resets LibCount to zero after printing. This is correct, ensuring that the count starts fresh for each new library.


88-91: Ensure NewVer is updated correctly for each line

The NewVer variable is updated on every matching line, but in the context of combining entries, only the latest version should be used. Confirm that NewVer reflects the most recent version after processing all entries for a library.

Add a check to ensure NewVer holds the latest version:

# Within the else block where LibCount > 1
# Compare and update NewVer if necessary
-if (/* condition to check if this NewVer is newer */) {
+    # Assuming a function compare_versions exists to compare semantic versions
+    if (compare_versions(NewVer, currentNewVer) < 0) {
+        NewVer = currentNewVer
+    }
}

You may need to implement a version comparison function to accurately determine the latest version.


100-102: Ensure all remaining libraries are processed in the END block

The printPrevLib() function is called in the END block to handle any remaining data. This is necessary for accurate processing and output.


47-47: Verify the regular expression used in the if condition

The regular expression in the condition:

/^\* `.*` bumped to .* \(from .*\).* \[.*[[:digit:]]+\]\(.*\)/

is intended to match lines that follow the expected bump line format. Ensure that this pattern accurately captures all possible variations of the input lines, including optional portions like warnings and forks.

Run the following script to test the regular expression against sample input lines:

This script helps confirm that the regular expression correctly identifies the intended lines.

✅ Verification successful

Regular expression verification successful

The regular expression accurately matches all intended bump line formats, including those with optional sections like warnings and forks.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Test the regular expression used in the AWK script

# Sample input lines
echo '* `lib1` bumped to v1.2.3 (from v1.2.2) [link1](https://example.com)' > test_input.txt
echo '* `lib1` bumped to v1.2.4 (from v1.2.3) but is still replaced by <fork1> [link2](https://example.com)' >> test_input.txt
echo '* `lib2` added at v0.4.5 [link3](https://example.com)' >> test_input.txt

# Expected: Only lines matching the bump pattern should be printed
awk '/^\* `.*` bumped to .* \(from .*\).* \[.*[[:digit:]]+\]\(.*\)/ {print}' test_input.txt

Length of output: 516

.changelog/get-dep-changes.sh (1)

337-337: Addition of context comment improves maintainability

The added comment at line 337 clarifies that combine-dep-lines.awk depends on the specific formats used in this script. This provides valuable context for future maintainers, preventing accidental changes that could disrupt the release preparation process.

.changelog/prep-release.sh (6)

3-4: LGTM!

The added comments appropriately document the script dependencies, enhancing the script's clarity.


101-107: LGTM!

The script correctly defines the path to combine-dep-lines.awk, allowing it to be overridden by the COMBINE_DEP_LINES_AWK environment variable, and properly checks for its existence.


294-294: LGTM!

The version validation logic for minor version increments appears correct and ensures sequential versioning.


466-490: LGTM!

The code effectively cleans, sorts, and combines the entries of the dependencies section. This enhances the readability and organization of the dependency changelog entries.


520-526: LGTM!

The script correctly recombines sections in the desired order, ensuring that the release notes are organized as intended.


553-554: LGTM!

The variables for the new release notes file are correctly defined, facilitating the creation of the full release notes.

.changelog/combine-dep-lines.awk Show resolved Hide resolved
.changelog/combine-dep-lines.awk Show resolved Hide resolved
.changelog/combine-dep-lines.awk Show resolved Hide resolved
@SpicyLemon SpicyLemon added this to the v1.20.0 milestone Oct 16, 2024
@SpicyLemon SpicyLemon enabled auto-merge (squash) October 23, 2024 17:52
@SpicyLemon SpicyLemon merged commit 286ac79 into main Oct 24, 2024
20 checks passed
@SpicyLemon SpicyLemon deleted the dwedul/combine-changelog-dep-lines branch October 24, 2024 16:31
SpicyLemon added a commit that referenced this pull request Oct 24, 2024
…s. (#2181)

* Add a note to get-dep-changes to alert folks that changing those formats might break other things.

* Create an awk script that will combine dependency changelog entries. Update prep-release to use it. Also apply a couple fixes that are alread in the release branch (and will be in main shortly). Also tweak the step 4 and 5 names to provide more context, and fix the verbose output header when recombining the sections.

* Add changelog entry.

* Clarify the new comment in get-dep-changes.sh.

* Update stuff that uses or talks about RELEASE_NOTES.md because it should actually be RELEASE_CHANGELOG.md. The SDK uses _NOTES but only puts a blurb in there, so it's not a changelog. But we include a changelog, so it makes sense to keep it named that way.
SpicyLemon added a commit that referenced this pull request Oct 24, 2024
…tion events), #2196 (timeout_commit), #2197 (recordspec cmd), #2198 (ParameterChangeProposal) #2199 (wasm build-address cmd). (#2200)

* Suppress scope value owner migration events. (#2195)

* Create a no-op event manager and use that during the metadata module migration.

* Do not suppress the events for a testnet upgrade since they were emitted when the migration ran on testnet.

* Add changelog entry.

* Update all the spec proto links to reference v1.20.0 (#2192)

* Update all the spec proto links to reference v1.20.0 (instead of 1.19.0).

* Add changelog entry.

* When prepping a release, combine the dependency bump changelog entries. (#2181)

* Add a note to get-dep-changes to alert folks that changing those formats might break other things.

* Create an awk script that will combine dependency changelog entries. Update prep-release to use it. Also apply a couple fixes that are alread in the release branch (and will be in main shortly). Also tweak the step 4 and 5 names to provide more context, and fix the verbose output header when recombining the sections.

* Add changelog entry.

* Clarify the new comment in get-dep-changes.sh.

* Update stuff that uses or talks about RELEASE_NOTES.md because it should actually be RELEASE_CHANGELOG.md. The SDK uses _NOTES but only puts a blurb in there, so it's not a changelog. But we include a changelog, so it makes sense to keep it named that way.

* Fix the `query metadata recordspec` command when given a rec-spec-id. (#2197)

* [2148]: Fix the query metadata recordspec command to correctly use the RecordSpecification query (instead of RecordSpecificationsForContractSpecification) when provided a record specification id.

* [2148]: Add changelog entry.

* Fix decoding of gov props with a ParameterChangeProposal in them. (#2198)

* Write a unit test that fails to parse a gov proposal with a ParameterChangeProposal in it because that type isn't being registered anymore.

* Register the params module stuff with the codecs since there's some gov props with a ParameterChangeProposal in them.

* Add changelog entry.

* Hard-code consensus.timeout_commit to 3.5s for mainnet. (#2196)

* [2121]: Change the default consensus timeout value to 3.5 seconds.

* [2121]: Hard-code the consensus.timeout_commit value.

* [2121]: Fix TestIsTestnetFlagSet to not be affected by existing env vars.

* [2121]: Fix a couple unit tests that broke when I changed the default commit timout.

* [2121]: Only hard-code the timeout commit on non-testnets.

* [2121]: Change the default back to 1.5s for faster default testnets.

* [2121]: Fix the TestPreUpgradeCmd that broke because of the hard-coded timeout commit.

* [2121]: Add some unit tests that make sure the consensus timeout commit value is behaving as expected.

* [2121]: Add changelog entry.

* [2121]: When forcing the timeout_commit to be 3.5 seconds, also force the skip flag to be false.

* [2121]: Update warnAboutSettings: Evaluate the timeout commit and skip-timeout-commit fields separately. Issue a warning if skip-timeout-commit is true. Issue a warning if the timeout commit is not exactly what we want it to be.

* Fix: Add node flag to WASM queries (build-address) (#2199)
@coderabbitai coderabbitai bot mentioned this pull request Oct 28, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants