fix(automation): keep nonconflicting lanes moving
This commit is contained in:
@@ -6076,6 +6076,7 @@ def _apply_parallel_mainline_execution_overlay(payload: dict[str, Any]) -> None:
|
||||
items = _list(payload.get("commander_inserted_requirement_work_items"))
|
||||
if not items:
|
||||
return
|
||||
current_p0_workplan_id = str(state.get("active_p0_workplan_id") or "")
|
||||
next_item = next(
|
||||
(
|
||||
_dict(item)
|
||||
@@ -6083,29 +6084,39 @@ def _apply_parallel_mainline_execution_overlay(payload: dict[str, Any]) -> None:
|
||||
if item.get("status") in {"in_progress", "pending"}
|
||||
and str(item.get("priority") or "") == "P0"
|
||||
and str(item.get("id") or "") != "CIR-P0-006"
|
||||
and str(item.get("mapped_workplan_id") or "")
|
||||
!= current_p0_workplan_id
|
||||
),
|
||||
_dict(items[0]),
|
||||
{},
|
||||
)
|
||||
external_wait_active = _stockplatform_external_data_wait_active(state)
|
||||
parallel_work_available = bool(next_item.get("id"))
|
||||
retry_readback_at = (
|
||||
_next_stockplatform_data_retry_readback_at()
|
||||
if external_wait_active
|
||||
else ""
|
||||
)
|
||||
overlay = {
|
||||
"enabled": external_wait_active,
|
||||
"enabled": parallel_work_available,
|
||||
"policy": str(
|
||||
state.get("next_executable_mainline_policy")
|
||||
or "when_p0_has_external_gate_do_not_idle"
|
||||
or "continue_current_p0_and_advance_non_conflicting_parallel_work"
|
||||
),
|
||||
"current_p0_workplan_id": str(state.get("active_p0_workplan_id") or ""),
|
||||
"current_p0_workplan_id": current_p0_workplan_id,
|
||||
"current_p0_state": str(state.get("active_p0_state") or ""),
|
||||
"current_p0_wait_state": (
|
||||
"external_stockplatform_data_retry_wait"
|
||||
if external_wait_active
|
||||
else "active_p0_not_external_wait"
|
||||
else (
|
||||
"active_p0_parallel_non_conflicting_work"
|
||||
if parallel_work_available
|
||||
else "no_parallel_p0_work_available"
|
||||
)
|
||||
),
|
||||
"retry_readback_at": retry_readback_at,
|
||||
"current_p0_preserved": True,
|
||||
"delegation_context_only": True,
|
||||
"non_conflicting_only": True,
|
||||
"parallel_work_item": {
|
||||
"id": str(next_item.get("id") or ""),
|
||||
"priority": str(next_item.get("priority") or ""),
|
||||
@@ -6115,8 +6126,10 @@ def _apply_parallel_mainline_execution_overlay(payload: dict[str, Any]) -> None:
|
||||
"next_action": str(next_item.get("next_action") or ""),
|
||||
},
|
||||
"report_contract": {
|
||||
"current_p0": str(state.get("active_p0_workplan_id") or ""),
|
||||
"action": "advance_parallel_mainline_work_item_while_external_data_retry_waits",
|
||||
"current_p0": current_p0_workplan_id,
|
||||
"action": (
|
||||
"advance_parallel_non_conflicting_work_without_replacing_current_p0"
|
||||
),
|
||||
"evidence": "priority_readback.parallel_mainline_execution",
|
||||
"next_action": str(next_item.get("next_action") or ""),
|
||||
},
|
||||
@@ -6124,7 +6137,7 @@ def _apply_parallel_mainline_execution_overlay(payload: dict[str, Any]) -> None:
|
||||
}
|
||||
payload["mainline_parallel_execution"] = overlay
|
||||
|
||||
state["parallel_mainline_execution_enabled"] = external_wait_active
|
||||
state["parallel_mainline_execution_enabled"] = parallel_work_available
|
||||
state["parallel_mainline_current_p0_wait_state"] = overlay[
|
||||
"current_p0_wait_state"
|
||||
]
|
||||
@@ -6140,12 +6153,12 @@ def _apply_parallel_mainline_execution_overlay(payload: dict[str, Any]) -> None:
|
||||
state["parallel_mainline_forbidden_actions"] = _PARALLEL_MAINLINE_FORBIDDEN_ACTIONS
|
||||
|
||||
rollups = _dict(payload.setdefault("rollups", {}))
|
||||
rollups["parallel_mainline_execution_enabled"] = external_wait_active
|
||||
rollups["parallel_mainline_execution_enabled"] = parallel_work_available
|
||||
rollups["parallel_mainline_work_item_id"] = overlay["parallel_work_item"]["id"]
|
||||
rollups["parallel_mainline_retry_readback_at"] = retry_readback_at
|
||||
|
||||
summary = _dict(payload.setdefault("summary", {}))
|
||||
summary["parallel_mainline_execution_enabled"] = external_wait_active
|
||||
summary["parallel_mainline_execution_enabled"] = parallel_work_available
|
||||
summary["parallel_mainline_current_p0_wait_state"] = overlay[
|
||||
"current_p0_wait_state"
|
||||
]
|
||||
|
||||
@@ -3486,6 +3486,32 @@ def test_awoooi_priority_work_order_readback_allows_parallel_mainline_on_stockpl
|
||||
assert payload["rollups"]["parallel_mainline_work_item_id"] == "CIR-P0-007"
|
||||
|
||||
|
||||
def test_awoooi_priority_work_order_readback_keeps_nonconflicting_parallel_work_active():
|
||||
payload = load_latest_awoooi_priority_work_order_readback()
|
||||
runtime = _stockplatform_runtime_ready()
|
||||
preflight = load_latest_stockplatform_public_api_controlled_recovery_preflight(
|
||||
runtime_readback=runtime
|
||||
)
|
||||
|
||||
apply_stockplatform_public_api_runtime_readback(payload, runtime)
|
||||
apply_stockplatform_public_api_controlled_recovery_preflight(payload, preflight)
|
||||
|
||||
parallel = payload["mainline_parallel_execution"]
|
||||
assert parallel["enabled"] is True
|
||||
assert parallel["current_p0_wait_state"] == (
|
||||
"active_p0_parallel_non_conflicting_work"
|
||||
)
|
||||
assert parallel["current_p0_preserved"] is True
|
||||
assert parallel["delegation_context_only"] is True
|
||||
assert parallel["non_conflicting_only"] is True
|
||||
assert parallel["parallel_work_item"]["id"] == "CIR-P0-007"
|
||||
assert parallel["report_contract"]["action"] == (
|
||||
"advance_parallel_non_conflicting_work_without_replacing_current_p0"
|
||||
)
|
||||
assert payload["summary"]["parallel_mainline_execution_enabled"] is True
|
||||
assert payload["rollups"]["parallel_mainline_execution_enabled"] is True
|
||||
|
||||
|
||||
def test_awoooi_priority_work_order_readback_routes_stockplatform_ai_recommendations():
|
||||
payload = load_latest_awoooi_priority_work_order_readback()
|
||||
runtime = _stockplatform_runtime_ai_recommendations_stale_after_core_recovered()
|
||||
|
||||
Reference in New Issue
Block a user