feat: add public h5 dashboard and publish traceability

This commit is contained in:
Wyndham ARR
2026-08-03 13:04:41 +08:00
parent 7e7470821b
commit 2107f00e32
29 changed files with 1047 additions and 71 deletions

View File

@@ -107,6 +107,28 @@ def _failure_stage(code: Any) -> str:
return "processor"
def _execution_metadata(delivery_mode: Any) -> Dict[str, str]:
"""Describe ARR execution without exposing host or network location."""
normalized = str(delivery_mode or "").strip().lower()
if normalized == "artifact_callback":
return {
"execution_scope": "arr_runtime",
"processor_mode": "fixed_processor",
"remote_dispatch": "none",
}
if normalized == "direct_mcp":
return {
"execution_scope": "remote_agent",
"processor_mode": "legacy_direct_mcp",
"remote_dispatch": "mcp",
}
return {
"execution_scope": "unknown",
"processor_mode": "unknown",
"remote_dispatch": "unknown",
}
def _append_log(
logs: List[Dict[str, Any]],
*,
@@ -202,7 +224,7 @@ def _attempt_logs(logs: List[Dict[str, Any]], attempts: Sequence[Mapping[str, An
level="success",
code="ATTEMPT_SUCCEEDED",
title="处理尝试已闭环",
message="本地处理结果已通过 ARR 验收并完成业务提交。",
message="ARR 固定处理器输出已通过验收并完成业务提交。",
details=details,
)
@@ -229,7 +251,7 @@ def _delivery_logs(
level="success",
code="ARTIFACT_RESULT_RECEIVED",
title="程序输出制品已登记",
message="ARR 已登记本地处理制品并开始独立验收。",
message="ARR 已登记固定处理器输出制品并开始独立验收。",
details=details,
)
if delivery.get("validated_at"):
@@ -426,7 +448,7 @@ def _outbox_logs(logs: List[Dict[str, Any]], events: Sequence[Mapping[str, Any]]
message=(
"任务失败事实已写入可靠事件队列。"
if is_failure
else "数据库提交事件已写入可靠队列,等待下游消费者。"
else "Finance 数据库提交已完成;事件已写入可靠队列,等待下游消费者。"
),
details=details,
)
@@ -482,6 +504,7 @@ def build_job_trace(
"""Build one complete trace using only explicitly allowlisted facts."""
logs: List[Dict[str, Any]] = []
execution = _execution_metadata(run.get("delivery_mode"))
_append_log(
logs,
log_id="run.received",
@@ -602,6 +625,9 @@ def build_job_trace(
"source_sha256": _safe_text(run.get("source_sha256"), 64),
"business_date": _iso(run.get("business_date")),
"delivery_mode": _safe_text(run.get("delivery_mode"), 32),
"execution_scope": execution["execution_scope"],
"processor_mode": execution["processor_mode"],
"remote_dispatch": execution["remote_dispatch"],
"attempt_no": (
int(latest_attempt.get("attempt_no") or 0)
if latest_attempt is not None