test: align report guard fixtures with dom-only evidence

This commit is contained in:
Code Queue Review
2026-05-23 05:06:54 +00:00
parent 4f93338822
commit 04a25cedc5
@@ -9,14 +9,20 @@ import { fileURLToPath } from "node:url";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const validator = path.join(repoRoot, "scripts/validate-dev-gate-report.mjs");
const baseReportPath = path.join(repoRoot, "reports/dev-gate/dev-cloud-workbench-live.json");
const baseDomOnlyReportPath = path.join(repoRoot, "reports/dev-gate/dev-cloud-workbench-dom-only.json");
const baseAggregatorReportPath = path.join(repoRoot, "reports/dev-gate/dev-m5-gate-aggregator-v2.json");
const baseReport = JSON.parse(await readFile(baseReportPath, "utf8"));
const baseDomOnlyReport = JSON.parse(await readFile(baseDomOnlyReportPath, "utf8"));
const baseAggregatorReport = JSON.parse(await readFile(baseAggregatorReportPath, "utf8"));
function cloneBaseReport() {
return JSON.parse(JSON.stringify(baseReport));
}
function cloneBaseDomOnlyReport() {
return JSON.parse(JSON.stringify(baseDomOnlyReport));
}
function cloneBaseAggregatorReport() {
return JSON.parse(JSON.stringify(baseAggregatorReport));
}
@@ -167,6 +173,8 @@ function applyCurrentIdentity(report) {
webAssetIdentity: identity.webAssetIdentity
});
ensureCurrentIdentityChecks(report, identity);
const runtimeCheck = report.checks.find((check) => check.id === "live-runtime-current-main");
if (runtimeCheck) {
Object.assign(runtimeCheck, {
@@ -198,8 +206,39 @@ function applyCurrentIdentity(report) {
}
}
function ensureCurrentIdentityChecks(report, identity) {
const httpIndex = report.checks.findIndex((check) => check.id === "live-http-html");
const runtimeCheck = {
id: "live-runtime-current-main",
status: identity.deploymentIdentity.status,
summary: identity.deploymentIdentity.summary,
evidence: identity.deploymentIdentity.evidence,
observations: identity.deploymentIdentity
};
const webAssetCheck = {
id: "live-web-assets-current-main",
status: identity.webAssetIdentity.status,
summary: identity.webAssetIdentity.summary,
evidence: identity.webAssetIdentity.assets.map((asset) => `${asset.path}: ${asset.status}`),
observations: identity.webAssetIdentity
};
upsertCheck(report, runtimeCheck, httpIndex >= 0 ? httpIndex : 0);
const updatedHttpIndex = report.checks.findIndex((check) => check.id === "live-http-html");
upsertCheck(report, webAssetCheck, updatedHttpIndex >= 0 ? updatedHttpIndex + 1 : 1);
}
function upsertCheck(report, nextCheck, insertIndex) {
const existingIndex = report.checks.findIndex((check) => check.id === nextCheck.id);
if (existingIndex >= 0) {
report.checks[existingIndex] = nextCheck;
return;
}
report.checks.splice(insertIndex, 0, nextCheck);
}
function acceptedDomOnlyReport() {
const report = cloneBaseReport();
const report = cloneBaseDomOnlyReport();
applyCurrentIdentity(report);
report.status = "pass";
report.mode = "dom-only";