@@ -646,5 +646,29 @@ assert_eq "test_merge_to_main_no_v2_tickets_dir_case" "0" "$HAS_V2_TICKETS_ARCHI
646646HAS_TICKETS_DIR_V2=$( grep -cE ' TICKETS_DIR.*=.*"?\.tickets"?' " $MERGE_SCRIPT " || true)
647647assert_eq " test_merge_to_main_no_TICKETS_DIR_tickets_path" " 0" " $HAS_TICKETS_DIR_V2 "
648648
649+ # =============================================================================
650+ # Test: _phase_version_bump checks for already-modified version file before bumping
651+ # Bug 6ea9-a2af: if bump-version.sh ran but git commit --amend failed, resume
652+ # would call bump-version.sh again (double-bump). The fix is to check whether the
653+ # version file is already modified before bumping.
654+ # =============================================================================
655+ echo " --- test_version_bump_idempotent_guard ---"
656+ _snapshot_fail
657+ # Look for a guard in _phase_version_bump that checks if version file is already modified
658+ # before calling bump-version.sh. The pattern: git diff or similar check before bump-version.sh
659+ _has_already_bumped_guard=0
660+ # Extract _phase_version_bump function body and check for a pre-bump guard
661+ # that detects an already-modified version file before calling bump-version.sh.
662+ # Must reference "already bumped" or check git diff on the version file.
663+ _vb_body=$( sed -n ' /_phase_version_bump()/,/^}/p' " $MERGE_SCRIPT " )
664+ # The pattern must appear AFTER the resume-skip block and BEFORE bump-version.sh call.
665+ # Filter out the "already completed (resume skip)" line — that's the state-file check, not the file-level guard.
666+ if echo " $_vb_body " | grep -v " resume skip" | grep -qE ' already.*bump|git diff.*version|version.*file.*modif' ; then
667+ _has_already_bumped_guard=1
668+ fi
669+ assert_eq " test_version_bump_idempotent_guard: _phase_version_bump must check if version already bumped before calling bump-version.sh" \
670+ " 1" " $_has_already_bumped_guard "
671+ assert_pass_if_clean " test_version_bump_idempotent_guard"
672+
649673# =============================================================================
650674print_summary
0 commit comments