fix(acceptance): 对齐负载报告第二版契约

生产验收统一校验并合并 acceptance-load-report/v2,避免成功负载因旧版 schemaVersion 断言被误判失败。\n\n已执行 bash -n、ShellCheck 和 production acceptance 脚本测试。
This commit is contained in:
2026-08-03 10:26:05 +08:00
parent 2636e93353
commit 75b3ed4748
2 changed files with 8 additions and 3 deletions
+3 -3
View File
@@ -2533,7 +2533,7 @@ REMOTE
cluster_scp "$host:$remote_report" "$local_report" >/dev/null || return 1
cluster_ssh "$host" "[[ ! -e '$remote_report' ]] || unlink '$remote_report'" >/dev/null || true
jq -e --arg runId "$run_id" --arg profile "$profile" \
'.schemaVersion == "acceptance-load-report/v1" and .runId == $runId and .profile == $profile and .secretSafe == true' \
'.schemaVersion == "acceptance-load-report/v2" and .runId == $runId and .profile == $profile and .secretSafe == true' \
"$local_report" >/dev/null || return 1
return "$status"
}
@@ -2548,7 +2548,7 @@ merge_remote_load_reports() {
def max_field($name): [.[].phases[0][$name] // 0] | max;
. as $reports
| {
schemaVersion:"acceptance-load-report/v1",
schemaVersion:"acceptance-load-report/v2",
runId:$reports[0].runId,
profile:$profile,
startedAt:([$reports[].startedAt] | min),
@@ -3601,7 +3601,7 @@ REMOTE
cluster_ssh "$CLUSTER_NINGBO_HOST" "[[ ! -e '$remote_report' ]] || unlink '$remote_report'" >/dev/null || true
chmod 0600 "$report_path"
jq -e --arg runId "$run_id" --arg profile "$profile" \
'.schemaVersion == "acceptance-load-report/v1" and .runId == $runId and .profile == $profile and .secretSafe == true' \
'.schemaVersion == "acceptance-load-report/v2" and .runId == $runId and .profile == $profile and .secretSafe == true' \
"$report_path" >/dev/null || return 1
(( status == 0 )) && jq -e '.passed == true' "$report_path" >/dev/null
}
@@ -7,6 +7,11 @@ tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
script=$root/scripts/cluster/run-production-acceptance.sh
grep -Fq 'acceptance-load-report/v2' "$script"
if grep -Fq 'acceptance-load-report/v1' "$script"; then
echo 'production acceptance still requires the obsolete load report v1 schema' >&2
exit 1
fi
# shellcheck source=scripts/cluster/common.sh
source "$root/scripts/cluster/common.sh"