Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Implement M4a selector-root validation for selector-shaped targets

Yuechen Li406692284df8
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentDocumentCoherenceValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentDocumentCoherenceValidationTests.cs
index 14bb0372..80fb1dd2 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentDocumentCoherenceValidationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentDocumentCoherenceValidationTests.cs
@@ -74,10 +74,10 @@ public sealed class FirmamentDocumentCoherenceValidationTests
3
-
op: expect_exists
- target: future_feature.top_face
+ target: base.top_face
-
op: expect_selectable
- target: ghost_feature.side_a
+ target: base.side_a
count: 1
""";
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
index a36dbaf4..eddb3f37 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
@@ -118,7 +118,7 @@ public sealed class FirmamentPrimitiveExecutionTests
Assert.True(result.Compilation.IsSuccess);
var artifact = result.Compilation.Value;
- Assert.Equal("firmament-primitives-and-booleans-executed", artifact.ArtifactKind);
+ Assert.Equal("firmament-m4a-selector-root-validated-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);
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
index eed88c35..877836f0 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
@@ -37,7 +37,7 @@ public sealed class FirmamentScaffoldTests
Assert.True(result.Compilation.IsSuccess);
var artifact = result.Compilation.Value;
- Assert.Equal("firmament-primitives-and-booleans-executed", artifact.ArtifactKind);
+ Assert.Equal("firmament-m4a-selector-root-validated-primitives-and-booleans-executed", artifact.ArtifactKind);
Assert.NotNull(artifact.ParsedDocument);
Assert.Equal("1", artifact.ParsedDocument!.Firmament.Version);
Assert.Equal("demo", artifact.ParsedDocument.Model.Name);
@@ -230,12 +230,19 @@ public sealed class FirmamentScaffoldTests
name: demo
units: mm
- ops[1]:
+ ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_exists
target: base.top_face
""",
- 1);
+ 2);
[Fact]
public void Compiler_Rejects_OpEntry_MissingOp() =>
@@ -858,11 +865,25 @@ public sealed class FirmamentScaffoldTests
radius: 1
""",
"expect_exists" => """
+ -
+ op: box
+ id: b1
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_exists
target: b1.top_face
""",
"expect_selectable" => """
+ -
+ op: box
+ id: b1
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_selectable
target: b1.top_face
@@ -886,7 +907,7 @@ public sealed class FirmamentScaffoldTests
name: demo
units: mm
- ops[{{((opName is "add" or "subtract" or "intersect") ? 2 : 1)}}]:
+ ops[{{((opName is "add" or "subtract" or "intersect" or "expect_exists" or "expect_selectable") ? 2 : 1)}}]:
{{payload}}
""";
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
index 7836f003..f65013cf 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
@@ -15,7 +15,14 @@ public sealed class FirmamentValidationRequiredFieldValidationTests
name: demo
units: mm
- ops[1]:
+ ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_exists
target: base.top_face
@@ -32,7 +39,12 @@ public sealed class FirmamentValidationRequiredFieldValidationTests
name: demo
units: mm
- ops[1]:
+ ops[2]:
+ -
+ op: cylinder
+ id: hole
+ radius: 1
+ height: 2
-
op: expect_selectable
target: hole.entry_face
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
index 442b3851..12274aa5 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
@@ -7,7 +7,7 @@ public sealed class FirmamentValidationTargetFeatureExistenceTests
[Theory]
[InlineData("testdata/firmament/fixtures/m2c-valid-expect-exists-bare-target-earlier.firmament")]
[InlineData("testdata/firmament/fixtures/m2c-valid-expect-selectable-bare-target-earlier.firmament")]
- [InlineData("testdata/firmament/fixtures/m2c-valid-mixed-bare-and-selector-targets.firmament")]
+ [InlineData("testdata/firmament/fixtures/m4a-valid-mixed-bare-and-selector-targets.firmament")]
public void Compiler_Accepts_BareValidationTargets_WhenFeatureDefinedEarlier(string fixturePath)
{
var result = CompileFixture(fixturePath);
@@ -38,15 +38,39 @@ public sealed class FirmamentValidationTargetFeatureExistenceTests
}
[Theory]
+ [InlineData("testdata/firmament/fixtures/m4a-valid-expect-exists-selector-target-root-earlier.firmament")]
+ [InlineData("testdata/firmament/fixtures/m4a-valid-expect-selectable-selector-target-root-earlier.firmament")]
[InlineData("testdata/firmament/fixtures/m2c-valid-expect-exists-selector-target-unresolved.firmament")]
[InlineData("testdata/firmament/fixtures/m2c-valid-expect-selectable-selector-target-unresolved.firmament")]
- public void Compiler_Leaves_SelectorShapedValidationTargets_Unchecked(string fixturePath)
+ public void Compiler_Accepts_SelectorShapedValidationTargets_WhenRootFeatureDefinedEarlier(string fixturePath)
{
var result = CompileFixture(fixturePath);
Assert.True(result.Compilation.IsSuccess);
}
+ [Theory]
+ [InlineData("testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-nonexistent.firmament", "expect_exists", "ghost")]
+ [InlineData("testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-nonexistent.firmament", "expect_selectable", "ghost")]
+ [InlineData("testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-forward.firmament", "expect_exists", "later")]
+ [InlineData("testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-forward.firmament", "expect_selectable", "later")]
+ public void Compiler_Rejects_SelectorShapedValidationTargets_WhenRootMissingOrForward(string fixturePath, string opName, string rootFeatureId)
+ {
+ var first = CompileFixture(fixturePath);
+ var second = CompileFixture(fixturePath);
+
+ 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.Message, secondDiagnostic.Message);
+ Assert.Equal(
+ $"[{FirmamentDiagnosticCodes.ValidationTargetUnknownSelectorRootFeatureId.Value}] Validation op '{opName}' at index 0 references unknown selector root feature id '{rootFeatureId}' via field 'target'.",
+ firstDiagnostic.Message);
+ }
+
private static FirmamentCompileResult CompileFixture(string fixturePath)
{
var fixtureText = FirmamentCorpusHarness.ReadFixtureText(fixturePath);
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetShapeClassificationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetShapeClassificationTests.cs
index ef1c6083..d317d6eb 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetShapeClassificationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetShapeClassificationTests.cs
@@ -11,6 +11,7 @@ public sealed class FirmamentValidationTargetShapeClassificationTests
[InlineData("expect_selectable", "mount_hole.entry_face", "SelectorShaped")]
public void Compiler_Classifies_ValidationTargets_BySurfaceShape(string opName, string target, string expectedShape)
{
+ var selectorRoot = target.Split('.', 2, StringSplitOptions.None)[0];
var source = string.Equals(expectedShape, "FeatureId", StringComparison.Ordinal)
? $$"""
firmament:
@@ -41,7 +42,14 @@ public sealed class FirmamentValidationTargetShapeClassificationTests
name: demo
units: mm
- ops[1]:
+ ops[2]:
+ -
+ op: box
+ id: {{selectorRoot}}
+ size[3]:
+ 1
+ 1
+ 1
-
op: {{opName}}
target: {{target}}
@@ -93,7 +101,7 @@ public sealed class FirmamentValidationTargetShapeClassificationTests
}
[Fact]
- public void Compiler_DoesNotResolve_ValidationTargets_Semantically()
+ public void Compiler_DoesNotResolve_SelectorPorts_Semantically()
{
const string source = """
firmament:
@@ -103,13 +111,20 @@ public sealed class FirmamentValidationTargetShapeClassificationTests
name: demo
units: mm
- ops[2]:
+ ops[3]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_exists
- target: future_feature.top_face
+ target: base.nonexistent_port_name
-
op: expect_selectable
- target: ghost_feature.edge_a
+ target: base.any_other_port
count: 1
""";
diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
index aa941747..8cb982ee 100644
--- a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
@@ -27,6 +27,7 @@ public static class FirmamentDiagnosticCodes
public static readonly FirmamentDiagnosticCode ReferenceDuplicateFeatureId = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0001");
public static readonly FirmamentDiagnosticCode ReferenceUnknownFeatureId = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0002");
public static readonly FirmamentDiagnosticCode ValidationTargetUnknownFeatureId = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0003");
+ public static readonly FirmamentDiagnosticCode ValidationTargetUnknownSelectorRootFeatureId = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0004");
public static readonly FirmamentDiagnosticCode SelectorPlaceholder = new($"{FirmamentDiagnosticConventions.SelectorPrefix}-0001");
public static readonly FirmamentDiagnosticCode SchemaPlaceholder = new($"{FirmamentDiagnosticConventions.SchemaPrefix}-0001");
public static readonly FirmamentDiagnosticCode LoweringPlaceholder = new($"{FirmamentDiagnosticConventions.LoweringPrefix}-0001");
diff --git a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs
index c1b427bb..d88d6b75 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-and-booleans-executed",
+ string ArtifactKind = "firmament-m4a-selector-root-validated-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.cs
index d110303e..ec8a0d25 100644
--- a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
@@ -71,7 +71,7 @@ public sealed class FirmamentCompiler
return new FirmamentCompileResult(
KernelResult<FirmamentCompilationArtifact>.Success(
new FirmamentCompilationArtifact(
- ArtifactKind: "firmament-primitives-and-booleans-executed",
+ ArtifactKind: "firmament-m4a-selector-root-validated-primitives-and-booleans-executed",
ParsedDocument: targetShapeValidationResult.Value,
PrimitiveLoweringPlan: primitiveLoweringResult.Value,
PrimitiveExecutionResult: primitiveExecutionResult.Value)));
diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentDocumentCoherenceValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentDocumentCoherenceValidator.cs
index 05115eb2..cbbfff8e 100644
--- a/Aetheris.Kernel.Firmament/Validation/FirmamentDocumentCoherenceValidator.cs
+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentDocumentCoherenceValidator.cs
@@ -19,19 +19,10 @@ internal static class FirmamentDocumentCoherenceValidator
if (entry.Family == FirmamentOpFamily.Validation)
{
- var targetShape = entry.ClassifiedFields is not null && entry.ClassifiedFields.TryGetValue("targetShape", out var shape)
- ? shape
- : null;
-
- if (string.Equals(targetShape, FirmamentValidationTargetShape.FeatureId.ToString(), StringComparison.Ordinal)
- && entry.RawFields.TryGetValue("target", out var targetId)
- && !featureIds.Contains(targetId))
+ ValidateValidationTargetReference(entry, index, featureIds, out var diagnostic);
+ if (diagnostic is not null)
{
- return KernelResult<bool>.Failure([
- CreateDiagnostic(
- FirmamentDiagnosticCodes.ValidationTargetUnknownFeatureId,
- $"Validation op '{entry.OpName}' at index {index} references unknown feature id '{targetId}' via field 'target'.")
- ]);
+ return KernelResult<bool>.Failure([diagnostic]);
}
continue;
@@ -65,6 +56,58 @@ internal static class FirmamentDocumentCoherenceValidator
return KernelResult<bool>.Success(true);
}
+ private static void ValidateValidationTargetReference(
+ FirmamentParsedOpEntry entry,
+ int index,
+ HashSet<string> featureIds,
+ out KernelDiagnostic? diagnostic)
+ {
+ diagnostic = null;
+
+ if (entry.KnownKind is not (FirmamentKnownOpKind.ExpectExists or FirmamentKnownOpKind.ExpectSelectable)
+ || !entry.RawFields.TryGetValue("target", out var targetRaw))
+ {
+ return;
+ }
+
+ var targetShape = entry.ClassifiedFields is not null && entry.ClassifiedFields.TryGetValue("targetShape", out var shape)
+ ? shape
+ : null;
+
+ if (string.Equals(targetShape, FirmamentValidationTargetShape.FeatureId.ToString(), StringComparison.Ordinal))
+ {
+ if (!featureIds.Contains(targetRaw))
+ {
+ diagnostic = CreateDiagnostic(
+ FirmamentDiagnosticCodes.ValidationTargetUnknownFeatureId,
+ $"Validation op '{entry.OpName}' at index {index} references unknown feature id '{targetRaw}' via field 'target'.");
+ }
+
+ return;
+ }
+
+ if (!string.Equals(targetShape, FirmamentValidationTargetShape.SelectorShaped.ToString(), StringComparison.Ordinal))
+ {
+ return;
+ }
+
+ var rootFeatureId = ExtractSelectorRoot(targetRaw);
+ if (!featureIds.Contains(rootFeatureId))
+ {
+ diagnostic = CreateDiagnostic(
+ FirmamentDiagnosticCodes.ValidationTargetUnknownSelectorRootFeatureId,
+ $"Validation op '{entry.OpName}' at index {index} references unknown selector root feature id '{rootFeatureId}' via field 'target'.");
+ }
+ }
+
+ private static string ExtractSelectorRoot(string target)
+ {
+ var separatorIndex = target.IndexOf('.', StringComparison.Ordinal);
+ return separatorIndex > 0
+ ? target[..separatorIndex]
+ : target;
+ }
+
private static string GetReferenceFieldName(FirmamentKnownOpKind kind) =>
kind switch
{
diff --git a/testdata/firmament/fixtures/m1c-valid-expect-exists.firmament b/testdata/firmament/fixtures/m1c-valid-expect-exists.firmament
index 97f19112..925fee10 100644
--- a/testdata/firmament/fixtures/m1c-valid-expect-exists.firmament
+++ b/testdata/firmament/fixtures/m1c-valid-expect-exists.firmament
@@ -5,7 +5,14 @@ model:
name: demo
units: mm
-ops[1]:
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_exists
target: base.top_face
diff --git a/testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament b/testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament
index 9d20b4bb..30ee1eed 100644
--- a/testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament
+++ b/testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament
@@ -5,7 +5,12 @@ model:
name: demo
units: mm
-ops[1]:
+ops[2]:
+ -
+ op: cylinder
+ id: hole
+ radius: 1
+ height: 2
-
op: expect_selectable
target: hole.entry_face
diff --git a/testdata/firmament/fixtures/m2b-valid-expect-exists-selector-target.firmament b/testdata/firmament/fixtures/m2b-valid-expect-exists-selector-target.firmament
index 97f19112..925fee10 100644
--- a/testdata/firmament/fixtures/m2b-valid-expect-exists-selector-target.firmament
+++ b/testdata/firmament/fixtures/m2b-valid-expect-exists-selector-target.firmament
@@ -5,7 +5,14 @@ model:
name: demo
units: mm
-ops[1]:
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_exists
target: base.top_face
diff --git a/testdata/firmament/fixtures/m2b-valid-expect-selectable-selector-target.firmament b/testdata/firmament/fixtures/m2b-valid-expect-selectable-selector-target.firmament
index 29d4a5d1..9a037b80 100644
--- a/testdata/firmament/fixtures/m2b-valid-expect-selectable-selector-target.firmament
+++ b/testdata/firmament/fixtures/m2b-valid-expect-selectable-selector-target.firmament
@@ -5,7 +5,11 @@ model:
name: demo
units: mm
-ops[1]:
+ops[2]:
+ -
+ op: sphere
+ id: mount_hole
+ radius: 2
-
op: expect_selectable
target: mount_hole.entry_face
diff --git a/testdata/firmament/fixtures/m2c-valid-expect-exists-selector-target-unresolved.firmament b/testdata/firmament/fixtures/m2c-valid-expect-exists-selector-target-unresolved.firmament
index f4c83eb7..925fee10 100644
--- a/testdata/firmament/fixtures/m2c-valid-expect-exists-selector-target-unresolved.firmament
+++ b/testdata/firmament/fixtures/m2c-valid-expect-exists-selector-target-unresolved.firmament
@@ -5,7 +5,14 @@ model:
name: demo
units: mm
-ops[1]:
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_exists
- target: ghost_feature.top_face
+ target: base.top_face
diff --git a/testdata/firmament/fixtures/m2c-valid-expect-selectable-selector-target-unresolved.firmament b/testdata/firmament/fixtures/m2c-valid-expect-selectable-selector-target-unresolved.firmament
index cace7b56..a5891484 100644
--- a/testdata/firmament/fixtures/m2c-valid-expect-selectable-selector-target-unresolved.firmament
+++ b/testdata/firmament/fixtures/m2c-valid-expect-selectable-selector-target-unresolved.firmament
@@ -5,8 +5,12 @@ model:
name: demo
units: mm
-ops[1]:
+ops[2]:
+ -
+ op: sphere
+ id: mount_hole
+ radius: 2
-
op: expect_selectable
- target: ghost_feature.entry_face
+ target: mount_hole.entry_face
count: 1
diff --git a/testdata/firmament/fixtures/m2c-valid-mixed-bare-and-selector-targets.firmament b/testdata/firmament/fixtures/m2c-valid-mixed-bare-and-selector-targets.firmament
index 10d551bb..bc71d87d 100644
--- a/testdata/firmament/fixtures/m2c-valid-mixed-bare-and-selector-targets.firmament
+++ b/testdata/firmament/fixtures/m2c-valid-mixed-bare-and-selector-targets.firmament
@@ -22,4 +22,4 @@ ops[4]:
count: 1
-
op: expect_exists
- target: future_feature.edge_a
+ target: base.edge_a
diff --git a/testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-forward.firmament b/testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-forward.firmament
new file mode 100644
index 00000000..399a7cee
--- /dev/null
+++ b/testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-forward.firmament
@@ -0,0 +1,18 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[2]:
+ -
+ op: expect_exists
+ target: later.top_face
+ -
+ op: box
+ id: later
+ size[3]:
+ 1
+ 1
+ 1
diff --git a/testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-nonexistent.firmament b/testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-nonexistent.firmament
new file mode 100644
index 00000000..90f7a23d
--- /dev/null
+++ b/testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-nonexistent.firmament
@@ -0,0 +1,11 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_exists
+ target: ghost.top_face
diff --git a/testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-forward.firmament b/testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-forward.firmament
new file mode 100644
index 00000000..5c3e715e
--- /dev/null
+++ b/testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-forward.firmament
@@ -0,0 +1,17 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[2]:
+ -
+ op: expect_selectable
+ target: later.entry_face
+ count: 1
+ -
+ op: cylinder
+ id: later
+ radius: 1
+ height: 2
diff --git a/testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-nonexistent.firmament b/testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-nonexistent.firmament
new file mode 100644
index 00000000..30dad965
--- /dev/null
+++ b/testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-nonexistent.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_selectable
+ target: ghost.entry_face
+ count: 1
diff --git a/testdata/firmament/fixtures/m4a-valid-expect-exists-selector-target-root-earlier.firmament b/testdata/firmament/fixtures/m4a-valid-expect-exists-selector-target-root-earlier.firmament
new file mode 100644
index 00000000..925fee10
--- /dev/null
+++ b/testdata/firmament/fixtures/m4a-valid-expect-exists-selector-target-root-earlier.firmament
@@ -0,0 +1,18 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 1
+ 1
+ 1
+ -
+ op: expect_exists
+ target: base.top_face
diff --git a/testdata/firmament/fixtures/m4a-valid-expect-selectable-selector-target-root-earlier.firmament b/testdata/firmament/fixtures/m4a-valid-expect-selectable-selector-target-root-earlier.firmament
new file mode 100644
index 00000000..837ea1c5
--- /dev/null
+++ b/testdata/firmament/fixtures/m4a-valid-expect-selectable-selector-target-root-earlier.firmament
@@ -0,0 +1,17 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[2]:
+ -
+ op: cylinder
+ id: mount_hole
+ radius: 1
+ height: 2
+ -
+ op: expect_selectable
+ target: mount_hole.entry_face
+ count: 1
diff --git a/testdata/firmament/fixtures/m4a-valid-mixed-bare-and-selector-targets.firmament b/testdata/firmament/fixtures/m4a-valid-mixed-bare-and-selector-targets.firmament
new file mode 100644
index 00000000..2f577103
--- /dev/null
+++ b/testdata/firmament/fixtures/m4a-valid-mixed-bare-and-selector-targets.firmament
@@ -0,0 +1,22 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[4]:
+ -
+ op: sphere
+ id: core
+ radius: 3
+ -
+ op: expect_exists
+ target: core
+ -
+ op: expect_exists
+ target: core.top_face
+ -
+ op: expect_selectable
+ target: core.any_port
+ count: 1
diff --git a/testdata/firmament/manifests/firmament.corpus.json b/testdata/firmament/manifests/firmament.corpus.json
index 11e4d334..68c386c7 100644
--- a/testdata/firmament/manifests/firmament.corpus.json
+++ b/testdata/firmament/manifests/firmament.corpus.json
@@ -748,6 +748,68 @@
"name": "Valid M3c mixed document executes primitives only",
"fixturePath": "testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament",
"expectedOutcome": "success"
+ },
+ {
+ "id": "m4a-valid-expect-exists-selector-target-root-earlier",
+ "name": "Valid M4a expect_exists selector-shaped target root references earlier feature",
+ "fixturePath": "testdata/firmament/fixtures/m4a-valid-expect-exists-selector-target-root-earlier.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m4a-valid-expect-selectable-selector-target-root-earlier",
+ "name": "Valid M4a expect_selectable selector-shaped target root references earlier feature",
+ "fixturePath": "testdata/firmament/fixtures/m4a-valid-expect-selectable-selector-target-root-earlier.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m4a-valid-mixed-bare-and-selector-targets",
+ "name": "Valid M4a mixed bare and selector-shaped targets with earlier roots",
+ "fixturePath": "testdata/firmament/fixtures/m4a-valid-mixed-bare-and-selector-targets.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m4a-invalid-expect-exists-selector-target-root-nonexistent",
+ "name": "Invalid M4a expect_exists selector-shaped target root missing feature",
+ "fixturePath": "testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-nonexistent.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-REF-0004"
+ }
+ },
+ {
+ "id": "m4a-invalid-expect-selectable-selector-target-root-nonexistent",
+ "name": "Invalid M4a expect_selectable selector-shaped target root missing feature",
+ "fixturePath": "testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-nonexistent.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-REF-0004"
+ }
+ },
+ {
+ "id": "m4a-invalid-expect-exists-selector-target-root-forward",
+ "name": "Invalid M4a expect_exists selector-shaped target root forward reference",
+ "fixturePath": "testdata/firmament/fixtures/m4a-invalid-expect-exists-selector-target-root-forward.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-REF-0004"
+ }
+ },
+ {
+ "id": "m4a-invalid-expect-selectable-selector-target-root-forward",
+ "name": "Invalid M4a expect_selectable selector-shaped target root forward reference",
+ "fixturePath": "testdata/firmament/fixtures/m4a-invalid-expect-selectable-selector-target-root-forward.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-REF-0004"
+ }
}
]
}