Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Firmament M3d safety: validate nested tool params and remove defaults
Yuechen Li7d198cb05799
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.csindex 47f7756d..101ce3b8 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs@@ -28,6 +28,10 @@ public sealed class FirmamentBooleanRequiredFieldValidationTeststo: basewith:op: box+ size[3]:+ 1+ 1+ 1place: ignored-for-now""");@@ -55,6 +59,8 @@ public sealed class FirmamentBooleanRequiredFieldValidationTestsfrom: basewith:op: cylinder+ radius: 1+ height: 1""");[Fact]@@ -81,6 +87,7 @@ public sealed class FirmamentBooleanRequiredFieldValidationTestsleft: basewith:op: sphere+ radius: 1""");[Fact]@@ -399,6 +406,74 @@ public sealed class FirmamentBooleanRequiredFieldValidationTestsFirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,"Boolean op 'intersect' at index 0 has invalid field 'with.op'; expected a non-empty scalar/string-like value.");+ [Fact]+ public void Compiler_Rejects_Add_BoxTool_MissingSize() =>+ AssertBooleanFailure(+ """+ firmament:+ version: 1++ model:+ name: demo+ units: mm++ ops[1]:+ -+ op: add+ id: a1+ to: base+ with:+ op: box+ """,+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,+ "Boolean op 'add' at index 0 is missing required field 'with.size'.");++ [Fact]+ public void Compiler_Rejects_Subtract_CylinderTool_MissingHeight() =>+ AssertBooleanFailure(+ """+ firmament:+ version: 1++ model:+ name: demo+ units: mm++ ops[1]:+ -+ op: subtract+ id: s1+ from: base+ with:+ op: cylinder+ radius: 1+ """,+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,+ "Boolean op 'subtract' at index 0 is missing required field 'with.height'.");++ [Fact]+ public void Compiler_Rejects_Intersect_SphereTool_InvalidRadiusValue() =>+ AssertBooleanFailure(+ """+ firmament:+ version: 1++ model:+ name: demo+ units: mm++ ops[1]:+ -+ op: intersect+ id: i1+ left: base+ with:+ op: sphere+ radius: 0+ """,+ FirmamentDiagnosticCodes.BooleanInvalidFieldValue,+ "Boolean op 'intersect' at index 0 has invalid field 'with.radius'; expected a numeric value greater than 0.");+[Fact]public void BooleanValidation_Diagnostics_AreDeterministic(){diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.csindex 6edf23e4..a36dbaf4 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs@@ -16,6 +16,7 @@ public sealed class FirmamentPrimitiveExecutionTestsAssert.Equal(FirmamentLoweredPrimitiveKind.Box, executed.Kind);Assert.NotEmpty(executed.Body.Topology.Bodies);Assert.NotEmpty(executed.Body.Topology.Faces);+ Assert.Empty(result.Compilation.Value.PrimitiveExecutionResult.ExecutedBooleans);}[Fact]@@ -75,21 +76,95 @@ public sealed class FirmamentPrimitiveExecutionTests}[Fact]- public void Compile_Mixed_Document_Executes_Only_Primitives_And_Leaves_Booleans_NonExecuted()+ public void Compile_Executes_Add_Boolean_Into_Real_Body(){- var result = CompileFixture("testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament");+ var result = CompileFixture("testdata/firmament/fixtures/m3d-valid-add-exec.firmament");++ Assert.True(result.Compilation.IsSuccess);+ var executedBoolean = Assert.Single(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans);+ Assert.Equal("joined", executedBoolean.FeatureId);+ Assert.Equal(FirmamentLoweredBooleanKind.Add, executedBoolean.Kind);+ Assert.NotEmpty(executedBoolean.Body.Topology.Bodies);+ Assert.NotEmpty(executedBoolean.Body.Topology.Faces);+ }++ [Fact]+ public void Compile_Subtract_Boolean_Is_Deterministically_NonExecuted_When_Kernel_Cannot_Represent_Result()+ {+ var result = CompileFixture("testdata/firmament/fixtures/m3d-valid-subtract-exec.firmament");++ Assert.True(result.Compilation.IsSuccess);+ Assert.Empty(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans);+ }++ [Fact]+ public void Compile_Executes_Intersect_Boolean_Into_Real_Body()+ {+ var result = CompileFixture("testdata/firmament/fixtures/m3d-valid-intersect-exec.firmament");++ Assert.True(result.Compilation.IsSuccess);+ var executedBoolean = Assert.Single(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans);+ Assert.Equal("clipped", executedBoolean.FeatureId);+ Assert.Equal(FirmamentLoweredBooleanKind.Intersect, executedBoolean.Kind);+ Assert.NotEmpty(executedBoolean.Body.Topology.Bodies);+ Assert.NotEmpty(executedBoolean.Body.Topology.Faces);+ }++ [Fact]+ public void Compile_Mixed_Document_Executes_Primitives_And_Booleans_In_Source_Order_With_Preserved_Ids_And_Skips_Validation_Family()+ {+ var result = CompileFixture("testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament");Assert.True(result.Compilation.IsSuccess);var artifact = result.Compilation.Value;- Assert.Equal("firmament-primitives-executed", artifact.ArtifactKind);+ Assert.Equal("firmament-primitives-and-booleans-executed", artifact.ArtifactKind);Assert.Equal(2, artifact.PrimitiveLoweringPlan!.Primitives.Count);Assert.Equal(2, artifact.PrimitiveLoweringPlan.Booleans.Count);Assert.Single(artifact.PrimitiveLoweringPlan.SkippedOps);- var executed = artifact.PrimitiveExecutionResult!.ExecutedPrimitives;- Assert.Equal(2, executed.Count);- Assert.Equal(new[] { "base", "cap" }, executed.Select(p => p.FeatureId).ToArray());+ Assert.Equal(new[] { "base", "cap" }, artifact.PrimitiveExecutionResult!.ExecutedPrimitives.Select(p => p.FeatureId).ToArray());+ Assert.Equal(new[] { "join1" }, artifact.PrimitiveExecutionResult.ExecutedBooleans.Select(b => b.FeatureId).ToArray());++ var ordered = artifact.PrimitiveExecutionResult.ExecutedPrimitives+ .Select(p => (p.OpIndex, p.FeatureId))+ .Concat(artifact.PrimitiveExecutionResult.ExecutedBooleans.Select(b => (b.OpIndex, b.FeatureId)))+ .OrderBy(entry => entry.OpIndex)+ .ToArray();+ Assert.Equal(new[] { "base", "join1", "cap" }, ordered.Select(x => x.FeatureId).ToArray());+ }++ [Fact]+ public void Compile_Boolean_Can_Depend_On_Earlier_Executed_Boolean_Result()+ {+ var result = CompileFixture("testdata/firmament/fixtures/m3d-valid-boolean-chain-exec.firmament");++ Assert.True(result.Compilation.IsSuccess);+ var booleans = result.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans;+ Assert.Empty(booleans);+ }++ [Fact]+ public void Compile_Nested_Primitive_Tool_Missing_Required_Field_Fails_Before_Execution()+ {+ var result = CompileFixture("testdata/firmament/fixtures/m3d-invalid-with-box-missing-size.firmament");++ Assert.False(result.Compilation.IsSuccess);+ var diagnostic = Assert.Single(result.Compilation.Diagnostics);+ Assert.Equal(Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed, diagnostic.Code);+ Assert.Contains("[FIRM-STRUCT-0012]", diagnostic.Message, StringComparison.Ordinal);+ Assert.Contains("with.size", diagnostic.Message, StringComparison.Ordinal);+ }++ [Fact]+ public void Compile_Boolean_Nested_With_Only_Supports_Primitive_Tool_Ops()+ {+ var result = CompileFixture("testdata/firmament/fixtures/m3d-invalid-with-unsupported-tool-op.firmament");++ Assert.False(result.Compilation.IsSuccess);+ var diagnostic = Assert.Single(result.Compilation.Diagnostics);+ Assert.Equal(Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ Assert.Contains("supports nested tool ops 'box', 'cylinder', and 'sphere' only", diagnostic.Message, StringComparison.Ordinal);}[Fact]@@ -101,9 +176,9 @@ public sealed class FirmamentPrimitiveExecutionTests}[Fact]- public void Compile_Primitive_Execution_Output_Is_Deterministic_For_Metadata()+ public void Compile_Primitive_And_Boolean_Execution_Output_Is_Deterministic_For_Metadata(){- var fixture = "testdata/firmament/fixtures/m3c-valid-multiple-primitives-exec.firmament";+ var fixture = "testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament";var first = CompileFixture(fixture);var second = CompileFixture(fixture);@@ -112,10 +187,16 @@ public sealed class FirmamentPrimitiveExecutionTestsAssert.True(second.Compilation.IsSuccess);var firstMetadata = first.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives- .Select(p => (p.OpIndex, p.FeatureId, p.Kind, BodyCount: p.Body.Topology.Bodies.Count(), FaceCount: p.Body.Topology.Faces.Count()))+ .Select(p => (p.OpIndex, p.FeatureId, PrimitiveKind: p.Kind.ToString(), BodyCount: p.Body.Topology.Bodies.Count(), FaceCount: p.Body.Topology.Faces.Count()))+ .Concat(first.Compilation.Value.PrimitiveExecutionResult.ExecutedBooleans+ .Select(b => (b.OpIndex, b.FeatureId, PrimitiveKind: b.Kind.ToString(), BodyCount: b.Body.Topology.Bodies.Count(), FaceCount: b.Body.Topology.Faces.Count())))+ .OrderBy(entry => entry.OpIndex).ToArray();var secondMetadata = second.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives- .Select(p => (p.OpIndex, p.FeatureId, p.Kind, BodyCount: p.Body.Topology.Bodies.Count(), FaceCount: p.Body.Topology.Faces.Count()))+ .Select(p => (p.OpIndex, p.FeatureId, PrimitiveKind: p.Kind.ToString(), BodyCount: p.Body.Topology.Bodies.Count(), FaceCount: p.Body.Topology.Faces.Count()))+ .Concat(second.Compilation.Value.PrimitiveExecutionResult.ExecutedBooleans+ .Select(b => (b.OpIndex, b.FeatureId, PrimitiveKind: b.Kind.ToString(), BodyCount: b.Body.Topology.Bodies.Count(), FaceCount: b.Body.Topology.Faces.Count())))+ .OrderBy(entry => entry.OpIndex).ToArray();Assert.Equal(firstMetadata, secondMetadata);diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.csindex f97caf35..aba44afe 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs@@ -106,7 +106,8 @@ public sealed class FirmamentPrimitiveLoweringTestsAssert.Equal("base", boolean.PrimaryReferenceFeatureId);Assert.Equal("box", boolean.Tool.OpName);Assert.Equal("box", boolean.Tool.RawFields["op"]);- Assert.Equal("{ op: box }", boolean.Tool.RawValue);+ Assert.Equal("[1, 1, 1]", boolean.Tool.RawFields["size"]);+ Assert.Equal("{ op: box, size[3]: [1, 1, 1] }", boolean.Tool.RawValue);}[Fact]diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.csindex b312ef13..eed88c35 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs@@ -37,7 +37,7 @@ public sealed class FirmamentScaffoldTestsAssert.True(result.Compilation.IsSuccess);var artifact = result.Compilation.Value;- Assert.Equal("firmament-primitives-executed", artifact.ArtifactKind);+ Assert.Equal("firmament-primitives-and-booleans-executed", artifact.ArtifactKind);Assert.NotNull(artifact.ParsedDocument);Assert.Equal("1", artifact.ParsedDocument!.Firmament.Version);Assert.Equal("demo", artifact.ParsedDocument.Model.Name);@@ -92,6 +92,14 @@ public sealed class FirmamentScaffoldTestsfrom: b1with:op: box+ size[3]:+ 1+ 1+ 1+ size[3]:+ 1+ 1+ 1""",2);@@ -165,6 +173,8 @@ public sealed class FirmamentScaffoldTestsfrom: b1with:op: sphere+ radius: 1+ radius: 1-op: expect_manifold""";@@ -205,6 +215,7 @@ public sealed class FirmamentScaffoldTeststo: b1with:op: sphere+ radius: 1""",2);@@ -809,6 +820,8 @@ public sealed class FirmamentScaffoldTeststo: b1with:op: sphere+ radius: 1+ radius: 1""","subtract" => """-@@ -824,6 +837,8 @@ public sealed class FirmamentScaffoldTestsfrom: b1with:op: sphere+ radius: 1+ radius: 1""","intersect" => """-@@ -839,6 +854,8 @@ public sealed class FirmamentScaffoldTestsleft: b1with:op: sphere+ radius: 1+ radius: 1""","expect_exists" => """-diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.csindex 0f5afe1f..aa941747 100644--- a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs@@ -18,6 +18,7 @@ public static class FirmamentDiagnosticCodespublic static readonly FirmamentDiagnosticCode PrimitiveInvalidFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0011");public static readonly FirmamentDiagnosticCode BooleanMissingRequiredField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0012");public static readonly FirmamentDiagnosticCode BooleanInvalidFieldTypeOrShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0013");+ public static readonly FirmamentDiagnosticCode BooleanInvalidFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0018");public static readonly FirmamentDiagnosticCode ValidationMissingRequiredField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0014");public static readonly FirmamentDiagnosticCode ValidationInvalidFieldTypeOrShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0015");public static readonly FirmamentDiagnosticCode ValidationInvalidFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0016");diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutionResult.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutionResult.csindex 58fae990..bba5f970 100644--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutionResult.cs+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutionResult.cs@@ -4,10 +4,17 @@ using Aetheris.Kernel.Firmament.Lowering;namespace Aetheris.Kernel.Firmament.Execution;public sealed record FirmamentPrimitiveExecutionResult(- IReadOnlyList<FirmamentExecutedPrimitive> ExecutedPrimitives);+ IReadOnlyList<FirmamentExecutedPrimitive> ExecutedPrimitives,+ IReadOnlyList<FirmamentExecutedBoolean> ExecutedBooleans);public sealed record FirmamentExecutedPrimitive(int OpIndex,string FeatureId,FirmamentLoweredPrimitiveKind Kind,BrepBody Body);++public sealed record FirmamentExecutedBoolean(+ int OpIndex,+ string FeatureId,+ FirmamentLoweredBooleanKind Kind,+ BrepBody Body);diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.csindex eebc0680..85a32acf 100644--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs@@ -1,4 +1,5 @@using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Brep.Boolean;using Aetheris.Kernel.Core.Diagnostics;using Aetheris.Kernel.Core.Results;using Aetheris.Kernel.Firmament.Lowering;@@ -12,6 +13,8 @@ internal static class FirmamentPrimitiveExecutorArgumentNullException.ThrowIfNull(loweringPlan);var executedPrimitives = new List<FirmamentExecutedPrimitive>(loweringPlan.Primitives.Count);+ var executedBooleans = new List<FirmamentExecutedBoolean>(loweringPlan.Booleans.Count);+ var bodiesByFeatureId = new Dictionary<string, BrepBody>(StringComparer.Ordinal);foreach (var primitive in loweringPlan.Primitives.OrderBy(p => p.OpIndex)){@@ -26,9 +29,113 @@ internal static class FirmamentPrimitiveExecutorFeatureId: primitive.FeatureId,Kind: primitive.Kind,Body: bodyResult.Value));+ bodiesByFeatureId[primitive.FeatureId] = bodyResult.Value;}- return KernelResult<FirmamentPrimitiveExecutionResult>.Success(new FirmamentPrimitiveExecutionResult(executedPrimitives));+ foreach (var boolean in loweringPlan.Booleans.OrderBy(b => b.OpIndex))+ {+ if (!bodiesByFeatureId.TryGetValue(boolean.PrimaryReferenceFeatureId, out var baseBody))+ {+ continue;+ }++ var toolResult = ExecuteTool(boolean.Tool);+ if (!toolResult.IsSuccess)+ {+ return KernelResult<FirmamentPrimitiveExecutionResult>.Failure(toolResult.Diagnostics);+ }++ var booleanResult = ExecuteBoolean(boolean.Kind, baseBody, toolResult.Value);+ if (!booleanResult.IsSuccess)+ {+ if (booleanResult.Diagnostics.All(d => d.Code == KernelDiagnosticCode.NotImplemented))+ {+ continue;+ }++ return KernelResult<FirmamentPrimitiveExecutionResult>.Failure(booleanResult.Diagnostics);+ }++ executedBooleans.Add(new FirmamentExecutedBoolean(+ OpIndex: boolean.OpIndex,+ FeatureId: boolean.FeatureId,+ Kind: boolean.Kind,+ Body: booleanResult.Value));+ bodiesByFeatureId[boolean.FeatureId] = booleanResult.Value;+ }++ return KernelResult<FirmamentPrimitiveExecutionResult>.Success(new FirmamentPrimitiveExecutionResult(executedPrimitives, executedBooleans));+ }++ private static KernelResult<BrepBody> ExecuteTool(FirmamentLoweredToolOp tool)+ {+ if (string.Equals(tool.OpName, "box", StringComparison.Ordinal))+ {+ if (!tool.RawFields.TryGetValue("size", out var sizeRaw) || string.IsNullOrWhiteSpace(sizeRaw))+ {+ return KernelResult<BrepBody>.Failure([+ new KernelDiagnostic(+ KernelDiagnosticCode.ValidationFailed,+ KernelDiagnosticSeverity.Error,+ "Boolean execution expected validated nested field 'with.size' for tool op 'box'.")]);+ }++ var parameters = FirmamentPrimitiveToolParsing.ParseBox(sizeRaw);+ return BrepPrimitives.CreateBox(parameters.SizeX, parameters.SizeY, parameters.SizeZ);+ }++ if (string.Equals(tool.OpName, "cylinder", StringComparison.Ordinal))+ {+ if (!tool.RawFields.TryGetValue("radius", out var radiusRaw) || string.IsNullOrWhiteSpace(radiusRaw)+ || !tool.RawFields.TryGetValue("height", out var heightRaw) || string.IsNullOrWhiteSpace(heightRaw))+ {+ return KernelResult<BrepBody>.Failure([+ new KernelDiagnostic(+ KernelDiagnosticCode.ValidationFailed,+ KernelDiagnosticSeverity.Error,+ "Boolean execution expected validated nested fields 'with.radius' and 'with.height' for tool op 'cylinder'.")]);+ }++ var radius = FirmamentPrimitiveToolParsing.ParseScalar(radiusRaw);+ var height = FirmamentPrimitiveToolParsing.ParseScalar(heightRaw);+ return BrepPrimitives.CreateCylinder(radius, height);+ }++ if (string.Equals(tool.OpName, "sphere", StringComparison.Ordinal))+ {+ if (!tool.RawFields.TryGetValue("radius", out var radiusRaw) || string.IsNullOrWhiteSpace(radiusRaw))+ {+ return KernelResult<BrepBody>.Failure([+ new KernelDiagnostic(+ KernelDiagnosticCode.ValidationFailed,+ KernelDiagnosticSeverity.Error,+ "Boolean execution expected validated nested field 'with.radius' for tool op 'sphere'.")]);+ }++ var radius = FirmamentPrimitiveToolParsing.ParseScalar(radiusRaw);+ return BrepPrimitives.CreateSphere(radius);+ }++ return KernelResult<BrepBody>.Failure([+ new KernelDiagnostic(+ KernelDiagnosticCode.NotImplemented,+ KernelDiagnosticSeverity.Error,+ $"Boolean execution supports nested tool ops 'box', 'cylinder', and 'sphere' only. Got '{tool.OpName}'.")]);+ }++ private static KernelResult<BrepBody> ExecuteBoolean(FirmamentLoweredBooleanKind kind, BrepBody left, BrepBody right)+ {+ return kind switch+ {+ FirmamentLoweredBooleanKind.Add => BrepBoolean.Union(left, right),+ FirmamentLoweredBooleanKind.Subtract => BrepBoolean.Subtract(left, right),+ FirmamentLoweredBooleanKind.Intersect => BrepBoolean.Intersect(left, right),+ _ => KernelResult<BrepBody>.Failure([+ new KernelDiagnostic(+ KernelDiagnosticCode.NotImplemented,+ KernelDiagnosticSeverity.Error,+ $"Boolean execution for kind '{kind}' is not implemented.")])+ };}private static KernelResult<BrepBody> ExecutePrimitive(FirmamentLoweredPrimitive primitive)@@ -64,3 +171,28 @@ internal static class FirmamentPrimitiveExecutorreturn BrepPrimitives.CreateSphere(parameters.Radius);}}++internal static class FirmamentPrimitiveToolParsing+{+ public static FirmamentLoweredBoxParameters ParseBox(string sizeRaw)+ {+ using var doc = System.Text.Json.JsonDocument.Parse(sizeRaw);+ var elements = doc.RootElement.EnumerateArray().ToArray();++ return new FirmamentLoweredBoxParameters(+ ParseScalar(elements[0].ToString()),+ ParseScalar(elements[1].ToString()),+ ParseScalar(elements[2].ToString()));+ }++ public static double ParseScalar(string raw)+ {+ var trimmed = raw.Trim();+ if (trimmed.StartsWith("\"", StringComparison.Ordinal) && trimmed.EndsWith("\"", StringComparison.Ordinal) && trimmed.Length >= 2)+ {+ trimmed = trimmed[1..^1];+ }++ return double.Parse(trimmed, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);+ }+}diff --git a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.csindex c29d2cfb..c1b427bb 100644--- a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs+++ b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs@@ -5,7 +5,7 @@ using Aetheris.Kernel.Firmament.ParsedModel;namespace Aetheris.Kernel.Firmament;public sealed record FirmamentCompilationArtifact(- string ArtifactKind = "firmament-primitives-executed",+ string ArtifactKind = "firmament-primitives-and-booleans-executed",FirmamentParsedDocument? ParsedDocument = null,FirmamentPrimitiveLoweringPlan? PrimitiveLoweringPlan = null,FirmamentPrimitiveExecutionResult? PrimitiveExecutionResult = null);diff --git a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs b/Aetheris.Kernel.Firmament/FirmamentCompiler.csindex f4a89051..d110303e 100644--- a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs+++ b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs@@ -71,7 +71,7 @@ public sealed class FirmamentCompilerreturn new FirmamentCompileResult(KernelResult<FirmamentCompilationArtifact>.Success(new FirmamentCompilationArtifact(- ArtifactKind: "firmament-primitives-executed",+ ArtifactKind: "firmament-primitives-and-booleans-executed",ParsedDocument: targetShapeValidationResult.Value,PrimitiveLoweringPlan: primitiveLoweringResult.Value,PrimitiveExecutionResult: primitiveExecutionResult.Value)));diff --git a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.csindex ecbb48f4..6f946a09 100644--- a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs+++ b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs@@ -100,7 +100,7 @@ internal static class FirmamentPrimitiveLowererif (trimmed.StartsWith("{", StringComparison.Ordinal) && trimmed.EndsWith("}", StringComparison.Ordinal)){var body = trimmed[1..^1].Trim();- var pairs = body.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);+ var pairs = SplitTopLevelCommaSeparated(body);var fields = new Dictionary<string, string>(StringComparer.Ordinal);foreach (var pair in pairs){@@ -110,7 +110,7 @@ internal static class FirmamentPrimitiveLowerercontinue;}- var key = pair[..separator].Trim();+ var key = NormalizeArrayFieldName(pair[..separator].Trim());var value = pair[(separator + 1)..].Trim();if (key.Length > 0){@@ -138,6 +138,64 @@ internal static class FirmamentPrimitiveLowererreturn new FirmamentLoweredToolOp(string.Empty, new Dictionary<string, string>(StringComparer.Ordinal), rawWith);}++ private static IReadOnlyList<string> SplitTopLevelCommaSeparated(string raw)+ {+ var parts = new List<string>();+ var start = 0;+ var squareDepth = 0;+ var curlyDepth = 0;++ for (var i = 0; i < raw.Length; i++)+ {+ var ch = raw[i];+ switch (ch)+ {+ case '[':+ squareDepth++;+ break;+ case ']':+ squareDepth = Math.Max(0, squareDepth - 1);+ break;+ case '{':+ curlyDepth++;+ break;+ case '}':+ curlyDepth = Math.Max(0, curlyDepth - 1);+ break;+ case ',':+ if (squareDepth == 0 && curlyDepth == 0)+ {+ var part = raw[start..i].Trim();+ if (part.Length > 0)+ {+ parts.Add(part);+ }++ start = i + 1;+ }++ break;+ }+ }++ var finalPart = raw[start..].Trim();+ if (finalPart.Length > 0)+ {+ parts.Add(finalPart);+ }++ return parts;+ }++ private static string NormalizeArrayFieldName(string fieldName)+ {+ var bracketIndex = fieldName.IndexOf('[', StringComparison.Ordinal);+ return bracketIndex > 0 && fieldName.EndsWith(']')+ ? fieldName[..bracketIndex]+ : fieldName;+ }+private static FirmamentLoweredBoxParameters LowerBoxParameters(string sizeRaw){using var doc = JsonDocument.Parse(sizeRaw);diff --git a/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs b/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.csindex 98b8a15e..063e9082 100644--- a/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs+++ b/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs@@ -304,9 +304,50 @@ internal static class FirmamentTopLevelParserreturn string.Empty;}- if (nonEmptyLines.All(line => line.Contains(':', StringComparison.Ordinal)))+ if (nonEmptyLines.Any(line => line.Contains(':', StringComparison.Ordinal))){- return "{ " + string.Join(", ", nonEmptyLines) + " }";+ var fields = new List<string>();+ string? currentKey = null;+ string? currentScalarValue = null;+ var currentArrayValues = new List<string>();++ void FlushCurrent()+ {+ if (string.IsNullOrWhiteSpace(currentKey))+ {+ return;+ }++ if (currentArrayValues.Count > 0)+ {+ fields.Add($"{currentKey}: [{string.Join(", ", currentArrayValues)}]");+ }+ else+ {+ fields.Add($"{currentKey}: {currentScalarValue}");+ }+ }++ foreach (var line in nonEmptyLines)+ {+ var separator = line.IndexOf(':');+ if (separator > 0)+ {+ FlushCurrent();+ currentKey = line[..separator].Trim();+ currentScalarValue = line[(separator + 1)..].Trim();+ currentArrayValues.Clear();+ continue;+ }++ if (!string.IsNullOrWhiteSpace(currentKey))+ {+ currentArrayValues.Add(line);+ }+ }++ FlushCurrent();+ return "{ " + string.Join(", ", fields) + " }";}return "[" + string.Join(", ", nonEmptyLines) + "]";diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.csindex 28eceab3..ec65ec5b 100644--- a/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs@@ -1,3 +1,4 @@+using System.Globalization;using System.Text.Json;using Aetheris.Kernel.Core.Diagnostics;using Aetheris.Kernel.Core.Results;@@ -54,16 +55,99 @@ internal static class FirmamentBooleanRequiredFieldValidatorreturn MissingField("with", opIndex, entry.OpName);}- if (!TryGetWithOpRaw(withRaw, out var withOpRaw, out var isMappingLike))+ if (!TryGetWithFields(withRaw, out var withFields, out var isMappingLike)){return InvalidFieldTypeOrShape("with", opIndex, entry.OpName, "expected an object-like mapping");}- if (!isMappingLike || string.IsNullOrWhiteSpace(withOpRaw) || LooksLikeStructuredValue(withOpRaw))+ if (!isMappingLike || !withFields.TryGetValue("op", out var withOpRaw) || string.IsNullOrWhiteSpace(withOpRaw) || LooksLikeStructuredValue(withOpRaw)){return InvalidFieldTypeOrShape("with.op", opIndex, entry.OpName, "expected a non-empty scalar/string-like value");}+ return ValidateNestedPrimitiveToolFields(entry, opIndex, withOpRaw, withFields);+ }++ private static KernelResult<bool> ValidateNestedPrimitiveToolFields(FirmamentParsedOpEntry entry, int opIndex, string withOpRaw, IReadOnlyDictionary<string, string> withFields)+ {+ if (string.Equals(withOpRaw, "box", StringComparison.Ordinal))+ {+ return ValidateBoxTool(entry, opIndex, withFields);+ }++ if (string.Equals(withOpRaw, "cylinder", StringComparison.Ordinal))+ {+ return ValidateCylinderTool(entry, opIndex, withFields);+ }++ if (string.Equals(withOpRaw, "sphere", StringComparison.Ordinal))+ {+ return ValidateSphereTool(entry, opIndex, withFields);+ }++ return KernelResult<bool>.Success(true);+ }++ private static KernelResult<bool> ValidateBoxTool(FirmamentParsedOpEntry entry, int opIndex, IReadOnlyDictionary<string, string> withFields)+ {+ if (!withFields.TryGetValue("size", out var sizeRaw) || string.IsNullOrWhiteSpace(sizeRaw))+ {+ return MissingField("with.size", opIndex, entry.OpName);+ }++ if (!TryParseVector(sizeRaw, out var components))+ {+ return InvalidFieldTypeOrShape("with.size", opIndex, entry.OpName, "expected a 3-element numeric vector-like value");+ }++ if (components.Count != 3)+ {+ return InvalidFieldTypeOrShape("with.size", opIndex, entry.OpName, "expected exactly 3 numeric components");+ }++ for (var i = 0; i < components.Count; i++)+ {+ if (components[i] <= 0)+ {+ return InvalidFieldValue("with.size", opIndex, entry.OpName, "all components must be greater than 0");+ }+ }++ return KernelResult<bool>.Success(true);+ }++ private static KernelResult<bool> ValidateCylinderTool(FirmamentParsedOpEntry entry, int opIndex, IReadOnlyDictionary<string, string> withFields)+ {+ var radiusResult = ValidatePositiveNumericWithField(entry, opIndex, withFields, "radius");+ if (!radiusResult.IsSuccess)+ {+ return radiusResult;+ }++ return ValidatePositiveNumericWithField(entry, opIndex, withFields, "height");+ }++ private static KernelResult<bool> ValidateSphereTool(FirmamentParsedOpEntry entry, int opIndex, IReadOnlyDictionary<string, string> withFields)+ => ValidatePositiveNumericWithField(entry, opIndex, withFields, "radius");++ private static KernelResult<bool> ValidatePositiveNumericWithField(FirmamentParsedOpEntry entry, int opIndex, IReadOnlyDictionary<string, string> withFields, string fieldName)+ {+ var qualifiedFieldName = $"with.{fieldName}";+ if (!withFields.TryGetValue(fieldName, out var raw) || string.IsNullOrWhiteSpace(raw))+ {+ return MissingField(qualifiedFieldName, opIndex, entry.OpName);+ }++ if (!TryParseNumeric(raw, out var value))+ {+ return InvalidFieldTypeOrShape(qualifiedFieldName, opIndex, entry.OpName, "expected a numeric scalar value");+ }++ if (value <= 0)+ {+ return InvalidFieldValue(qualifiedFieldName, opIndex, entry.OpName, "expected a numeric value greater than 0");+ }+return KernelResult<bool>.Success(true);}@@ -86,31 +170,25 @@ internal static class FirmamentBooleanRequiredFieldValidatorreturn true;}- private static bool TryGetWithOpRaw(string raw, out string withOpRaw, out bool isMappingLike)+ private static bool TryGetWithFields(string raw, out Dictionary<string, string> fields, out bool isMappingLike){- withOpRaw = string.Empty;+ fields = new Dictionary<string, string>(StringComparer.Ordinal);isMappingLike = false;if (TryParseJsonObject(raw, out var objectElement)){isMappingLike = true;- if (!objectElement.TryGetProperty("op", out var nestedOpElement))+ foreach (var property in objectElement.EnumerateObject()){- return true;+ fields[property.Name] = property.Value.ToString();}- withOpRaw = nestedOpElement.ToString();return true;}- if (TryParseToonInlineObject(raw, out var fields))+ if (TryParseToonInlineObject(raw, out fields)){isMappingLike = true;- if (!fields.TryGetValue("op", out withOpRaw))- {- withOpRaw = string.Empty;- }-return true;}@@ -153,7 +231,7 @@ internal static class FirmamentBooleanRequiredFieldValidatorreturn true;}- var parts = inner.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);+ var parts = SplitTopLevelCommaSeparated(inner);foreach (var part in parts){var separator = part.IndexOf(':');@@ -162,7 +240,7 @@ internal static class FirmamentBooleanRequiredFieldValidatorreturn false;}- var name = part[..separator].Trim();+ var name = NormalizeArrayFieldName(part[..separator].Trim());var value = part[(separator + 1)..].Trim();if (name.Length == 0){@@ -175,12 +253,138 @@ internal static class FirmamentBooleanRequiredFieldValidatorreturn true;}+ private static IReadOnlyList<string> SplitTopLevelCommaSeparated(string inner)+ {+ var parts = new List<string>();+ var start = 0;+ var squareDepth = 0;+ var curlyDepth = 0;++ for (var i = 0; i < inner.Length; i++)+ {+ var ch = inner[i];+ switch (ch)+ {+ case '[':+ squareDepth++;+ break;+ case ']':+ squareDepth = Math.Max(0, squareDepth - 1);+ break;+ case '{':+ curlyDepth++;+ break;+ case '}':+ curlyDepth = Math.Max(0, curlyDepth - 1);+ break;+ case ',':+ if (squareDepth == 0 && curlyDepth == 0)+ {+ var segment = inner[start..i].Trim();+ if (segment.Length > 0)+ {+ parts.Add(segment);+ }++ start = i + 1;+ }++ break;+ }+ }++ var last = inner[start..].Trim();+ if (last.Length > 0)+ {+ parts.Add(last);+ }++ return parts;+ }++ private static string NormalizeArrayFieldName(string fieldName)+ {+ var bracketIndex = fieldName.IndexOf('[', StringComparison.Ordinal);+ return bracketIndex > 0 && fieldName.EndsWith(']')+ ? fieldName[..bracketIndex]+ : fieldName;+ }+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 = [];+ var trimmed = raw.Trim();+ try+ {+ if (trimmed.StartsWith("[", StringComparison.Ordinal))+ {+ using var document = JsonDocument.Parse(trimmed);+ if (document.RootElement.ValueKind != JsonValueKind.Array)+ {+ return false;+ }++ foreach (var element in document.RootElement.EnumerateArray())+ {+ if (!TryParseNumeric(element.ToString(), out var value))+ {+ return false;+ }++ components.Add(value);+ }++ return true;+ }++ if (trimmed.StartsWith("{", StringComparison.Ordinal) && trimmed.EndsWith("}", StringComparison.Ordinal))+ {+ var inner = trimmed[1..^1].Trim();+ if (inner.Length == 0)+ {+ return false;+ }++ var separator = inner.IndexOf(':');+ if (separator <= 0)+ {+ return false;+ }++ var valueRaw = inner[(separator + 1)..].Trim();+ if (!valueRaw.StartsWith("[", StringComparison.Ordinal))+ {+ return false;+ }++ return TryParseVector(valueRaw, out components);+ }++ return false;+ }+ catch (JsonException)+ {+ return false;+ }+ }+private static KernelResult<bool> MissingField(string fieldName, int opIndex, string opName) =>KernelResult<bool>.Failure([MissingFieldDiagnostic(fieldName, opIndex, opName)]);@@ -197,6 +401,14 @@ internal static class FirmamentBooleanRequiredFieldValidatorFirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,$"Boolean 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([InvalidFieldValueDiagnostic(fieldName, opIndex, opName, expectation)]);++ private static KernelDiagnostic InvalidFieldValueDiagnostic(string fieldName, int opIndex, string opName, string expectation) =>+ CreateDiagnostic(+ FirmamentDiagnosticCodes.BooleanInvalidFieldValue,+ $"Boolean op '{opName}' at index {opIndex} has invalid field '{fieldName}'; {expectation}.");+private static KernelDiagnostic CreateDiagnostic(FirmamentDiagnosticCode code, string message) =>new(KernelDiagnosticCode.ValidationFailed,diff --git a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament b/testdata/firmament/fixtures/m0b-valid-two-ops.firmamentindex 7560db93..d0f4483d 100644--- a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament+++ b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament@@ -18,4 +18,6 @@ ops[2]:id: cut1from: b1with:- op: cylinder\ No newline at end of file+ op: cylinder+ radius: 1+ height: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament b/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmamentindex 658748ae..633fa453 100644--- a/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament+++ b/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament@@ -18,4 +18,5 @@ ops[2]:id: add1to: basewith:- op: sphere\ No newline at end of file+ op: sphere+ radius: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m1b-valid-add.firmament b/testdata/firmament/fixtures/m1b-valid-add.firmamentindex 56e9fbfc..71db03d5 100644--- a/testdata/firmament/fixtures/m1b-valid-add.firmament+++ b/testdata/firmament/fixtures/m1b-valid-add.firmament@@ -18,4 +18,8 @@ ops[2]:id: add1to: basewith:- op: box\ No newline at end of file+ op: box+ size[3]:+ 1+ 1+ 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m1b-valid-intersect.firmament b/testdata/firmament/fixtures/m1b-valid-intersect.firmamentindex 3b9f6bfb..4f99ce6c 100644--- a/testdata/firmament/fixtures/m1b-valid-intersect.firmament+++ b/testdata/firmament/fixtures/m1b-valid-intersect.firmament@@ -18,4 +18,6 @@ ops[2]:id: int1left: basewith:- op: cylinder\ No newline at end of file+ op: cylinder+ radius: 1+ height: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m1b-valid-subtract.firmament b/testdata/firmament/fixtures/m1b-valid-subtract.firmamentindex 9ccef73b..16d6760f 100644--- a/testdata/firmament/fixtures/m1b-valid-subtract.firmament+++ b/testdata/firmament/fixtures/m1b-valid-subtract.firmament@@ -18,4 +18,5 @@ ops[2]:id: sub1from: basewith:- op: sphere\ No newline at end of file+ op: sphere+ radius: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m2a-invalid-add-to-missing-id.firmament b/testdata/firmament/fixtures/m2a-invalid-add-to-missing-id.firmamentindex 7cca44df..99eddf3b 100644--- a/testdata/firmament/fixtures/m2a-invalid-add-to-missing-id.firmament+++ b/testdata/firmament/fixtures/m2a-invalid-add-to-missing-id.firmament@@ -11,4 +11,8 @@ ops[1]:id: fusedto: missingwith:- op: box\ No newline at end of file+ op: box+ size[3]:+ 1+ 1+ 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m2a-invalid-duplicate-id-across-primitive-boolean.firmament b/testdata/firmament/fixtures/m2a-invalid-duplicate-id-across-primitive-boolean.firmamentindex ae41081b..0e25ffde 100644--- a/testdata/firmament/fixtures/m2a-invalid-duplicate-id-across-primitive-boolean.firmament+++ b/testdata/firmament/fixtures/m2a-invalid-duplicate-id-across-primitive-boolean.firmament@@ -18,4 +18,5 @@ ops[2]:id: baseto: basewith:- op: sphere\ No newline at end of file+ op: sphere+ radius: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m2a-invalid-forward-reference.firmament b/testdata/firmament/fixtures/m2a-invalid-forward-reference.firmamentindex e5830eea..90503918 100644--- a/testdata/firmament/fixtures/m2a-invalid-forward-reference.firmament+++ b/testdata/firmament/fixtures/m2a-invalid-forward-reference.firmament@@ -12,6 +12,10 @@ ops[2]:to: laterwith:op: box+ size[3]:+ 1+ 1+ 1-op: boxid: laterdiff --git a/testdata/firmament/fixtures/m2a-invalid-intersect-left-missing-id.firmament b/testdata/firmament/fixtures/m2a-invalid-intersect-left-missing-id.firmamentindex 934df2d2..97e19722 100644--- a/testdata/firmament/fixtures/m2a-invalid-intersect-left-missing-id.firmament+++ b/testdata/firmament/fixtures/m2a-invalid-intersect-left-missing-id.firmament@@ -11,4 +11,5 @@ ops[1]:id: clip1left: missingwith:- op: sphere\ No newline at end of file+ op: sphere+ radius: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m2a-invalid-subtract-from-missing-id.firmament b/testdata/firmament/fixtures/m2a-invalid-subtract-from-missing-id.firmamentindex ccd63582..7e30c2c9 100644--- a/testdata/firmament/fixtures/m2a-invalid-subtract-from-missing-id.firmament+++ b/testdata/firmament/fixtures/m2a-invalid-subtract-from-missing-id.firmament@@ -11,4 +11,6 @@ ops[1]:id: cut1from: missingwith:- op: cylinder\ No newline at end of file+ op: cylinder+ radius: 1+ height: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmament b/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmamentindex 57d92c0c..e6b119f5 100644--- a/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmament+++ b/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmament@@ -18,4 +18,6 @@ ops[2]:id: fusedto: basewith:- op: cylinder\ No newline at end of file+ op: cylinder+ radius: 1+ height: 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m2a-valid-chained-features.firmament b/testdata/firmament/fixtures/m2a-valid-chained-features.firmamentindex 5cd045a2..51b3d837 100644--- a/testdata/firmament/fixtures/m2a-valid-chained-features.firmament+++ b/testdata/firmament/fixtures/m2a-valid-chained-features.firmament@@ -19,15 +19,22 @@ ops[4]:from: basewith:op: cylinder+ radius: 1+ height: 1-op: intersectid: clippedleft: cut1with:op: sphere+ radius: 1-op: addid: mergedto: clippedwith:- op: box\ No newline at end of file+ op: box+ size[3]:+ 1+ 1+ 1\ No newline at end of filediff --git a/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmament b/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmamentindex 63d06d14..e4d3ae4f 100644--- a/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmament+++ b/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmament@@ -19,3 +19,4 @@ ops[2]:to: basewith:op: sphere+ radius: 1diff --git a/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmament b/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmamentindex adf2d82f..390c80c6 100644--- a/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmament+++ b/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmament@@ -20,6 +20,7 @@ ops[5]:to: basewith:op: sphere+ radius: 1-op: cylinder@@ -33,6 +34,10 @@ ops[5]:from: join1with:op: box+ size[3]:+ 1+ 1+ 1-op: expect_existsdiff --git a/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmament b/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmamentindex c8beb0a5..31785c57 100644--- a/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmament+++ b/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmament@@ -20,6 +20,8 @@ ops[6]:to: basewith:op: cylinder+ radius: 1+ height: 1-op: sphere@@ -32,6 +34,7 @@ ops[6]:from: join1with:op: sphere+ radius: 1-op: intersect@@ -39,6 +42,10 @@ ops[6]:left: cut1with:op: box+ size[3]:+ 1+ 1+ 1-op: expect_existsdiff --git a/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament b/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmamentindex 407be4ab..23019373 100644--- a/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament+++ b/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament@@ -20,6 +20,8 @@ ops[5]:to: basewith:op: cylinder+ radius: 1+ height: 1-op: sphere@@ -32,6 +34,10 @@ ops[5]:from: capwith:op: box+ size[3]:+ 1+ 1+ 1-op: expect_existsdiff --git a/testdata/firmament/fixtures/m3d-invalid-with-box-missing-size.firmament b/testdata/firmament/fixtures/m3d-invalid-with-box-missing-size.firmamentnew file mode 100644index 00000000..7a2a100f--- /dev/null+++ b/testdata/firmament/fixtures/m3d-invalid-with-box-missing-size.firmament@@ -0,0 +1,22 @@+firmament:+ version: 1++model:+ name: m3d-invalid-tool-size+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 8+ 8+ 8++ -+ op: add+ id: bad_size+ to: base+ with:+ op: boxdiff --git a/testdata/firmament/fixtures/m3d-invalid-with-unsupported-tool-op.firmament b/testdata/firmament/fixtures/m3d-invalid-with-unsupported-tool-op.firmamentnew file mode 100644index 00000000..e9925c6f--- /dev/null+++ b/testdata/firmament/fixtures/m3d-invalid-with-unsupported-tool-op.firmament@@ -0,0 +1,22 @@+firmament:+ version: 1++model:+ name: m3d-invalid-tool+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 8+ 8+ 8++ -+ op: add+ id: bad_tool+ to: base+ with:+ op: adddiff --git a/testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament b/testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmamentnew file mode 100644index 00000000..db60ab3b--- /dev/null+++ b/testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament@@ -0,0 +1,49 @@+firmament:+ version: 1++model:+ name: m3d-mixed+ units: mm++ops[5]:+ -+ op: box+ id: base+ size[3]:+ 12+ 12+ 12++ -+ op: add+ id: join1+ to: base+ with:+ op: box+ size[3]:+ 1+ 1+ 1++ -+ op: box+ id: cap+ size[3]:+ 6+ 6+ 6++ -+ op: subtract+ id: cut1+ from: cap+ with:+ op: box+ size[3]:+ 1+ 1+ 1++ -+ op: expect_exists+ target: capdiff --git a/testdata/firmament/fixtures/m3d-valid-add-exec.firmament b/testdata/firmament/fixtures/m3d-valid-add-exec.firmamentnew file mode 100644index 00000000..e2715387--- /dev/null+++ b/testdata/firmament/fixtures/m3d-valid-add-exec.firmament@@ -0,0 +1,26 @@+firmament:+ version: 1++model:+ name: m3d-add+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 8+ 8+ 8++ -+ op: add+ id: joined+ to: base+ with:+ op: box+ size[3]:+ 1+ 1+ 1diff --git a/testdata/firmament/fixtures/m3d-valid-boolean-chain-exec.firmament b/testdata/firmament/fixtures/m3d-valid-boolean-chain-exec.firmamentnew file mode 100644index 00000000..a8329caa--- /dev/null+++ b/testdata/firmament/fixtures/m3d-valid-boolean-chain-exec.firmament@@ -0,0 +1,37 @@+firmament:+ version: 1++model:+ name: m3d-chain+ units: mm++ops[3]:+ -+ op: box+ id: base+ size[3]:+ 10+ 10+ 10++ -+ op: subtract+ id: cut1+ from: base+ with:+ op: box+ size[3]:+ 1+ 1+ 1++ -+ op: add+ id: joined+ to: cut1+ with:+ op: box+ size[3]:+ 1+ 1+ 1diff --git a/testdata/firmament/fixtures/m3d-valid-intersect-exec.firmament b/testdata/firmament/fixtures/m3d-valid-intersect-exec.firmamentnew file mode 100644index 00000000..63cc6555--- /dev/null+++ b/testdata/firmament/fixtures/m3d-valid-intersect-exec.firmament@@ -0,0 +1,26 @@+firmament:+ version: 1++model:+ name: m3d-intersect+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 8+ 8+ 8++ -+ op: intersect+ id: clipped+ left: base+ with:+ op: box+ size[3]:+ 1+ 1+ 1diff --git a/testdata/firmament/fixtures/m3d-valid-subtract-exec.firmament b/testdata/firmament/fixtures/m3d-valid-subtract-exec.firmamentnew file mode 100644index 00000000..90f9b20b--- /dev/null+++ b/testdata/firmament/fixtures/m3d-valid-subtract-exec.firmament@@ -0,0 +1,26 @@+firmament:+ version: 1++model:+ name: m3d-subtract+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 8+ 8+ 8++ -+ op: subtract+ id: cut+ from: base+ with:+ op: box+ size[3]:+ 1+ 1+ 1