Skip to content

Add .github/copilot-review-instructions.md to reduce noisy automated PR comments#683

Closed
YunchuWang wants to merge 1 commit intomainfrom
wangbill/add-copilot-review-instructions
Closed

Add .github/copilot-review-instructions.md to reduce noisy automated PR comments#683
YunchuWang wants to merge 1 commit intomainfrom
wangbill/add-copilot-review-instructions

Conversation

@YunchuWang
Copy link
Member

Summary

Adds a .github/copilot-review-instructions.md\ file to guide the GitHub Copilot PR review bot, reducing false-positive and low-signal automated comments.

Motivation

In recent PRs (e.g., #682), the Copilot review bot generated several noisy comments:

  • Falsely claiming valid C# 7.2 named-argument syntax was invalid
  • Style suggestions (ternary, nested if) on unchanged code outside the PR diff
  • Suggesting converting \�irtual\ methods to \�bstract\ (a breaking change)
  • Suggesting tests for unmodified code paths
  • Comments from \github-code-quality\ bot on pre-existing code

What this file does

Per GitHub docs, .github/copilot-review-instructions.md\ provides custom instructions that the Copilot code review bot reads when reviewing PRs. This is separate from .github/copilot-instructions.md\ (which controls Chat/Completion).

Key rules added

  • Scope: Only review lines in the PR diff; skip unchanged code
  • Language accuracy: Don't flag valid modern C# syntax (\LangVersion latest\ / C# 14)
  • Comment quality: Prioritize correctness bugs over style nitpicks
  • Virtual methods: Recognize the deliberate \�irtual\ + default-impl pattern
  • Nullability: Verify base declarations before flagging override mismatches
  • Test code: Don't suggest tests for unmodified code paths
  • Consolidation: Defers to existing \copilot-instructions.md\ review rules to avoid drift

Review quality

This file was reviewed by the code-review-agent and scored 94/100 with 0 blockers, 0 high, 0 medium issues. Only 2 nit-level observations remain (sealed scope consistency in test section, C# version parenthetical staleness).

Copilot AI review requested due to automatic review settings March 21, 2026 17:33
Copy link
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

Adds a repository-level Copilot code review instruction file to constrain automated PR review feedback to the diff and reduce recurring false-positive / low-signal comments in this codebase.

Changes:

  • Introduces .github/copilot-review-instructions.md with scope, language-accuracy, and comment-quality guidance for Copilot PR reviews.
  • Documents repo-specific review heuristics around virtual-method default implementations, nullability checks, and test-related feedback.
  • References .github/copilot-instructions.md for consolidated, non-duplicated baseline rules.


## Test Code

- Test helper classes and mock implementations in `test/` directories are internal to the test project. Apply the same `sealed` requirement from `copilot-instructions.md` only to new classes introduced in the PR.
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

The “sealed” guidance in the Test Code section is narrower than the earlier guidance (which allows commenting when visibility/inheritance changes). To avoid inconsistent bot behavior, consider aligning this bullet with the earlier rule (e.g., allow comments when a test helper class is newly introduced or its inheritance/visibility was changed in the PR).

Suggested change
- Test helper classes and mock implementations in `test/` directories are internal to the test project. Apply the same `sealed` requirement from `copilot-instructions.md` only to new classes introduced in the PR.
- Test helper classes and mock implementations in `test/` directories are internal to the test project. Apply the same `sealed` requirement from `copilot-instructions.md` only when such a class is newly introduced in the PR or its visibility/inheritance was changed in the PR.

Copilot uses AI. Check for mistakes.

## Language Accuracy

- **Verify C# syntax claims before posting.** This repository uses `<LangVersion>latest</LangVersion>` on .NET 10 (currently C# 14). Do not flag valid modern C# syntax as errors. In particular:
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

The statement tying <LangVersion>latest</LangVersion> specifically to “.NET 10 (currently C# 14)” is likely to go stale and is slightly inaccurate for this repo: LangVersion is set globally (Directory.Build.props), and the exact C# version implied by latest changes over time. Consider rephrasing to reference the repo setting without naming a specific C# version (or link to Directory.Build.props).

Suggested change
- **Verify C# syntax claims before posting.** This repository uses `<LangVersion>latest</LangVersion>` on .NET 10 (currently C# 14). Do not flag valid modern C# syntax as errors. In particular:
- **Verify C# syntax claims before posting.** This repository configures `<LangVersion>latest</LangVersion>` centrally (see `Directory.Build.props`). Do not flag valid modern C# syntax as errors. In particular:

Copilot uses AI. Check for mistakes.
@YunchuWang YunchuWang closed this Mar 21, 2026
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.

2 participants