Skip to content

fix: sync-main-to-dev conflict detection with merge-tree - #412

Merged
c-vigo merged 1 commit into
release/0.3.1from
bugfix/410-sync-main-to-dev-false-conflict-detection
Mar 22, 2026
Merged

c-vigo merged 1 commit into
release/0.3.1from
bugfix/410-sync-main-to-dev-false-conflict-detection

Conversation

@c-vigo

@c-vigo c-vigo commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes false-positive merge conflict detection in sync-main-to-dev: the workflow used a working-tree git merge with stderr discarded, so any non-zero exit was treated as conflicts. Sync PRs were mislabeled merge-conflict, titles got (conflicts), and auto-merge was skipped even when GitHub reported a clean merge.

Replaces that with git merge-tree --write-tree origin/dev origin/main (in-memory, same merge semantics as git merge), distinguishes exit 1 (real conflicts) from other failures, and fails the step on unexpected errors instead of mislabeling.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • .github/workflows/sync-main-to-dev.yml
    • Document pipeline as merge-tree-based conflict detection
    • Replace trial git merge + merge --abort with git fetch origin main dev and git merge-tree --write-tree; set conflict output from exit code; log/warn/error accordingly
  • assets/workspace/.github/workflows/sync-main-to-dev.yml
    • Same conflict-detection logic for the workspace/downstream template
  • CHANGELOG.md
  • assets/workspace/.devcontainer/CHANGELOG.md
    • Synced from root CHANGELOG.md via manifest (pre-commit)

Changelog Entry

This PR targets release/0.3.1; the entry is under ## [0.3.1] - TBD → ### Fixed (not ## Unreleased):

- **Sync-main-to-dev conflict detection uses merge-tree** ([#410](https://github.com/vig-os/devcontainer/issues/410))
  - Replace working-tree trial merge with `git merge-tree --write-tree` so clean merges are not mislabeled as conflicts
  - Enable auto-merge when dev merges cleanly with main; print merge-tree output on conflicts; fail the step on unexpected errors

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

N/A — workflow-only change; verify on next sync-main-to-dev run (clean merge → auto-merge enabled, no false merge-conflict label).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Release branch: changelog entry is under ## [0.3.1] - TBD → ### Fixed (not ## Unreleased), per project changelog rules.

Downstream devcontainer-smoke-test keeps a decoupled copy of this workflow; align it on the next template sync or a follow-up PR there.

Refs: #410

@c-vigo c-vigo self-assigned this Mar 22, 2026
@c-vigo
c-vigo requested a review from Copilot March 22, 2026 12:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes false-positive merge conflict detection in the sync-main-to-dev GitHub Actions workflow by switching from a working-tree git merge check (with stderr suppressed) to an in-memory git merge-tree --write-tree check with explicit exit-code handling. This aligns sync PR labeling/title/auto-merge behavior with GitHub’s actual mergeability state and avoids mislabeling on unrelated failures.

Changes:

  • Replace trial working-tree git merge conflict detection with git merge-tree --write-tree, treating exit code 1 as conflicts and other failures as fatal.
  • Apply the same logic to the workspace template copy of the workflow.
  • Add a changelog entry documenting the fix (and sync it into the workspace .devcontainer changelog).

Reviewed changes

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

File Description
.github/workflows/sync-main-to-dev.yml Uses git merge-tree --write-tree for conflict detection; distinguishes conflicts vs unexpected errors to prevent false merge-conflict labeling and skipped auto-merge.
assets/workspace/.github/workflows/sync-main-to-dev.yml Mirrors the updated merge-tree-based conflict detection logic in the workspace template workflow.
CHANGELOG.md Documents the fix under the 0.3.1 “Fixed” section with issue reference.
assets/workspace/.devcontainer/CHANGELOG.md Syncs the same changelog entry into the workspace devcontainer template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@c-vigo
c-vigo merged commit c2d2e70 into release/0.3.1 Mar 22, 2026
16 checks passed
@c-vigo
c-vigo deleted the bugfix/410-sync-main-to-dev-false-conflict-detection branch March 22, 2026 12:59
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