Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Implement Firmament M0b structural ops list parsing

Yuechen Li0f100aca5adb
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs
index 9988bf8d..15c27fd3 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs
@@ -4,7 +4,7 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class FirmamentCorpusScaffoldTests
{
- private const string ManifestPath = "testdata/firmament/manifests/m0a.corpus.json";
+ private const string ManifestPath = "testdata/firmament/manifests/m0b.corpus.json";
[Fact]
public void Manifest_Exists_And_CanBeLoaded()
@@ -36,15 +36,19 @@ public sealed class FirmamentCorpusScaffoldTests
}
[Fact]
- public void Fixtures_UseCanonicalEmptyOpsSpelling()
+ public void ToonFixtures_UseCanonicalOpsHeaderSpelling()
{
var manifest = FirmamentCorpusHarness.LoadManifest(ManifestPath);
foreach (var entry in manifest.Entries)
{
var fixtureText = FirmamentCorpusHarness.ReadFixtureText(entry.FixturePath);
+ if (fixtureText.TrimStart().StartsWith("{", StringComparison.Ordinal))
+ {
+ continue;
+ }
- Assert.Contains("ops[0]:", fixtureText, StringComparison.Ordinal);
+ Assert.Contains("ops[", fixtureText, StringComparison.Ordinal);
Assert.DoesNotContain("ops: []", fixtureText, StringComparison.Ordinal);
Assert.DoesNotContain("\nops:\n", fixtureText, StringComparison.Ordinal);
}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
index d227b5e9..fef35feb 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
@@ -33,11 +33,115 @@ public sealed class FirmamentScaffoldTests
Assert.True(result.Compilation.IsSuccess);
var artifact = result.Compilation.Value;
- Assert.Equal("firmament-top-level-skeleton-parsed", artifact.ArtifactKind);
+ Assert.Equal("firmament-ops-structure-parsed", artifact.ArtifactKind);
Assert.NotNull(artifact.ParsedDocument);
Assert.Equal("1", artifact.ParsedDocument!.Firmament.Version);
Assert.Equal("demo", artifact.ParsedDocument.Model.Name);
Assert.Equal("mm", artifact.ParsedDocument.Model.Units);
+ Assert.Empty(artifact.ParsedDocument.Ops.Entries);
+ }
+
+ [Fact]
+ public void Compiler_Accepts_StructurallyValidSingleOp() =>
+ AssertValidOpsCount(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "box" }
+ ]
+ }
+ """,
+ 1);
+
+ [Fact]
+ public void Compiler_Accepts_StructurallyValidMultipleOps() =>
+ AssertValidOpsCount(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "box" },
+ { "op": "subtract", "target": "a" }
+ ]
+ }
+ """,
+ 2);
+
+ [Fact]
+ public void Compiler_Rejects_OpEntry_MissingOp() =>
+ AssertSingleValidationError(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "target": "a" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.StructureMissingRequiredOpField,
+ "Operation entry at index 0 is missing required field 'op'.");
+
+ [Fact]
+ public void Compiler_Rejects_OpEntry_WrongShape() =>
+ AssertSingleValidationError(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ "not-an-object"
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.StructureInvalidOpsEntryShape,
+ "Operation entry at index 0 must be an object with fields.");
+
+ [Fact]
+ public void Compiler_Rejects_OpValue_InvalidShape() =>
+ AssertSingleValidationError(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.StructureInvalidOpFieldValue,
+ "Operation entry at index 0 has invalid 'op' value; expected a non-empty scalar.");
+
+ [Fact]
+ public void Compiler_Rejects_OpEntry_MissingOp_Deterministically()
+ {
+ var compiler = new FirmamentCompiler();
+ var source = """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "target": "a" }
+ ]
+ }
+ """;
+
+ var first = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+ var second = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+
+ Assert.False(first.Compilation.IsSuccess);
+ Assert.False(second.Compilation.IsSuccess);
+
+ var firstDiagnostic = Assert.Single(first.Compilation.Diagnostics);
+ var secondDiagnostic = Assert.Single(second.Compilation.Diagnostics);
+
+ Assert.Equal(firstDiagnostic.Code, secondDiagnostic.Code);
+ Assert.Equal(firstDiagnostic.Severity, secondDiagnostic.Severity);
+ Assert.Equal(firstDiagnostic.Message, secondDiagnostic.Message);
+ Assert.Equal(firstDiagnostic.Source, secondDiagnostic.Source);
}
[Fact]
@@ -154,6 +258,9 @@ public sealed class FirmamentScaffoldTests
Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureUnknownTopLevelSection.Value);
Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureMissingRequiredField.Value);
Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureInvalidSectionShape.Value);
+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureInvalidOpsEntryShape.Value);
+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureMissingRequiredOpField.Value);
+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructureInvalidOpFieldValue.Value);
Assert.StartsWith("FIRM-REF", FirmamentDiagnosticCodes.ReferencePlaceholder.Value);
Assert.StartsWith("FIRM-SEL", FirmamentDiagnosticCodes.SelectorPlaceholder.Value);
Assert.StartsWith("FIRM-SCHEMA", FirmamentDiagnosticCodes.SchemaPlaceholder.Value);
@@ -173,6 +280,15 @@ public sealed class FirmamentScaffoldTests
Assert.Equal(5, span.End.Column);
}
+ private static void AssertValidOpsCount(string source, int expectedOps)
+ {
+ var compiler = new FirmamentCompiler();
+ var result = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+
+ Assert.True(result.Compilation.IsSuccess);
+ Assert.Equal(expectedOps, result.Compilation.Value.ParsedDocument!.Ops.Entries.Count);
+ }
+
private static void AssertSingleValidationError(string source, FirmamentDiagnosticCode expectedFirmamentCode, string expectedMessageTail)
{
var compiler = new FirmamentCompiler();
diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
index 334a3a9d..c13a4861 100644
--- a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
@@ -8,6 +8,9 @@ public static class FirmamentDiagnosticCodes
public static readonly FirmamentDiagnosticCode StructureUnknownTopLevelSection = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0002");
public static readonly FirmamentDiagnosticCode StructureMissingRequiredField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0003");
public static readonly FirmamentDiagnosticCode StructureInvalidSectionShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0004");
+ public static readonly FirmamentDiagnosticCode StructureInvalidOpsEntryShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0005");
+ public static readonly FirmamentDiagnosticCode StructureMissingRequiredOpField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0006");
+ public static readonly FirmamentDiagnosticCode StructureInvalidOpFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0007");
public static readonly FirmamentDiagnosticCode ReferencePlaceholder = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0001");
public static readonly FirmamentDiagnosticCode SelectorPlaceholder = new($"{FirmamentDiagnosticConventions.SelectorPrefix}-0001");
diff --git a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs
index c89ab3c1..3f65b44d 100644
--- a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs
@@ -3,5 +3,5 @@ using Aetheris.Kernel.Firmament.ParsedModel;
namespace Aetheris.Kernel.Firmament;
public sealed record FirmamentCompilationArtifact(
- string ArtifactKind = "firmament-top-level-skeleton-parsed",
+ string ArtifactKind = "firmament-ops-structure-parsed",
FirmamentParsedDocument? ParsedDocument = null);
diff --git a/Aetheris.Kernel.Firmament/ParsedModel/FirmamentParsedDocument.cs b/Aetheris.Kernel.Firmament/ParsedModel/FirmamentParsedDocument.cs
index 5e4cc93e..f93caa3d 100644
--- a/Aetheris.Kernel.Firmament/ParsedModel/FirmamentParsedDocument.cs
+++ b/Aetheris.Kernel.Firmament/ParsedModel/FirmamentParsedDocument.cs
@@ -11,4 +11,8 @@ public sealed record FirmamentParsedHeader(string Version);
public sealed record FirmamentParsedModelHeader(string Name, string Units);
-public sealed record FirmamentParsedOpsSection(string Shape);
+public sealed record FirmamentParsedOpsSection(IReadOnlyList<FirmamentParsedOpEntry> Entries);
+
+public sealed record FirmamentParsedOpEntry(
+ string OpName,
+ IReadOnlyDictionary<string, string> RawFields);
diff --git a/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs b/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs
index 17b47c4a..c211bf78 100644
--- a/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs
+++ b/Aetheris.Kernel.Firmament/Parsing/FirmamentTopLevelParser.cs
@@ -117,11 +117,17 @@ internal static class FirmamentTopLevelParser
return MissingField("model", "units");
}
+ var parsedOpsResult = ParseJsonOpsEntries(opsSection);
+ if (!parsedOpsResult.IsSuccess)
+ {
+ return KernelResult<FirmamentParsedDocument>.Failure(parsedOpsResult.Diagnostics);
+ }
+
return KernelResult<FirmamentParsedDocument>.Success(
new FirmamentParsedDocument(
new FirmamentParsedHeader(versionElement.ToString()),
new FirmamentParsedModelHeader(nameElement.ToString(), unitsElement.ToString()),
- new FirmamentParsedOpsSection("array"),
+ new FirmamentParsedOpsSection(parsedOpsResult.Value),
HasSchema: root.TryGetProperty("schema", out _),
HasPmi: root.TryGetProperty("pmi", out _)));
}
@@ -189,19 +195,90 @@ internal static class FirmamentTopLevelParser
return MissingField("model", "units");
}
+ var parsedOpsResult = ParseToonOpsEntries(opsSection);
+ if (!parsedOpsResult.IsSuccess)
+ {
+ return KernelResult<FirmamentParsedDocument>.Failure(parsedOpsResult.Diagnostics);
+ }
+
return KernelResult<FirmamentParsedDocument>.Success(
new FirmamentParsedDocument(
new FirmamentParsedHeader(version),
new FirmamentParsedModelHeader(name, units),
- new FirmamentParsedOpsSection("array"),
+ new FirmamentParsedOpsSection(parsedOpsResult.Value),
HasSchema: toon.Sections.ContainsKey("schema"),
HasPmi: toon.Sections.ContainsKey("pmi")));
}
+ private static KernelResult<IReadOnlyList<FirmamentParsedOpEntry>> ParseJsonOpsEntries(JsonElement opsSection)
+ {
+ var entries = new List<FirmamentParsedOpEntry>();
+ var index = 0;
+ foreach (var opElement in opsSection.EnumerateArray())
+ {
+ if (opElement.ValueKind != JsonValueKind.Object)
+ {
+ return InvalidOpsEntryShape(index);
+ }
+
+ if (!opElement.TryGetProperty("op", out var opNameElement))
+ {
+ return MissingOpField(index);
+ }
+
+ if (!IsValidOpScalar(opNameElement))
+ {
+ return InvalidOpFieldValue(index);
+ }
+
+ var opName = opNameElement.ToString();
+
+ var rawFields = new Dictionary<string, string>(StringComparer.Ordinal);
+ foreach (var property in opElement.EnumerateObject())
+ {
+ rawFields[property.Name] = property.Value.ToString();
+ }
+
+ entries.Add(new FirmamentParsedOpEntry(opName, rawFields));
+ index++;
+ }
+
+ return KernelResult<IReadOnlyList<FirmamentParsedOpEntry>>.Success(entries);
+ }
+
+ private static KernelResult<IReadOnlyList<FirmamentParsedOpEntry>> ParseToonOpsEntries(FirmamentToonSection opsSection)
+ {
+ var entries = new List<FirmamentParsedOpEntry>();
+ for (var index = 0; index < opsSection.ArrayEntries.Count; index++)
+ {
+ var opEntry = opsSection.ArrayEntries[index];
+ if (!opEntry.IsObjectLike)
+ {
+ return InvalidOpsEntryShape(index);
+ }
+
+ if (!opEntry.Fields.TryGetValue("op", out var opName))
+ {
+ return MissingOpField(index);
+ }
+
+ if (string.IsNullOrWhiteSpace(opName))
+ {
+ return InvalidOpFieldValue(index);
+ }
+
+ entries.Add(new FirmamentParsedOpEntry(opName, new Dictionary<string, string>(opEntry.Fields, StringComparer.Ordinal)));
+ }
+
+ return KernelResult<IReadOnlyList<FirmamentParsedOpEntry>>.Success(entries);
+ }
+
private static KernelResult<FirmamentToonTopLevel> ParseToonTopLevel(string sourceText)
{
var sections = new Dictionary<string, FirmamentToonSection>(StringComparer.Ordinal);
string? currentObjectSection = null;
+ FirmamentToonObjectEntry? currentArrayObjectEntry = null;
+ FirmamentToonSection? currentArraySection = null;
var lines = sourceText.Replace("\r\n", "\n", StringComparison.Ordinal).Replace("\r", "\n", StringComparison.Ordinal).Split('\n');
for (var index = 0; index < lines.Length; index++)
@@ -216,12 +293,45 @@ internal static class FirmamentTopLevelParser
if (char.IsWhiteSpace(rawLine[0]))
{
+ var field = line.Trim();
+
+ if (currentArraySection is not null)
+ {
+ if (field == "-")
+ {
+ currentObjectSection = null;
+ currentArrayObjectEntry = new FirmamentToonObjectEntry();
+ currentArraySection.ArrayEntries.Add(currentArrayObjectEntry);
+ continue;
+ }
+
+ if (currentArrayObjectEntry is null)
+ {
+ return InvalidToonSyntax();
+ }
+
+ var arraySeparator = field.IndexOf(':');
+ if (arraySeparator <= 0)
+ {
+ return InvalidToonSyntax();
+ }
+
+ var arrayFieldName = field[..arraySeparator].Trim();
+ var arrayFieldValue = field[(arraySeparator + 1)..].Trim();
+ if (arrayFieldName.Length == 0)
+ {
+ return InvalidToonSyntax();
+ }
+
+ currentArrayObjectEntry.Fields[arrayFieldName] = arrayFieldValue;
+ continue;
+ }
+
if (currentObjectSection is null)
{
return InvalidToonSyntax();
}
- var field = line.Trim();
var separator = field.IndexOf(':');
if (separator <= 0)
{
@@ -240,6 +350,8 @@ internal static class FirmamentTopLevelParser
}
currentObjectSection = null;
+ currentArrayObjectEntry = null;
+ currentArraySection = null;
var header = line.Trim();
if (!header.EndsWith(":", StringComparison.Ordinal))
@@ -255,7 +367,9 @@ internal static class FirmamentTopLevelParser
if (TryParseArrayHeader(header, out var arraySectionName))
{
- sections[arraySectionName] = FirmamentToonSection.ArrayLike();
+ var arraySection = FirmamentToonSection.ArrayLike();
+ sections[arraySectionName] = arraySection;
+ currentArraySection = arraySection;
continue;
}
@@ -288,6 +402,18 @@ internal static class FirmamentTopLevelParser
&& int.TryParse(countText, out _);
}
+ private static bool IsValidOpScalar(JsonElement opNameElement)
+ {
+ return opNameElement.ValueKind switch
+ {
+ JsonValueKind.String => !string.IsNullOrWhiteSpace(opNameElement.GetString()),
+ JsonValueKind.Number => true,
+ JsonValueKind.True => true,
+ JsonValueKind.False => true,
+ _ => false
+ };
+ }
+
private static KernelResult<FirmamentToonTopLevel> InvalidToonSyntax() =>
KernelResult<FirmamentToonTopLevel>.Failure(
[
@@ -333,6 +459,33 @@ internal static class FirmamentTopLevelParser
$"Section '{sectionName}' must be a {expectedShape}.")
]);
+ private static KernelResult<IReadOnlyList<FirmamentParsedOpEntry>> InvalidOpsEntryShape(int index) =>
+ KernelResult<IReadOnlyList<FirmamentParsedOpEntry>>.Failure(
+ [
+ CreateDiagnostic(
+ KernelDiagnosticCode.ValidationFailed,
+ FirmamentDiagnosticCodes.StructureInvalidOpsEntryShape,
+ $"Operation entry at index {index} must be an object with fields.")
+ ]);
+
+ private static KernelResult<IReadOnlyList<FirmamentParsedOpEntry>> MissingOpField(int index) =>
+ KernelResult<IReadOnlyList<FirmamentParsedOpEntry>>.Failure(
+ [
+ CreateDiagnostic(
+ KernelDiagnosticCode.ValidationFailed,
+ FirmamentDiagnosticCodes.StructureMissingRequiredOpField,
+ $"Operation entry at index {index} is missing required field 'op'.")
+ ]);
+
+ private static KernelResult<IReadOnlyList<FirmamentParsedOpEntry>> InvalidOpFieldValue(int index) =>
+ KernelResult<IReadOnlyList<FirmamentParsedOpEntry>>.Failure(
+ [
+ CreateDiagnostic(
+ KernelDiagnosticCode.ValidationFailed,
+ FirmamentDiagnosticCodes.StructureInvalidOpFieldValue,
+ $"Operation entry at index {index} has invalid 'op' value; expected a non-empty scalar.")
+ ]);
+
private static KernelDiagnostic CreateDiagnostic(KernelDiagnosticCode kernelCode, FirmamentDiagnosticCode firmamentCode, string message) =>
new(
kernelCode,
@@ -342,10 +495,17 @@ internal static class FirmamentTopLevelParser
private sealed record FirmamentToonTopLevel(IReadOnlyDictionary<string, FirmamentToonSection> Sections);
- private sealed record FirmamentToonSection(bool IsObjectLike, bool IsArrayLike, Dictionary<string, string> Fields)
+ private sealed record FirmamentToonSection(bool IsObjectLike, bool IsArrayLike, Dictionary<string, string> Fields, List<FirmamentToonObjectEntry> ArrayEntries)
+ {
+ public static FirmamentToonSection ObjectLike() => new(true, false, new Dictionary<string, string>(StringComparer.Ordinal), []);
+
+ public static FirmamentToonSection ArrayLike() => new(false, true, new Dictionary<string, string>(StringComparer.Ordinal), []);
+ }
+
+ private sealed class FirmamentToonObjectEntry
{
- public static FirmamentToonSection ObjectLike() => new(true, false, new Dictionary<string, string>(StringComparer.Ordinal));
+ public bool IsObjectLike { get; set; } = true;
- public static FirmamentToonSection ArrayLike() => new(false, true, new Dictionary<string, string>(StringComparer.Ordinal));
+ public Dictionary<string, string> Fields { get; } = new(StringComparer.Ordinal);
}
}
diff --git a/testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament b/testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament
new file mode 100644
index 00000000..0999a682
--- /dev/null
+++ b/testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament
@@ -0,0 +1,5 @@
+{
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": ["not-an-object"]
+}
diff --git a/testdata/firmament/fixtures/m0b-invalid-op-missing-op.firmament b/testdata/firmament/fixtures/m0b-invalid-op-missing-op.firmament
new file mode 100644
index 00000000..cde73dfa
--- /dev/null
+++ b/testdata/firmament/fixtures/m0b-invalid-op-missing-op.firmament
@@ -0,0 +1,10 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ target: partA
diff --git a/testdata/firmament/fixtures/m0b-invalid-op-value-shape.firmament b/testdata/firmament/fixtures/m0b-invalid-op-value-shape.firmament
new file mode 100644
index 00000000..31a1c0c0
--- /dev/null
+++ b/testdata/firmament/fixtures/m0b-invalid-op-value-shape.firmament
@@ -0,0 +1,10 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op:
diff --git a/testdata/firmament/fixtures/m0b-valid-empty-ops.firmament b/testdata/firmament/fixtures/m0b-valid-empty-ops.firmament
new file mode 100644
index 00000000..4f815bc7
--- /dev/null
+++ b/testdata/firmament/fixtures/m0b-valid-empty-ops.firmament
@@ -0,0 +1,8 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[0]:
diff --git a/testdata/firmament/fixtures/m0b-valid-one-op.firmament b/testdata/firmament/fixtures/m0b-valid-one-op.firmament
new file mode 100644
index 00000000..1236f681
--- /dev/null
+++ b/testdata/firmament/fixtures/m0b-valid-one-op.firmament
@@ -0,0 +1,10 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: box
diff --git a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
new file mode 100644
index 00000000..5ddca160
--- /dev/null
+++ b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
@@ -0,0 +1,13 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[2]:
+ -
+ op: box
+ -
+ op: subtract
+ left: a
diff --git a/testdata/firmament/manifests/m0b.corpus.json b/testdata/firmament/manifests/m0b.corpus.json
new file mode 100644
index 00000000..523025d8
--- /dev/null
+++ b/testdata/firmament/manifests/m0b.corpus.json
@@ -0,0 +1,56 @@
+{
+ "version": "1",
+ "entries": [
+ {
+ "id": "m0b-valid-empty-ops",
+ "name": "Valid empty ops section",
+ "fixturePath": "testdata/firmament/fixtures/m0b-valid-empty-ops.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m0b-valid-one-op",
+ "name": "Valid single structurally parsed op",
+ "fixturePath": "testdata/firmament/fixtures/m0b-valid-one-op.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m0b-valid-two-ops",
+ "name": "Valid multiple structurally parsed ops",
+ "fixturePath": "testdata/firmament/fixtures/m0b-valid-two-ops.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m0b-invalid-op-missing-op",
+ "name": "Invalid op entry missing op field",
+ "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-missing-op.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0006"
+ }
+ },
+ {
+ "id": "m0b-invalid-op-entry-wrong-shape",
+ "name": "Invalid op entry wrong coarse shape",
+ "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-entry-wrong-shape.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0005"
+ }
+ },
+ {
+ "id": "m0b-invalid-op-value-shape",
+ "name": "Invalid op value shape",
+ "fixturePath": "testdata/firmament/fixtures/m0b-invalid-op-value-shape.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0007"
+ }
+ }
+ ]
+}