test(update): pin the refused-receipt shape the stop_reason clause exists for
update_contract writes {"outcome": "refused", "stop_reason": <code>} with no
exit_code; that is the one production receipt where the stop_reason clause in
_receipt_looks_unfinished is load-bearing. The previous negative control used
exit_code=1, which the exit_code branch already catches. Docstring reworded:
a KeyboardInterrupt never lands on a success receipt (the boundary finalize is
a no-op once the inner path finalized).
This commit is contained in:
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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": <code>} 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(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user