Graduate conformance authority from Eve
This commit is contained in:
parent
4ab9fa5185
commit
44649e4c9f
19 changed files with 195 additions and 9595 deletions
|
|
@ -1,44 +0,0 @@
|
|||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { validateSchemaSubset } from "../../runtimes/incubating/test-support/schema-subset.mjs";
|
||||
|
||||
const [witnessArgument, exportArgument] = process.argv.slice(2);
|
||||
if (!witnessArgument || !exportArgument) {
|
||||
console.error("Usage: node tools/conformance/attach-plugin-witness.mjs <plugin-witness.json> <conformance-export-directory>");
|
||||
process.exit(2);
|
||||
}
|
||||
const witnessPath = path.resolve(witnessArgument);
|
||||
const exportDirectory = path.resolve(exportArgument);
|
||||
const indexPath = path.join(exportDirectory, "index.json");
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const witness = parseJson(await readFile(witnessPath, "utf8"));
|
||||
const schema = parseJson(await readFile(path.join(repoRoot, "schemas/gamecult.eve.plugin_witness.v1.schema.json"), "utf8"));
|
||||
const schemaErrors = validateSchemaSubset(schema, witness);
|
||||
if (schemaErrors.length) throw new Error(`Plugin witness schema errors: ${schemaErrors.join("; ")}`);
|
||||
|
||||
const attachmentRoot = path.join(exportDirectory, "attachments", "plugin", safeSegment(witness.witnessId));
|
||||
await mkdir(attachmentRoot, { recursive: true });
|
||||
const exportedWitnessPath = path.join(attachmentRoot, "witness.json");
|
||||
await writeFile(exportedWitnessPath, `${JSON.stringify(witness, null, 2)}\n`);
|
||||
|
||||
const index = parseJson(await readFile(indexPath, "utf8"));
|
||||
const record = {
|
||||
witnessId: witness.witnessId,
|
||||
pluginId: witness.pluginId,
|
||||
ownerRepo: witness.ownerRepo,
|
||||
status: witness.status,
|
||||
transport: witness.transport,
|
||||
operationCount: witness.operations.length,
|
||||
witnessExportPath: slash(path.relative(exportDirectory, exportedWitnessPath)),
|
||||
};
|
||||
index.pluginWitnesses = [
|
||||
...(Array.isArray(index.pluginWitnesses) ? index.pluginWitnesses : []).filter(candidate => candidate.witnessId !== record.witnessId),
|
||||
record,
|
||||
].sort((left, right) => left.witnessId.localeCompare(right.witnessId));
|
||||
await writeFile(indexPath, `${JSON.stringify(index, null, 2)}\n`);
|
||||
console.log(exportedWitnessPath);
|
||||
|
||||
function safeSegment(value) { return String(value).replace(/[^a-zA-Z0-9._-]+/g, "-"); }
|
||||
function slash(value) { return value.replaceAll("\\", "/"); }
|
||||
function parseJson(value) { return JSON.parse(value.replace(/^\uFEFF/, "")); }
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
import { copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { validateSchemaSubset } from "../../runtimes/incubating/test-support/schema-subset.mjs";
|
||||
|
||||
const [witnessArgument, exportArgument] = process.argv.slice(2);
|
||||
if (!witnessArgument || !exportArgument) {
|
||||
console.error("Usage: node tools/conformance/attach-runtime-witness.mjs <runtime-witness.json> <conformance-export-directory>");
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const witnessPath = path.resolve(witnessArgument);
|
||||
const exportDirectory = path.resolve(exportArgument);
|
||||
const indexPath = path.join(exportDirectory, "index.json");
|
||||
const witness = parseJson(await readFile(witnessPath, "utf8"));
|
||||
validateWitness(witness);
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const witnessSchema = parseJson(await readFile(path.join(repoRoot, "schemas/gamecult.eve.runtime_witness.v1.schema.json"), "utf8"));
|
||||
const schemaErrors = validateSchemaSubset(witnessSchema, witness);
|
||||
if (schemaErrors.length) throw new Error(`Runtime witness schema errors: ${schemaErrors.join("; ")}`);
|
||||
|
||||
const attachmentRoot = path.join(exportDirectory, "attachments", "runtime", safeSegment(witness.witnessId));
|
||||
await mkdir(attachmentRoot, { recursive: true });
|
||||
const artifacts = [];
|
||||
for (const artifact of witness.artifacts) {
|
||||
const sourcePath = path.resolve(path.dirname(witnessPath), artifact.path);
|
||||
const fileName = path.basename(sourcePath);
|
||||
const destinationPath = path.join(attachmentRoot, fileName);
|
||||
await copyFile(sourcePath, destinationPath);
|
||||
artifacts.push({
|
||||
...artifact,
|
||||
exportPath: slash(path.relative(exportDirectory, destinationPath)),
|
||||
});
|
||||
}
|
||||
|
||||
const exportedWitness = { ...witness, artifacts };
|
||||
const exportedWitnessPath = path.join(attachmentRoot, "witness.json");
|
||||
await writeFile(exportedWitnessPath, `${JSON.stringify(exportedWitness, null, 2)}\n`);
|
||||
|
||||
const index = parseJson(await readFile(indexPath, "utf8"));
|
||||
const record = {
|
||||
witnessId: witness.witnessId,
|
||||
runtimeId: witness.runtimeId,
|
||||
runtimeOwnerRepo: witness.runtimeOwnerRepo,
|
||||
providerId: witness.providerId,
|
||||
surfaceId: witness.surfaceId,
|
||||
projectionKind: witness.projectionKind,
|
||||
status: witness.status,
|
||||
cacheState: witness.execution.cacheState,
|
||||
witnessExportPath: slash(path.relative(exportDirectory, exportedWitnessPath)),
|
||||
artifactCount: artifacts.length,
|
||||
};
|
||||
index.runtimeWitnesses = [
|
||||
...(Array.isArray(index.runtimeWitnesses) ? index.runtimeWitnesses : []).filter(candidate => candidate.witnessId !== record.witnessId),
|
||||
record,
|
||||
].sort((left, right) => left.witnessId.localeCompare(right.witnessId));
|
||||
await writeFile(indexPath, `${JSON.stringify(index, null, 2)}\n`);
|
||||
console.log(exportedWitnessPath);
|
||||
|
||||
function validateWitness(value) {
|
||||
for (const field of ["witnessId", "runtimeId", "runtimeOwnerRepo", "providerId", "surfaceId", "projectionKind", "status", "generatedAtUtc", "authority"]) {
|
||||
if (!value?.[field]) throw new Error(`Runtime witness missing ${field}.`);
|
||||
}
|
||||
if (value.schema !== "gamecult.eve.runtime_witness.v1") throw new Error(`Unexpected runtime witness schema: ${value.schema || ""}`);
|
||||
if (!value.execution?.cacheState || !Number.isFinite(value.execution?.durationMs)) throw new Error("Runtime witness execution is incomplete.");
|
||||
if (!value.assertions || typeof value.assertions !== "object") throw new Error("Runtime witness assertions are missing.");
|
||||
if (value.receipts !== undefined && !Array.isArray(value.receipts)) throw new Error("Runtime witness receipts must be an array when present.");
|
||||
if (!Array.isArray(value.artifacts) || !value.artifacts.length) throw new Error("Runtime witness artifacts are missing.");
|
||||
for (const artifact of value.artifacts) {
|
||||
if (!artifact.path || !/^[a-f0-9]{64}$/i.test(artifact.sha256 || "") || !(artifact.sizeBytes > 0)) {
|
||||
throw new Error(`Runtime witness artifact is invalid: ${artifact.path || "unknown"}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function safeSegment(value) { return String(value).replace(/[^a-zA-Z0-9._-]+/g, "-"); }
|
||||
function slash(value) { return value.replaceAll("\\", "/"); }
|
||||
function parseJson(value) { return JSON.parse(value.replace(/^\uFEFF/, "")); }
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,120 +0,0 @@
|
|||
{
|
||||
"schema": "gamecult.eve.conformance_handoff.v1",
|
||||
"splitTarget": "EveConformance",
|
||||
"ownerRepo": "EveConformance",
|
||||
"currentHostRepo": "Eve",
|
||||
"authorityBoundary": "EveConformance owns fixture corpus layout, conformance pack export, parity runner orchestration, consumer smokes, report artifacts, capability matrix evidence, and CI once the harness stabilizes. Eve keeps the kernel contracts, browser reference oracle, and minimal core fixtures.",
|
||||
"moveSets": [
|
||||
{
|
||||
"id": "conformance-runner",
|
||||
"destinationOwner": "EveConformance",
|
||||
"currentPaths": [
|
||||
"tools/parity/run-parity.mjs",
|
||||
"tools/parity/parity-manifest.json",
|
||||
"tools/conformance/consume-export.mjs"
|
||||
],
|
||||
"replacementProof": "EveConformance runs the parity/conformance harness without depending on Eve source layout."
|
||||
},
|
||||
{
|
||||
"id": "conformance-schemas",
|
||||
"destinationOwner": "EveConformance",
|
||||
"currentPaths": [
|
||||
"schemas/gamecult.eve.conformance_export.v1.schema.json",
|
||||
"schemas/gamecult.eve.conformance_handoff.v1.schema.json",
|
||||
"schemas/gamecult.eve.capability_matrix.v1.schema.json",
|
||||
"schemas/gamecult.eve.conformance_fixture.v1.schema.json",
|
||||
"schemas/gamecult.eve.provider_scenario.v1.schema.json",
|
||||
"schemas/gamecult.eve.provider_advertisement.v1.schema.json",
|
||||
"schemas/gamecult.eve.provider_handoff.v1.schema.json",
|
||||
"schemas/gamecult.eve.electron_shell_projection.v1.schema.json",
|
||||
"schemas/gamecult.eve.unity_scene_projection.v1.schema.json",
|
||||
"schemas/gamecult.eve.unity_playable_world_asset_manifest.v1.schema.json",
|
||||
"schemas/gamecult.eve.tui_grid.v1.schema.json",
|
||||
"schemas/gamecult.eve.web_layout_probe.v1.schema.json",
|
||||
"schemas/gamecult.eve.runtime_capability.v1.schema.json",
|
||||
"schemas/gamecult.eve.runtime_lifecycle.v1.schema.json",
|
||||
"schemas/gamecult.eve.runtime_split_handoff.v1.schema.json",
|
||||
"schemas/gamecult.eve.command_receipt.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin_receipt.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin_advertisement.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin_handoff.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin_witness.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin_abi_fixture.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin_abi.request.v1.schema.json",
|
||||
"schemas/gamecult.eve.plugin_abi.response.v1.schema.json",
|
||||
"schemas/gamecult.eve.runtime_release_request.v1.schema.json",
|
||||
"schemas/gamecult.eve.runtime_capture_request.v1.schema.json",
|
||||
"schemas/gamecult.eve.runtime_witness.v1.schema.json"
|
||||
],
|
||||
"replacementProof": "EveConformance publishes the schema catalog and copied schema documents needed by conformance, plugin, provider, and runtime consumers."
|
||||
},
|
||||
{
|
||||
"id": "consumer-smokes",
|
||||
"destinationOwner": "EveConformance",
|
||||
"currentPaths": [
|
||||
"scripts/run-conformance-consumer-smoke.ps1",
|
||||
"scripts/run-plugin-owner-conformance-consumer-smoke.ps1",
|
||||
"scripts/run-runtime-owner-conformance-consumer-smoke.ps1",
|
||||
"scripts/run-split-target-conformance-consumer-smoke.ps1",
|
||||
"scripts/run-aetheria-conformance-consumer-smoke.ps1"
|
||||
],
|
||||
"replacementProof": "Runtime, plugin, provider, and split-target consumers can verify exported packs without reading Eve's parity manifest."
|
||||
},
|
||||
{
|
||||
"id": "fixture-corpus",
|
||||
"destinationOwner": "EveConformance",
|
||||
"currentPaths": [
|
||||
"web/fixtures/cultui-slider-inspector.conformance.json",
|
||||
"web/fixtures/sai-vn-surface.conformance.json",
|
||||
"web/fixtures/fensalir-direct2d-surface.conformance.json",
|
||||
"web/fixtures/cultui-embedded-surface.conformance.json"
|
||||
],
|
||||
"replacementProof": "Core, plugin, provider, and runtime fixture metadata are exported as conformance packs with owner and exit criteria."
|
||||
}
|
||||
],
|
||||
"contractInputs": [
|
||||
"gamecult.eve.surface.v1",
|
||||
"gamecult.eve.command.v1",
|
||||
"gamecult.eve.command_invocation.v1",
|
||||
"gamecult.eve.command_receipt.v1",
|
||||
"gamecult.eve.conformance_export.v1",
|
||||
"gamecult.eve.conformance_handoff.v1",
|
||||
"gamecult.eve.capability_matrix.v1",
|
||||
"gamecult.eve.conformance_fixture.v1",
|
||||
"gamecult.eve.provider_scenario.v1",
|
||||
"gamecult.eve.plugin.v1",
|
||||
"gamecult.eve.plugin_receipt.v1",
|
||||
"gamecult.eve.plugin_advertisement.v1",
|
||||
"gamecult.eve.plugin_handoff.v1",
|
||||
"gamecult.eve.plugin_witness.v1",
|
||||
"gamecult.eve.plugin_abi_fixture.v1",
|
||||
"gamecult.eve.plugin_abi.request.v1",
|
||||
"gamecult.eve.plugin_abi.response.v1",
|
||||
"gamecult.eve.runtime_release_request.v1",
|
||||
"gamecult.eve.runtime_capture_request.v1",
|
||||
"gamecult.eve.runtime_witness.v1",
|
||||
"gamecult.eve.provider_advertisement.v1",
|
||||
"gamecult.eve.provider_handoff.v1",
|
||||
"gamecult.eve.electron_shell_projection.v1",
|
||||
"gamecult.eve.unity_scene_projection.v1",
|
||||
"gamecult.eve.unity_playable_world_asset_manifest.v1",
|
||||
"gamecult.eve.tui_grid.v1",
|
||||
"gamecult.eve.web_layout_probe.v1",
|
||||
"gamecult.eve.runtime_capability.v1",
|
||||
"gamecult.eve.runtime_lifecycle.v1",
|
||||
"gamecult.eve.runtime_split_handoff.v1"
|
||||
],
|
||||
"forbiddenImports": [
|
||||
"provider internals as conformance truth",
|
||||
"runtime source layout as required consumer input",
|
||||
"plugin semantic internals as Eve core authority",
|
||||
"screenshot artifacts as provider state"
|
||||
],
|
||||
"requiredExternalProofs": [
|
||||
"EveConformance publishes a consumable conformance export without depending on Eve source layout.",
|
||||
"Runtime repos consume runtime targets, lifecycle evidence, and capture status from exported packs.",
|
||||
"Plugin owner repos consume plugin manifests, ABI operations, capabilities, and handoff paths from exported packs.",
|
||||
"Provider repos consume provider advertisements, scenarios, receipts, and handoff paths from exported packs."
|
||||
]
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { compileEveDsl } from "../../web/eve-dsl.js";
|
||||
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const manifest = JSON.parse(await readFile(path.join(repoRoot, "tools/parity/parity-manifest.json"), "utf8"));
|
||||
|
||||
const fixtureId = process.argv[2] || "cultui-inspector";
|
||||
const outputPath = process.argv[3]
|
||||
? path.resolve(process.argv[3])
|
||||
: path.join(repoRoot, "artifacts/parity/fixtures", `${fixtureId}.surface.json`);
|
||||
|
||||
const fixture = manifest.fixtures.find(candidate =>
|
||||
candidate.id === fixtureId || candidate.expect?.providerId === fixtureId);
|
||||
|
||||
if (!fixture) {
|
||||
throw new Error(`Unknown parity fixture: ${fixtureId}`);
|
||||
}
|
||||
|
||||
const surface = await loadSurface(fixture.surface);
|
||||
surface.fixtureId = fixture.id;
|
||||
surface.values ||= surface.mesh?.snapshot?.() || {};
|
||||
delete surface.mesh;
|
||||
|
||||
await mkdir(path.dirname(outputPath), { recursive: true });
|
||||
await writeFile(outputPath, `${JSON.stringify(surface, null, 2)}\n`);
|
||||
console.log(outputPath);
|
||||
|
||||
async function loadSurface(surface) {
|
||||
const absolutePath = path.join(repoRoot, surface.path);
|
||||
const source = await readFile(absolutePath, "utf8");
|
||||
if (surface.transport === "local-eve-dsl") return compileEveDsl(source);
|
||||
if (surface.transport === "local-json") return JSON.parse(source);
|
||||
throw new Error(`Unsupported parity surface transport: ${surface.transport}`);
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue