Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Enforce canonical TOON fixtures for Firmament corpus

Yuechen Lif817f5b161d1
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs
new file mode 100644
index 00000000..0f89c040
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs
@@ -0,0 +1,313 @@
+using Aetheris.Kernel.Firmament.Diagnostics;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class FirmamentBooleanRequiredFieldValidationTests
+{
+ [Fact]
+ public void Compiler_Accepts_ValidAdd() =>
+ AssertValidBooleanOp("""
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "add", "id": "add1", "to": "base", "with": { "op": "box" }, "place": "ignored-for-now" }
+ ]
+ }
+ """);
+
+ [Fact]
+ public void Compiler_Accepts_ValidSubtract() =>
+ AssertValidBooleanOp("""
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "subtract", "id": "sub1", "from": "base", "with": { "op": "cylinder" } }
+ ]
+ }
+ """);
+
+ [Fact]
+ public void Compiler_Accepts_ValidIntersect() =>
+ AssertValidBooleanOp("""
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "intersect", "id": "int1", "left": "base", "with": { "op": "sphere" } }
+ ]
+ }
+ """);
+
+ [Fact]
+ public void Compiler_Rejects_Add_MissingId() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "add", "to": "base", "with": { "op": "box" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'add' at index 0 is missing required field 'id'.");
+
+ [Fact]
+ public void Compiler_Rejects_Add_MissingTo() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "add", "id": "a1", "with": { "op": "box" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'add' at index 0 is missing required field 'to'.");
+
+ [Fact]
+ public void Compiler_Rejects_Add_MissingWith() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "add", "id": "a1", "to": "base" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'add' at index 0 is missing required field 'with'.");
+
+ [Fact]
+ public void Compiler_Rejects_Add_InvalidWithShape() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "add", "id": "a1", "to": "base", "with": "sphere" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,
+ "Boolean op 'add' at index 0 has invalid field 'with'; expected an object-like mapping.");
+
+ [Fact]
+ public void Compiler_Rejects_Add_MissingWithOp() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "add", "id": "a1", "to": "base", "with": { "id": "tool1" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,
+ "Boolean op 'add' at index 0 has invalid field 'with.op'; expected a non-empty scalar/string-like value.");
+
+ [Fact]
+ public void Compiler_Rejects_Subtract_MissingId() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "subtract", "from": "base", "with": { "op": "box" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'subtract' at index 0 is missing required field 'id'.");
+
+ [Fact]
+ public void Compiler_Rejects_Subtract_MissingFrom() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "subtract", "id": "s1", "with": { "op": "box" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'subtract' at index 0 is missing required field 'from'.");
+
+ [Fact]
+ public void Compiler_Rejects_Subtract_MissingWith() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "subtract", "id": "s1", "from": "base" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'subtract' at index 0 is missing required field 'with'.");
+
+ [Fact]
+ public void Compiler_Rejects_Subtract_InvalidWithShape() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "subtract", "id": "s1", "from": "base", "with": ["tool"] }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,
+ "Boolean op 'subtract' at index 0 has invalid field 'with'; expected an object-like mapping.");
+
+ [Fact]
+ public void Compiler_Rejects_Subtract_MissingWithOp() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "subtract", "id": "s1", "from": "base", "with": { "op": "" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,
+ "Boolean op 'subtract' at index 0 has invalid field 'with.op'; expected a non-empty scalar/string-like value.");
+
+ [Fact]
+ public void Compiler_Rejects_Intersect_MissingId() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "intersect", "left": "base", "with": { "op": "box" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'intersect' at index 0 is missing required field 'id'.");
+
+ [Fact]
+ public void Compiler_Rejects_Intersect_MissingLeft() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "intersect", "id": "i1", "with": { "op": "box" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'intersect' at index 0 is missing required field 'left'.");
+
+ [Fact]
+ public void Compiler_Rejects_Intersect_MissingWith() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "intersect", "id": "i1", "left": "base" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanMissingRequiredField,
+ "Boolean op 'intersect' at index 0 is missing required field 'with'.");
+
+ [Fact]
+ public void Compiler_Rejects_Intersect_InvalidWithShape() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "intersect", "id": "i1", "left": "base", "with": 7 }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,
+ "Boolean op 'intersect' at index 0 has invalid field 'with'; expected an object-like mapping.");
+
+ [Fact]
+ public void Compiler_Rejects_Intersect_MissingWithOp() =>
+ AssertBooleanFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "intersect", "id": "i1", "left": "base", "with": { "id": "tool" } }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,
+ "Boolean op 'intersect' at index 0 has invalid field 'with.op'; expected a non-empty scalar/string-like value.");
+
+ [Fact]
+ public void BooleanValidation_Diagnostics_AreDeterministic()
+ {
+ const string source = """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "add", "id": "a1", "to": "base", "with": { "id": "tool" } }
+ ]
+ }
+ """;
+
+ var compiler = new FirmamentCompiler();
+ 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);
+ }
+
+ private static void AssertValidBooleanOp(string source)
+ {
+ var compiler = new FirmamentCompiler();
+ var result = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+ Assert.True(result.Compilation.IsSuccess);
+ }
+
+ private static void AssertBooleanFailure(string source, FirmamentDiagnosticCode expectedCode, string expectedMessageTail)
+ {
+ var compiler = new FirmamentCompiler();
+ var result = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+
+ Assert.False(result.Compilation.IsSuccess);
+ var diagnostic = Assert.Single(result.Compilation.Diagnostics);
+ Assert.Equal($"[{expectedCode.Value}] {expectedMessageTail}", diagnostic.Message);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs
index ca421dd7..e9a41eb4 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs
@@ -35,6 +35,26 @@ public sealed class FirmamentCorpusScaffoldTests
}
}
+
+ [Fact]
+ public void Fixtures_AreCanonicalToonStyle_NotJsonObjectLiterals()
+ {
+ var fixturesRoot = Path.Combine(FirmamentCorpusHarness.RepoRoot(), "testdata", "firmament", "fixtures");
+ var fixtureFiles = Directory.GetFiles(fixturesRoot, "*.firmament", SearchOption.TopDirectoryOnly)
+ .OrderBy(path => path, StringComparer.Ordinal)
+ .ToArray();
+
+ Assert.NotEmpty(fixtureFiles);
+
+ foreach (var fixturePath in fixtureFiles)
+ {
+ var fixtureText = FirmamentCorpusHarness.NormalizeLf(File.ReadAllText(fixturePath));
+ Assert.False(
+ fixtureText.TrimStart().StartsWith("{", StringComparison.Ordinal),
+ $"Fixture '{Path.GetFileName(fixturePath)}' must use canonical TOON-style Firmament syntax, not a JSON object literal.");
+ }
+ }
+
[Fact]
public void ToonFixtures_UseCanonicalOpsHeaderSpelling()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
index 5ea6ca08..378862b6 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
@@ -34,7 +34,7 @@ public sealed class FirmamentScaffoldTests
Assert.True(result.Compilation.IsSuccess);
var artifact = result.Compilation.Value;
- Assert.Equal("firmament-ops-primitive-required-fields-validated", artifact.ArtifactKind);
+ Assert.Equal("firmament-ops-primitive-and-boolean-required-fields-validated", artifact.ArtifactKind);
Assert.NotNull(artifact.ParsedDocument);
Assert.Equal("1", artifact.ParsedDocument!.Firmament.Version);
Assert.Equal("demo", artifact.ParsedDocument.Model.Name);
@@ -65,7 +65,7 @@ public sealed class FirmamentScaffoldTests
"model": { "name": "demo", "units": "mm" },
"ops": [
{ "op": "box", "id": "b1", "size": [2, 3, 4] },
- { "op": "subtract", "target": "a" }
+ { "op": "subtract", "id": "cut1", "from": "a", "with": { "op": "box" } }
]
}
""",
@@ -119,7 +119,7 @@ public sealed class FirmamentScaffoldTests
"model": { "name": "demo", "units": "mm" },
"ops": [
{ "op": "box", "id": "b1", "size": [1, 2, 3] },
- { "op": "subtract" },
+ { "op": "subtract", "id": "s1", "from": "b1", "with": { "op": "sphere" } },
{ "op": "expect_manifold" }
]
}
@@ -144,7 +144,7 @@ public sealed class FirmamentScaffoldTests
"firmament": { "version": "1" },
"model": { "name": "demo", "units": "mm" },
"ops": [
- { "op": "add" }
+ { "op": "add", "id": "add1", "to": "b1", "with": { "op": "sphere" } }
]
}
""",
@@ -582,6 +582,8 @@ public sealed class FirmamentScaffoldTests
Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.PrimitiveMissingRequiredField.Value);
Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.PrimitiveInvalidFieldTypeOrShape.Value);
Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue.Value);
+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.BooleanMissingRequiredField.Value);
+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape.Value);
Assert.StartsWith("FIRM-REF", FirmamentDiagnosticCodes.ReferencePlaceholder.Value);
Assert.StartsWith("FIRM-SEL", FirmamentDiagnosticCodes.SelectorPlaceholder.Value);
Assert.StartsWith("FIRM-SCHEMA", FirmamentDiagnosticCodes.SchemaPlaceholder.Value);
@@ -618,6 +620,9 @@ public sealed class FirmamentScaffoldTests
"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 }",
+ "add" => "{ \"op\": \"add\", \"id\": \"a1\", \"to\": \"b1\", \"with\": { \"op\": \"sphere\" } }",
+ "subtract" => "{ \"op\": \"subtract\", \"id\": \"s1\", \"from\": \"b1\", \"with\": { \"op\": \"sphere\" } }",
+ "intersect" => "{ \"op\": \"intersect\", \"id\": \"i1\", \"left\": \"b1\", \"with\": { \"op\": \"sphere\" } }",
_ => $"{{ \"op\": \"{opName}\" }}"
};
diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
index 4fb10969..257701e6 100644
--- a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
@@ -16,6 +16,8 @@ public static class FirmamentDiagnosticCodes
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 BooleanMissingRequiredField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0012");
+ public static readonly FirmamentDiagnosticCode BooleanInvalidFieldTypeOrShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0013");
public static readonly FirmamentDiagnosticCode ReferencePlaceholder = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0001");
public static readonly FirmamentDiagnosticCode SelectorPlaceholder = new($"{FirmamentDiagnosticConventions.SelectorPrefix}-0001");
diff --git a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
index af7e0cca..b481cd4e 100644
--- a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
@@ -24,10 +24,17 @@ public sealed class FirmamentCompiler
KernelResult<FirmamentCompilationArtifact>.Failure(primitiveValidationResult.Diagnostics));
}
+ var booleanValidationResult = FirmamentBooleanRequiredFieldValidator.Validate(parseResult.Value);
+ if (!booleanValidationResult.IsSuccess)
+ {
+ return new FirmamentCompileResult(
+ KernelResult<FirmamentCompilationArtifact>.Failure(booleanValidationResult.Diagnostics));
+ }
+
return new FirmamentCompileResult(
KernelResult<FirmamentCompilationArtifact>.Success(
new FirmamentCompilationArtifact(
- ArtifactKind: "firmament-ops-primitive-required-fields-validated",
+ ArtifactKind: "firmament-ops-primitive-and-boolean-required-fields-validated",
ParsedDocument: parseResult.Value)));
}
}
diff --git a/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs b/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs
index dda38220..87261de2 100644
--- a/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs
+++ b/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs
@@ -317,6 +317,14 @@ internal static class FirmamentTopLevelParser
continue;
}
+ if (field.StartsWith("- ", StringComparison.Ordinal))
+ {
+ currentObjectSection = null;
+ currentArrayObjectEntry = null;
+ currentArraySection.ArrayEntries.Add(new FirmamentToonObjectEntry { IsObjectLike = false });
+ continue;
+ }
+
if (currentArrayObjectEntry is null)
{
return InvalidToonSyntax();
diff --git a/Aetheris.Kernel.Firmament/README.md b/Aetheris.Kernel.Firmament/README.md
index 71b7b811..766323e8 100644
--- a/Aetheris.Kernel.Firmament/README.md
+++ b/Aetheris.Kernel.Firmament/README.md
@@ -16,3 +16,5 @@ Not implemented yet: parser, semantic validation, selectors, lowering, or STEP b
The top-level lanes (`Connectors`, `ParsedModel`, `Lanes`, `Mapping`, `Diagnostics`) are intentionally separated to guide future implementation work.
Pre-M0 composition seam note: `ImportOrchestrator.CreateDefault(...)` now supports additive registration while keeping STEP/AP242 as the default import composition, so Firmament can later register its own source-family connector/lane without reshaping STEP-specific wiring.
+
+Canonical corpus note: repository `.firmament` fixtures under `testdata/firmament/fixtures/` are maintained only in canonical TOON-style Firmament syntax; JSON-shaped source text is supported by parser compatibility but is not canonical corpus form.
diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs
new file mode 100644
index 00000000..28eceab3
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs
@@ -0,0 +1,206 @@
+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 FirmamentBooleanRequiredFieldValidator
+{
+ 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.Boolean)
+ {
+ continue;
+ }
+
+ var validationResult = entry.KnownKind switch
+ {
+ FirmamentKnownOpKind.Add => ValidateBooleanEntry(entry, index, targetFieldName: "to"),
+ FirmamentKnownOpKind.Subtract => ValidateBooleanEntry(entry, index, targetFieldName: "from"),
+ FirmamentKnownOpKind.Intersect => ValidateBooleanEntry(entry, index, targetFieldName: "left"),
+ _ => KernelResult<bool>.Success(true)
+ };
+
+ if (!validationResult.IsSuccess)
+ {
+ return validationResult;
+ }
+ }
+
+ return KernelResult<bool>.Success(true);
+ }
+
+ private static KernelResult<bool> ValidateBooleanEntry(FirmamentParsedOpEntry entry, int opIndex, string targetFieldName)
+ {
+ if (!TryGetRequiredNonEmptyScalar(entry, "id", opIndex, out var missingOrTypeDiagnostic))
+ {
+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);
+ }
+
+ if (!TryGetRequiredNonEmptyScalar(entry, targetFieldName, opIndex, out missingOrTypeDiagnostic))
+ {
+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);
+ }
+
+ if (!entry.RawFields.TryGetValue("with", out var withRaw) || string.IsNullOrWhiteSpace(withRaw))
+ {
+ return MissingField("with", opIndex, entry.OpName);
+ }
+
+ if (!TryGetWithOpRaw(withRaw, out var withOpRaw, out var isMappingLike))
+ {
+ return InvalidFieldTypeOrShape("with", opIndex, entry.OpName, "expected an object-like mapping");
+ }
+
+ if (!isMappingLike || string.IsNullOrWhiteSpace(withOpRaw) || LooksLikeStructuredValue(withOpRaw))
+ {
+ return InvalidFieldTypeOrShape("with.op", opIndex, entry.OpName, "expected a non-empty scalar/string-like value");
+ }
+
+ 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 = InvalidFieldTypeOrShapeDiagnostic(fieldName, opIndex, entry.OpName, "expected a non-empty scalar/string-like value");
+ return false;
+ }
+
+ return true;
+ }
+
+ private static bool TryGetWithOpRaw(string raw, out string withOpRaw, out bool isMappingLike)
+ {
+ withOpRaw = string.Empty;
+ isMappingLike = false;
+
+ if (TryParseJsonObject(raw, out var objectElement))
+ {
+ isMappingLike = true;
+ if (!objectElement.TryGetProperty("op", out var nestedOpElement))
+ {
+ return true;
+ }
+
+ withOpRaw = nestedOpElement.ToString();
+ return true;
+ }
+
+ if (TryParseToonInlineObject(raw, out var fields))
+ {
+ isMappingLike = true;
+ if (!fields.TryGetValue("op", out withOpRaw))
+ {
+ withOpRaw = string.Empty;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ private static bool TryParseJsonObject(string raw, out JsonElement objectElement)
+ {
+ objectElement = default;
+
+ try
+ {
+ using var document = JsonDocument.Parse(raw);
+ if (document.RootElement.ValueKind != JsonValueKind.Object)
+ {
+ return false;
+ }
+
+ objectElement = document.RootElement.Clone();
+ return true;
+ }
+ catch (JsonException)
+ {
+ return false;
+ }
+ }
+
+ private static bool TryParseToonInlineObject(string raw, out Dictionary<string, string> fields)
+ {
+ fields = new Dictionary<string, string>(StringComparer.Ordinal);
+ var trimmed = raw.Trim();
+ if (!trimmed.StartsWith("{", StringComparison.Ordinal) || !trimmed.EndsWith("}", StringComparison.Ordinal))
+ {
+ return false;
+ }
+
+ var inner = trimmed[1..^1].Trim();
+ if (inner.Length == 0)
+ {
+ return true;
+ }
+
+ var parts = inner.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
+ foreach (var part in parts)
+ {
+ var separator = part.IndexOf(':');
+ if (separator <= 0)
+ {
+ return false;
+ }
+
+ var name = part[..separator].Trim();
+ var value = part[(separator + 1)..].Trim();
+ if (name.Length == 0)
+ {
+ return false;
+ }
+
+ fields[name] = value;
+ }
+
+ return true;
+ }
+
+ private static bool LooksLikeStructuredValue(string raw)
+ {
+ var trimmed = raw.Trim();
+ return trimmed.StartsWith("{", StringComparison.Ordinal) || trimmed.StartsWith("[", StringComparison.Ordinal);
+ }
+
+ 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.BooleanMissingRequiredField,
+ $"Boolean op '{opName}' at index {opIndex} is missing required field '{fieldName}'.");
+
+ private static KernelResult<bool> InvalidFieldTypeOrShape(string fieldName, int opIndex, string opName, string expectation) =>
+ KernelResult<bool>.Failure([InvalidFieldTypeOrShapeDiagnostic(fieldName, opIndex, opName, expectation)]);
+
+ private static KernelDiagnostic InvalidFieldTypeOrShapeDiagnostic(string fieldName, int opIndex, string opName, string expectation) =>
+ CreateDiagnostic(
+ FirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,
+ $"Boolean op '{opName}' at index {opIndex} has invalid field '{fieldName}'; {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-invalid-op-entry-wrong-shape.firmament b/testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament
index 0999a682..bf28d071 100644
--- a/testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament
+++ b/testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament
@@ -1,5 +1,9 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": ["not-an-object"]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ - not-an-object
diff --git a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
index be39a0c2..76cb8ef9 100644
--- a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
+++ b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
@@ -9,7 +9,9 @@ ops[2]:
-
op: box
id: b1
- size: [2, 3, 4]
+ size: [1, 2, 3]
-
op: subtract
- left: a
+ id: cut1
+ from: b1
+ with: { op: cylinder }
diff --git a/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament b/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament
index b27c8fba..07c34965 100644
--- a/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament
+++ b/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament
@@ -8,3 +8,6 @@ model:
ops[1]:
-
op: add
+ id: add1
+ to: base
+ with: { op: sphere }
diff --git a/testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmament b/testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmament
index 5c81a41d..566b51b1 100644
--- a/testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-box-missing-id.firmament
@@ -1,7 +1,11 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "box", "size": [1, 2, 3] }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index 7b77455a..cf1c9ac5 100644
--- a/testdata/firmament/fixtures/m1a-invalid-box-missing-size.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-box-missing-size.firmament
@@ -1,7 +1,11 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "box", "id": "b1" }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index 173b913c..fc68550b 100644
--- a/testdata/firmament/fixtures/m1a-invalid-box-size-non-positive.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-box-size-non-positive.firmament
@@ -1,7 +1,12 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "box", "id": "b1", "size": [1, 0, 3] }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index d142845a..d0578fe4 100644
--- a/testdata/firmament/fixtures/m1a-invalid-box-size-shape.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-box-size-shape.firmament
@@ -1,7 +1,12 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "box", "id": "b1", "size": [1, 2] }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index 4767c9fc..2a7fb7e1 100644
--- a/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-height.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-height.firmament
@@ -1,7 +1,12 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "cylinder", "id": "c1", "radius": 2 }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index f079a7bf..54df58aa 100644
--- a/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-radius.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-cylinder-missing-radius.firmament
@@ -1,7 +1,12 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "cylinder", "id": "c1", "height": 2 }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index 1fd87be5..e29b777f 100644
--- a/testdata/firmament/fixtures/m1a-invalid-cylinder-non-positive-radius.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-cylinder-non-positive-radius.firmament
@@ -1,7 +1,13 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "cylinder", "id": "c1", "radius": -1, "height": 2 }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index ff16b6be..fede266c 100644
--- a/testdata/firmament/fixtures/m1a-invalid-sphere-missing-radius.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-sphere-missing-radius.firmament
@@ -1,7 +1,11 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "sphere", "id": "s1" }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index f75d32bb..39b18e4a 100644
--- a/testdata/firmament/fixtures/m1a-invalid-sphere-non-positive-radius.firmament
+++ b/testdata/firmament/fixtures/m1a-invalid-sphere-non-positive-radius.firmament
@@ -1,7 +1,12 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "sphere", "id": "s1", "radius": 0 }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: sphere
+ id: s1
+ radius: 0
diff --git a/testdata/firmament/fixtures/m1a-valid-cylinder.firmament b/testdata/firmament/fixtures/m1a-valid-cylinder.firmament
index 64866f88..c3926c4c 100644
--- a/testdata/firmament/fixtures/m1a-valid-cylinder.firmament
+++ b/testdata/firmament/fixtures/m1a-valid-cylinder.firmament
@@ -1,7 +1,13 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "cylinder", "id": "c1", "radius": 2.5, "height": 8 }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ 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.firmament
index dba143b7..efa6ab82 100644
--- a/testdata/firmament/fixtures/m1a-valid-sphere.firmament
+++ b/testdata/firmament/fixtures/m1a-valid-sphere.firmament
@@ -1,7 +1,12 @@
-{
- "firmament": { "version": "1" },
- "model": { "name": "demo", "units": "mm" },
- "ops": [
- { "op": "sphere", "id": "s1", "radius": 3 }
- ]
-}
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: sphere
+ id: s1
+ radius: 3
diff --git a/testdata/firmament/fixtures/m1b-invalid-add-invalid-with-shape.firmament b/testdata/firmament/fixtures/m1b-invalid-add-invalid-with-shape.firmament
new file mode 100644
index 00000000..994b968f
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-add-invalid-with-shape.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: add
+ id: a1
+ to: base
+ with: sphere
diff --git a/testdata/firmament/fixtures/m1b-invalid-add-missing-id.firmament b/testdata/firmament/fixtures/m1b-invalid-add-missing-id.firmament
new file mode 100644
index 00000000..73421a36
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-add-missing-id.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: add
+ to: base
+ with: { op: box }
diff --git a/testdata/firmament/fixtures/m1b-invalid-add-missing-to.firmament b/testdata/firmament/fixtures/m1b-invalid-add-missing-to.firmament
new file mode 100644
index 00000000..79b20ab4
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-add-missing-to.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: add
+ id: a1
+ with: { op: box }
diff --git a/testdata/firmament/fixtures/m1b-invalid-add-missing-with-op.firmament b/testdata/firmament/fixtures/m1b-invalid-add-missing-with-op.firmament
new file mode 100644
index 00000000..f6bbb838
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-add-missing-with-op.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: add
+ id: a1
+ to: base
+ with: { id: tool }
diff --git a/testdata/firmament/fixtures/m1b-invalid-add-missing-with.firmament b/testdata/firmament/fixtures/m1b-invalid-add-missing-with.firmament
new file mode 100644
index 00000000..28f65e29
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-add-missing-with.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: add
+ id: a1
+ to: base
diff --git a/testdata/firmament/fixtures/m1b-invalid-intersect-invalid-with-shape.firmament b/testdata/firmament/fixtures/m1b-invalid-intersect-invalid-with-shape.firmament
new file mode 100644
index 00000000..e10bdd93
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-intersect-invalid-with-shape.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: intersect
+ id: i1
+ left: base
+ with: 7
diff --git a/testdata/firmament/fixtures/m1b-invalid-intersect-missing-id.firmament b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-id.firmament
new file mode 100644
index 00000000..98b0c7c8
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-id.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: intersect
+ left: base
+ with: { op: box }
diff --git a/testdata/firmament/fixtures/m1b-invalid-intersect-missing-left.firmament b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-left.firmament
new file mode 100644
index 00000000..6451104c
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-left.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: intersect
+ id: i1
+ with: { op: box }
diff --git a/testdata/firmament/fixtures/m1b-invalid-intersect-missing-with-op.firmament b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-with-op.firmament
new file mode 100644
index 00000000..9c3791e0
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-with-op.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: intersect
+ id: i1
+ left: base
+ with: { id: tool }
diff --git a/testdata/firmament/fixtures/m1b-invalid-intersect-missing-with.firmament b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-with.firmament
new file mode 100644
index 00000000..280b0832
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-intersect-missing-with.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: intersect
+ id: i1
+ left: base
diff --git a/testdata/firmament/fixtures/m1b-invalid-subtract-invalid-with-shape.firmament b/testdata/firmament/fixtures/m1b-invalid-subtract-invalid-with-shape.firmament
new file mode 100644
index 00000000..1118f8a0
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-subtract-invalid-with-shape.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: subtract
+ id: s1
+ from: base
+ with: [tool]
diff --git a/testdata/firmament/fixtures/m1b-invalid-subtract-missing-from.firmament b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-from.firmament
new file mode 100644
index 00000000..540df1d4
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-from.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: subtract
+ id: s1
+ with: { op: box }
diff --git a/testdata/firmament/fixtures/m1b-invalid-subtract-missing-id.firmament b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-id.firmament
new file mode 100644
index 00000000..042a3d71
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-id.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: subtract
+ from: base
+ with: { op: box }
diff --git a/testdata/firmament/fixtures/m1b-invalid-subtract-missing-with-op.firmament b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-with-op.firmament
new file mode 100644
index 00000000..83ffbbc4
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-with-op.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: subtract
+ id: s1
+ from: base
+ with: { id: tool }
diff --git a/testdata/firmament/fixtures/m1b-invalid-subtract-missing-with.firmament b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-with.firmament
new file mode 100644
index 00000000..0570a7e9
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-invalid-subtract-missing-with.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: subtract
+ id: s1
+ from: base
diff --git a/testdata/firmament/fixtures/m1b-valid-add.firmament b/testdata/firmament/fixtures/m1b-valid-add.firmament
new file mode 100644
index 00000000..11849a89
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-valid-add.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: add
+ id: add1
+ to: base
+ with: { op: box }
diff --git a/testdata/firmament/fixtures/m1b-valid-intersect.firmament b/testdata/firmament/fixtures/m1b-valid-intersect.firmament
new file mode 100644
index 00000000..142589d7
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-valid-intersect.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: intersect
+ id: int1
+ left: base
+ with: { op: cylinder }
diff --git a/testdata/firmament/fixtures/m1b-valid-subtract.firmament b/testdata/firmament/fixtures/m1b-valid-subtract.firmament
new file mode 100644
index 00000000..65eaaeb6
--- /dev/null
+++ b/testdata/firmament/fixtures/m1b-valid-subtract.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: subtract
+ id: sub1
+ from: base
+ with: { op: sphere }
diff --git a/testdata/firmament/manifests/m0c.corpus.json b/testdata/firmament/manifests/m0c.corpus.json
index 7272924c..101368eb 100644
--- a/testdata/firmament/manifests/m0c.corpus.json
+++ b/testdata/firmament/manifests/m0c.corpus.json
@@ -185,6 +185,189 @@
"name": "Valid sphere primitive required fields",
"fixturePath": "testdata/firmament/fixtures/m1a-valid-sphere.firmament",
"expectedOutcome": "success"
+ },
+ {
+ "id": "m1b-valid-add",
+ "name": "Valid add boolean required fields",
+ "fixturePath": "testdata/firmament/fixtures/m1b-valid-add.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m1b-valid-subtract",
+ "name": "Valid subtract boolean required fields",
+ "fixturePath": "testdata/firmament/fixtures/m1b-valid-subtract.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m1b-valid-intersect",
+ "name": "Valid intersect boolean required fields",
+ "fixturePath": "testdata/firmament/fixtures/m1b-valid-intersect.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m1b-invalid-add-missing-id",
+ "name": "Invalid add missing id",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-add-missing-id.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-add-missing-to",
+ "name": "Invalid add missing to",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-add-missing-to.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-add-missing-with",
+ "name": "Invalid add missing with",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-add-missing-with.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-add-invalid-with-shape",
+ "name": "Invalid add invalid with shape",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-add-invalid-with-shape.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0013"
+ }
+ },
+ {
+ "id": "m1b-invalid-add-missing-with-op",
+ "name": "Invalid add missing with.op",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-add-missing-with-op.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0013"
+ }
+ },
+ {
+ "id": "m1b-invalid-subtract-missing-id",
+ "name": "Invalid subtract missing id",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-subtract-missing-id.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-subtract-missing-from",
+ "name": "Invalid subtract missing from",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-subtract-missing-from.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-subtract-missing-with",
+ "name": "Invalid subtract missing with",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-subtract-missing-with.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-subtract-invalid-with-shape",
+ "name": "Invalid subtract invalid with shape",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-subtract-invalid-with-shape.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0013"
+ }
+ },
+ {
+ "id": "m1b-invalid-subtract-missing-with-op",
+ "name": "Invalid subtract missing with.op",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-subtract-missing-with-op.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0013"
+ }
+ },
+ {
+ "id": "m1b-invalid-intersect-missing-id",
+ "name": "Invalid intersect missing id",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-intersect-missing-id.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-intersect-missing-left",
+ "name": "Invalid intersect missing left",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-intersect-missing-left.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-intersect-missing-with",
+ "name": "Invalid intersect missing with",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-intersect-missing-with.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0012"
+ }
+ },
+ {
+ "id": "m1b-invalid-intersect-invalid-with-shape",
+ "name": "Invalid intersect invalid with shape",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-intersect-invalid-with-shape.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0013"
+ }
+ },
+ {
+ "id": "m1b-invalid-intersect-missing-with-op",
+ "name": "Invalid intersect missing with.op",
+ "fixturePath": "testdata/firmament/fixtures/m1b-invalid-intersect-missing-with-op.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0013"
+ }
}
]
}