豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

feat: Add PR message formatting for dependency-name groups#14289

Merged
markhallen merged 3 commits intomainfrom
markhallen/update-group-by-dependency-name-description
Feb 27, 2026
Merged

feat: Add PR message formatting for dependency-name groups#14289
markhallen merged 3 commits intomainfrom
markhallen/update-group-by-dependency-name-description

Conversation

@markhallen
Copy link
Copy Markdown
Contributor

@markhallen markhallen commented Feb 26, 2026

What are you trying to accomplish?

When group-by: dependency-name is configured, dynamic subgroups like "monorepo-deps/dummy-pkg-a" are created. Today the raw subgroup name leaks into PR titles and bodies, producing confusing messages like "Bump the monorepo-deps/dummy-pkg-a group across 3 directories".

This PR adds dedicated title and body formatting for these dependency-name groups so that users see clean, dependency-focused messages instead.

PR title examples:

Scenario Title
Multiple directories Bump dummy-pkg-a across 3 directories
Single directory Bump dummy-pkg-a in /frontend
No directory info Bump dummy-pkg-a

PR body lists each affected directory with its version change (e.g. - /frontend: 1.4.0 → 1.5.0).

Anything you want to highlight for special attention from reviewers?

The change is split into two layers:

  1. Metadata plumbing (GroupDependencySelector#deduplicate_by_name_only): When deduplicating by name, the surviving dependency now gets metadata[:updated_directories] populated with all directories where it was updated. This preserves directory info that was previously lost.

  2. Message formatting (MessageBuilder): New dependency_name_group_pr_name and dependency_name_group_intro methods dispatch from the existing group_pr_name and version_commit_message_intro methods when dependency_group.group_by_dependency_name? is true. All existing code paths are unchanged.

How will you know you've accomplished your goal?

  • All existing tests continue to pass (44/44 selector tests, 128/128 message builder tests)
  • New tests verify:
    • updated_directories metadata is populated with all directories when group_by_dependency_name? is true
    • updated_directories is not set when group_by_dependency_name? is false (no behavior change)
    • PR title formats correctly for multi-directory, single-directory, and no-directory scenarios
    • PR body formats correctly with per-directory version listings

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

When group-by: dependency-name is configured, dynamic subgroups like
'monorepo-deps/dummy-pkg-a' are created. Previously the raw subgroup
name leaked into PR titles.

Changes:
- Populate updated_directories metadata in deduplicate_by_name_only
  so each surviving dependency tracks all directories it was updated in
- Add dependency_name_group_pr_name for titles like 'Bump X across N
  directories', 'Bump X in /dir', or 'Bump X'
- Add dependency_name_group_intro for PR body with per-directory
  version changes
- Add tests for both GroupDependencySelector and MessageBuilder
Copilot AI review requested due to automatic review settings February 26, 2026 14:58
@markhallen markhallen requested a review from a team as a code owner February 26, 2026 14:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adds dedicated formatting for dependency-name groups (created when group-by: dependency-name is configured) to produce clean, dependency-focused PR titles and bodies instead of exposing the raw subgroup names.

Changes:

  • Enhanced GroupDependencySelector to preserve directory information in metadata when deduplicating by dependency name
  • Added dependency_name_group_pr_name and dependency_name_group_intro methods to MessageBuilder for dependency-name group formatting
  • Added comprehensive test coverage for both single and multi-directory scenarios

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
updater/lib/dependabot/updater/group_dependency_selector.rb Added logic to populate updated_directories metadata when deduplicating by name, preserving directory context
updater/spec/dependabot/updater/group_dependency_selector_spec.rb Added tests verifying metadata population for dependency-name groups and absence of metadata for regular groups
common/lib/dependabot/pull_request_creator/message_builder.rb Added new formatting methods for dependency-name group PR titles and bodies with directory-aware messaging
common/spec/dependabot/pull_request_creator/message_builder_spec.rb Added tests for PR title and body formatting across multiple directory scenarios

Comment thread common/lib/dependabot/pull_request_creator/message_builder.rb Outdated
- Add nil-safe fallback (|| "unknown") for humanized_previous_version and
  humanized_version in dependency_name_group_intro multi-directory path
- Replace directories.count == 1 with directories.one? per rubocop
  Style/CollectionQuerying preference
@markhallen markhallen merged commit 72067f3 into main Feb 27, 2026
204 of 206 checks passed
@markhallen markhallen deleted the markhallen/update-group-by-dependency-name-description branch February 27, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants