fix(api): normalize priority work order source truth
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 24s
CD Pipeline / build-and-deploy (push) Successful in 9m37s
CD Pipeline / post-deploy-checks (push) Successful in 1m1s

This commit is contained in:
Your Name
2026-06-30 09:29:54 +08:00
parent a7e6de46aa
commit a4abc00d25
4 changed files with 181 additions and 14 deletions

View File

@@ -74,6 +74,50 @@ def test_awoooi_priority_work_order_readback_endpoint_returns_snapshot():
assert "do not reboot" in data["next_execution_order"][0]
def test_awoooi_priority_work_order_readback_normalizes_runtime_source_truth(
monkeypatch: pytest.MonkeyPatch,
):
runtime_sha = "b4dc407ce05c68a3908b993437a61b869d83810f"
runtime_short_sha = runtime_sha[:10]
monkeypatch.setenv("AWOOOI_BUILD_COMMIT_SHA", runtime_sha)
monkeypatch.setenv("AWOOOI_DESIRED_API_IMAGE_TAG", runtime_sha)
payload = load_latest_awoooi_priority_work_order_readback()
current_head = payload["current_head"]
state = payload["mainline_execution_state"]
assert current_head["gitea_main_sha"] == runtime_sha
assert current_head["latest_source_readiness_commit_sha"] == runtime_sha
assert current_head["latest_source_readiness_cd_run_id"] == (
f"production_readback:{runtime_short_sha}"
)
assert current_head["latest_fetched_gitea_main_subject"] == (
f"production desired image tag {runtime_short_sha}"
)
assert current_head["stale_current_head_metadata_normalized"] is True
assert state["current_main_latest_source_sha"] == runtime_sha
assert state["latest_successful_deployed_source_sha"] == runtime_sha
assert state["current_main_cd_run_status"] == "production_readback_verified"
assert state["p0_004_template_copy_apply_gate_source_status"] == (
"production_endpoint_ready"
)
assert state["reboot_drill_preflight_source_status"] == "production_endpoint_ready"
assert payload["rollups"]["stale_current_head_metadata_normalized"] is True
assert payload["summary"]["latest_successful_deployed_source_sha"] == runtime_sha
current_truth = json.dumps(
{
"current_head": current_head,
"mainline_execution_state": state,
},
ensure_ascii=False,
sort_keys=True,
)
assert "3973" not in current_truth
assert "49637ee7" not in current_truth
assert "f426522" not in current_truth
def test_awoooi_priority_work_order_readback_rejects_reordered_active_p0(tmp_path):
operations_dir = tmp_path / "docs" / "operations"
operations_dir.mkdir(parents=True)