Validate Eve command descriptors

This commit is contained in:
Meta Vens 2026-07-08 23:50:10 +01:00
commit c93ad5519c
4 changed files with 136 additions and 9 deletions

View file

@ -274,16 +274,18 @@ Exit criteria:
## Active Work Queue
1. Add command descriptor checks to fixtures and runtime source-symbol
expectations.
2. Add authority/staleness witness fixture to browser reference.
3. Add conformance-pack metadata files beside fixtures.
4. Add a Direct2D adapter spike or explicitly demote Direct2D until Fensalir owns
1. Add authority/staleness witness fixture to browser reference.
2. Add conformance-pack metadata files beside fixtures.
3. Add a Direct2D adapter spike or explicitly demote Direct2D until Fensalir owns
the body.
5. Add split-readiness reports for EveFlutter and EveUnity.
4. Add split-readiness reports for EveFlutter and EveUnity.
Recently cut:
- Command descriptor validation now runs for strict fixtures. Sai proves
`story.*`/`style.patch`; Aetheria proves the daemon command boundary; the web
lowerer resolves authored `action.command` through the shared Eve command
intent path.
- Provider advertisement validation now runs in the parity harness.
- Repixelizer and Aetheria provider advertisements are checked against
`gamecult.eve.provider_advertisement.v1`.

View file

@ -0,0 +1,35 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "gamecult.eve.command.v1",
"title": "Eve Command Descriptor",
"type": "object",
"required": ["schema", "command"],
"properties": {
"schema": {
"const": "gamecult.eve.command.v1"
},
"command": {
"type": "string",
"minLength": 1
},
"label": {
"type": "string"
},
"surfaceId": {
"type": "string"
},
"transport": {
"type": "string"
},
"authority": {
"type": "string"
},
"result": {
"type": "string"
},
"payloadSchema": {
"type": "string"
}
},
"additionalProperties": true
}

View file

@ -6,6 +6,7 @@
"graduationDocument": "docs/repo-strategy.md"
},
"schemas": {
"gamecult.eve.command.v1": "schemas/gamecult.eve.command.v1.schema.json",
"gamecult.eve.plugin.v1": "schemas/gamecult.eve.plugin.v1.schema.json",
"gamecult.eve.plugin_advertisement.v1": "schemas/gamecult.eve.plugin_advertisement.v1.schema.json",
"gamecult.eve.provider_advertisement.v1": "schemas/gamecult.eve.provider_advertisement.v1.schema.json"
@ -166,7 +167,10 @@
"fontBody",
"fontTitle",
"pixelArt"
]
],
"commandDescriptors": ["story.continue", "story.choose", "story.jump", "style.patch"],
"commandDescriptorSchema": "gamecult.eve.command.v1",
"commandReferencesDeclared": true
}
},
{
@ -182,7 +186,10 @@
"providerId": "aetheria",
"componentKinds": ["surface", "card", "text", "metric", "partition", "field.surface2d", "control.button"],
"styleTokens": ["colorBackground", "colorPanel", "colorText", "colorMuted", "colorAccent"],
"bindings": ["aetheria.daemon.frameId", "aetheria.daemon.soaView.gravityField", "aetheria.daemon.commands"]
"bindings": ["aetheria.daemon.frameId", "aetheria.daemon.soaView.gravityField", "aetheria.daemon.commands"],
"commandDescriptors": ["aetheria.daemon.commands"],
"commandDescriptorSchema": "gamecult.eve.command.v1",
"commandReferencesDeclared": true
}
},
{
@ -352,7 +359,7 @@
"expectedSourceSymbols": [
{
"path": "packages/eve-browser-lowering/src/index.ts",
"contains": ["surface.slot", "embeddedDocuments", "cultui-embedded-slot"]
"contains": ["surface.slot", "embeddedDocuments", "cultui-embedded-slot", "createEveCommandIntent", "resolveComponentCommandId"]
}
],
"capture": {

View file

@ -66,6 +66,10 @@ async function evaluateFixture(fixture) {
.map(node => node.props?.name)
.filter(Boolean))].sort();
const tokenNames = Object.keys(state.surface?.styles?.tokens || {}).sort();
const commandDescriptors = readCommandDescriptors(state.commands || []);
const commandIds = commandDescriptors.map(command => command.command).sort();
const commandReferences = readCommandReferences(nodes);
const commandDescriptorErrors = await validateCommandDescriptors(fixture, commandDescriptors);
const checks = [];
addCheck(checks, "providerId", state.providerId === fixture.expect.providerId, {
@ -122,6 +126,29 @@ async function evaluateFixture(fixture) {
});
}
for (const command of fixture.expect.commandDescriptors || []) {
addCheck(checks, `command:${command}`, commandIds.includes(command), {
expected: "present",
actual: commandIds,
});
}
for (const error of commandDescriptorErrors) {
addCheck(checks, `commandDescriptor:${error}`, false, {
expected: "valid command descriptor",
actual: error,
});
}
if (fixture.expect.commandReferencesDeclared) {
for (const reference of commandReferences) {
addCheck(checks, `commandReference:${reference.nodeId}:${reference.command}`, commandIds.includes(reference.command), {
expected: "declared command descriptor",
actual: commandIds,
});
}
}
const knownPacks = new Set((manifest.conformancePacks || []).map(pack => pack.id));
if (fixture.pack) {
addCheck(checks, "conformancePack", knownPacks.has(fixture.pack), {
@ -151,6 +178,9 @@ async function evaluateFixture(fixture) {
controlParts: controlPartNames,
bindings,
embeddedDocuments,
commands: commandIds,
commandReferences,
commandDescriptorErrors,
checks,
};
}
@ -486,6 +516,53 @@ function readBindings(node) {
return bindings;
}
function readCommandDescriptors(commands) {
return commands
.filter(command => command && typeof command === "object")
.map(command => ({
...command,
command: typeof command.command === "string" ? command.command : "",
schema: typeof command.schema === "string" ? command.schema : "",
}))
.filter(command => command.command);
}
async function validateCommandDescriptors(fixture, commandDescriptors) {
if (!fixture.expect.commandDescriptorSchema) return [];
const schemaPath = manifest.schemas?.[fixture.expect.commandDescriptorSchema];
if (!schemaPath) return [`${fixture.expect.commandDescriptorSchema}:schemaPath:missing`];
const absoluteSchemaPath = path.join(repoRoot, schemaPath);
if (!existsSync(absoluteSchemaPath)) return [`${schemaPath}:missing`];
const schema = JSON.parse(await readFile(absoluteSchemaPath, "utf8"));
return commandDescriptors.flatMap(command =>
validateSchemaSubset(schema, command, `command:${command.command}`));
}
function readCommandReferences(nodes) {
return nodes.flatMap(node => {
const props = node.props || {};
const action = objectProps(props.action);
const command = firstNonEmptyString(props.command, props.commandId, action.command, action.target, action.type, node.commandId);
if (!command) return [];
return [{
nodeId: node.id || "",
kind: node.kind || "",
command,
}];
}).sort((a, b) => `${a.nodeId}:${a.command}`.localeCompare(`${b.nodeId}:${b.command}`));
}
function firstNonEmptyString(...values) {
for (const value of values) {
if (typeof value === "string" && value.trim()) return value;
}
return "";
}
function objectProps(value) {
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
}
function countBy(items, selector) {
const counts = {};
for (const item of items) {
@ -568,6 +645,12 @@ function renderMarkdown(report) {
lines.push(`| ${fixture.title} | ${fixture.pack} | ${fixture.status} | ${fixture.providerId} | ${fixture.componentCount} | ${failed} |`);
}
lines.push("", "## Fixture Commands", "", "| Fixture | Descriptors | References | Descriptor Errors |", "| --- | --- | --- | --- |");
for (const fixture of report.fixtures) {
const refs = fixture.commandReferences.map(reference => `${reference.nodeId}:${reference.command}`).join(", ");
lines.push(`| ${fixture.title} | ${fixture.commands.join(", ")} | ${refs} | ${fixture.commandDescriptorErrors.join(", ")} |`);
}
lines.push("", "## Plugins", "", "| Plugin | Status | Owner | Capabilities | Missing |", "| --- | --- | --- | --- | --- |");
for (const plugin of report.plugins || []) {
const missing = [