[DO NOT MERGE] Tests for reorg auto-fix 3-way patching strategy#38337
Open
hestonhoffman wants to merge 1 commit into
Open
[DO NOT MERGE] Tests for reorg auto-fix 3-way patching strategy#38337hestonhoffman wants to merge 1 commit into
hestonhoffman wants to merge 1 commit into
Conversation
Adds astro_reorg/test_transform_diff_paths.py, which validates the format-patch -> transform_diff_paths -> git am --3way pipeline used by resolve_pr_conflicts.py's attempt_fix(). Three isolated scenarios (each in a throwaway temp git repo): 1. Context drift, no overlap: --3way merges both edits. 2. Control: the same patch fails under plain `am`, proving --3way is load-bearing rather than incidental. 3. True content conflict: --3way fails and `git am --abort` recovers, confirming attempt_fix routes to manual review instead of pushing a silently-wrong branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
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.
What does this PR do? What is the motivation?
Adds tests that verify the auto-fix patching strategy in
resolve_pr_conflicts.py— specifically theformat-patch→transform_diff_paths→git am --3waypipeline inattempt_fix().This came out of a code review of the reorg scripts. The open question was whether
--3wayis the right merge approach, and in particular whether rewriting the patch's file paths (content/en/...→hugo/content/en/...) breaks--3way's ability to reconstruct the ancestor blob it needs. It does not —--3waykeys the blob lookup on the SHA in the patch header, which the path rewrite leaves untouched.astro_reorg/test_transform_diff_paths.pybuilds a throwaway git repo in a temp dir for each scenario (nothing in the real repo is touched) and covers three cases on the same pipeline:--3waymerges both the PR's edit and an unrelated master edit.am(no--3way), proving--3wayis load-bearing, not incidental.--3wayfails andgit am --abortrecovers, confirmingattempt_fix()routes to manual review instead of pushing a silently-wrong branch.Run with:
python3 astro_reorg/test_transform_diff_paths.pyMerge instructions
This PR targets the
jen.gilbert/astro-reorg-scriptsbranch, not master. It is for the author to review the tests — do not merge.Merge readiness:
Additional notes
Not tied to a Jira ticket — this is review-support tooling for the reorg scripts.
🤖 Generated with Claude Code