Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Implement M1a primitive required-field validation
Yuechen Lica31c189cccc
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.csindex e4882238..5ea6ca08 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs@@ -34,7 +34,7 @@ public sealed class FirmamentScaffoldTestsAssert.True(result.Compilation.IsSuccess);var artifact = result.Compilation.Value;- Assert.Equal("firmament-ops-structure-known-kind-family-parsed", artifact.ArtifactKind);+ Assert.Equal("firmament-ops-primitive-required-fields-validated", artifact.ArtifactKind);Assert.NotNull(artifact.ParsedDocument);Assert.Equal("1", artifact.ParsedDocument!.Firmament.Version);Assert.Equal("demo", artifact.ParsedDocument.Model.Name);@@ -50,7 +50,7 @@ public sealed class FirmamentScaffoldTests"firmament": { "version": "1" },"model": { "name": "demo", "units": "mm" },"ops": [- { "op": "box" }+ { "op": "box", "id": "b1", "size": [1, 2, 3] }]}""",@@ -64,7 +64,7 @@ public sealed class FirmamentScaffoldTests"firmament": { "version": "1" },"model": { "name": "demo", "units": "mm" },"ops": [- { "op": "box" },+ { "op": "box", "id": "b1", "size": [2, 3, 4] },{ "op": "subtract", "target": "a" }]}@@ -81,7 +81,7 @@ public sealed class FirmamentScaffoldTests"firmament": { "version": "1" },"model": { "name": "demo", "units": "mm" },"ops": [- { "op": "sphere", "note": "x" }+ { "op": "sphere", "id": "s1", "radius": 2.5, "note": "x" }]}""";@@ -118,7 +118,7 @@ public sealed class FirmamentScaffoldTests"firmament": { "version": "1" },"model": { "name": "demo", "units": "mm" },"ops": [- { "op": "box" },+ { "op": "box", "id": "b1", "size": [1, 2, 3] },{ "op": "subtract" },{ "op": "expect_manifold" }]@@ -388,6 +388,184 @@ public sealed class FirmamentScaffoldTestsFirmamentDiagnosticCodes.StructureUnknownTopLevelSection,"Unknown top-level section 'other'.");+ [Fact]+ public void Compiler_Accepts_ValidCylinderPrimitiveOp() =>+ AssertValidOpsCount(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "radius": 1.5, "height": 10 }+ ]+ }+ """,+ 1);++ [Fact]+ public void Compiler_Rejects_Box_MissingId() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "size": [1, 2, 3] }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveMissingRequiredField,+ "Primitive op 'box' at index 0 is missing required field 'id'.");++ [Fact]+ public void Compiler_Rejects_Box_MissingSize() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "id": "b1" }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveMissingRequiredField,+ "Primitive op 'box' at index 0 is missing required field 'size'.");++ [Fact]+ public void Compiler_Rejects_Box_InvalidSizeShape() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "id": "b1", "size": [1, 2] }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldTypeOrShape,+ "Primitive op 'box' at index 0 has invalid field 'size'; expected exactly 3 numeric components.");++ [Fact]+ public void Compiler_Rejects_Box_NonPositiveSizeComponent() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "id": "b1", "size": [1, 0, 3] }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,+ "Primitive op 'box' at index 0 has invalid field 'size' value; all components must be greater than 0.");++ [Fact]+ public void Compiler_Rejects_Cylinder_MissingRadius() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "height": 5 }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveMissingRequiredField,+ "Primitive op 'cylinder' at index 0 is missing required field 'radius'.");++ [Fact]+ public void Compiler_Rejects_Cylinder_MissingHeight() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "radius": 2 }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveMissingRequiredField,+ "Primitive op 'cylinder' at index 0 is missing required field 'height'.");++ [Fact]+ public void Compiler_Rejects_Cylinder_NonPositiveRadiusOrHeight() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "radius": -1, "height": 5 }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,+ "Primitive op 'cylinder' at index 0 has invalid field 'radius' value; expected a numeric value greater than 0.");++ [Fact]+ public void Compiler_Rejects_Sphere_MissingRadius() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "sphere", "id": "s1" }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveMissingRequiredField,+ "Primitive op 'sphere' at index 0 is missing required field 'radius'.");++ [Fact]+ public void Compiler_Rejects_Sphere_NonPositiveRadius() =>+ AssertSingleValidationError(+ """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "sphere", "id": "s1", "radius": 0 }+ ]+ }+ """,+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,+ "Primitive op 'sphere' at index 0 has invalid field 'radius' value; expected a numeric value greater than 0.");++ [Fact]+ public void PrimitiveValidation_Diagnostics_AreDeterministic()+ {+ var compiler = new FirmamentCompiler();+ var source = """+ {+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "id": "b1", "size": [1, 2] }+ ]+ }+ """;++ var first = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));+ var second = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));++ Assert.False(first.Compilation.IsSuccess);+ Assert.False(second.Compilation.IsSuccess);++ var firstDiagnostic = Assert.Single(first.Compilation.Diagnostics);+ var secondDiagnostic = Assert.Single(second.Compilation.Diagnostics);++ Assert.Equal(firstDiagnostic.Code, secondDiagnostic.Code);+ Assert.Equal(firstDiagnostic.Severity, secondDiagnostic.Severity);+ Assert.Equal(firstDiagnostic.Message, secondDiagnostic.Message);+ Assert.Equal(firstDiagnostic.Source, secondDiagnostic.Source);+ }+[Fact]public void DiagnosticTaxonomyIdentifiers_AreStableAndNonEmpty(){@@ -401,6 +579,9 @@ public sealed class FirmamentScaffoldTestsAssert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureMissingRequiredOpField.Value);Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureInvalidOpFieldValue.Value);Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureUnknownOpKind.Value);+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.PrimitiveMissingRequiredField.Value);+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.PrimitiveInvalidFieldTypeOrShape.Value);+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue.Value);Assert.StartsWith("FIRM-REF", FirmamentDiagnosticCodes.ReferencePlaceholder.Value);Assert.StartsWith("FIRM-SEL", FirmamentDiagnosticCodes.SelectorPlaceholder.Value);Assert.StartsWith("FIRM-SCHEMA", FirmamentDiagnosticCodes.SchemaPlaceholder.Value);@@ -432,12 +613,20 @@ public sealed class FirmamentScaffoldTestsprivate static void AssertClassifiedFamily(string opName, FirmamentOpFamily expectedFamily){var compiler = new FirmamentCompiler();+ var payload = opName switch+ {+ "box" => "{ \"op\": \"box\", \"id\": \"b1\", \"size\": [1, 1, 1] }",+ "cylinder" => "{ \"op\": \"cylinder\", \"id\": \"c1\", \"radius\": 1, \"height\": 2 }",+ "sphere" => "{ \"op\": \"sphere\", \"id\": \"s1\", \"radius\": 1 }",+ _ => $"{{ \"op\": \"{opName}\" }}"+ };+var source = $$"""{"firmament": { "version": "1" },"model": { "name": "demo", "units": "mm" },"ops": [- { "op": "{{opName}}" }+ {{payload}}]}""";diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.csindex 5093f12a..4fb10969 100644--- a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs@@ -13,6 +13,10 @@ public static class FirmamentDiagnosticCodespublic static readonly FirmamentDiagnosticCode StructureInvalidOpFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0007");public static readonly FirmamentDiagnosticCode StructureUnknownOpKind = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0008");+ public static readonly FirmamentDiagnosticCode PrimitiveMissingRequiredField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0009");+ public static readonly FirmamentDiagnosticCode PrimitiveInvalidFieldTypeOrShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0010");+ public static readonly FirmamentDiagnosticCode PrimitiveInvalidFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0011");+public static readonly FirmamentDiagnosticCode ReferencePlaceholder = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0001");public static readonly FirmamentDiagnosticCode SelectorPlaceholder = new($"{FirmamentDiagnosticConventions.SelectorPrefix}-0001");public static readonly FirmamentDiagnosticCode SchemaPlaceholder = new($"{FirmamentDiagnosticConventions.SchemaPrefix}-0001");diff --git a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.csindex ad2fc951..8350aaae 100644--- a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs+++ b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs@@ -3,5 +3,5 @@ using Aetheris.Kernel.Firmament.ParsedModel;namespace Aetheris.Kernel.Firmament;public sealed record FirmamentCompilationArtifact(- string ArtifactKind = "firmament-ops-structure-known-kind-family-parsed",+ string ArtifactKind = "firmament-ops-primitive-required-fields-validated",FirmamentParsedDocument? ParsedDocument = null);diff --git a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs b/Aetheris.Kernel.Firmament/FirmamentCompiler.csindex 67444a2e..af7e0cca 100644--- a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs+++ b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs@@ -1,5 +1,6 @@using Aetheris.Kernel.Core.Results;using Aetheris.Kernel.Firmament.Parsing;+using Aetheris.Kernel.Firmament.Validation;namespace Aetheris.Kernel.Firmament;@@ -16,8 +17,17 @@ public sealed class FirmamentCompilerKernelResult<FirmamentCompilationArtifact>.Failure(parseResult.Diagnostics));}+ var primitiveValidationResult = FirmamentPrimitiveRequiredFieldValidator.Validate(parseResult.Value);+ if (!primitiveValidationResult.IsSuccess)+ {+ return new FirmamentCompileResult(+ KernelResult<FirmamentCompilationArtifact>.Failure(primitiveValidationResult.Diagnostics));+ }+return new FirmamentCompileResult(KernelResult<FirmamentCompilationArtifact>.Success(- new FirmamentCompilationArtifact(ParsedDocument: parseResult.Value)));+ new FirmamentCompilationArtifact(+ ArtifactKind: "firmament-ops-primitive-required-fields-validated",+ ParsedDocument: parseResult.Value)));}}diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.csnew file mode 100644index 00000000..4b451f02--- /dev/null+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs@@ -0,0 +1,244 @@+using System.Globalization;+using System.Text.Json;+using Aetheris.Kernel.Core.Diagnostics;+using Aetheris.Kernel.Core.Results;+using Aetheris.Kernel.Firmament.Diagnostics;+using Aetheris.Kernel.Firmament.ParsedModel;++namespace Aetheris.Kernel.Firmament.Validation;++internal static class FirmamentPrimitiveRequiredFieldValidator+{+ public static KernelResult<bool> Validate(FirmamentParsedDocument parsedDocument)+ {+ ArgumentNullException.ThrowIfNull(parsedDocument);++ for (var index = 0; index < parsedDocument.Ops.Entries.Count; index++)+ {+ var entry = parsedDocument.Ops.Entries[index];+ if (entry.Family != FirmamentOpFamily.Primitive)+ {+ continue;+ }++ var validationResult = entry.KnownKind switch+ {+ FirmamentKnownOpKind.Box => ValidateBox(entry, index),+ FirmamentKnownOpKind.Cylinder => ValidateCylinder(entry, index),+ FirmamentKnownOpKind.Sphere => ValidateSphere(entry, index),+ _ => KernelResult<bool>.Success(true)+ };++ if (!validationResult.IsSuccess)+ {+ return validationResult;+ }+ }++ return KernelResult<bool>.Success(true);+ }++ private static KernelResult<bool> ValidateBox(FirmamentParsedOpEntry entry, int opIndex)+ {+ if (!TryGetRequiredNonEmptyScalar(entry, "id", opIndex, out var missingOrTypeDiagnostic))+ {+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);+ }++ if (!entry.RawFields.TryGetValue("size", out var sizeRaw) || string.IsNullOrWhiteSpace(sizeRaw))+ {+ return MissingField("size", opIndex, entry.OpName);+ }++ if (!TryParseVector(sizeRaw, out var components))+ {+ return InvalidFieldType("size", opIndex, entry.OpName, "expected a 3-element numeric vector-like value");+ }++ if (components.Count != 3)+ {+ return InvalidFieldType("size", opIndex, entry.OpName, "expected exactly 3 numeric components");+ }++ for (var i = 0; i < components.Count; i++)+ {+ if (components[i] <= 0)+ {+ return InvalidFieldValue("size", opIndex, entry.OpName, "all components must be greater than 0");+ }+ }++ return KernelResult<bool>.Success(true);+ }++ private static KernelResult<bool> ValidateCylinder(FirmamentParsedOpEntry entry, int opIndex)+ {+ if (!TryGetRequiredNonEmptyScalar(entry, "id", opIndex, out var missingOrTypeDiagnostic))+ {+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);+ }++ var radiusResult = ValidatePositiveNumericField(entry, "radius", opIndex);+ if (!radiusResult.IsSuccess)+ {+ return radiusResult;+ }++ var heightResult = ValidatePositiveNumericField(entry, "height", opIndex);+ if (!heightResult.IsSuccess)+ {+ return heightResult;+ }++ return KernelResult<bool>.Success(true);+ }++ private static KernelResult<bool> ValidateSphere(FirmamentParsedOpEntry entry, int opIndex)+ {+ if (!TryGetRequiredNonEmptyScalar(entry, "id", opIndex, out var missingOrTypeDiagnostic))+ {+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);+ }++ var radiusResult = ValidatePositiveNumericField(entry, "radius", opIndex);+ if (!radiusResult.IsSuccess)+ {+ return radiusResult;+ }++ return KernelResult<bool>.Success(true);+ }++ private static bool TryGetRequiredNonEmptyScalar(FirmamentParsedOpEntry entry, string fieldName, int opIndex, out KernelDiagnostic? diagnostic)+ {+ diagnostic = null;++ if (!entry.RawFields.TryGetValue(fieldName, out var raw) || string.IsNullOrWhiteSpace(raw))+ {+ diagnostic = MissingFieldDiagnostic(fieldName, opIndex, entry.OpName);+ return false;+ }++ if (LooksLikeStructuredValue(raw))+ {+ diagnostic = InvalidFieldTypeDiagnostic(fieldName, opIndex, entry.OpName, "expected a non-empty scalar/string-like value");+ return false;+ }++ return true;+ }++ private static KernelResult<bool> ValidatePositiveNumericField(FirmamentParsedOpEntry entry, string fieldName, int opIndex)+ {+ if (!entry.RawFields.TryGetValue(fieldName, out var raw) || string.IsNullOrWhiteSpace(raw))+ {+ return MissingField(fieldName, opIndex, entry.OpName);+ }++ if (!TryParseNumeric(raw, out var value))+ {+ return InvalidFieldType(fieldName, opIndex, entry.OpName, "expected a numeric scalar value");+ }++ if (value <= 0)+ {+ return InvalidFieldValue(fieldName, opIndex, entry.OpName, "expected a numeric value greater than 0");+ }++ return KernelResult<bool>.Success(true);+ }++ private static bool LooksLikeStructuredValue(string raw)+ {+ var trimmed = raw.Trim();+ return trimmed.StartsWith("{", StringComparison.Ordinal) || trimmed.StartsWith("[", StringComparison.Ordinal);+ }++ private static bool TryParseNumeric(string raw, out double value)+ {+ var trimmed = raw.Trim();+ if (trimmed.StartsWith("\"", StringComparison.Ordinal) && trimmed.EndsWith("\"", StringComparison.Ordinal) && trimmed.Length >= 2)+ {+ trimmed = trimmed[1..^1];+ }++ return double.TryParse(trimmed, NumberStyles.Float, CultureInfo.InvariantCulture, out value);+ }++ private static bool TryParseVector(string raw, out List<double> components)+ {+ components = [];++ try+ {+ using var document = JsonDocument.Parse(raw);+ if (document.RootElement.ValueKind != JsonValueKind.Array)+ {+ return false;+ }++ foreach (var element in document.RootElement.EnumerateArray())+ {+ if (element.ValueKind != JsonValueKind.Number)+ {+ return false;+ }++ components.Add(element.GetDouble());+ }++ return true;+ }+ catch (JsonException)+ {+ var trimmed = raw.Trim();+ if (!trimmed.StartsWith("[", StringComparison.Ordinal) || !trimmed.EndsWith("]", StringComparison.Ordinal))+ {+ return false;+ }++ var content = trimmed[1..^1];+ var parts = content.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);+ foreach (var part in parts)+ {+ if (!TryParseNumeric(part, out var value))+ {+ return false;+ }++ components.Add(value);+ }++ return true;+ }+ }++ private static KernelResult<bool> MissingField(string fieldName, int opIndex, string opName) =>+ KernelResult<bool>.Failure([MissingFieldDiagnostic(fieldName, opIndex, opName)]);++ private static KernelDiagnostic MissingFieldDiagnostic(string fieldName, int opIndex, string opName) =>+ CreateDiagnostic(+ FirmamentDiagnosticCodes.PrimitiveMissingRequiredField,+ $"Primitive op '{opName}' at index {opIndex} is missing required field '{fieldName}'.");++ private static KernelResult<bool> InvalidFieldType(string fieldName, int opIndex, string opName, string expectation) =>+ KernelResult<bool>.Failure([InvalidFieldTypeDiagnostic(fieldName, opIndex, opName, expectation)]);++ private static KernelDiagnostic InvalidFieldTypeDiagnostic(string fieldName, int opIndex, string opName, string expectation) =>+ CreateDiagnostic(+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldTypeOrShape,+ $"Primitive op '{opName}' at index {opIndex} has invalid field '{fieldName}'; {expectation}.");++ private static KernelResult<bool> InvalidFieldValue(string fieldName, int opIndex, string opName, string expectation) =>+ KernelResult<bool>.Failure(+ [CreateDiagnostic(+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,+ $"Primitive op '{opName}' at index {opIndex} has invalid field '{fieldName}' value; {expectation}.")]);++ private static KernelDiagnostic CreateDiagnostic(FirmamentDiagnosticCode code, string message) =>+ new(+ KernelDiagnosticCode.ValidationFailed,+ KernelDiagnosticSeverity.Error,+ $"[{code.Value}] {message}",+ FirmamentDiagnosticConventions.Source);+}diff --git a/testdata/firmament/fixtures/m0b-valid-one-op.firmament b/testdata/firmament/fixtures/m0b-valid-one-op.firmamentindex 1236f681..25ce96bc 100644--- a/testdata/firmament/fixtures/m0b-valid-one-op.firmament+++ b/testdata/firmament/fixtures/m0b-valid-one-op.firmament@@ -8,3 +8,5 @@ model:ops[1]:-op: box+ id: b1+ size: [1, 2, 3]diff --git a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament b/testdata/firmament/fixtures/m0b-valid-two-ops.firmamentindex 5ddca160..be39a0c2 100644--- a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament+++ b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament@@ -8,6 +8,8 @@ model:ops[2]:-op: box+ id: b1+ size: [2, 3, 4]-op: subtractleft: adiff --git a/testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmament b/testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmamentnew file mode 100644index 00000000..5c81a41d--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "size": [1, 2, 3] }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-box-missing-size.firmament b/testdata/firmament/fixtures/m1a-invalid-box-missing-size.firmamentnew file mode 100644index 00000000..7b77455a--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-box-missing-size.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "id": "b1" }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-box-size-non-positive.firmament b/testdata/firmament/fixtures/m1a-invalid-box-size-non-positive.firmamentnew file mode 100644index 00000000..173b913c--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-box-size-non-positive.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "id": "b1", "size": [1, 0, 3] }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-box-size-shape.firmament b/testdata/firmament/fixtures/m1a-invalid-box-size-shape.firmamentnew file mode 100644index 00000000..d142845a--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-box-size-shape.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "box", "id": "b1", "size": [1, 2] }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-height.firmament b/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-height.firmamentnew file mode 100644index 00000000..4767c9fc--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-height.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "radius": 2 }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-radius.firmament b/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-radius.firmamentnew file mode 100644index 00000000..f079a7bf--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-radius.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "height": 2 }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-cylinder-non-positive-radius.firmament b/testdata/firmament/fixtures/m1a-invalid-cylinder-non-positive-radius.firmamentnew file mode 100644index 00000000..1fd87be5--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-cylinder-non-positive-radius.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "radius": -1, "height": 2 }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-sphere-missing-radius.firmament b/testdata/firmament/fixtures/m1a-invalid-sphere-missing-radius.firmamentnew file mode 100644index 00000000..ff16b6be--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-sphere-missing-radius.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "sphere", "id": "s1" }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-invalid-sphere-non-positive-radius.firmament b/testdata/firmament/fixtures/m1a-invalid-sphere-non-positive-radius.firmamentnew file mode 100644index 00000000..f75d32bb--- /dev/null+++ b/testdata/firmament/fixtures/m1a-invalid-sphere-non-positive-radius.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "sphere", "id": "s1", "radius": 0 }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-valid-cylinder.firmament b/testdata/firmament/fixtures/m1a-valid-cylinder.firmamentnew file mode 100644index 00000000..64866f88--- /dev/null+++ b/testdata/firmament/fixtures/m1a-valid-cylinder.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "cylinder", "id": "c1", "radius": 2.5, "height": 8 }+ ]+}diff --git a/testdata/firmament/fixtures/m1a-valid-sphere.firmament b/testdata/firmament/fixtures/m1a-valid-sphere.firmamentnew file mode 100644index 00000000..dba143b7--- /dev/null+++ b/testdata/firmament/fixtures/m1a-valid-sphere.firmament@@ -0,0 +1,7 @@+{+ "firmament": { "version": "1" },+ "model": { "name": "demo", "units": "mm" },+ "ops": [+ { "op": "sphere", "id": "s1", "radius": 3 }+ ]+}diff --git a/testdata/firmament/manifests/m0c.corpus.json b/testdata/firmament/manifests/m0c.corpus.jsonindex d1abeff7..7272924c 100644--- a/testdata/firmament/manifests/m0c.corpus.json+++ b/testdata/firmament/manifests/m0c.corpus.json@@ -1,6 +1,39 @@{"version": "1","entries": [+ {+ "id": "m0b-invalid-op-entry-wrong-shape",+ "name": "Invalid op entry wrong coarse shape",+ "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0005"+ }+ },+ {+ "id": "m0b-invalid-op-missing-op",+ "name": "Invalid op entry missing op field",+ "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-missing-op.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0006"+ }+ },+ {+ "id": "m0b-invalid-op-value-shape",+ "name": "Invalid op value shape",+ "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-value-shape.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0007"+ }+ },{"id": "m0b-valid-empty-ops","name": "Valid empty ops section",@@ -19,6 +52,17 @@"fixturePath": "testdata/firmament/fixtures/m0b-valid-two-ops.firmament","expectedOutcome": "success"},+ {+ "id": "m0c-invalid-unknown-op",+ "name": "Invalid unknown op kind",+ "fixturePath": "testdata/firmament/fixtures/m0c-invalid-unknown-op.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0008"+ }+ },{"id": "m0c-valid-known-boolean-op","name": "Valid known boolean op",@@ -32,48 +76,115 @@"expectedOutcome": "success"},{- "id": "m0b-invalid-op-missing-op",- "name": "Invalid op entry missing op field",- "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-missing-op.firmament",+ "id": "m1a-invalid-box-missing-id",+ "name": "Invalid box missing id",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmament","expectedOutcome": "failure","expectedDiagnostic": {"source": "firmament","kernelCode": "ValidationFailed",- "firmamentCode": "FIRM-STRUCT-0006"+ "firmamentCode": "FIRM-STRUCT-0009"}},{- "id": "m0b-invalid-op-entry-wrong-shape",- "name": "Invalid op entry wrong coarse shape",- "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament",+ "id": "m1a-invalid-box-missing-size",+ "name": "Invalid box missing size",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-box-missing-size.firmament","expectedOutcome": "failure","expectedDiagnostic": {"source": "firmament","kernelCode": "ValidationFailed",- "firmamentCode": "FIRM-STRUCT-0005"+ "firmamentCode": "FIRM-STRUCT-0009"}},{- "id": "m0b-invalid-op-value-shape",- "name": "Invalid op value shape",- "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-value-shape.firmament",+ "id": "m1a-invalid-box-size-non-positive",+ "name": "Invalid box non-positive size",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-box-size-non-positive.firmament","expectedOutcome": "failure","expectedDiagnostic": {"source": "firmament","kernelCode": "ValidationFailed",- "firmamentCode": "FIRM-STRUCT-0007"+ "firmamentCode": "FIRM-STRUCT-0011"}},{- "id": "m0c-invalid-unknown-op",- "name": "Invalid unknown op kind",- "fixturePath": "testdata/firmament/fixtures/m0c-invalid-unknown-op.firmament",+ "id": "m1a-invalid-box-size-shape",+ "name": "Invalid box size shape",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-box-size-shape.firmament","expectedOutcome": "failure","expectedDiagnostic": {"source": "firmament","kernelCode": "ValidationFailed",- "firmamentCode": "FIRM-STRUCT-0008"+ "firmamentCode": "FIRM-STRUCT-0010"+ }+ },+ {+ "id": "m1a-invalid-cylinder-missing-height",+ "name": "Invalid cylinder missing height",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-cylinder-missing-height.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0009"+ }+ },+ {+ "id": "m1a-invalid-cylinder-missing-radius",+ "name": "Invalid cylinder missing radius",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-cylinder-missing-radius.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0009"+ }+ },+ {+ "id": "m1a-invalid-cylinder-non-positive-radius",+ "name": "Invalid cylinder non-positive radius",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-cylinder-non-positive-radius.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0011"}+ },+ {+ "id": "m1a-invalid-sphere-missing-radius",+ "name": "Invalid sphere missing radius",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-sphere-missing-radius.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0009"+ }+ },+ {+ "id": "m1a-invalid-sphere-non-positive-radius",+ "name": "Invalid sphere non-positive radius",+ "fixturePath": "testdata/firmament/fixtures/m1a-invalid-sphere-non-positive-radius.firmament",+ "expectedOutcome": "failure",+ "expectedDiagnostic": {+ "source": "firmament",+ "kernelCode": "ValidationFailed",+ "firmamentCode": "FIRM-STRUCT-0011"+ }+ },+ {+ "id": "m1a-valid-cylinder",+ "name": "Valid cylinder primitive required fields",+ "fixturePath": "testdata/firmament/fixtures/m1a-valid-cylinder.firmament",+ "expectedOutcome": "success"+ },+ {+ "id": "m1a-valid-sphere",+ "name": "Valid sphere primitive required fields",+ "fixturePath": "testdata/firmament/fixtures/m1a-valid-sphere.firmament",+ "expectedOutcome": "success"}]}