Skip to content

chore(azure): simplify calculation for getMergeMethod#42849

Merged
jamietanna merged 2 commits intomainfrom
chore/azure
Apr 24, 2026
Merged

chore(azure): simplify calculation for getMergeMethod#42849
jamietanna merged 2 commits intomainfrom
chore/azure

Conversation

@jamietanna
Copy link
Copy Markdown
Contributor

@jamietanna jamietanna commented Apr 23, 2026

Changes

Instead of the complicated check we were previously performing which:

  • recovered from errors if policyConfigurations wasn't undefined, or
    other errors occurred
  • trimmed the field names and checked if they were one of the
    GitPullRequestMergeStrategy options

We can instead rewrite this with stronger types and compile time checks
to confirm that the mapping from a policy configuration matches the
different GitPullRequestMergeStrategys.

This provides a clearer intent for what this code is doing.

This changes behaviour slightly - previously, the first JSON key defined
that was a GitPullRequestMergeStrategy would be used (which is JSON
implementation specific), whereas now it is a defined order.

We also add coverage for the new behaviour.

Context

Please select one of the below:

  • This closes an existing Issue: Closes #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository:

Instead of the complicated check we were previously performing which:

- recovered from errors if `policyConfigurations` wasn't undefined, or
  other errors occurred
- trimmed the field names and checked if they were one of the
  `GitPullRequestMergeStrategy` options

We can instead rewrite this with stronger types and compile time checks
to confirm that the mapping from a policy configuration matches the
different `GitPullRequestMergeStrategy`s.

This provides a clearer intent for what this code is doing.

This changes behaviour slightly - previously, the first JSON key defined
that was a `GitPullRequestMergeStrategy` would be used (which is JSON
implementation specific), whereas now it is a defined order.

We also add coverage for the new behaviour.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
@jamietanna
Copy link
Copy Markdown
Contributor Author

Wondering if we should do it as a "fix" to:

  • get it released
  • indicate that there may be functionality change

?

Copy link
Copy Markdown
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

otherwise LGTM

Comment thread lib/modules/platform/azure/azure-helper.ts Outdated
@jamietanna jamietanna enabled auto-merge April 23, 2026 15:37
@jamietanna jamietanna added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit 6fb038b Apr 24, 2026
46 checks passed
@jamietanna jamietanna deleted the chore/azure branch April 24, 2026 06:24
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 43.141.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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