Skip to content

Improve inter-branch merge configuration errors - #17384

Open
missymessa wants to merge 2 commits into
dotnet:mainfrom
missymessa:fix-inter-branch-config-errors
Open

Improve inter-branch merge configuration errors#17384
missymessa wants to merge 2 commits into
dotnet:mainfrom
missymessa:fix-inter-branch-config-errors

Conversation

@missymessa

Copy link
Copy Markdown
Member

Summary

  • distinguish configuration download failures from JSON parsing failures
  • fail the workflow for malformed JSON, invalid schema, and missing MergeToBranch
  • preserve the successful no-op behavior when a valid configuration has no entry for the current branch
  • clarify the no-configuration workflow message

Validation

  • valid MSBuild configuration emits the expected outputs
  • a valid configuration without a branch mapping exits successfully without outputs
  • the historical malformed MSBuild configuration fails with the JSON parser's line and position
  • a missing configuration file fails with its HTTP status
  • invalid schema and missing MergeToBranch fail with targeted messages

Azure DevOps work item: https://dev.azure.com/dnceng/internal/_workitems/edit/10214

Separate download, JSON parsing, and schema validation failures so malformed merge-flow configuration fails with an actionable error while an unconfigured branch remains a successful no-op.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 040f9d82-5d74-492a-a03d-71f0143afb36
Copilot AI lite review requested due to automatic review settings August 21, 2026 20:28

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

Improves inter-branch merge configuration error handling and clarifies no-op workflow messaging.

Changes:

  • Separates download, JSON parsing, and schema validation failures.
  • Validates configuration structure and required MergeToBranch.
  • Clarifies the no-configuration workflow message.

Reviewed changes

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

File Summary
.github/workflows/scripts/read-configuration.ps1 Adds configuration parsing and validation. A moderate issue remains: ContainsKey is called before the root-type guard, causing non-object JSON roots to produce method-invocation errors instead of targeted schema errors (lines 74 and 99).
.github/workflows/inter-branch-merge-base.yml Updates the no-configuration workflow message.
Suppressed comments (1)

.github/workflows/scripts/read-configuration.ps1:100

  • This presence check casts the value to a string, so schema-invalid JSON values such as a number, boolean, array, or object can pass as non-empty and be written to the workflow output. The merge step then treats that representation as a branch and can fail later or target the wrong branch. Require MergeToBranch itself to be a string before accepting it.
    if ($configuration.ContainsKey('MergeToBranch') -and
        ![string]::IsNullOrWhiteSpace([string]$configuration['MergeToBranch'])) {

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

Comment thread .github/workflows/scripts/read-configuration.ps1 Outdated
Ensure non-object JSON roots receive the targeted schema error and reject non-string MergeToBranch values before producing workflow outputs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 040f9d82-5d74-492a-a03d-71f0143afb36
Copilot AI review requested due to automatic review settings August 21, 2026 20:37

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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