Export plugin ABI operation coverage
This commit is contained in:
parent
b86a905be5
commit
8d4d1de876
6 changed files with 165 additions and 0 deletions
|
|
@ -313,6 +313,11 @@ Recently cut:
|
|||
`plugins[].abiOperationContracts`. Sai and Norn can consume operation-level
|
||||
`input` and `expect` contracts for `describe`, `validate`, `project`,
|
||||
`lower`, `measure`, and `apply` without reading Eve-local fixture files.
|
||||
- Plugin ABI operation coverage is now exported as root
|
||||
`pluginAbiOperationCoverage[]` records. The plugin-owner smoke asserts Sai
|
||||
and Norn `describe`, `lower`, and `apply` operations as `contracted`, so plugin
|
||||
owners can consume the coverage ledger without walking Eve's nested plugin
|
||||
records.
|
||||
- Runtime/plugin projection gaps are now exported as
|
||||
`runtimePluginProjectionGaps[]`. The runtime-owner smoke asserts Unity and
|
||||
Electron plugin gaps as typed records, so missing Sai, Norn, or TeX projection
|
||||
|
|
|
|||
|
|
@ -146,6 +146,11 @@ Plugin ABI fixture operations are exported as `plugins[].abiOperationContracts`
|
|||
with `operation`, `input`, and `expect` blocks. Plugin owners can consume the
|
||||
operation-level contract for `describe`, `validate`, `project`, `lower`,
|
||||
`measure`, and `apply` without opening Eve-local fixture files.
|
||||
The same operation set is indexed as root `pluginAbiOperationCoverage[]` records
|
||||
with plugin id, owner repo, operation, status, fixture path, input keys, and
|
||||
expect keys. Plugin-owner smokes can assert contracted operations with
|
||||
`--expect-plugin-abi-operation-coverage <pluginId:operation:status:ownerRepo>`
|
||||
without walking nested plugin records.
|
||||
|
||||
The runtime conformance pack is evidence-shaped, not fixture-shaped. Its
|
||||
`packs/runtime.json` document includes `runtimeTargets` so runtime repos can
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"plugins",
|
||||
"providers",
|
||||
"runtimes",
|
||||
"pluginAbiOperationCoverage",
|
||||
"interactiveWorldSurfaces",
|
||||
"worldSurfaceLoweringCoverage",
|
||||
"splitTargetBlockers",
|
||||
|
|
@ -501,6 +502,72 @@
|
|||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"pluginAbiOperationCoverage": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"pluginId",
|
||||
"ownerRepo",
|
||||
"splitTarget",
|
||||
"status",
|
||||
"operation",
|
||||
"abiFixturePath",
|
||||
"inputKeys",
|
||||
"expectKeys"
|
||||
],
|
||||
"properties": {
|
||||
"pluginId": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"ownerRepo": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"splitTarget": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"operation": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"abiFixturePath": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"inputKeys": {
|
||||
"type": "array"
|
||||
},
|
||||
"expectKeys": {
|
||||
"type": "array"
|
||||
},
|
||||
"projectionKind": {
|
||||
"type": "string"
|
||||
},
|
||||
"loweringKind": {
|
||||
"type": "string"
|
||||
},
|
||||
"measurementKind": {
|
||||
"type": "string"
|
||||
},
|
||||
"commandEnvelope": {
|
||||
"type": "string"
|
||||
},
|
||||
"receiptSchema": {
|
||||
"type": "string"
|
||||
},
|
||||
"preservesProviderAuthority": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"providers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
|
|||
|
|
@ -43,12 +43,18 @@ node $consumerScript $consumerExport `
|
|||
--expect-plugin-operation sai.vn:lower `
|
||||
--expect-plugin-operation sai.vn:measure `
|
||||
--expect-plugin-operation sai.vn:apply `
|
||||
--expect-plugin-abi-operation-coverage sai.vn:describe:contracted:Sai `
|
||||
--expect-plugin-abi-operation-coverage sai.vn:lower:contracted:Sai `
|
||||
--expect-plugin-abi-operation-coverage sai.vn:apply:contracted:Sai `
|
||||
--expect-plugin-operation norn.graph:describe `
|
||||
--expect-plugin-operation norn.graph:validate `
|
||||
--expect-plugin-operation norn.graph:project `
|
||||
--expect-plugin-operation norn.graph:lower `
|
||||
--expect-plugin-operation norn.graph:measure `
|
||||
--expect-plugin-operation norn.graph:apply `
|
||||
--expect-plugin-abi-operation-coverage norn.graph:describe:contracted:Norn `
|
||||
--expect-plugin-abi-operation-coverage norn.graph:lower:contracted:Norn `
|
||||
--expect-plugin-abi-operation-coverage norn.graph:apply:contracted:Norn `
|
||||
--expect-plugin-capability sai.vn:vn.stage `
|
||||
--expect-plugin-capability sai.vn:story.choose `
|
||||
--expect-plugin-capability sai.vn:story.continue `
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ if (!exportDirectory) {
|
|||
" --expect-plugin-runtime-authority <pluginId:authority>",
|
||||
" --expect-plugin-runtime-field <pluginId:field.path:value>",
|
||||
" --expect-plugin-abi-field <pluginId:operation:field.path:value>",
|
||||
" --expect-plugin-abi-operation-coverage <pluginId:operation:status:ownerRepo>",
|
||||
" --expect-plugin-handoff <pluginId>",
|
||||
" --expect-provider-surface <providerId:surfaceId>",
|
||||
" --expect-provider-surface-kind <providerId:surfaceId:surfaceKind>",
|
||||
|
|
@ -125,6 +126,7 @@ function validateIndex(index, directory, expectations, errors) {
|
|||
const providers = Array.isArray(index.providers) ? index.providers : [];
|
||||
const runtimes = mergeRuntimeRecords(Array.isArray(index.runtimes) ? index.runtimes : [], exportedRuntimeTargets);
|
||||
const splitTargets = Array.isArray(index.splitTargets) ? index.splitTargets : [];
|
||||
const pluginAbiOperationCoverage = Array.isArray(index.pluginAbiOperationCoverage) ? index.pluginAbiOperationCoverage : [];
|
||||
const capabilityGaps = Array.isArray(index.capabilityGaps) ? index.capabilityGaps : [];
|
||||
const runtimePluginProjectionGaps = Array.isArray(index.runtimePluginProjectionGaps) ? index.runtimePluginProjectionGaps : [];
|
||||
const interactiveWorldSurfaces = Array.isArray(index.interactiveWorldSurfaces) ? index.interactiveWorldSurfaces : [];
|
||||
|
|
@ -133,6 +135,7 @@ function validateIndex(index, directory, expectations, errors) {
|
|||
const worldSurfaceLoweringGaps = Array.isArray(index.worldSurfaceLoweringGaps) ? index.worldSurfaceLoweringGaps : [];
|
||||
|
||||
validatePluginRecords(plugins, errors);
|
||||
validatePluginAbiOperationCoverage(index.pluginAbiOperationCoverage, errors);
|
||||
validateProviderRecords(providers, errors);
|
||||
validateRuntimeRecords(runtimes, errors);
|
||||
validateSplitTargetRecords(splitTargets, errors);
|
||||
|
|
@ -292,6 +295,21 @@ function validateIndex(index, directory, expectations, errors) {
|
|||
errors.push(`plugins:${expectation.pluginId}:abiOperation:${expectation.operation}.${expectation.fieldPath}:expected ${expectation.value} got ${actual || ""}`);
|
||||
}
|
||||
}
|
||||
for (const expectation of expectations.pluginAbiOperationCoverage) {
|
||||
const record = pluginAbiOperationCoverage.find(candidate =>
|
||||
candidate.pluginId === expectation.pluginId &&
|
||||
candidate.operation === expectation.operation);
|
||||
if (!record) {
|
||||
errors.push(`pluginAbiOperationCoverage:${expectation.pluginId}:${expectation.operation}:missing`);
|
||||
continue;
|
||||
}
|
||||
if (record.status !== expectation.status) {
|
||||
errors.push(`pluginAbiOperationCoverage:${expectation.pluginId}:${expectation.operation}:status:expected ${expectation.status} got ${record.status || ""}`);
|
||||
}
|
||||
if (record.ownerRepo !== expectation.ownerRepo) {
|
||||
errors.push(`pluginAbiOperationCoverage:${expectation.pluginId}:${expectation.operation}:ownerRepo:expected ${expectation.ownerRepo} got ${record.ownerRepo || ""}`);
|
||||
}
|
||||
}
|
||||
for (const expectedPlugin of expectations.pluginHandoffs) {
|
||||
const plugin = plugins.find(candidate => candidate.pluginId === expectedPlugin);
|
||||
if (!plugin) {
|
||||
|
|
@ -725,6 +743,21 @@ function validatePluginRecords(plugins, errors) {
|
|||
}
|
||||
}
|
||||
|
||||
function validatePluginAbiOperationCoverage(records, errors) {
|
||||
if (!Array.isArray(records)) {
|
||||
errors.push("pluginAbiOperationCoverage:missing");
|
||||
return;
|
||||
}
|
||||
for (const [index, record] of records.entries()) {
|
||||
for (const field of ["pluginId", "ownerRepo", "status", "operation", "abiFixturePath"]) {
|
||||
if (!record?.[field]) errors.push(`pluginAbiOperationCoverage:${index}:${field}:missing`);
|
||||
}
|
||||
for (const field of ["inputKeys", "expectKeys"]) {
|
||||
if (!Array.isArray(record?.[field])) errors.push(`pluginAbiOperationCoverage:${index}:${field}:expected array`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validateProviderRecords(providers, errors) {
|
||||
for (const provider of providers) {
|
||||
const label = `providers:${provider.providerId || "unknown"}`;
|
||||
|
|
@ -800,6 +833,7 @@ function parseArguments(args) {
|
|||
pluginRuntimeAuthorities: [],
|
||||
pluginRuntimeFields: [],
|
||||
pluginAbiFields: [],
|
||||
pluginAbiOperationCoverage: [],
|
||||
pluginHandoffs: [],
|
||||
providers: [],
|
||||
providerSurfaces: [],
|
||||
|
|
@ -848,6 +882,7 @@ function parseArguments(args) {
|
|||
["--expect-plugin-runtime-authority", expectations.pluginRuntimeAuthorities],
|
||||
["--expect-plugin-runtime-field", expectations.pluginRuntimeFields],
|
||||
["--expect-plugin-abi-field", expectations.pluginAbiFields],
|
||||
["--expect-plugin-abi-operation-coverage", expectations.pluginAbiOperationCoverage],
|
||||
["--expect-plugin-handoff", expectations.pluginHandoffs],
|
||||
["--expect-provider-surface", expectations.providerSurfaces],
|
||||
["--expect-provider-surface-kind", expectations.providerSurfaceKinds],
|
||||
|
|
@ -910,6 +945,8 @@ function parseArguments(args) {
|
|||
target.push(parsePluginRuntimeFieldExpectation(value));
|
||||
} else if (option === "--expect-plugin-abi-field") {
|
||||
target.push(parsePluginAbiFieldExpectation(value));
|
||||
} else if (option === "--expect-plugin-abi-operation-coverage") {
|
||||
target.push(parsePluginAbiOperationCoverageExpectation(value));
|
||||
} else if (option === "--expect-plugin-handoff") {
|
||||
target.push(value);
|
||||
} else if (option === "--expect-provider-surface") {
|
||||
|
|
@ -1065,6 +1102,20 @@ function parsePluginAbiFieldExpectation(value) {
|
|||
};
|
||||
}
|
||||
|
||||
function parsePluginAbiOperationCoverageExpectation(value) {
|
||||
const parts = value.split(":");
|
||||
if (parts.length !== 4 || parts.some(part => !part)) {
|
||||
console.error(`Expected plugin ABI operation coverage in <pluginId:operation:status:ownerRepo> form, got: ${value}`);
|
||||
process.exit(2);
|
||||
}
|
||||
return {
|
||||
pluginId: parts[0],
|
||||
operation: parts[1],
|
||||
status: parts[2],
|
||||
ownerRepo: parts[3],
|
||||
};
|
||||
}
|
||||
|
||||
function parseProviderSurfaceFieldExpectation(value) {
|
||||
const parts = value.split(":");
|
||||
if (parts.length < 4 || !parts[0] || !parts[1] || !parts[2] || !parts.slice(3).join(":")) {
|
||||
|
|
|
|||
|
|
@ -1674,6 +1674,7 @@ function buildConformanceExport(report) {
|
|||
worldSurfaceLoweringCoverage: collectWorldSurfaceLoweringCoverage(report),
|
||||
worldSurfaceLoweringGaps: collectWorldSurfaceLoweringGaps(report),
|
||||
splitTargetBlockers: collectSplitTargetBlockers(report),
|
||||
pluginAbiOperationCoverage: collectPluginAbiOperationCoverage(report),
|
||||
capabilityGaps: collectCapabilityGaps(report),
|
||||
plugins: (report.plugins || []).map(plugin => ({
|
||||
pluginId: plugin.pluginId,
|
||||
|
|
@ -1949,6 +1950,36 @@ function collectRuntimePluginProjectionGaps(report) {
|
|||
return gaps;
|
||||
}
|
||||
|
||||
function collectPluginAbiOperationCoverage(report) {
|
||||
const requiredOperations = ["describe", "validate", "project", "lower", "measure", "apply"];
|
||||
const coverage = [];
|
||||
for (const plugin of report.plugins || []) {
|
||||
const operations = new Map((plugin.abiOperationContracts || []).map(contract => [contract.operation, contract]));
|
||||
for (const operation of requiredOperations) {
|
||||
const contract = operations.get(operation);
|
||||
const input = contract?.input || {};
|
||||
const expect = contract?.expect || {};
|
||||
coverage.push({
|
||||
pluginId: plugin.pluginId,
|
||||
ownerRepo: plugin.ownerRepo || "",
|
||||
splitTarget: plugin.splitTarget || "",
|
||||
status: contract ? "contracted" : "missing-contract",
|
||||
operation,
|
||||
abiFixturePath: plugin.abiFixturePath || "",
|
||||
inputKeys: Object.keys(input).sort(),
|
||||
expectKeys: Object.keys(expect).sort(),
|
||||
projectionKind: expect.projectionKind || "",
|
||||
loweringKind: expect.loweringKind || "",
|
||||
measurementKind: expect.measurementKind || "",
|
||||
commandEnvelope: expect.commandEnvelope || "",
|
||||
receiptSchema: expect.receiptSchema || "",
|
||||
preservesProviderAuthority: expect.preservesProviderAuthority === true,
|
||||
});
|
||||
}
|
||||
}
|
||||
return coverage;
|
||||
}
|
||||
|
||||
function collectSplitTargetBlockers(report) {
|
||||
return (report.splitTargets || []).flatMap(target => target.blockerRecords || []);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue