rewrite-history-merge-preserving.py documents a four-phase model, but Phase 3 — verifying that the Phase-2 rewritten tip has the same tree as the Phase-1 reference — has no implementing function. The check the script exists to guarantee is left to the operator.
What is and isn't implemented
Verified on upstream/main (script merged via 1f41862f3c3):
| Phase |
Documented at |
Implemented by |
| 1 — reference tree |
docstring |
run_phase_1_reference() |
| 2 — merge-preserving rewrite |
docstring |
run_phase_2_rewrite() |
| 3 — VERIFY tip ≡ reference |
docstring line 36 |
❌ nothing |
| 4 — Mode A merge |
docstring |
assert_topology_preserved() (topology only) |
grep -c 'def run_phase_3\|def verify_phase' returns 0.
--phase-1 prints the reference tree hash and exits; the default Phase-2 path
never compares against it. Nothing closes the loop, so a per-commit rewrite
that silently disagrees with the format-once-at-main tree passes unnoticed.
Proposed work
Add a run_phase_3_verify(reference_tree, branch) that diffs the rewritten tip
against the Phase-1 reference and exits non-zero on any difference, and wire it
into the Phase-2 path (or a --verify-against <tree> flag) so the gate is
automatic rather than a documented manual step.
~30 lines. Until it exists, the manual gate is git diff --stat <ref> HEAD,
which must be empty.
rewrite-history-merge-preserving.pydocuments a four-phase model, but Phase 3 — verifying that the Phase-2 rewritten tip has the same tree as the Phase-1 reference — has no implementing function. The check the script exists to guarantee is left to the operator.What is and isn't implemented
Verified on
upstream/main(script merged via1f41862f3c3):run_phase_1_reference()run_phase_2_rewrite()assert_topology_preserved()(topology only)grep -c 'def run_phase_3\|def verify_phase'returns 0.--phase-1prints the reference tree hash and exits; the default Phase-2 pathnever compares against it. Nothing closes the loop, so a per-commit rewrite
that silently disagrees with the format-once-at-main tree passes unnoticed.
Proposed work
Add a
run_phase_3_verify(reference_tree, branch)that diffs the rewritten tipagainst the Phase-1 reference and exits non-zero on any difference, and wire it
into the Phase-2 path (or a
--verify-against <tree>flag) so the gate isautomatic rather than a documented manual step.
~30 lines. Until it exists, the manual gate is
git diff --stat <ref> HEAD,which must be empty.