Skip to content

Optimize PR validation for XML documentation changes - #10763

Merged
Amaury Levé (Evangelink) merged 6 commits into
mainfrom
dev/amauryleve/pr-build-optimization
Aug 26, 2026
Merged

Optimize PR validation for XML documentation changes#10763
Amaury Levé (Evangelink) merged 6 commits into
mainfrom
dev/amauryleve/pr-build-optimization

Conversation

@Evangelink

@Evangelink Amaury Levé (Evangelink) commented Aug 26, 2026

Copy link
Copy Markdown
Member

PRs that change only C# XML documentation currently run the full multi-OS build and test matrix even though their meaningful compiler input is limited to generated documentation. PR #10740 is a representative example.

Approach

  • Add a fail-closed Roslyn classifier that verifies every changed file is an existing non-sample C# file and that code, directives, strings, and ordinary comments are unchanged.
  • Extract and execute the classifier from the trusted PR target branch, never from the contribution being classified. A missing or failing trusted classifier selects full validation.
  • Route eligible product XML-documentation-only changes through the Windows Release build/package lane without tests.
  • Retain full validation for sample changes and XML <include> documentation because their build coverage and path semantics can be platform-sensitive.
  • Fall back to full validation for mixed changes, parse errors, unsupported syntax, file additions or deletions, classifier failures, or unexpected output.

The target branch does not contain the classifier until this PR merges, so this PR intentionally exercises the full validation matrix. Subsequent PRs can use the optimized path from the trusted merged version.

Validation

Copilot AI balanced review requested due to automatic review settings August 26, 2026 07:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Optimizes validation for XML-documentation-only C# changes by classifying diffs and reducing CI execution.

Changes:

  • Adds a fail-closed Roslyn-based PowerShell classifier.
  • Routes documentation-only changes through Release build lanes while skipping tests and multi-OS jobs.
Show a summary per file
File Description
eng/classify-xml-doc-change.ps1 Classifies XML-documentation-only diffs.
azure-pipelines.yml Uses classification to reduce validation jobs.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread eng/classify-xml-doc-change.ps1

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

# Dimension Verdict
13 Test Completeness & Coverage 🟢 1 NIT
17 Documentation Accuracy 🟢 1 NIT
20 Build Infrastructure & Dependencies 🟡 1 MODERATE

✅ 19/22 dimensions clean. 3 dimensions N/A (Analyzer Quality, IPC Wire Compatibility, MSBuild Authoring — no relevant files changed).

Summary: Well-designed fail-closed classifier with good self-tests and correct pipeline condition logic. The Roslyn assembly loading is implicit (relying on agent environment), but the bash wrapper's if ! guard ensures graceful degradation. The pipeline conditions correctly route xmlDocsOnly PRs through minimal validation while preserving full validation for any ambiguity.

  • Build Infrastructure — Roslyn assembly loading is implicit; consider explicit load with clear error
  • Test Completeness — self-tests could cover removed-doc and preprocessor-directive cases
  • Documentation — Release lane comment could clarify "validation" means compilation only (tests skipped)

Comment thread azure-pipelines.yml Outdated
Comment thread eng/classify-xml-doc-change.ps1
Comment thread eng/classify-xml-doc-change.ps1
Copilot AI review requested due to automatic review settings August 26, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

eng/classify-xml-doc-change.ps1:272

  • The self-tests are not executed by any repository pipeline invocation: the only call site invokes this script with -Base/-Head. As a result, regressions in this safety-critical classifier (including the raw-string and mixed-comment cases) will not fail CI. Add a -SelfTest step to DetectChanges before using the classifier result.
if ($SelfTest) {
    Invoke-SelfTest
    exit 0
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread eng/classify-xml-doc-change.ps1 Outdated
Copilot AI review requested due to automatic review settings August 26, 2026 08:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@Evangelink Amaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 26, 2026
@Evangelink
Amaury Levé (Evangelink) enabled auto-merge (squash) August 26, 2026 08:34
Copilot AI review requested due to automatic review settings August 26, 2026 11:05
@Evangelink
Amaury Levé (Evangelink) force-pushed the dev/amauryleve/pr-build-optimization branch from bf064e3 to 3cd7a9d Compare August 26, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread azure-pipelines.yml Outdated
Comment thread azure-pipelines.yml
Copilot AI review requested due to automatic review settings August 26, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread eng/classify-xml-doc-change.ps1
Copilot AI review requested due to automatic review settings August 26, 2026 11:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

eng/classify-xml-doc-change.ps1:144

  • This explicitly rejects every sample C# file, so xmlDocsOnly is false for sample documentation-only PRs and WindowsSamples still runs both Release and Debug (along with the normal Debug lane). That contradicts the PR description's stated routing of sample XML-documentation-only changes through only the WindowsSamples Release lane. If retaining full validation for samples is intentional, update the PR description to remove that claimed optimization; otherwise sample classification and matrix gating still need to be implemented.
        -not $Path.StartsWith("samples/", [System.StringComparison]::Ordinal))
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Use a fail-closed Roslyn classifier to identify documentation-only C# diffs and reduce them to the applicable Release build lane.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7509ec42-006c-4962-8918-73c3fae329d9
Load PowerShell's Roslyn assemblies explicitly, expand classifier self-tests, and clarify that the optimized Release lane skips tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7509ec42-006c-4962-8918-73c3fae329d9
Associate significant trivia with its token and side, cover directive relocation, and run classifier self-tests in the detection job.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7509ec42-006c-4962-8918-73c3fae329d9
Exclude sample-tree changes from the shortcut and reject XML include documentation so non-public samples and platform-sensitive include paths retain their existing validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7509ec42-006c-4962-8918-73c3fae329d9
Exercise multi-file documentation, mixed code, added file, and deleted file diffs in a temporary Git repository.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7509ec42-006c-4962-8918-73c3fae329d9
@Evangelink
Amaury Levé (Evangelink) force-pushed the dev/amauryleve/pr-build-optimization branch from 1107122 to 96f1d2a Compare August 26, 2026 12:26
Copilot AI review requested due to automatic review settings August 26, 2026 12:26
Extract and self-test the classifier from the PR target branch, and fail closed when that trusted version is unavailable or cannot classify the diff.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7509ec42-006c-4962-8918-73c3fae329d9

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings August 26, 2026 12:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@Evangelink
Amaury Levé (Evangelink) merged commit 74e0f54 into main Aug 26, 2026
26 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/pr-build-optimization branch August 26, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants