fix(k1): close verified stop checkpoint gap
This commit is contained in:
@@ -3217,11 +3217,22 @@ def _require_active_cessation_shape(
|
||||
and physical_proof.reconciliation_resolution == "physical-standby-observed"
|
||||
and physical_proof.stop_fence == "definitely-not-dispatched"
|
||||
)
|
||||
reconciled_ambiguous_stop_standby = bool(
|
||||
physical_proof.action == "stop"
|
||||
and physical_proof.operation_id != checkpoint.original_start_operation_id
|
||||
and _stop_lineage_reaches_checkpoint_start(checkpoint, physical_proof)
|
||||
and physical_proof.resolution == "physical-standby-observed"
|
||||
and not physical_proof.composite_complete
|
||||
and physical_proof.reconciliation_kind == "ambiguous-outcome"
|
||||
and physical_proof.reconciliation_resolution == "physical-standby-observed"
|
||||
and physical_proof.stop_fence == "none"
|
||||
)
|
||||
if not (
|
||||
ordinary_stop
|
||||
or reconciled_start_standby
|
||||
or reconciled_ambiguous_start_standby
|
||||
or reconciled_undispatched_stop_standby
|
||||
or reconciled_ambiguous_stop_standby
|
||||
):
|
||||
raise ActiveAcquisitionRecoveryCheckpointTransitionError(
|
||||
"active cessation lacks terminal physical standby lineage"
|
||||
@@ -3269,7 +3280,11 @@ def _require_active_reconciled_standby_shape(
|
||||
)
|
||||
if not (
|
||||
cessation_physical_proof.reconciliation_kind
|
||||
in {"prepared-stop-classification", "resolved-active-cessation"}
|
||||
in {
|
||||
"ambiguous-outcome",
|
||||
"prepared-stop-classification",
|
||||
"resolved-active-cessation",
|
||||
}
|
||||
and cessation_physical_proof.reconciliation_resolution
|
||||
== "physical-standby-observed"
|
||||
and cessation_physical_proof.effective_resolution
|
||||
|
||||
@@ -11498,11 +11498,38 @@ class XgridsK1CompatibilityService:
|
||||
== "explicit-read-only-reconciliation"
|
||||
and not reconciliation.observation.mqtt_retained
|
||||
)
|
||||
reconciled_ambiguous_terminal_stop = bool(
|
||||
record.stage == "resolved"
|
||||
and record.resolution == "physical-standby-observed"
|
||||
and reconciliation is not None
|
||||
and reconciliation.kind == "ambiguous-outcome"
|
||||
and reconciliation.resolution == "physical-standby-observed"
|
||||
and reconciliation.original_attempt.operation_id == record.operation_id
|
||||
and reconciliation.original_attempt.acquisition_id == record.acquisition_id
|
||||
and reconciliation.original_attempt.action == "stop"
|
||||
and reconciliation.original_attempt.stage == "observing"
|
||||
and reconciliation.original_attempt.resolution is None
|
||||
and reconciliation.original_attempt.publish_call_returned is True
|
||||
and reconciliation.original_attempt.packet_id is not None
|
||||
and reconciliation.original_attempt.qos2_completed
|
||||
and reconciliation.original_attempt.application_response is not None
|
||||
and reconciliation.original_attempt.application_response.success
|
||||
and reconciliation.observation.source
|
||||
== "explicit-read-only-reconciliation"
|
||||
and reconciliation.observation.session_state in {"ready", "scan_over"}
|
||||
and not reconciliation.observation.project_bound
|
||||
and not reconciliation.observation.init_ready
|
||||
and not reconciliation.observation.mqtt_retained
|
||||
)
|
||||
if not (
|
||||
persisted is not None
|
||||
and status is not None
|
||||
and record.action == "stop"
|
||||
and (unresolved_stop or classified_terminal_stop)
|
||||
and (
|
||||
unresolved_stop
|
||||
or classified_terminal_stop
|
||||
or reconciled_ambiguous_terminal_stop
|
||||
)
|
||||
and record.acquisition_id == checkpoint.acquisition_id
|
||||
and record.identity.vendor_device_id_sha256
|
||||
== checkpoint.identity.vendor_device_id_sha256
|
||||
@@ -12979,7 +13006,7 @@ class XgridsK1CompatibilityService:
|
||||
self,
|
||||
token: _ActiveAcquisitionCheckpointTrustToken | None,
|
||||
) -> bool:
|
||||
"""Finish the exact fsync-after-ledger crash gap without device I/O."""
|
||||
"""Finish an exact STOP-ledger/checkpoint fsync gap without device I/O."""
|
||||
|
||||
if token is None or token.checkpoint_state != "active":
|
||||
return False
|
||||
@@ -12990,14 +13017,35 @@ class XgridsK1CompatibilityService:
|
||||
if record is not None and record.reconciliations
|
||||
else None
|
||||
)
|
||||
definitely_undispatched = bool(
|
||||
record is not None
|
||||
and record.resolution == "not-dispatched"
|
||||
and reconciliation is not None
|
||||
and reconciliation.kind == "prepared-stop-classification"
|
||||
)
|
||||
dispatched_then_observed_standby = bool(
|
||||
record is not None
|
||||
and record.resolution == "physical-standby-observed"
|
||||
and reconciliation is not None
|
||||
and reconciliation.kind == "ambiguous-outcome"
|
||||
and reconciliation.original_attempt.operation_id == record.operation_id
|
||||
and reconciliation.original_attempt.acquisition_id == record.acquisition_id
|
||||
and reconciliation.original_attempt.action == "stop"
|
||||
and reconciliation.original_attempt.stage == "observing"
|
||||
and reconciliation.original_attempt.resolution is None
|
||||
and reconciliation.original_attempt.publish_call_returned is True
|
||||
and reconciliation.original_attempt.packet_id is not None
|
||||
and reconciliation.original_attempt.qos2_completed
|
||||
and reconciliation.original_attempt.application_response is not None
|
||||
and reconciliation.original_attempt.application_response.success
|
||||
)
|
||||
if not (
|
||||
ledger_snapshot.status == "resolved"
|
||||
and record is not None
|
||||
and record.action == "stop"
|
||||
and record.stage == "resolved"
|
||||
and record.resolution == "not-dispatched"
|
||||
and reconciliation is not None
|
||||
and reconciliation.kind == "prepared-stop-classification"
|
||||
and (definitely_undispatched or dispatched_then_observed_standby)
|
||||
and reconciliation.resolution == "physical-standby-observed"
|
||||
and reconciliation.observation.source
|
||||
== "explicit-read-only-reconciliation"
|
||||
|
||||
Reference in New Issue
Block a user