[Backport pipeline] Fix manifest.yml data loss during cherry-pick conflict resolution#19962
Open
mrodm wants to merge 13 commits into
Open
[Backport pipeline] Fix manifest.yml data loss during cherry-pick conflict resolution#19962mrodm wants to merge 13 commits into
mrodm wants to merge 13 commits into
Conversation
…cherry-pick Previously the apply script always reset manifest.yml to HEAD after a cherry-pick, discarding any legitimate content changes (e.g. new fields) alongside the version bump. Now only a version-line-only conflict is auto-resolved, letting the rest of the file's cherry-picked content merge normally; genuine conflicts elsewhere in the file are still reported. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
resolveManifestVersionConflict parses git's rendered conflict-marker text directly. Under diff3/zdiff3 conflict styles the extra base section made every conflict block look unresolvable, silently degrading auto-resolution with no diagnostic. Forcing the style on the cherry-pick invocation removes the dependency on the caller's ambient git config. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ld during conflict resolution resolveManifestVersionConflict now requires the merged manifest.yml to contain exactly one "version:" line before accepting it as resolved, falling back to a reported conflict otherwise. This protects against a version-only conflict block whose "theirs" side is empty (e.g. the source commit's hunk deleted the field alongside unrelated content), which previously produced a manifest.yml missing its mandatory version field and surfaced as an opaque error instead of a normal conflict. Test scenarios were also reworked to reflect the realistic backport shape: the branch is the older side, advancing only through its own small independent bumps, while the cherry-picked commit's version (carried on main) is normally ahead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…st.yml disappears
A cherry-picked commit deleting or renaming a package's manifest.yml
left the apply pipeline with an opaque hard error instead of a normal
conflict report — whether the file vanished via a delete/modify
conflict, or a clean merge that removes it outright with no conflict
markers at all. cherryPickOrConflict now checks for this explicitly
right after the cherry-pick runs and reports Result{Status:"conflict"}
in either case, before ever calling resolveManifestVersionConflict or
setManifestVersion on a file that no longer exists.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
resolveManifestVersionConflict now returns whether manifest.yml had any conflict markers at all, not just whether it ended up resolved — those were previously conflated, since it also reports "resolved" when manifest.yml never conflicted in the first place (some other file caused the cherry-pick failure). cherryPickOrConflict uses this to log a note precisely when a real version-only conflict was silently resolved by keeping the incoming change, so operators tailing logs can tell that apart from an ordinary clean cherry-pick. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ersion Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…t a realistic scenario Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…fore the cherry-pick even starts Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tVersion, drop the duplicate yaml.v3 parser Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…hard HEAD calls Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…hes the original PR Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This reverts commit 47b0768.
mrodm
commented
Jul 3, 2026
| // git config: resolveManifestVersionConflict below parses "<<<<<<<"/"======="/ | ||
| // ">>>>>>>" text directly, and a diff3/zdiff3 style would make every block | ||
| // look unresolvable. | ||
| cherryErr := a.git.Run("-c", "merge.conflictStyle=merge", "cherry-pick", "-n", sha) |
Collaborator
Author
There was a problem hiding this comment.
It changes the conflict style markers in this single call/process. So, this call does not change any configuration the developers could have in their own setups or laptops.
💚 Build Succeeded
cc @mrodm |
mrodm
commented
Jul 3, 2026
Comment on lines
+455
to
+458
| if len(ours) == 1 && strings.HasPrefix(ours[0], "version:") { | ||
| out = append(out, theirs...) | ||
| continue | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
This loop just accepts the conflicts related to version line.
Other conflicts in the manifest.yml are kept. So if any conflicts remains after this loop, this file is going to be reported as a conflicting file.
mrodm
commented
Jul 3, 2026
|
|
||
| b.WriteString("\n## Author's checklist\n\n") | ||
| b.WriteString("- [ ] Review the version set in `manifest.yml` and `changelog.yml`\n") | ||
| b.WriteString("- [ ] Compare the `manifest.yml` changes here against the original PR (linked above under Origin) and confirm they match — a conflict limited to the version line is auto-resolved by keeping the incoming change as-is, with no compatibility check against this branch\n") |
Collaborator
Author
There was a problem hiding this comment.
Added a new checklist item in the PR description to try to emphasize that developers should check the manifest.yml file, if it makes sense or no.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Backport pipeline] Fix manifest.yml data loss during cherry-pick conflict resolution
TL;DR
The backport-apply pipeline (
dev/backports/apply/apply.go) discarded all changes to a package'smanifest.ymlwhenever a cherry-pick conflicted on it — not just the version bump, but any other legitimate content the source commit touched (new fields, category/owner changes, data stream additions, etc.). This PR fixes that: only a genuine version-line conflict is auto-resolved (version normalized back to the branch's own lineage), everything else is preserved or surfaced as a real conflict for a human to resolve. Includes several follow-up hardening, observability, and cleanup passes from two rounds of code review.Proposed commit message
Author's Checklist
47b0768d89, "Test changes locally") that disablesgit push/gh pr createand adds a duplicate.backports.ymltest entrygo test ./dev/backports/apply/...passes (unit + integration tests, including the new manifest-preservation and missing-manifest regression tests)go vet ./dev/backports/...is cleanHow to test this PR locally
go test ./dev/backports/apply/...Or exercise the pipeline directly against a scratch repo:
Related issues