Skip to content

ci: fail the build on unresolved merge-conflict markers - #1661

Merged
kazo0 merged 1 commit into
mainfrom
dev/sb/ci-conflict-markers
Oct 16, 2026
Merged

kazo0 merged 1 commit into
mainfrom
dev/sb/ci-conflict-markers

Conversation

@kazo0

@kazo0 kazo0 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue (If applicable): n/a

PR Type

  • Build or CI related changes

What is the current behavior?

Mergify opens a backport PR even when its cherry-pick conflicts, and commits the <<<<<<< / >>>>>>> markers as-is. Nothing fails until the build chokes on them, deep in a long run.

What is the new behavior?

A new Conflict Markers stage scans the tree for unresolved conflict markers and fails in seconds, listing each file and line.

  • It runs on its own (dependsOn: []), so it does not wait on any other stage.
  • It scans the whole tree, not the diff, so markers already on the base branch are reported too.
  • ======= is not matched, because it is also a Markdown heading underline. Binary files are skipped.
  • The pipeline check is already required on this branch, so a failing stage blocks the PR. No branch-protection change is needed.

Other information

A PR runs the pipeline YAML from its target branch, so backport PRs are only protected once this stage is also on that release or servicing branch. That backport is a clean cherry-pick.

Tested locally: the scan passes on the current tree, and fails with both marker lines listed when a conflicted file is planted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HYd7dbzNqeaaibH62FHLgc

- Mergify opens a backport PR even when its cherry-pick conflicts,
  committing the markers as-is; nothing fails until the build chokes
  on them
- New Conflict_Markers stage, independent of every other stage, greps
  the whole tree for `<<<<<<<` / `>>>>>>>` lines and fails in seconds
- Whole tree rather than the diff, so markers already on the base
  branch are reported by name on every PR into it
- Binary files are skipped (-I) so stray byte matches do not fail it

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HYd7dbzNqeaaibH62FHLgc
Copilot AI balanced review requested due to automatic review settings October 6, 2026 16:07
@kazo0

kazo0 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio backport servicing/10.0

@mergify

mergify Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

backport servicing/10.0

✅ Backports have been created

Details

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.

Copilot review overview

🟢 Approval recommended

The CI stage is small, self-contained, and its regex, exit-code handling, and pipeline wiring are verified correct and consistent with existing repo conventions.

Review effort: Balanced
Findings: None

What changed in this PR

This PR adds a new Azure Pipelines stage, Conflict Markers, that scans the entire checked-out tree for unresolved merge-conflict markers (<<<<<<< / >>>>>>>) and fails fast when any are found. The motivation is Mergify-generated backport PRs that commit conflict markers as-is, which otherwise only surface deep in a long build; this surfaces them in seconds with each offending file and line listed.

Changes:

  • New build/workflow/stage-conflict-markers.yml template: a single Scan job that runs git grep -nIE '^(<<<<<<<|>>>>>>>)( |$)' and maps git grep's exit codes (0 = markers found → fail, 1 = none → pass, >1 = error → fail).
  • build/workflow/pipeline.yml: inserts the Conflict_Markers stage with dependsOn: [] so it runs immediately and in parallel with other stages.
File Description
build/​workflow/​stage-conflict-markers.yml New stage template; greps tracked files for conflict markers, skips binaries (-I), excludes ======= to avoid Markdown heading false positives, and reports file/line.
build/​workflow/​pipeline.yml Wires the new Conflict_Markers stage into the pipeline with no dependencies so it runs early and gates the overall build result.

Notes from verification:

  • The git grep + case $? idiom relies on Azure's inline bash: not enabling errexit; this is confirmed in-repo (steps add set -euo pipefail explicitly when they need it, e.g. stage-build-desktop.yml:93), so the "no matches" (exit 1) path correctly passes.
  • A tree-wide search with the same pattern finds no matches today, so the stage passes on the current branch.
  • Stage/job structure, pool, vmImage, cancelTimeoutInMinutes: 0, and the top-level jobs: template layout are consistent with existing templates.

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

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

@kazo0
kazo0 enabled auto-merge (squash) October 8, 2026 05:03
@kazo0
kazo0 disabled auto-merge October 16, 2026 15:32
@kazo0
kazo0 merged commit dc7482e into main Oct 16, 2026
27 checks passed
@kazo0
kazo0 deleted the dev/sb/ci-conflict-markers branch October 16, 2026 15:33
kazo0 added a commit that referenced this pull request Oct 16, 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