fix(k1): settle reopened standby after reset
This commit is contained in:
@@ -2084,6 +2084,65 @@ def test_ready_prepared_stop_classification_is_retireable_only_by_scenario_reset
|
||||
)
|
||||
|
||||
|
||||
def test_ready_prepared_stop_reset_reopen_accepts_fresh_ready(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""A post-reset reopen must consume a new READY, not reject the old audit."""
|
||||
|
||||
ledger = _ledger(tmp_path, monkeypatch)
|
||||
_prepare_start(ledger)
|
||||
_complete_start(ledger)
|
||||
_prepare_stop(ledger)
|
||||
_, classified = _prepared_stop_classification(ledger, "ready")
|
||||
assert isinstance(classified, ledger_module.PhysicalCommandRecord)
|
||||
|
||||
retired = ledger.retire_unavailable_target(
|
||||
retirement_id="prepared-stop-ready-reset-retirement",
|
||||
expected_operation_id=classified.operation_id,
|
||||
expected_revision=classified.revision,
|
||||
expected_transport_ref=classified.connection.transport_ref,
|
||||
reason="connection-scenario-reset-by-operator",
|
||||
)
|
||||
reopened = ledger.reopen_retired_reconciliation(
|
||||
reopening_id="prepared-stop-ready-reset-reopen",
|
||||
expected_revision=retired.revision,
|
||||
expected_retirement_id="prepared-stop-ready-reset-retirement",
|
||||
expected_transport_ref=retired.connection.transport_ref,
|
||||
expected_discovery_generation=120,
|
||||
reason="reset-network-intent-read-only-settlement",
|
||||
)
|
||||
assert reopened.reopened_physical_state_requires_reconciliation is True
|
||||
|
||||
fresh_connection = _connection(
|
||||
control_session_id="prepared-stop-ready-reset-fresh-control",
|
||||
host_path_epoch=9,
|
||||
producer_generation=13,
|
||||
)
|
||||
settled = ledger.observe_resolved_active_standby(
|
||||
STOP_OPERATION,
|
||||
reconciliation_id="prepared-stop-ready-reset-fresh-ready",
|
||||
verified_binding=_verified_binding(
|
||||
connection=fresh_connection,
|
||||
verification_id="prepared-stop-ready-reset-fresh-ready.device-info",
|
||||
),
|
||||
observation=_status(
|
||||
"ready",
|
||||
connection=fresh_connection,
|
||||
source="explicit-read-only-reconciliation",
|
||||
observed_at="2026-08-14T11:11:00.000Z",
|
||||
),
|
||||
)
|
||||
|
||||
assert settled.resolution == "not-dispatched"
|
||||
assert settled.original_command_outcome == "not-dispatched"
|
||||
assert settled.reconciled_physical_state == "standby"
|
||||
assert settled.reopened_physical_state_requires_reconciliation is False
|
||||
assert PhysicalCommandLedger(tmp_path / "repository", clock=_clock).snapshot().record == (
|
||||
settled
|
||||
)
|
||||
|
||||
|
||||
def test_scenario_reset_retires_effective_active_prepared_stop_classification(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
|
||||
Reference in New Issue
Block a user