fix(ci): include commits in all relevant workspace changelogs#7570
fix(ci): include commits in all relevant workspace changelogs#7570paulbalaji merged 3 commits intomainfrom
Conversation
Previously, when a commit touched files in multiple workspaces (e.g., both agents/relayer and agents/validator), it would only appear in whichever workspace was checked first due to `break 2` exiting both loops. This fix: 1. Tracks ALL matched workspaces per commit using an associative array 2. Adds each commit to every workspace changelog it touches 3. Supports explicit scope override via conventional commit format (e.g., `feat(relayer):` will only add to relayer changelog) Example: A commit touching both `agents/relayer/` and `agents/validator/` will now correctly appear in both changelogs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
📝 WalkthroughWalkthroughThe script now maps commit scopes to workspace paths, prefers explicit scope parsing, supports assigning a single commit to multiple workspaces, writes per-workspace changelog buckets, and can prepend generated sections into workspace Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
rust/scripts/ci/generate-workspace-changelog.sh (1)
171-178: Perfect. This is where each commit lands in every workspace that needs it.Sanitizing the workspace name to use as a filename (
/ -> _) is necessary and clean. No issues here.That said, you're sanitizing workspace names a few more times down the script (lines 214, 274). If this ever needs tweaking, you might want to extract it to a tiny helper function. But honestly, for a script this size, it's not a big deal.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rust/scripts/ci/generate-workspace-changelog.sh(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/testnet_config.json in future code reviews as requested by paulbalaji.
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/mainnet_config.json in future code reviews as requested by paulbalaji.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: build-and-push-to-gcr
- GitHub Check: e2e-matrix (radix)
- GitHub Check: e2e-matrix (starknet)
- GitHub Check: e2e-matrix (sealevel)
- GitHub Check: e2e-matrix (cosmwasm)
- GitHub Check: e2e-matrix (evm)
- GitHub Check: e2e-matrix (cosmosnative)
- GitHub Check: lint-rs
- GitHub Check: test-rs
- GitHub Check: lander-coverage
🔇 Additional comments (7)
rust/scripts/ci/generate-workspace-changelog.sh (7)
107-119: Scope mapping looks solid.Covers all the important workspaces and chains. Good convention to have this centralized.
121-122: Variable scoping inside the subshell works, but the design is a touch fragile.The
matched_workspacesarray declared here sits outside thewhile readloop, which creates a subshell (line 125). Inside that subshell, the array at line 145 becomes a fresh local one—which is fine because you're really just tracking which TEMP_DIR files to write. Files survive the subshell boundary fine. That said, the comment at line 144 suggests some uncertainty about array behavior. The design works, but using process substitution instead of piping would keep everything in one scope and make the intent clearer.
129-137: Explicit scope detection is sound.Regex correctly pulls the scope from conventional format (e.g.,
feat(relayer):), and the safe lookup via${SCOPE_TO_WORKSPACE[$scope]:-}is the right defensive move. Good that explicit scopes win over file-based detection.
143-164: This is where the fix lives, and it's done right.The old code had a
break 2that would bail out after the first workspace match. Now you're properly iterating through all files and collecting all matching workspaces before storing the commit (lines 171-178). The regex at line 158 with(/|$)is sensible—it prevents partial name matches. This should mean commits that touchagents/relayer/andagents/validator/get added to both changelogs, which is the whole point of this PR.
166-169: Good fallback for the odd commit that doesn't fit the workspace mold.Assigning to "other" ensures nothing gets lost. Smart design.
181-196: Solid abstraction for rendering workspace sections.Sorting and deduplicating with
sort -ukeeps things clean. Using it in two different contexts (lines 222 and 283) is a nice touch—DRY without being overly clever.
198-258: The file-update logic is well thought out.You validate the VERSION upfront, respect workspace filters, skip workspaces with no changes, and properly preserve existing changelogs by prepending. Date handling is automatic. Nice touches all around.
One small thing: line 257 exits with 0 regardless of whether anything was updated. It works fine (no changes = success), but if a caller ever needs to distinguish between "nothing to do" and "updated 5 workspaces," they can't. Not a blocker—just something to keep in mind.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
rust/scripts/ci/generate-workspace-changelog.sh (1)
129-137: Optional: Consider scope pattern robustness.The regex at line 132 only matches lowercase scopes (
^[a-z]+\(([a-z]+)\):). While consistent with the SCOPE_TO_WORKSPACE map, you might want to handle variations gracefully—for instance, converting uppercase to lowercase or supporting hyphens in scope names if developers use them. Not a blocker, but worth thinking about for future-proofing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rust/scripts/ci/generate-workspace-changelog.sh(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/testnet_config.json in future code reviews as requested by paulbalaji.
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/mainnet_config.json in future code reviews as requested by paulbalaji.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: infra-test
- GitHub Check: e2e-matrix (starknet)
- GitHub Check: e2e-matrix (cosmwasm)
- GitHub Check: e2e-matrix (radix)
- GitHub Check: e2e-matrix (evm)
- GitHub Check: e2e-matrix (cosmosnative)
- GitHub Check: e2e-matrix (sealevel)
- GitHub Check: agent-configs (mainnet3)
- GitHub Check: agent-configs (testnet4)
- GitHub Check: yarn-install
- GitHub Check: build-and-push-to-gcr
- GitHub Check: test-rs
- GitHub Check: lint-rs
- GitHub Check: lander-coverage
🔇 Additional comments (4)
rust/scripts/ci/generate-workspace-changelog.sh (4)
107-122: LGTM on the scope mapping and declarations.The SCOPE_TO_WORKSPACE mapping covers all the main workspaces nicely, and the structure is clear and maintainable.
182-196: Nice helper function design.The
generate_workspace_changelog()function is clean, reusable, and properly handles theinclude_headerflag. Usingsort -uto deduplicate commits is sensible for changelog consistency.
199-258: --write-to-workspace implementation looks solid.The logic properly validates VERSION, iterates through filtered workspaces, generates content, and prepends it to each workspace's CHANGELOG.md with a version header and date. The directory creation and existing changelog preservation are handled correctly.
260-290: Output generation logic is well-structured.Processing workspaces in Cargo.toml order plus "other" is the right approach. The filter check is applied consistently, and the separator logic between workspaces keeps output readable.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
rust/scripts/ci/generate-workspace-changelog.sh (1)
130-138: Mind your scope regex—it's lowercase-only.The pattern
^[a-z]+\(([a-z]+)\):at line 133 only matches lowercase scopes likefeat(relayer):. If someone writesfeat(Relayer):orfeat(RELAYER):, the explicit scope detection skips it and falls back to file-based detection. Conventional commits usually stick to lowercase, but you might want to make the regex case-insensitive to catch variations:-if [[ "$commit_msg" =~ ^[a-z]+\(([a-z]+)\): ]]; then +if [[ "$commit_msg" =~ ^[a-z]+\(([a-z0-9_-]+)\): ]]; then(Also added common scope separators like hyphens and underscores.)
That said, the file-based fallback means nothing breaks—commits still get categorized. So this is more of a robustness thing than a blocker.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rust/scripts/ci/generate-workspace-changelog.sh(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/mainnet_config.json in future code reviews as requested by paulbalaji.
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/testnet_config.json in future code reviews as requested by paulbalaji.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: infra-test
- GitHub Check: build-and-push-to-gcr
- GitHub Check: e2e-matrix (starknet)
- GitHub Check: e2e-matrix (cosmosnative)
- GitHub Check: e2e-matrix (evm)
- GitHub Check: e2e-matrix (radix)
- GitHub Check: e2e-matrix (sealevel)
- GitHub Check: e2e-matrix (cosmwasm)
- GitHub Check: lander-coverage
- GitHub Check: test-rs
- GitHub Check: lint-rs
🔇 Additional comments (3)
rust/scripts/ci/generate-workspace-changelog.sh (3)
122-178: Nice work fixing that subshell issue—the layers are properly preserved now.Your process substitution at line 178 (
done < <(...)instead of pipe) keeps everything in the current shell context, so the associative array modifications actually stick around. That's the core fix from the past review, and it's implemented correctly. The way you're resettingmatched_workspaceson each iteration (line 126) and writing all matched workspace names to separate files (lines 171-177) means commits now get categorized into every workspace they touch, not just the first one.The multi-workspace tracking pattern here is solid—no more
break 2silently dropping commits.
181-195: Function structure looks good; just note the sorting subshell.The
generate_workspace_changelog()function is clean and reusable. Line 191 does spin up a subshell (sort -u | while read), but since you're just reading and echoing output—not modifying any shell state—it's a harmless pattern. If you ever need to squeeze more performance, you could switch tosort -u | sed 's/^/* /'to avoid the subshell, but this is perfectly fine as-is.
198-257: Verify that --write-to-workspace overwrites are safe in your CI flow.The feature looks well-structured: it validates
VERSION, respects workspace filters, and prepends new changelog entries while preserving old content. However, line 249 directly overwritesCHANGELOG.mdfiles. A couple of things to check:
- Is the overwrite reversible or idempotent if the script runs twice with the same VERSION?
- Are these files tracked in git, and if so, how does the CI handle the modifications?
The logic itself is correct—new version goes at the top, old content shifts down. Just want to make sure this doesn't surprise the workflow.
🦀 Rust Agent Docker Image Built SuccessfullyImage Tags: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7570 +/- ##
============================
============================
🚀 New features to boost your workflow:
|
Summary
Fixes a bug where commits touching multiple Rust workspaces were only included in one changelog.
Problem
When a commit touched files in multiple workspaces (e.g., both
agents/relayer/andagents/validator/), it would only appear in whichever workspace was checked first due tobreak 2exiting both loops in the changelog generation script.For example, PR #7464 (
feat: crash loop even in the event reorg_flag.json is unparsable) touches both relayer and validator, but was only appearing in the relayer changelog in release PR #7505.Solution
feat(relayer):will only add to the relayer changelog, regardless of files touched)Before vs After
Before:
git log -- rust/main/agents/validatorshows 5 commits, but validator changelog only had 2After:
All 5 commits now appear correctly.
Test Plan
🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.