Attach EveTui grid capture evidence
This commit is contained in:
parent
0462cacadc
commit
ea372b1176
17 changed files with 502 additions and 35 deletions
|
|
@ -51,6 +51,7 @@ if (!exportDirectory) {
|
|||
" --expect-runtime-handoff <runtimeId>",
|
||||
" --expect-runtime-command-schema <runtimeId:schema>",
|
||||
" --expect-runtime-capture-status <runtimeId:status>",
|
||||
" --expect-runtime-capture-artifact <runtimeId:kind:schema:providerId:surfaceId>",
|
||||
" --expect-runtime-lifecycle-status <runtimeId:stage:status>",
|
||||
" --expect-runtime-lifecycle-pending <runtimeId:stage:pending-proof-substring>",
|
||||
" --expect-runtime-lifecycle-field <runtimeId:stage:field.path:value>",
|
||||
|
|
@ -588,6 +589,26 @@ function validateIndex(index, directory, expectations, errors) {
|
|||
errors.push(`runtimes:${expectation.runtimeId}:captureStatus:expected ${expectation.status} got ${runtime.captureStatus || ""}`);
|
||||
}
|
||||
}
|
||||
for (const expectation of expectations.runtimeCaptureArtifacts) {
|
||||
const runtime = runtimes.find(candidate => candidate.runtimeId === expectation.runtimeId);
|
||||
if (!runtime) {
|
||||
errors.push(`runtimes:${expectation.runtimeId}:missing`);
|
||||
continue;
|
||||
}
|
||||
const artifacts = Array.isArray(runtime.captureArtifacts) ? runtime.captureArtifacts : [];
|
||||
const artifact = artifacts.find(candidate =>
|
||||
candidate.kind === expectation.kind
|
||||
&& candidate.schema === expectation.schema
|
||||
&& candidate.providerId === expectation.providerId
|
||||
&& candidate.surfaceId === expectation.surfaceId);
|
||||
if (!artifact) {
|
||||
errors.push(`runtimes:${expectation.runtimeId}:captureArtifacts:${expectation.kind}:${expectation.schema}:${expectation.providerId}:${expectation.surfaceId}:missing`);
|
||||
}
|
||||
const artifactErrors = Array.isArray(runtime.captureArtifactErrors) ? runtime.captureArtifactErrors : [];
|
||||
if (artifactErrors.length) {
|
||||
errors.push(`runtimes:${expectation.runtimeId}:captureArtifactErrors:${artifactErrors.join(",")}`);
|
||||
}
|
||||
}
|
||||
for (const expectation of expectations.runtimeLifecycleStatuses) {
|
||||
const runtime = runtimes.find(candidate => candidate.runtimeId === expectation.runtimeId);
|
||||
if (!runtime) {
|
||||
|
|
@ -1100,6 +1121,7 @@ function parseArguments(args) {
|
|||
runtimeHandoffs: [],
|
||||
runtimeCommandSchemas: [],
|
||||
runtimeCaptureStatuses: [],
|
||||
runtimeCaptureArtifacts: [],
|
||||
runtimeLifecycleStatuses: [],
|
||||
runtimeLifecyclePendingProofs: [],
|
||||
runtimeLifecycleFields: [],
|
||||
|
|
@ -1154,6 +1176,7 @@ function parseArguments(args) {
|
|||
["--expect-runtime-handoff", expectations.runtimeHandoffs],
|
||||
["--expect-runtime-command-schema", expectations.runtimeCommandSchemas],
|
||||
["--expect-runtime-capture-status", expectations.runtimeCaptureStatuses],
|
||||
["--expect-runtime-capture-artifact", expectations.runtimeCaptureArtifacts],
|
||||
["--expect-runtime-lifecycle-status", expectations.runtimeLifecycleStatuses],
|
||||
["--expect-runtime-lifecycle-pending", expectations.runtimeLifecyclePendingProofs],
|
||||
["--expect-runtime-lifecycle-field", expectations.runtimeLifecycleFields],
|
||||
|
|
@ -1240,6 +1263,8 @@ function parseArguments(args) {
|
|||
target.push(parseRuntimeExpectation(value, "schema"));
|
||||
} else if (option === "--expect-runtime-capture-status") {
|
||||
target.push(parseRuntimeExpectation(value, "status"));
|
||||
} else if (option === "--expect-runtime-capture-artifact") {
|
||||
target.push(parseRuntimeCaptureArtifactExpectation(value));
|
||||
} else if (option === "--expect-runtime-lifecycle-status") {
|
||||
target.push(parseRuntimeLifecycleExpectation(value, "status"));
|
||||
} else if (option === "--expect-runtime-lifecycle-pending") {
|
||||
|
|
@ -1293,6 +1318,21 @@ function parseScreenshotMetricExpectation(value) {
|
|||
};
|
||||
}
|
||||
|
||||
function parseRuntimeCaptureArtifactExpectation(value) {
|
||||
const parts = value.split(":");
|
||||
if (parts.length !== 5 || parts.some(part => !part)) {
|
||||
console.error(`Expected runtime capture artifact in <runtimeId:kind:schema:providerId:surfaceId> form, got: ${value}`);
|
||||
process.exit(2);
|
||||
}
|
||||
return {
|
||||
runtimeId: parts[0],
|
||||
kind: parts[1],
|
||||
schema: parts[2],
|
||||
providerId: parts[3],
|
||||
surfaceId: parts[4],
|
||||
};
|
||||
}
|
||||
|
||||
function parseWorldLoweringGapExpectation(value) {
|
||||
const parts = value.split(":");
|
||||
if (parts.length !== 5 || parts.some(part => !part)) {
|
||||
|
|
|
|||
115
tools/evetui/evetui-capture-artifact.mjs
Normal file
115
tools/evetui/evetui-capture-artifact.mjs
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { EveTuiShell } from "../../runtimes/incubating/eve-tui/src/eve-tui-shell.mjs";
|
||||
import { buildTuiCaptureRequest, loadJsonFile, writeCaptureRequest } from "./evetui-capture-contract.mjs";
|
||||
|
||||
export function buildTuiCaptureArtifact({
|
||||
advertisement,
|
||||
capabilityManifest,
|
||||
surfaceDocument,
|
||||
advertisementPath = "",
|
||||
capabilityManifestPath = "",
|
||||
stamp = "latest",
|
||||
width = 80,
|
||||
} = {}) {
|
||||
const request = buildTuiCaptureRequest({
|
||||
advertisement,
|
||||
capabilityManifest,
|
||||
advertisementPath,
|
||||
capabilityManifestPath,
|
||||
stamp,
|
||||
});
|
||||
const shell = new EveTuiShell({ width });
|
||||
const grid = shell.lowerSurface(surfaceDocument, advertisement, request.surfaceId);
|
||||
validateGridArtifact(grid, request);
|
||||
|
||||
return {
|
||||
request,
|
||||
grid: {
|
||||
...grid,
|
||||
artifactKind: request.artifactKind,
|
||||
captureKind: request.captureKind,
|
||||
sourceAdvertisementPath: request.sourceAdvertisementPath,
|
||||
sourceCapabilityManifestPath: request.sourceCapabilityManifestPath,
|
||||
issuedAtUtc: request.issuedAtUtc,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function writeTuiCaptureArtifact({ request, grid }, { outputPath, requestOutputPath = "" } = {}) {
|
||||
if (!outputPath) throw new Error("outputPath is required");
|
||||
mkdirSync(path.dirname(outputPath), { recursive: true });
|
||||
writeFileSync(outputPath, `${JSON.stringify(grid, null, 2)}\n`, "utf8");
|
||||
if (requestOutputPath) {
|
||||
writeCaptureRequest(request, requestOutputPath);
|
||||
}
|
||||
}
|
||||
|
||||
function validateGridArtifact(grid, request) {
|
||||
if (grid.schema !== "gamecult.eve.tui_grid.v1") {
|
||||
throw new Error(`Unexpected TUI grid schema: ${grid.schema || ""}`);
|
||||
}
|
||||
for (const [field, expected] of [
|
||||
["runtimeId", request.runtimeId],
|
||||
["providerId", request.providerId],
|
||||
["surfaceId", request.surfaceId],
|
||||
["projectionKind", request.projectionKind],
|
||||
["commandBoundary", request.commandBoundary],
|
||||
["receiptSchema", request.receiptSchema],
|
||||
]) {
|
||||
if ((grid[field] || "") !== (expected || "")) {
|
||||
throw new Error(`TUI grid ${field} expected ${expected || ""} got ${grid[field] || ""}`);
|
||||
}
|
||||
}
|
||||
if (!Array.isArray(grid.lines) || !grid.lines.length) {
|
||||
throw new Error("TUI grid artifact must contain at least one line");
|
||||
}
|
||||
}
|
||||
|
||||
function parseArgs(argv) {
|
||||
const args = {};
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const value = argv[index];
|
||||
if (!value.startsWith("--")) continue;
|
||||
const key = value.slice(2);
|
||||
const next = argv[index + 1];
|
||||
if (!next || next.startsWith("--")) {
|
||||
args[key] = true;
|
||||
} else {
|
||||
args[key] = next;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
function runCli() {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
for (const required of ["advertisement", "capability", "surface", "output"]) {
|
||||
if (!args[required]) {
|
||||
throw new Error(`missing required --${required}`);
|
||||
}
|
||||
}
|
||||
const stamp = args.stamp || "latest";
|
||||
const artifact = buildTuiCaptureArtifact({
|
||||
advertisement: loadJsonFile(args.advertisement),
|
||||
capabilityManifest: loadJsonFile(args.capability),
|
||||
surfaceDocument: loadJsonFile(args.surface),
|
||||
advertisementPath: args.advertisement,
|
||||
capabilityManifestPath: args.capability,
|
||||
stamp,
|
||||
width: Number(args.width || 80),
|
||||
});
|
||||
writeTuiCaptureArtifact(artifact, {
|
||||
outputPath: args.output,
|
||||
requestOutputPath: args["request-output"] || "",
|
||||
});
|
||||
process.stdout.write(`${args.output}\n`);
|
||||
}
|
||||
|
||||
const invokedPath = process.argv[1] ? path.resolve(process.argv[1]) : "";
|
||||
const modulePath = fileURLToPath(import.meta.url);
|
||||
if (invokedPath === modulePath) {
|
||||
runCli();
|
||||
}
|
||||
33
tools/evetui/evetui-capture-artifact.test.mjs
Normal file
33
tools/evetui/evetui-capture-artifact.test.mjs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import { buildTuiCaptureArtifact } from "./evetui-capture-artifact.mjs";
|
||||
|
||||
const advertisement = JSON.parse(readFileSync(new URL("../../web/fixtures/aetheria.provider-advertisement.json", import.meta.url), "utf8"));
|
||||
const capabilityManifest = JSON.parse(readFileSync(new URL("../../runtimes/incubating/eve-tui/eve-runtime-capability.json", import.meta.url), "utf8"));
|
||||
const surfaceDocument = JSON.parse(readFileSync(new URL("../../web/fixtures/aetheria-world-surface.json", import.meta.url), "utf8"));
|
||||
|
||||
test("builds TUI JSON grid capture artifact from provider advertisement and surface", () => {
|
||||
const { request, grid } = buildTuiCaptureArtifact({
|
||||
advertisement,
|
||||
capabilityManifest,
|
||||
surfaceDocument,
|
||||
advertisementPath: "web/fixtures/aetheria.provider-advertisement.json",
|
||||
capabilityManifestPath: "runtimes/incubating/eve-tui/eve-runtime-capability.json",
|
||||
stamp: "smoke",
|
||||
width: 72,
|
||||
});
|
||||
|
||||
assert.equal(request.artifactKind, "json-grid");
|
||||
assert.equal(request.artifactPath, "artifacts/evetui-capture/smoke/tui-grid.json");
|
||||
assert.equal(grid.schema, "gamecult.eve.tui_grid.v1");
|
||||
assert.equal(grid.runtimeId, "tui");
|
||||
assert.equal(grid.providerId, "aetheria");
|
||||
assert.equal(grid.surfaceId, "aetheria.daemon.game");
|
||||
assert.equal(grid.commandBoundary, "aetheria.daemon.commands");
|
||||
assert.equal(grid.receiptSchema, "aetheria.eve_command_acceptance_status.v1");
|
||||
assert.equal(grid.artifactKind, "json-grid");
|
||||
assert.equal(grid.captureKind, "terminal-cell-grid");
|
||||
assert.equal(grid.width, 72);
|
||||
assert.ok(grid.lines.some(line => line.includes("aetheria.daemon.game")));
|
||||
});
|
||||
|
|
@ -24,9 +24,9 @@ test("builds TUI capture request from provider advertisement", () => {
|
|||
assert.equal(request.projectionKind, "provider-authored-world-surface");
|
||||
assert.equal(request.commandBoundary, "aetheria.daemon.commands");
|
||||
assert.equal(request.receiptSchema, "aetheria.eve_command_acceptance_status.v1");
|
||||
assert.equal(request.captureKind, "terminal-transcript-or-cell-grid");
|
||||
assert.equal(request.artifactKind, "ansi-transcript-or-json-grid");
|
||||
assert.equal(request.artifactPath, "artifacts/evetui-capture/smoke/tui-transcript.ansi");
|
||||
assert.equal(request.captureKind, "terminal-cell-grid");
|
||||
assert.equal(request.artifactKind, "json-grid");
|
||||
assert.equal(request.artifactPath, "artifacts/evetui-capture/smoke/tui-grid.json");
|
||||
assert.match(request.authority, /provider state/);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@
|
|||
],
|
||||
"pendingProofs": [
|
||||
"TUI runtime body graduates to EveTui outside provider product code.",
|
||||
"TUI terminal transcript or cell-grid captures are attached to conformance output."
|
||||
"TUI terminal transcript or cell-grid captures are attached to conformance output from the EveTui owner repo."
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -868,9 +868,12 @@
|
|||
"scripts/run-evetui-lifecycle-smoke.ps1",
|
||||
"scripts/run-evetui-provider-shell-smoke.ps1",
|
||||
"scripts/run-evetui-capture-contract-smoke.ps1",
|
||||
"scripts/run-evetui-capture-smoke.ps1",
|
||||
"scripts/run-evetui-release-contract-smoke.ps1",
|
||||
"tools/evetui/evetui-capture-contract.mjs",
|
||||
"tools/evetui/evetui-capture-contract.test.mjs",
|
||||
"tools/evetui/evetui-capture-artifact.mjs",
|
||||
"tools/evetui/evetui-capture-artifact.test.mjs",
|
||||
"tools/evetui/evetui-release-contract.mjs",
|
||||
"tools/evetui/evetui-release-contract.test.mjs"
|
||||
],
|
||||
|
|
@ -885,11 +888,19 @@
|
|||
},
|
||||
{
|
||||
"path": "tools/evetui/evetui-capture-contract.mjs",
|
||||
"contains": ["buildTuiCaptureRequest", "gamecult.eve.runtime_capture_request.v1", "ansi-transcript-or-json-grid", "loweringTargets", "writeCaptureRequest"]
|
||||
"contains": ["buildTuiCaptureRequest", "gamecult.eve.runtime_capture_request.v1", "artifactKind", "loweringTargets", "writeCaptureRequest"]
|
||||
},
|
||||
{
|
||||
"path": "tools/evetui/evetui-capture-contract.test.mjs",
|
||||
"contains": ["builds TUI capture request from provider advertisement", "rejects capture request when the surface does not advertise TUI", "artifacts/evetui-capture/smoke/tui-transcript.ansi"]
|
||||
"contains": ["builds TUI capture request from provider advertisement", "rejects capture request when the surface does not advertise TUI", "artifacts/evetui-capture/smoke/tui-grid.json"]
|
||||
},
|
||||
{
|
||||
"path": "tools/evetui/evetui-capture-artifact.mjs",
|
||||
"contains": ["buildTuiCaptureArtifact", "EveTuiShell", "gamecult.eve.tui_grid.v1", "writeTuiCaptureArtifact", "request-output"]
|
||||
},
|
||||
{
|
||||
"path": "tools/evetui/evetui-capture-artifact.test.mjs",
|
||||
"contains": ["builds TUI JSON grid capture artifact", "gamecult.eve.tui_grid.v1", "artifacts/evetui-capture/smoke/tui-grid.json"]
|
||||
},
|
||||
{
|
||||
"path": "tools/evetui/evetui-release-contract.mjs",
|
||||
|
|
@ -901,8 +912,19 @@
|
|||
}
|
||||
],
|
||||
"capture": {
|
||||
"status": "missing",
|
||||
"note": "TUI transcript or cell-grid capture is a split blocker until EveTui attaches durable terminal artifacts."
|
||||
"status": "json-grid",
|
||||
"note": "TUI attaches a provider-advertisement-backed gamecult.eve.tui_grid.v1 JSON capture artifact; packaged runtime ownership remains an EveTui split blocker.",
|
||||
"artifacts": [
|
||||
{
|
||||
"kind": "json-grid",
|
||||
"schema": "gamecult.eve.tui_grid.v1",
|
||||
"path": "artifacts/evetui-capture/latest/tui-grid.json",
|
||||
"providerId": "aetheria",
|
||||
"surfaceId": "aetheria.daemon.game",
|
||||
"sourceSurfacePath": "web/fixtures/aetheria-world-surface.json",
|
||||
"requestPath": "artifacts/evetui-capture/latest/capture-request.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -318,6 +318,8 @@ async function evaluateRuntime(runtime, fixtureResults) {
|
|||
const capabilityManifestDocument = await readRuntimeCapabilityManifestDocument(runtime);
|
||||
const lifecycleManifestDocument = await readRuntimeLifecycleManifestDocument(runtime);
|
||||
const lifecycle = runtime.lifecycle || capabilityManifestDocument?.lifecycle || readLifecycleStages(lifecycleManifestDocument);
|
||||
const capture = runtime.capture || capabilityManifestDocument?.capture || null;
|
||||
const captureArtifactErrors = validateRuntimeCaptureArtifacts(capture);
|
||||
const lifecycleErrors = await validateRuntimeLifecycle(runtime, lifecycle, lifecycleManifestDocument);
|
||||
const splitHandoffPath = await readRuntimeSplitHandoffPath(runtime);
|
||||
const splitHandoffErrors = await validateRuntimeSplitHandoff(runtime, splitHandoffPath);
|
||||
|
|
@ -333,6 +335,7 @@ async function evaluateRuntime(runtime, fixtureResults) {
|
|||
if (runtime.kind === "active" && commandTransportSmokeErrors.length) status = "missing-command-transport-smoke";
|
||||
if (runtime.kind === "active" && capabilityManifestErrors.length) status = "invalid-runtime-capability";
|
||||
if (runtime.kind === "active" && lifecycleErrors.length) status = "invalid-runtime-lifecycle";
|
||||
if (runtime.kind === "active" && captureArtifactErrors.length) status = "invalid-runtime-capture-artifact";
|
||||
if (runtime.kind === "active" && splitHandoffErrors.length) status = "invalid-runtime-split-handoff";
|
||||
if (runtime.kind === "active" && localProviderCatalogErrors.length) status = "invalid-local-provider-catalog";
|
||||
if (runtime.kind === "active" && missingIncubationFields.length) status = "missing-incubation-metadata";
|
||||
|
|
@ -378,6 +381,7 @@ async function evaluateRuntime(runtime, fixtureResults) {
|
|||
localProviderCatalog: runtime.localProviderCatalog || null,
|
||||
localProviderCatalogErrors,
|
||||
lifecycle,
|
||||
captureArtifactErrors,
|
||||
ownerRepo: runtime.ownerRepo || "",
|
||||
repoRole: runtime.repoRole || "",
|
||||
graduationTrigger: runtime.graduationTrigger || "",
|
||||
|
|
@ -387,7 +391,7 @@ async function evaluateRuntime(runtime, fixtureResults) {
|
|||
activationCriteria: runtime.activationCriteria || [],
|
||||
missingIncubationFields,
|
||||
pluginCapabilityGaps,
|
||||
capture: runtime.capture,
|
||||
capture,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1914,6 +1918,8 @@ function buildConformanceExport(report) {
|
|||
lifecycleManifestPath: runtime.lifecycleManifest?.manifestPath || "",
|
||||
commandTransportSchema: runtimeCommandTransportSchema(runtime),
|
||||
captureStatus: runtime.capture?.status || "",
|
||||
captureArtifacts: runtime.capture?.artifacts || [],
|
||||
captureArtifactErrors: runtime.captureArtifactErrors || [],
|
||||
lifecycle: runtime.lifecycle,
|
||||
lifecycleErrors: runtime.lifecycleErrors || [],
|
||||
missingEvidence: [
|
||||
|
|
@ -1923,6 +1929,7 @@ function buildConformanceExport(report) {
|
|||
...runtime.commandTransportSmokeErrors.map(id => `command-smoke:${id}`),
|
||||
...runtime.capabilityManifestErrors.map(id => `runtime-capability:${id}`),
|
||||
...runtime.lifecycleErrors.map(id => `runtime-lifecycle:${id}`),
|
||||
...runtime.captureArtifactErrors.map(id => `runtime-capture:${id}`),
|
||||
...runtime.localProviderCatalogErrors.map(id => `local-provider-catalog:${id}`),
|
||||
],
|
||||
}))
|
||||
|
|
@ -2013,6 +2020,8 @@ function buildConformanceExport(report) {
|
|||
splitHandoffExportPath: makeHandoffExportPath("runtime", runtime.id, runtime.splitHandoffPath || ""),
|
||||
commandTransportSchema: runtimeCommandTransportSchema(runtime),
|
||||
captureStatus: runtime.capture?.status || "",
|
||||
captureArtifacts: runtime.capture?.artifacts || [],
|
||||
captureArtifactErrors: runtime.captureArtifactErrors || [],
|
||||
...(runtime.lifecycle ? { lifecycle: runtime.lifecycle } : {}),
|
||||
worldSurfaceLowering: runtime.worldSurfaceLowering || [],
|
||||
})),
|
||||
|
|
@ -2075,6 +2084,7 @@ function buildCapabilityMatrix(report) {
|
|||
worldSurfaceLowering: runtime.worldSurfaceLowering || [],
|
||||
commandTransportSchema: runtimeCommandTransportSchema(runtime),
|
||||
captureStatus: runtime.capture?.status || "",
|
||||
captureArtifacts: runtime.capture?.artifacts || [],
|
||||
splitHandoffExportPath: makeHandoffExportPath("runtime", runtime.id, runtime.splitHandoffPath || ""),
|
||||
}));
|
||||
|
||||
|
|
@ -2184,6 +2194,7 @@ function collectCapabilityGaps(report) {
|
|||
...(runtime.commandTransportSmokeErrors || []).map(id => `command-smoke:${id}`),
|
||||
...(runtime.capabilityManifestErrors || []).map(id => `runtime-capability:${id}`),
|
||||
...(runtime.lifecycleErrors || []).map(id => `runtime-lifecycle:${id}`),
|
||||
...(runtime.captureArtifactErrors || []).map(id => `runtime-capture:${id}`),
|
||||
...(runtime.splitHandoffErrors || []).map(id => `runtime-split-handoff:${id}`),
|
||||
...(runtime.localProviderCatalogErrors || []).map(id => `local-provider-catalog:${id}`),
|
||||
...(runtime.pluginCapabilityGaps || []).map(id => `plugin-capability:${id}`),
|
||||
|
|
@ -2545,6 +2556,29 @@ function buildBoundingBoxMetric(runtime, fixture) {
|
|||
}
|
||||
|
||||
const captureStatus = runtime.capture?.status || "";
|
||||
if (captureStatus === "json-grid") {
|
||||
const artifact = (runtime.capture?.artifacts || []).find(candidate => candidate.kind === "json-grid");
|
||||
const errors = runtime.captureArtifactErrors || [];
|
||||
return buildScreenshotMetric(runtime, fixture, {
|
||||
metricKind: "bounding-boxes",
|
||||
status: errors.length ? "fail" : "terminal-grid-capture",
|
||||
score: errors.length ? 0 : 1,
|
||||
expected: {
|
||||
source: "runtime terminal grid capture",
|
||||
schema: artifact?.schema || "gamecult.eve.tui_grid.v1",
|
||||
path: artifact?.path || "",
|
||||
},
|
||||
actual: {
|
||||
captureStatus,
|
||||
artifactKind: artifact?.kind || "",
|
||||
errors,
|
||||
},
|
||||
evidenceLayer: "runtime-terminal-grid-capture",
|
||||
detail: errors.length
|
||||
? "Declared terminal grid capture artifact is missing or invalid."
|
||||
: "Terminal grid capture is present; graphical bounding boxes are not a TUI invariant.",
|
||||
});
|
||||
}
|
||||
const runtimeHasCaptureBody = ["chrome-headless", "ssh-png", "adb-png", "golden", "ssh-golden"].includes(captureStatus);
|
||||
let status = "pass";
|
||||
let score = 1;
|
||||
|
|
@ -2645,6 +2679,54 @@ function readRuntimeLayoutProbe(runtime, fixtureId) {
|
|||
return { config, document, errors };
|
||||
}
|
||||
|
||||
function validateRuntimeCaptureArtifacts(capture) {
|
||||
const artifacts = Array.isArray(capture?.artifacts) ? capture.artifacts : [];
|
||||
const errors = [];
|
||||
for (const artifact of artifacts) {
|
||||
const artifactPath = artifact.path || "";
|
||||
if (!artifactPath) {
|
||||
errors.push("artifact.path:missing");
|
||||
continue;
|
||||
}
|
||||
const absoluteArtifactPath = path.join(repoRoot, artifactPath);
|
||||
if (!existsSync(absoluteArtifactPath)) {
|
||||
errors.push(`${artifactPath}:missing`);
|
||||
continue;
|
||||
}
|
||||
let document;
|
||||
try {
|
||||
document = JSON.parse(readFileSync(absoluteArtifactPath, "utf8"));
|
||||
} catch (error) {
|
||||
errors.push(`${artifactPath}:invalid-json:${error instanceof Error ? error.message : String(error)}`);
|
||||
continue;
|
||||
}
|
||||
for (const [field, expected] of [
|
||||
["schema", artifact.schema],
|
||||
["runtimeId", artifact.runtimeId],
|
||||
["providerId", artifact.providerId],
|
||||
["surfaceId", artifact.surfaceId],
|
||||
]) {
|
||||
if (expected && document[field] !== expected) {
|
||||
errors.push(`${artifactPath}:${field}:expected ${expected} got ${document[field] || ""}`);
|
||||
}
|
||||
}
|
||||
if (artifact.schema && manifest.schemas?.[artifact.schema]) {
|
||||
try {
|
||||
const schema = JSON.parse(readFileSync(path.join(repoRoot, manifest.schemas[artifact.schema]), "utf8"));
|
||||
errors.push(...validateSchemaSubset(schema, document, `captureArtifact:${artifactPath}`));
|
||||
} catch (error) {
|
||||
errors.push(`${manifest.schemas[artifact.schema]}:unreadable:${error instanceof Error ? error.message : String(error)}`);
|
||||
}
|
||||
}
|
||||
for (const linkedPath of [artifact.sourceSurfacePath, artifact.requestPath].filter(Boolean)) {
|
||||
if (!existsSync(path.join(repoRoot, linkedPath))) {
|
||||
errors.push(`${artifactPath}:linked-path:${linkedPath}:missing`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
function collectSplitTargetBlockers(report) {
|
||||
return (report.splitTargets || []).flatMap(target => target.blockerRecords || []);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue