fix(pr): stop rebased syncs from losing ancestry#98765
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 1, 2026, 5:34 PM ET / 21:34 UTC. Summary PR surface: Tests +501, Other +558. Total +1059 across 6 files. Reproducibility: no. live high-confidence reproduction was run in this read-only review. The source path is reproducible by inspection: current Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the guarded publication and repair flow only after script-owner approval and green exact-head gates confirm the stricter fail-closed behavior is acceptable for maintainer PR landing workflows. Do we have a high-confidence way to reproduce the issue? No live high-confidence reproduction was run in this read-only review. The source path is reproducible by inspection: current Is this the best way to solve the issue? Yes, the guard is placed at the publication boundary and the same-tree repair path is narrowly constrained. The remaining concern is upgrade safety for maintainer sync flows, not a better code location for the fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eb417fa206e6. Label changesLabel justifications:
Evidence reviewedPR surface: Tests +501, Other +558. Total +1059 across 6 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Superseded by #108018, landed as 2e73cff. This PR repaired the old eager-rebase design by adding an explicit ancestry-repair mode. The landed fix removes that root condition: prepare sync preserves the hosted PR ancestry, rejects rewritten local topology before mutation, and delegates mainline drift to merge verification. That is one smaller canonical path and does not require force-moving a contributor branch. The landed regression suite covers the ancestry refusal and exact merge-parent CI diff, and exact-head CI passed. Thank you for carrying the original failure analysis; closing this larger repair branch as obsolete. |
What Problem This Solves
Fixes an issue where maintainers syncing a rebased PR preparation head could publish the intended tree on the old branch ancestry, leaving the prepared topology and merge-gate evidence inconsistent.
Why This Change Was Made
The default GitHub GraphQL publication path now refuses before mutation unless the prepared head preserves both the remote lease ancestry and mainline merge base. A new explicit
prepare-push --repair-ancestrymode may move only a same-repository branch ref when the verified local and remote trees are identical; it requires the recorded sync artifact, an unchanged lease, explicit git/unsigned overrides, a successful force-with-lease dry run, and post-publication SHA/tree/base/content verification. It never falls back to GraphQL.The repair clears stale preparation evidence and cannot finalize until normal hosted gates pass for the exact published SHA. Other Testbox changed-head publication remains refused and the normal content-changing path proves or reruns local gates before publication.
User Impact
Maintainers can repair same-tree ancestry after a rebase without fabricating gate artifacts or weakening
prepare-runormerge-run. Unsafe or ambiguous publication states fail closed before the branch is mutated.Evidence
node scripts/run-vitest.mjs test/scripts/pr-push-topology.test.ts test/scripts/pr-wrappers.test.ts— 22 tests passed.bash -nand ShellCheck on the touched shell wrappers passed.git diff --checkpassed.tbx_01kwfrjn5xkx6q8vbxf6yxvdj3(Actions run).gpt-5.6-solxhigh autoreview reported no actionable findings on the rebased current-main diff.