diff --git a/hermes_cli/update_cmd_fleet.py b/hermes_cli/update_cmd_fleet.py index b8ebab13f3..8aa42deeeb 100644 --- a/hermes_cli/update_cmd_fleet.py +++ b/hermes_cli/update_cmd_fleet.py @@ -81,8 +81,8 @@ def _receipt_looks_unfinished(receipt: dict) -> bool: """True when *receipt* is from an update that did not finish cleanly. ``stop_reason`` records *how* the command boundary closed the receipt - (``completed at command boundary``, ``sys.exit(0)``, even KeyboardInterrupt - on an otherwise successful run). A truthy stop_reason must not make a + (``completed at command boundary``, ``sys.exit(0)``, or a refusal code from + ``update_contract``). A truthy stop_reason must not make a successful receipt look unfinished, or the next ``hermes update`` retriggers ``fleet_restart_pending`` from pre-pull plan SHAs. """ diff --git a/tests/hermes_cli/test_update_fleet_restart_pending.py b/tests/hermes_cli/test_update_fleet_restart_pending.py index ccde52ffc7..321fa25bf8 100644 --- a/tests/hermes_cli/test_update_fleet_restart_pending.py +++ b/tests/hermes_cli/test_update_fleet_restart_pending.py @@ -312,6 +312,14 @@ def test_successful_non_boundary_stop_reasons_are_finished(receipt): assert update_cmd._receipt_looks_unfinished(receipt) is False +def test_refused_receipt_with_only_a_stop_reason_is_unfinished(): + # update_contract writes {"outcome": "refused", "stop_reason": } with no exit_code; + # the stop_reason clause is what keeps that receipt unfinished. + assert update_cmd._receipt_looks_unfinished( + {"outcome": "refused", "stop_reason": "not_updatable_in_place"} + ) is True + + def test_failed_interrupt_stop_reason_is_unfinished(): assert update_cmd._receipt_looks_unfinished( {