Skip to content

Filter metadata files from rebase instruction conflict lists#5448

Merged
premun merged 5 commits intomainfrom
copilot/fix-rebase-instruction-comments
Nov 10, 2025
Merged

Filter metadata files from rebase instruction conflict lists#5448
premun merged 5 commits intomainfrom
copilot/fix-rebase-instruction-comments

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 7, 2025

Fixes an issue where rebase instruction comments were listing VMR metadata files like source-manifest.json alongside actual source files in the conflict list.

Changes Made

  • Modified PullRequestCommentBuilder.AppendConflictedFileList: Added filtering logic to only include files under the repository source directory (src/{repo-name}/) for forward flow subscriptions with case-insensitive path matching
  • Consolidated forward flow logic: Combined filtering and path manipulation into a single conditional block for better code organization
  • Simplified variable usage: Removed redundant intermediate variable for cleaner code
  • Added unit tests: Created three comprehensive tests in PullRequestCommentBuilderTests.cs to verify the filtering works correctly for both conflict notification methods, including case-insensitive path matching

The fix ensures that only actual source files from the repository are listed in conflict messages, excluding VMR-level metadata files like src/source-manifest.json and src/git-info/*. Path matching is case-insensitive to handle variations in path casing.

Example

For a forward flow subscription with TargetDirectory = "sdk":

  • ✅ Files like src/sdk/file1.cs or SRC/SDK/file1.cs are included in the conflict list (case-insensitive)
  • ❌ Files like src/source-manifest.json are filtered out

Testing

  • ✅ Build succeeds with no errors or warnings

  • ✅ All existing tests continue to pass

  • ✅ New unit tests verify correct filtering behavior for forward flow subscriptions

  • ✅ Case-insensitive path matching is validated with dedicated test

  • ✅ Backward compatibility maintained for backflow subscriptions (no filtering applied)

  • Fixes Rebase instruction comment lists source-manifest.json in conflicts #5447

Original prompt

This section details on the original issue you should resolve

<issue_title>Rebase instruction comment lists source-manifest.json in conflicts</issue_title>
<issue_description>It should only list files from under src/.

dotnet/dotnet#3273 (comment)</issue_description>

<agent_instructions>This is in the notification comment coming from the PR Updater and PR comment builder</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@premun
Copy link
Copy Markdown
Member

premun commented Nov 7, 2025

@copilot try again

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot try again

Done! The fix filters out metadata files like source-manifest.json from the conflict list. Now only files under src/{repo-name}/ are included in rebase instruction comments for forward flow subscriptions.

Commit: 89f0d1d

Copilot AI changed the title [WIP] Fix rebase instruction comments for conflicts Filter metadata files from rebase instruction conflict lists Nov 7, 2025
Copilot AI requested a review from premun November 7, 2025 14:48
@premun premun marked this pull request as ready for review November 10, 2025 09:12
Copilot AI review requested due to automatic review settings November 10, 2025 09:12
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 filtering logic to pull request conflict comments for forward flow subscriptions, ensuring only relevant source files are included and metadata files are excluded.

  • Filters conflicted file lists to show only files under the repository's source directory (e.g., src/sdk/) for forward flow
  • Implements case-insensitive path matching for cross-platform robustness
  • Strips the src/{targetDirectory}/ prefix from displayed file paths for cleaner output

Reviewed Changes

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

File Description
src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestCommentBuilder.cs Adds filtering logic in AppendConflictedFileList to exclude metadata files and only show files under the target directory for forward flow subscriptions
test/ProductConstructionService.DependencyFlow.Tests/PullRequestCommentBuilderTests.cs Adds three comprehensive tests verifying metadata file filtering, case-insensitive path matching, and proper path stripping for both conflict notification methods

…ndencyFlow/PullRequestCommentBuilder.cs

Co-authored-by: Copilot <[email protected]>
@premun premun merged commit cd95b6f into main Nov 10, 2025
8 of 9 checks passed
@premun premun deleted the copilot/fix-rebase-instruction-comments branch November 10, 2025 10:04
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.

Rebase instruction comment lists source-manifest.json in conflicts

4 participants