Export split handoff move coverage

This commit is contained in:
Meta Vens 2026-07-09 03:16:59 +01:00
commit b9f7592edf
6 changed files with 229 additions and 7 deletions

View file

@ -53,6 +53,7 @@ if (!exportDirectory) {
" --expect-split-target-status <targetId:status>",
" --expect-split-target-blocker <targetId:blocker-substring>",
" --expect-split-target-blocker-record <targetId:kind:subject>",
" --expect-split-handoff-move <splitTarget:runtimeId:moveSetId:pathKind:status:path-substring>",
" --expect-split-target-proof <targetId:proof-substring>",
].join("\n"));
process.exit(2);
@ -136,6 +137,7 @@ function validateIndex(index, directory, expectations, errors) {
const worldSurfaceLoweringCoverage = Array.isArray(index.worldSurfaceLoweringCoverage) ? index.worldSurfaceLoweringCoverage : [];
const commandBoundaryCoverage = Array.isArray(index.commandBoundaryCoverage) ? index.commandBoundaryCoverage : [];
const splitTargetBlockers = Array.isArray(index.splitTargetBlockers) ? index.splitTargetBlockers : [];
const splitHandoffMoveCoverage = Array.isArray(index.splitHandoffMoveCoverage) ? index.splitHandoffMoveCoverage : [];
const worldSurfaceLoweringGaps = Array.isArray(index.worldSurfaceLoweringGaps) ? index.worldSurfaceLoweringGaps : [];
validatePluginRecords(plugins, errors);
@ -158,6 +160,7 @@ function validateIndex(index, directory, expectations, errors) {
validateCapabilityGaps(index.capabilityGaps, errors);
validateRuntimePluginProjectionGaps(index.runtimePluginProjectionGaps, errors);
validateSplitTargetBlockers(index.splitTargetBlockers, errors);
validateSplitHandoffMoveCoverage(index.splitHandoffMoveCoverage, errors);
validateWorldSurfaceLoweringCoverage(index.worldSurfaceLoweringCoverage, errors);
validateCommandBoundaryCoverage(index.commandBoundaryCoverage, errors);
validateWorldSurfaceLoweringGaps(index.worldSurfaceLoweringGaps, errors);
@ -609,6 +612,18 @@ function validateIndex(index, directory, expectations, errors) {
errors.push(`splitTargetBlockers:${expectation.targetId}:${expectation.kind}:${expectation.subject}:missing`);
}
}
for (const expectation of expectations.splitHandoffMoves) {
const record = splitHandoffMoveCoverage.find(candidate =>
candidate.splitTarget === expectation.splitTarget &&
candidate.runtimeId === expectation.runtimeId &&
candidate.moveSetId === expectation.moveSetId &&
candidate.pathKind === expectation.pathKind &&
candidate.status === expectation.status &&
candidate.sourcePath?.includes(expectation.pathSubstring));
if (!record) {
errors.push(`splitHandoffMoveCoverage:${expectation.splitTarget}:${expectation.runtimeId}:${expectation.moveSetId}:${expectation.pathKind}:${expectation.status}:${expectation.pathSubstring}:missing`);
}
}
for (const expectation of expectations.splitTargetProofs) {
const target = splitTargets.find(candidate => candidate.id === expectation.targetId);
if (!target) {
@ -736,6 +751,21 @@ function validateSplitTargetBlockers(blockers, errors) {
}
}
function validateSplitHandoffMoveCoverage(records, errors) {
if (!Array.isArray(records)) {
errors.push("splitHandoffMoveCoverage:missing");
return;
}
for (const [index, record] of records.entries()) {
for (const field of ["splitTarget", "runtimeId", "runtimeOwnerRepo", "handoffPath", "handoffExportPath", "moveSetId", "stage", "destinationOwner", "replacementProof", "pathKind", "sourcePath", "status", "severity"]) {
if (!record?.[field]) errors.push(`splitHandoffMoveCoverage:${index}:${field}:missing`);
}
if (typeof record?.pathExists !== "boolean") {
errors.push(`splitHandoffMoveCoverage:${index}:pathExists:expected boolean`);
}
}
}
function validateWorldSurfaceLoweringCoverage(records, errors) {
if (!Array.isArray(records)) {
errors.push("worldSurfaceLoweringCoverage:missing");
@ -931,6 +961,7 @@ function parseArguments(args) {
splitTargetStatuses: [],
splitTargetBlockers: [],
splitTargetBlockerRecords: [],
splitHandoffMoves: [],
splitTargetProofs: [],
capabilityMatrix: false,
capabilityGaps: [],
@ -978,6 +1009,7 @@ function parseArguments(args) {
["--expect-split-target-status", expectations.splitTargetStatuses],
["--expect-split-target-blocker", expectations.splitTargetBlockers],
["--expect-split-target-blocker-record", expectations.splitTargetBlockerRecords],
["--expect-split-handoff-move", expectations.splitHandoffMoves],
["--expect-split-target-proof", expectations.splitTargetProofs],
["--expect-capability-gap", expectations.capabilityGaps],
["--expect-runtime-plugin-gap", expectations.runtimePluginGaps],
@ -1066,6 +1098,8 @@ function parseArguments(args) {
target.push(parseSplitTargetExpectation(value, "blocker"));
} else if (option === "--expect-split-target-blocker-record") {
target.push(parseSplitTargetBlockerRecordExpectation(value));
} else if (option === "--expect-split-handoff-move") {
target.push(parseSplitHandoffMoveExpectation(value));
} else if (option === "--expect-split-target-proof") {
target.push(parseSplitTargetExpectation(value, "proof"));
} else if (option === "--expect-world-lowering-gap") {
@ -1158,6 +1192,22 @@ function parseSplitTargetBlockerRecordExpectation(value) {
};
}
function parseSplitHandoffMoveExpectation(value) {
const parts = value.split(":");
if (parts.length < 6 || parts.slice(0, 5).some(part => !part) || !parts.slice(5).join(":")) {
console.error(`Expected split handoff move in <splitTarget:runtimeId:moveSetId:pathKind:status:path-substring> form, got: ${value}`);
process.exit(2);
}
return {
splitTarget: parts[0],
runtimeId: parts[1],
moveSetId: parts[2],
pathKind: parts[3],
status: parts[4],
pathSubstring: parts.slice(5).join(":"),
};
}
function parsePluginExpectation(value, field) {
const separator = value.indexOf(":");
if (separator <= 0 || separator === value.length - 1) {

View file

@ -1,5 +1,5 @@
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { existsSync } from "node:fs";
import { existsSync, readFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { compileEveDsl } from "../../web/eve-dsl.js";
@ -1675,6 +1675,7 @@ function buildConformanceExport(report) {
commandBoundaryCoverage: collectCommandBoundaryCoverage(report),
worldSurfaceLoweringGaps: collectWorldSurfaceLoweringGaps(report),
splitTargetBlockers: collectSplitTargetBlockers(report),
splitHandoffMoveCoverage: collectSplitHandoffMoveCoverage(report),
pluginAbiOperationCoverage: collectPluginAbiOperationCoverage(report),
providerPluginRequirementCoverage: collectProviderPluginRequirementCoverage(report),
capabilityGaps: collectCapabilityGaps(report),
@ -2017,6 +2018,74 @@ function collectSplitTargetBlockers(report) {
return (report.splitTargets || []).flatMap(target => target.blockerRecords || []);
}
function collectSplitHandoffMoveCoverage(report) {
const records = [];
for (const runtime of report.runtimes || []) {
if (!runtime.splitHandoffPath) continue;
const absoluteHandoffPath = path.join(repoRoot, runtime.splitHandoffPath);
if (!existsSync(absoluteHandoffPath)) continue;
let handoff;
try {
handoff = JSON.parse(readFileSync(absoluteHandoffPath, "utf8"));
} catch {
continue;
}
for (const moveSet of handoff.moveSets || []) {
const currentPaths = Array.isArray(moveSet.currentPaths) ? moveSet.currentPaths : [];
const observedProviderPaths = Array.isArray(moveSet.observedProviderPaths) ? moveSet.observedProviderPaths : [];
for (const sourcePath of currentPaths) {
const absoluteSourcePath = path.join(repoRoot, sourcePath);
records.push(buildSplitHandoffMoveRecord(runtime, handoff, moveSet, {
pathKind: "current",
sourcePath,
pathExists: existsSync(absoluteSourcePath),
}));
}
for (const sourcePath of observedProviderPaths) {
records.push(buildSplitHandoffMoveRecord(runtime, handoff, moveSet, {
pathKind: "observed-provider",
sourcePath,
pathExists: existsSync(sourcePath),
}));
}
if (!currentPaths.length && !observedProviderPaths.length) {
records.push(buildSplitHandoffMoveRecord(runtime, handoff, moveSet, {
pathKind: "replacement-required",
sourcePath: "(none)",
pathExists: false,
}));
}
}
}
return records.sort((left, right) =>
`${left.splitTarget}:${left.runtimeId}:${left.moveSetId}:${left.pathKind}:${left.sourcePath}`
.localeCompare(`${right.splitTarget}:${right.runtimeId}:${right.moveSetId}:${right.pathKind}:${right.sourcePath}`));
}
function buildSplitHandoffMoveRecord(runtime, handoff, moveSet, source) {
const status = source.pathKind === "replacement-required"
? "no-source-paths"
: source.pathExists ? "exists" : "missing";
return {
splitTarget: handoff.splitTarget || runtime.splitTarget || "",
runtimeId: handoff.runtimeId || runtime.id || "",
runtimeOwnerRepo: handoff.ownerRepo || resolveRuntimeProjectionOwnerRepo(runtime),
handoffPath: runtime.splitHandoffPath || "",
handoffExportPath: makeHandoffExportPath("runtime", runtime.id, runtime.splitHandoffPath || ""),
moveSetId: moveSet.id || "",
stage: moveSet.stage || "",
destinationOwner: moveSet.destinationOwner || "",
replacementProof: moveSet.replacementProof || "",
pathKind: source.pathKind,
sourcePath: normalizePath(source.sourcePath),
pathExists: source.pathExists,
status,
severity: "blocker",
};
}
function collectInteractiveWorldSurfaces(report) {
const surfaces = [];
for (const provider of report.providers || []) {