Skip to content

[DO NOT MERGE] Tests for reorg auto-fix 3-way patching strategy#38337

Open
hestonhoffman wants to merge 1 commit into
jen.gilbert/astro-reorg-scriptsfrom
heston/astro-reorg-3way-tests
Open

[DO NOT MERGE] Tests for reorg auto-fix 3-way patching strategy#38337
hestonhoffman wants to merge 1 commit into
jen.gilbert/astro-reorg-scriptsfrom
heston/astro-reorg-3way-tests

Conversation

@hestonhoffman

Copy link
Copy Markdown
Contributor

What does this PR do? What is the motivation?

Adds tests that verify the auto-fix patching strategy in resolve_pr_conflicts.py — specifically the format-patchtransform_diff_pathsgit am --3way pipeline in attempt_fix().

This came out of a code review of the reorg scripts. The open question was whether --3way is 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 — --3way keys the blob lookup on the SHA in the patch header, which the path rewrite leaves untouched.

astro_reorg/test_transform_diff_paths.py builds 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:

  1. Context drift, no overlap--3way merges both the PR's edit and an unrelated master edit.
  2. Control — the same patch fails under plain am (no --3way), proving --3way is load-bearing, not incidental.
  3. True content conflict — PR and master edit the same line; --3way fails and git am --abort recovers, confirming attempt_fix() routes to manual review instead of pushing a silently-wrong branch.

Run with: python3 astro_reorg/test_transform_diff_paths.py

Merge instructions

This PR targets the jen.gilbert/astro-reorg-scripts branch, not master. It is for the author to review the tests — do not merge.

Merge readiness:

  • Ready for merge

Additional notes

Not tied to a Jira ticket — this is review-support tooling for the reorg scripts.

🤖 Generated with Claude Code

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>
@hestonhoffman
hestonhoffman requested a review from a team as a code owner July 20, 2026 22:52
@hestonhoffman hestonhoffman added the Do Not Merge Just do not merge this PR :) label Jul 20, 2026
@datadog-official

Copy link
Copy Markdown
Contributor

Pipelines

⚠️ Warnings

🚦 2 Pipeline jobs failed

DataDog/documentation | build_preview   View in Datadog   GitLab

Merge label check | Merge is not allowed when &#39;Do Not Merge&#39; label is present   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 595260e | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge Just do not merge this PR :)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant