From 04a25cedc5a8bc60d5c71edaa00dfc92a08c7b55 Mon Sep 17 00:00:00 2001 From: Code Queue Review Date: Sat, 23 May 2026 05:06:54 +0000 Subject: [PATCH] test: align report guard fixtures with dom-only evidence --- .../validate-dev-gate-report-guard.test.mjs | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/scripts/validate-dev-gate-report-guard.test.mjs b/scripts/validate-dev-gate-report-guard.test.mjs index ecb4d553..e933731b 100644 --- a/scripts/validate-dev-gate-report-guard.test.mjs +++ b/scripts/validate-dev-gate-report-guard.test.mjs @@ -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";