fix(k1): admit start after reopened standby
This commit is contained in:
@@ -3820,13 +3820,21 @@ def _is_reopened_classified_stop_standby_settlement(
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Accept one fresh READY that settles a reopened READY-classified STOP."""
|
"""Accept one fresh READY that settles a reopened READY-classified STOP."""
|
||||||
|
|
||||||
classification = _prepared_stop_classification(record)
|
operation_id = reconciliation.original_attempt.operation_id
|
||||||
|
classification = next(
|
||||||
|
(
|
||||||
|
item
|
||||||
|
for item in record.reconciliations
|
||||||
|
if item.kind == "prepared-stop-classification"
|
||||||
|
and item.original_attempt.operation_id == operation_id
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
if not (
|
if not (
|
||||||
classification is not None
|
classification is not None
|
||||||
and classification.resolution == "physical-standby-observed"
|
and classification.resolution == "physical-standby-observed"
|
||||||
and reconciliation.kind == "resolved-active-cessation"
|
and reconciliation.kind == "resolved-active-cessation"
|
||||||
and reconciliation.resolution == "physical-standby-observed"
|
and reconciliation.resolution == "physical-standby-observed"
|
||||||
and reconciliation.original_attempt.operation_id == record.operation_id
|
|
||||||
and reconciliation.observation.session_state == "ready"
|
and reconciliation.observation.session_state == "ready"
|
||||||
and not reconciliation.observation.project_bound
|
and not reconciliation.observation.project_bound
|
||||||
and not reconciliation.observation.init_ready
|
and not reconciliation.observation.init_ready
|
||||||
@@ -3837,7 +3845,7 @@ def _is_reopened_classified_stop_standby_settlement(
|
|||||||
for reopening in record.operator_reconciliation_reopens
|
for reopening in record.operator_reconciliation_reopens
|
||||||
for retirement in record.operator_retirements
|
for retirement in record.operator_retirements
|
||||||
if reopening.retirement_id == retirement.retirement_id
|
if reopening.retirement_id == retirement.retirement_id
|
||||||
and retirement.original_attempt.operation_id == record.operation_id
|
and retirement.original_attempt.operation_id == operation_id
|
||||||
and retirement.original_attempt.resolution == "not-dispatched"
|
and retirement.original_attempt.resolution == "not-dispatched"
|
||||||
]
|
]
|
||||||
if settlement_index >= len(matching_reopens):
|
if settlement_index >= len(matching_reopens):
|
||||||
|
|||||||
@@ -2142,6 +2142,30 @@ def test_ready_prepared_stop_reset_reopen_accepts_fresh_ready(
|
|||||||
settled
|
settled
|
||||||
)
|
)
|
||||||
|
|
||||||
|
successor = ledger.prepare(
|
||||||
|
operation_id=NEXT_START_OPERATION,
|
||||||
|
parent_operation_id=STOP_OPERATION,
|
||||||
|
acquisition_id="acquisition-after-reset-fresh-ready",
|
||||||
|
action="start",
|
||||||
|
identity=IDENTITY,
|
||||||
|
connection=fresh_connection,
|
||||||
|
compatibility_profile_id="xgrids-k1-v0.6.0",
|
||||||
|
payload_sha256="8" * 64,
|
||||||
|
baseline_status=_status(
|
||||||
|
"ready",
|
||||||
|
connection=fresh_connection,
|
||||||
|
observed_at="2026-08-14T11:11:01.000Z",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
assert successor.revision == settled.revision + 1
|
||||||
|
assert successor.action == "start"
|
||||||
|
assert successor.stage == "prepared"
|
||||||
|
assert successor.parent_operation_id == STOP_OPERATION
|
||||||
|
assert successor.reconciliations[-1].reconciliation_id == (
|
||||||
|
"prepared-stop-ready-reset-fresh-ready"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_scenario_reset_retires_effective_active_prepared_stop_classification(
|
def test_scenario_reset_retires_effective_active_prepared_stop_classification(
|
||||||
tmp_path: Path,
|
tmp_path: Path,
|
||||||
|
|||||||
Reference in New Issue
Block a user