feat(work-items): surface current p0 execution focus
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m8s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-10 11:33:08 +08:00
parent c578bcdcfa
commit 53e25c6616
5 changed files with 374 additions and 13 deletions

View File

@@ -5006,6 +5006,149 @@ def _stockplatform_ai_recommendations_wait(
)
def _active_p0_blocker_group_counts(active_blockers: list[str]) -> dict[str, int]:
return {
"host_boot_detection": sum(
1 for blocker in active_blockers if blocker in _REBOOT_HOST_BOOT_DETECTION_BLOCKERS
),
"windows99_vmware": sum(
1 for blocker in active_blockers if blocker.startswith("windows99_")
),
"service_data_backup": sum(
1
for blocker in active_blockers
if blocker
in {
"backup_core_green_not_1",
"host_188_service_green_not_1",
"post_start_blocked_not_zero",
"product_data_green_not_1",
"service_green_not_1",
"wazuh_dashboard_degraded",
}
),
"other": sum(
1
for blocker in active_blockers
if blocker not in _REBOOT_HOST_BOOT_DETECTION_BLOCKERS
and not blocker.startswith("windows99_")
and blocker
not in {
"backup_core_green_not_1",
"host_188_service_green_not_1",
"post_start_blocked_not_zero",
"product_data_green_not_1",
"service_green_not_1",
"wazuh_dashboard_degraded",
}
),
}
def _build_current_p0_execution_focus(state: dict[str, Any]) -> dict[str, Any]:
active_blockers = _strings(state.get("active_p0_live_active_blockers"))
group_counts = _active_p0_blocker_group_counts(active_blockers)
service_blocker_count = _int(
state.get("controlled_service_data_backup_blocker_count")
)
service_backup_closed = (
state.get("controlled_service_data_backup_can_clear_blockers") is True
or service_blocker_count == 0
)
locator_dry_run_ready = bool(
state.get("windows99_vmx_source_locator_controlled_relink_dry_run_ready")
is True
or state.get("windows99_vmx_source_locator_candidate_relink_dry_run_ready")
is True
or str(state.get("windows99_vmx_source_locator_status") or "")
== "collector_readback_scoped_relink_dry_run_ready"
)
autostart_check_ready = bool(
state.get("windows99_vmware_autostart_check_mode_package_ready") is True
and state.get("windows99_vmware_autostart_check_mode_allowed") is True
)
ready_packages: list[dict[str, Any]] = []
if locator_dry_run_ready:
ready_packages.append(
{
"id": "windows99_vmx_source_scoped_relink_dry_run",
"status": str(
state.get("windows99_vmx_source_locator_status") or "ready"
),
"target_aliases": _strings(
state.get("windows99_vmx_source_locator_target_aliases")
),
"next_executable_step": str(
state.get("windows99_vmx_source_locator_next_executable_step")
or "rerun_no_secret_collector_and_scorecard"
),
}
)
if autostart_check_ready:
ready_packages.append(
{
"id": "windows99_vmware_autostart_check_mode",
"status": str(
state.get("windows99_vmware_autostart_check_mode_package_status")
or "ready"
),
"target_aliases": _strings(
state.get("windows99_vmware_autostart_check_mode_target_vm_aliases")
),
"next_executable_step": str(
state.get("windows99_vmware_autostart_check_mode_next_executable_step")
or ""
),
}
)
if service_blocker_count and not service_backup_closed:
stage = "service_data_backup_readback_not_green"
lane = "service_data_backup_readback"
next_executable_step = "collect_service_data_backup_readback_no_restart_no_db_write"
elif ready_packages:
stage = "windows99_no_secret_verifier_rerun_ready"
lane = "windows99_vmware_verify_collection"
next_executable_step = "rerun_no_secret_collector_and_scorecard_no_vm_power_change"
elif group_counts["host_boot_detection"]:
stage = "host_probe_verifier_only_required"
lane = "reboot_event_detector_and_host_probe"
next_executable_step = "rerun_reboot_event_detector_and_host_probe_verify_only_no_reboot"
else:
stage = "p0_readback_review_required"
lane = "p0_mainline_readback"
next_executable_step = str(state.get("active_p0_next_safe_action") or "")
focus = {
"schema_version": "awoooi_current_p0_execution_focus_v1",
"workplan_id": str(state.get("active_p0_workplan_id") or ""),
"state": str(state.get("active_p0_state") or ""),
"stage": stage,
"lane": lane,
"primary_blocker": str(state.get("active_p0_primary_blocker") or ""),
"next_executable_step": next_executable_step,
"readiness_percent": _int(state.get("active_p0_readiness_percent")),
"active_blocker_count": len(active_blockers),
"blocker_group_counts": group_counts,
"ready_package_count": len(ready_packages),
"ready_packages": ready_packages,
"no_secret_verifier_ready": bool(ready_packages),
"scoped_relink_dry_run_ready": locator_dry_run_ready,
"autostart_check_mode_ready": autostart_check_ready,
"service_data_backup_closed": service_backup_closed,
"operation_boundaries": {
"secret_value_read": False,
"host_reboot": False,
"vm_power_change": False,
"remote_write": False,
"database_write": False,
"github_api": False,
},
}
return focus
def _apply_parallel_mainline_execution_overlay(payload: dict[str, Any]) -> None:
state = _dict(payload.setdefault("mainline_execution_state", {}))
items = _list(payload.get("commander_inserted_requirement_work_items"))
@@ -5116,6 +5259,8 @@ def _set_rollups_and_summary(
)
active_blockers = _strings(state.get("active_p0_live_active_blockers"))
active_gap_count = _int(state.get("active_p0_immediate_apply_gap_count"))
current_p0_focus = _build_current_p0_execution_focus(state)
payload["current_p0_execution_focus"] = current_p0_focus
payload["rollups"] = {
"completed_p0_count": len(completed),
@@ -5533,9 +5678,29 @@ def _set_rollups_and_summary(
"stale_current_head_metadata_normalized": runtime_source_truth_available,
"stale_cd_runs_reopen_closed_work": False,
"break_glass_reboot_drill_required": True,
"current_p0_execution_focus_stage": current_p0_focus["stage"],
"current_p0_execution_focus_lane": current_p0_focus["lane"],
"current_p0_execution_focus_ready_package_count": current_p0_focus[
"ready_package_count"
],
"current_p0_execution_focus_no_secret_verifier_ready": current_p0_focus[
"no_secret_verifier_ready"
],
}
payload["summary"] = {
"status": str(payload.get("status") or ""),
"current_p0_execution_focus": current_p0_focus,
"current_p0_execution_focus_stage": current_p0_focus["stage"],
"current_p0_execution_focus_lane": current_p0_focus["lane"],
"current_p0_execution_focus_next_executable_step": current_p0_focus[
"next_executable_step"
],
"current_p0_execution_focus_ready_package_count": current_p0_focus[
"ready_package_count"
],
"current_p0_execution_focus_no_secret_verifier_ready": current_p0_focus[
"no_secret_verifier_ready"
],
"active_p0_workplan_id": str(state.get("active_p0_workplan_id") or ""),
"active_p0_state": str(state.get("active_p0_state") or ""),
"active_p0_readiness_percent": _int(