Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Enforce minimal Firmament V2 DFM concepts

Yuechen Li8cbb24d897a6
diff --git a/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs b/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs
index 7f102f90..730af3e4 100644
--- a/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs
+++ b/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs
@@ -198,9 +198,12 @@ public sealed class FirmamentFixtureCorpusTests
Assert.Equal("FirmamentV2Parser", doc.RootElement.GetProperty("frontend").GetProperty("parserName").GetString());
}
else
+ {
+ if (!path.Contains("template-v2-", StringComparison.Ordinal))
{
Assert.False(doc.RootElement.GetProperty("fixture").GetProperty("parserBacked").GetBoolean());
}
+ }
Assert.DoesNotContain("air-x11-firmament-parse-failed", diagnostics);
}
}
@@ -308,7 +311,7 @@ public sealed class FirmamentFixtureCorpusTests
public void FirmamentV2Templates_MetadataRecognized()
{
var fixtures = DiscoverV2Fixtures().Where(p => p.Contains("/Templates/", StringComparison.Ordinal)).ToArray();
- Assert.Equal(5, fixtures.Length);
+ Assert.Equal(7, fixtures.Length);
foreach (var path in fixtures)
{
var fixture = LoadMetadata(path);
@@ -325,7 +328,10 @@ public sealed class FirmamentFixtureCorpusTests
{
using var doc = Trace(path);
var diagnostics = doc.RootElement.GetProperty("diagnostics").EnumerateArray().Select(x => x.GetString()).ToArray();
- Assert.False(doc.RootElement.GetProperty("fixture").GetProperty("parserBacked").GetBoolean());
+ if (!path.Contains("template-v2-", StringComparison.Ordinal))
+ {
+ Assert.False(doc.RootElement.GetProperty("fixture").GetProperty("parserBacked").GetBoolean());
+ }
Assert.True(doc.RootElement.GetProperty("fixture").GetProperty("expectationSatisfied").GetBoolean(), path);
Assert.DoesNotContain("air-x11-firmament-parse-failed", diagnostics);
}
@@ -337,7 +343,9 @@ public sealed class FirmamentFixtureCorpusTests
var expected = new[]
{
(Path: "Templates/invalid/template-concept-unit-mismatch-v2.invalid.firmfixture", Diagnostic: "firmament-concept-unit-mismatch"),
- (Path: "Templates/invalid/template-unknown-process-v2.invalid.firmfixture", Diagnostic: "firmament-template-process-unknown")
+ (Path: "Templates/invalid/template-unknown-process-v2.invalid.firmfixture", Diagnostic: "firmament-template-process-unknown"),
+ (Path: "Templates/invalid/template-v2-cnc-min-tool-radius-enforced.invalid.firmfixture", Diagnostic: "firmament-v2-dfm-minimum-tool-radius-violation"),
+ (Path: "Templates/invalid/template-v2-concept-unit-mismatch-rejected-at-build.invalid.firmfixture", Diagnostic: "firmament-v2-dfm-concept-unit-mismatch")
};
foreach (var item in expected)
diff --git a/Aetheris.CLI.Tests/FirmamentV2SourceCompositionStepPipelineTests.cs b/Aetheris.CLI.Tests/FirmamentV2SourceCompositionStepPipelineTests.cs
index bca83539..580dfc5b 100644
--- a/Aetheris.CLI.Tests/FirmamentV2SourceCompositionStepPipelineTests.cs
+++ b/Aetheris.CLI.Tests/FirmamentV2SourceCompositionStepPipelineTests.cs
@@ -84,6 +84,30 @@ public sealed class FirmamentV2SourceCompositionStepPipelineTests
Assert.Contains("expected-diagnostic: firmament-v2-semantic-hole-overlap", fixtureText, StringComparison.Ordinal);
}
+
+ [Theory]
+ [InlineData("Templates/invalid/template-v2-cnc-min-tool-radius-enforced.invalid.firmfixture", "template-v2-cnc-min-tool-radius-enforced", "firmament-v2-dfm-minimum-tool-radius-violation")]
+ [InlineData("Templates/invalid/template-v2-concept-unit-mismatch-rejected-at-build.invalid.firmfixture", "template-v2-concept-unit-mismatch-rejected-at-build", "firmament-v2-dfm-concept-unit-mismatch")]
+ public void STEP_V2_X6_template_dfm_concept_invalid_fixtures_reject_during_real_build(string fixtureRelativePath, string fixtureId, string expectedDiagnostic)
+ {
+ var fixturePath = Fixture(fixtureRelativePath);
+ var stepPath = TempStep(fixtureId);
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+
+ var exit = Aetheris.CLI.CliRunner.Run(["build", fixturePath, "--out", stepPath, "--json"], stdout, stderr);
+
+ Assert.NotEqual(0, exit);
+ var combined = stdout.ToString() + stderr.ToString();
+ Assert.Contains(expectedDiagnostic, combined, StringComparison.Ordinal);
+ Assert.False(File.Exists(stepPath), fixtureId + " must not emit successful AP242");
+ var fixtureText = File.ReadAllText(fixturePath);
+ Assert.Contains("tier: 5", fixtureText, StringComparison.Ordinal);
+ Assert.Contains("current-stage: deterministic rejection", fixtureText, StringComparison.Ordinal);
+ Assert.Contains("feature-area: dfm/concept-enforcement", fixtureText, StringComparison.Ordinal);
+ Assert.Contains("build-command: aetheris build", fixtureText, StringComparison.Ordinal);
+ }
+
[Theory]
[MemberData(nameof(DerivationCases))]
public void STEP_V2_X3_derivation_fixtures_build_emit_reimport_and_match_box_evidence(string fixtureRelativePath, string fixtureId, double expectedVolume)
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
index cea09b6c..3243c978 100644
--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
@@ -41,6 +41,12 @@ public static class FirmamentBuildAndExport
var v2Parse = FirmamentV2Parser.Parse(sourceText);
if (v2Parse.IsSuccess && v2Parse.Document is not null)
{
+ var dfm = FirmamentV2DfmEnforcement.Validate(v2Parse.Document);
+ if (!dfm.IsSuccess)
+ {
+ return KernelResult<FirmamentStepExportResult>.Failure(dfm.Diagnostics);
+ }
+
if (TryExportV2SemanticHoleBody(v2Parse.Document) is { } semanticHoleExport)
{
return semanticHoleExport;
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
index 59ed49c3..97bd3b8e 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
@@ -1,6 +1,6 @@
namespace Aetheris.Kernel.Firmament.FirmamentV2;
-public sealed record FirmamentV2Document(string ModelName, string Units, IReadOnlyList<FirmamentV2SolidBinding> Solids, IReadOnlyList<FirmamentV2ModifyBlock>? ModifyBlocks = null)
+public sealed record FirmamentV2Document(string ModelName, string Units, IReadOnlyList<FirmamentV2SolidBinding> Solids, IReadOnlyList<FirmamentV2ModifyBlock>? ModifyBlocks = null, IReadOnlyList<FirmamentV2TemplateDecl>? Templates = null)
{
public FirmamentV2SolidBinding Solid => Solids[^1];
public FirmamentV2SideHoleIntent? SideHoleIntent => ModifyBlocks?.SelectMany(m => m.Regions.Select(r =>
@@ -82,6 +82,9 @@ public sealed record FirmamentV2SemanticHoleDecl(
double? CounterboreDepth = null,
double? CountersinkDiameter = null,
double? CountersinkAngleDegrees = null);
+public sealed record FirmamentV2ConceptDecl(string Name, string RawValue, double NumericValue, string? Unit);
+public sealed record FirmamentV2TemplateDecl(string Process, string Name, IReadOnlyList<FirmamentV2ConceptDecl> Concepts);
+
public sealed record FirmamentV2ParseResult(bool IsSuccess, FirmamentV2Document? Document, IReadOnlyList<string> Diagnostics)
{
public static FirmamentV2ParseResult Success(FirmamentV2Document document, IReadOnlyList<string> diagnostics) => new(true, document, diagnostics);
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2DfmEnforcement.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2DfmEnforcement.cs
new file mode 100644
index 00000000..5576879b
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2DfmEnforcement.cs
@@ -0,0 +1,52 @@
+using Aetheris.Kernel.Core.Diagnostics;
+using Aetheris.Kernel.Core.Results;
+
+namespace Aetheris.Kernel.Firmament.FirmamentV2;
+
+internal static class FirmamentV2DfmEnforcement
+{
+ public static KernelResult<object> Validate(FirmamentV2Document document)
+ {
+ ArgumentNullException.ThrowIfNull(document);
+
+ var diagnostics = new List<KernelDiagnostic>();
+ foreach (var template in document.Templates ?? [])
+ {
+ if (!string.Equals(template.Process, "CNC", StringComparison.Ordinal)) continue;
+ foreach (var concept in template.Concepts.Where(c => string.Equals(c.Name, "minimumToolRadius", StringComparison.Ordinal)))
+ {
+ if (!string.Equals(concept.Unit, document.Units, StringComparison.Ordinal))
+ {
+ diagnostics.Add(Error($"{FirmamentV2Parser.DfmConceptUnitMismatch}: template '{template.Name}' concept '{concept.Name}' expects length unit '{document.Units}' but found '{concept.Unit ?? "<unitless>"}' in '{concept.RawValue}'."));
+ continue;
+ }
+
+ foreach (var (featureName, radius) in EnumerateHoleRadii(document))
+ {
+ if (radius < concept.NumericValue)
+ {
+ diagnostics.Add(Error($"{FirmamentV2Parser.DfmMinimumToolRadiusViolation}: template '{template.Name}' concept '{concept.Name}' requires minimum tool radius {concept.NumericValue:0.###}{document.Units}; feature '{featureName}' has radius {radius:0.###}{document.Units}."));
+ }
+ }
+ }
+ }
+
+ return diagnostics.Count == 0
+ ? KernelResult<object>.Success(new object())
+ : KernelResult<object>.Failure(diagnostics);
+ }
+
+ private static IEnumerable<(string FeatureName, double Radius)> EnumerateHoleRadii(FirmamentV2Document document)
+ {
+ foreach (var modify in document.ModifyBlocks ?? [])
+ foreach (var hole in modify.SemanticHoles)
+ {
+ yield return ($"{modify.TargetSolid}.{hole.Name}.shaft", hole.ShaftDiameter / 2d);
+ if (hole.CounterboreDiameter is { } cb) yield return ($"{modify.TargetSolid}.{hole.Name}.counterbore", cb / 2d);
+ if (hole.CountersinkDiameter is { } cs) yield return ($"{modify.TargetSolid}.{hole.Name}.countersink", cs / 2d);
+ }
+ }
+
+ private static KernelDiagnostic Error(string message) =>
+ new(KernelDiagnosticCode.ValidationFailed, KernelDiagnosticSeverity.Error, message, "FirmamentV2.DfmEnforcement");
+}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
index 63a4fbb7..b19448a7 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
@@ -34,6 +34,8 @@ public static class FirmamentV2Parser
public const string SelectorSubselectorUnsupported = "firmament-v2-selector-subselector-unsupported";
public const string FatArrowOutsideExpose = "firmament-v2-fat-arrow-outside-expose";
public const string RawBackendIdReferenceForbidden = "firmament-raw-backend-id-reference-forbidden";
+ public const string DfmConceptUnitMismatch = "firmament-v2-dfm-concept-unit-mismatch";
+ public const string DfmMinimumToolRadiusViolation = "firmament-v2-dfm-minimum-tool-radius-violation";
public const string ModifyTargetUnresolved = "firmament-v2-modify-target-unresolved";
public const string ModifyTargetNotSolid = "firmament-v2-modify-target-not-solid";
@@ -85,6 +87,8 @@ public static class FirmamentV2Parser
private static readonly Regex ThroughRegex = new(@"\bthrough\s*:\s*(?<target>face\([^)]*\)|[A-Za-z_][A-Za-z0-9_]*)", RegexOptions.CultureInvariant);
private static readonly Regex CenterRegex = new(@"\bcenter\s*:\s*\[(?<values>[^\]]*)\]", RegexOptions.CultureInvariant | RegexOptions.Singleline);
private static readonly Regex SemanticHoleHeaderRegex = new(@"\bhole\s*<\s*(?<variant>[A-Za-z_][A-Za-z0-9_]*)\s*>\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);
+ private static readonly Regex TemplateHeaderRegex = new(@"\btemplate\s*<\s*(?<process>[A-Za-z_][A-Za-z0-9_]*)\s*>\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);
+ private static readonly Regex ConceptRegex = new(@"\bconcept\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*:\s*(?<value>[-+0-9.eE]+)\s*(?<unit>[A-Za-z_][A-Za-z0-9_]*)?", RegexOptions.CultureInvariant);
public static FirmamentV2ParseResult Parse(string sourceText)
{
@@ -130,10 +134,11 @@ public static class FirmamentV2Parser
}
var modifyBlocks = ParseModifyBlocks(source, byName, diagnostics);
+ var templates = ParseTemplates(source, diagnostics);
FirmamentV2Document? document = null;
if (modelMatch.Success && unitsMatch.Success && solids.Count > 0 && !diagnostics.Any(IsFatalDiagnostic))
- document = new FirmamentV2Document(modelMatch.Groups["name"].Value, unitsMatch.Groups["units"].Value, solids, modifyBlocks);
+ document = new FirmamentV2Document(modelMatch.Groups["name"].Value, unitsMatch.Groups["units"].Value, solids, modifyBlocks, templates);
diagnostics.Add(document is null ? "firmament-v2-parse-failed" : "firmament-v2-parse-succeeded");
diagnostics.Sort(StringComparer.Ordinal);
@@ -315,7 +320,7 @@ public static class FirmamentV2Parser
if (attach is null || cut is null) return null;
var centerU = cut.Tool.Center?.U ?? 0;
var centerV = cut.Tool.Center?.V ?? 0;
- var route = FirmamentV2SideHoleRoutePolicy.Resolve(attach.Axis, cut.Tool.Through.Axis, solid.Box.Size, cut.Tool.Radius, centerU, centerV);
+ var route = FirmamentV2SideHoleRoutePolicy.Resolve(attach.Axis, cut.Tool.Through.Axis, solid.Box!.Size, cut.Tool.Radius, centerU, centerV);
if (!route.IsSupported)
{
diagnostics.Add(route.Diagnostic!);
@@ -438,7 +443,7 @@ public static class FirmamentV2Parser
return selector is null ? null : FirmamentV2FaceTarget.Direct(selector.Axis);
}
- var exposure = solid.Box.Exposures.FirstOrDefault(e => string.Equals(e.Alias, source, StringComparison.Ordinal));
+ var exposure = solid.Box!.Exposures.FirstOrDefault(e => string.Equals(e.Alias, source, StringComparison.Ordinal));
if (exposure is null) { diagnostics.Add(AliasUnresolved); return null; }
if (!string.Equals(exposure.RefType, "FaceRef", StringComparison.Ordinal))
{
@@ -448,9 +453,30 @@ public static class FirmamentV2Parser
}
return FirmamentV2FaceTarget.Alias(source, exposure.Axis);
}
+ private static IReadOnlyList<FirmamentV2TemplateDecl> ParseTemplates(string source, List<string> diagnostics)
+ {
+ var templates = new List<FirmamentV2TemplateDecl>();
+ foreach (Match tm in TemplateHeaderRegex.Matches(source))
+ {
+ var open = source.IndexOf('{', tm.Index);
+ var close = FindMatchingBrace(source, open);
+ if (close < 0) { diagnostics.Add(UnsupportedConstruct); continue; }
+ var body = source[(open + 1)..close];
+ var concepts = new List<FirmamentV2ConceptDecl>();
+ foreach (Match cm in ConceptRegex.Matches(body))
+ {
+ if (double.TryParse(cm.Groups["value"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var value) && double.IsFinite(value))
+ {
+ concepts.Add(new FirmamentV2ConceptDecl(cm.Groups["name"].Value, cm.Value.Trim(), value, cm.Groups["unit"].Success ? cm.Groups["unit"].Value : null));
+ }
+ }
+ templates.Add(new FirmamentV2TemplateDecl(tm.Groups["process"].Value, tm.Groups["name"].Value, concepts));
+ }
+ return templates;
+ }
private static bool ContainsUnsupportedConstruct(string source) =>
- Regex.IsMatch(source, @"\b(concept|PMI|where|template|add|shell|fillet|chamfer|regions|profile|material|pattern)\b|<\s*Process\s*>", RegexOptions.CultureInvariant);
+ Regex.IsMatch(source, @"\b(PMI|where|add|shell|fillet|chamfer|regions|profile|material|pattern)\b|<\s*Process\s*>", RegexOptions.CultureInvariant);
private static bool ContainsRawBackendId(string source) =>
Regex.IsMatch(source, @"\b(brep|step|backend|coedge)\s*\.|STEP\s*#|#[0-9]+", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
diff --git a/docs/implementation/step-v2-x6-dfm-concept-enforcement.md b/docs/implementation/step-v2-x6-dfm-concept-enforcement.md
new file mode 100644
index 00000000..267820d5
--- /dev/null
+++ b/docs/implementation/step-v2-x6-dfm-concept-enforcement.md
@@ -0,0 +1,87 @@
+# STEP-V2-X6 — minimal DFM/concept build enforcement
+
+STEP-V2-X6 promotes a narrow Tier 5 slice of Firmament V2 template/concept metadata from parse/storage evidence to real build-time rejection. This is not a general DFM framework and does not execute Forge packages or plugins.
+
+## Fixtures
+
+Added build-verified invalid fixtures:
+
+- `fixtures/FirmamentV2/Templates/invalid/template-v2-cnc-min-tool-radius-enforced.invalid.firmfixture`
+- `fixtures/FirmamentV2/Templates/invalid/template-v2-concept-unit-mismatch-rejected-at-build.invalid.firmfixture`
+
+Both fixtures use the real `aetheris build` path and are classified as Tier 5 deterministic rejections.
+
+## Supported enforcement scope
+
+The only enforced process/template shape in this milestone is:
+
+- `template<CNC> <Name> { concept minimumToolRadius: <number> <unit> }`
+
+The only feature family checked by the rule is the already-supported Firmament V2 semantic hole family inside `modify` blocks:
+
+- `hole<shaft>` shaft radius;
+- `hole<counterbore>` shaft and counterbore radii;
+- `hole<countersink>` shaft and countersink entry radii.
+
+The source document must still use the existing model-level `units mm` path. The minimum tool radius concept must use the same length unit as the model (`mm` today). A concept unit such as `deg` is parsed as template metadata, then rejected by build enforcement.
+
+## Diagnostics
+
+Stable diagnostics introduced for the enforced MVP slice:
+
+- `firmament-v2-dfm-minimum-tool-radius-violation`
+- `firmament-v2-dfm-concept-unit-mismatch`
+
+The diagnostic messages include the template name, concept name, expected/actual unit or minimum value, and the offending semantic hole radius when applicable.
+
+## Real command path
+
+The rejection path is:
+
+```text
+Firmament V2 fixture
+ -> FirmamentV2Parser.Parse
+ -> FirmamentV2DfmEnforcement.Validate
+ -> FirmamentBuildAndExport.ExportSource
+ -> CLI build failure before STEP/AP242 write
+```
+
+Direct CLI probes:
+
+```bash
+dotnet run --project Aetheris.CLI -- build fixtures/FirmamentV2/Templates/invalid/template-v2-cnc-min-tool-radius-enforced.invalid.firmfixture --out "$tmp/template-v2-cnc-min-tool-radius.step" --json
+```
+
+```bash
+dotnet run --project Aetheris.CLI -- build fixtures/FirmamentV2/Templates/invalid/template-v2-concept-unit-mismatch-rejected-at-build.invalid.firmfixture --out "$tmp/template-v2-concept-unit-mismatch.step" --json
+```
+
+Both commands are expected to return a failing build result and must not leave a successful AP242 output file.
+
+## What remains metadata-only
+
+All other template/process/concept shapes remain metadata-only or fixture-doctrine examples, including non-CNC processes, `minimumWallThickness`, `minimumHoleDiameter`, cost/process selection, materials, standards tables, and PMI lowering.
+
+## Relationship to the MVP contract
+
+This closes the Tier 5 MVP contract items:
+
+- `template-v2-cnc-min-tool-radius-enforced`
+- `template-v2-concept-unit-mismatch-rejected-at-build`
+
+The implementation deliberately proves only that parsed Firmament V2 DFM/concept metadata can block the real build path with deterministic diagnostics.
+
+## Relationship to FORGE-X1/X2
+
+FORGE-X1/X2 provide descriptor scaffolding and the Aetheris.Standard concept pack direction. STEP-V2-X6 does not load descriptors dynamically, execute Forge plugins, or read external package standards. The current enforcement is built into the Firmament V2 build path as an MVP bridge until a fuller Forge runtime exists.
+
+## Deferred capabilities
+
+Deferred on purpose:
+
+- dynamic Forge package loading;
+- plugin execution;
+- standards/fit/thread/tap tables;
+- broad CNC manufacturability analysis;
+- process strategy scoring or cost modeling;
+- new primitive, hole, pattern, PMI, STEP, DisplayIR, frontend, or product behavior.
diff --git a/docs/mvp/firmament-v2-ap242-mvp-readiness-contract.md b/docs/mvp/firmament-v2-ap242-mvp-readiness-contract.md
index 6241281b..4fefc320 100644
--- a/docs/mvp/firmament-v2-ap242-mvp-readiness-contract.md
+++ b/docs/mvp/firmament-v2-ap242-mvp-readiness-contract.md
@@ -234,3 +234,4 @@ If it does not emit valid AP242 through the real exporter, it is not MVP-ready.
## Implementation notes
* STEP-V2-X2 semantic hole AP242 fixture hardening is documented in `docs/implementation/step-v2-x2-semantic-holes-ap242.md`.
+* STEP-V2-X6 minimal Tier 5 DFM/concept build enforcement is documented in `docs/implementation/step-v2-x6-dfm-concept-enforcement.md`.
diff --git a/fixtures/FirmamentV2/Templates/invalid/template-v2-cnc-min-tool-radius-enforced.invalid.firmfixture b/fixtures/FirmamentV2/Templates/invalid/template-v2-cnc-min-tool-radius-enforced.invalid.firmfixture
new file mode 100644
index 00000000..185db0f6
--- /dev/null
+++ b/fixtures/FirmamentV2/Templates/invalid/template-v2-cnc-min-tool-radius-enforced.invalid.firmfixture
@@ -0,0 +1,30 @@
+// fixture-id: template-v2-cnc-min-tool-radius-enforced
+// case: template-v2-cnc-min-tool-radius-enforced
+// category: Templates
+// syntax-version: FirmamentV2
+// validity: invalid
+// implementation: parser-backed
+// expected: invalid
+// expected-stage: deterministic rejection
+// current-stage: deterministic rejection
+// expected-diagnostic: firmament-v2-dfm-minimum-tool-radius-violation
+// tier: 5
+// mvp-required: true
+// feature-area: dfm/concept-enforcement
+// build-command: aetheris build
+// notes: STEP-V2-X6 build-verified invalid fixture; CNC minimumToolRadius is enforced against a parsed semantic shaft hole during the real build path.
+model TemplateV2CncMinToolRadiusEnforced {
+ units mm
+ template<CNC> ShopDefault {
+ concept minimumToolRadius: 1 mm
+ }
+ solid base: Box { size: [10, 8, 6] }
+ modify base {
+ hole<shaft> tooSmall {
+ on: face(+Z)
+ center: [0, 0]
+ radius: 0.25
+ end: throughAll
+ }
+ }
+}
diff --git a/fixtures/FirmamentV2/Templates/invalid/template-v2-concept-unit-mismatch-rejected-at-build.invalid.firmfixture b/fixtures/FirmamentV2/Templates/invalid/template-v2-concept-unit-mismatch-rejected-at-build.invalid.firmfixture
new file mode 100644
index 00000000..6cd63cd2
--- /dev/null
+++ b/fixtures/FirmamentV2/Templates/invalid/template-v2-concept-unit-mismatch-rejected-at-build.invalid.firmfixture
@@ -0,0 +1,30 @@
+// fixture-id: template-v2-concept-unit-mismatch-rejected-at-build
+// case: template-v2-concept-unit-mismatch-rejected-at-build
+// category: Templates
+// syntax-version: FirmamentV2
+// validity: invalid
+// implementation: parser-backed
+// expected: invalid
+// expected-stage: deterministic rejection
+// current-stage: deterministic rejection
+// expected-diagnostic: firmament-v2-dfm-concept-unit-mismatch
+// tier: 5
+// mvp-required: true
+// feature-area: dfm/concept-enforcement
+// build-command: aetheris build
+// notes: STEP-V2-X6 build-verified invalid fixture; metadata parses, then build enforcement rejects minimumToolRadius because it is declared in angular units.
+model TemplateV2ConceptUnitMismatchRejectedAtBuild {
+ units mm
+ template<CNC> BadShop {
+ concept minimumToolRadius: 2 deg
+ }
+ solid base: Box { size: [10, 8, 6] }
+ modify base {
+ hole<shaft> buildUse {
+ on: face(+Z)
+ center: [0, 0]
+ radius: 2.5
+ end: throughAll
+ }
+ }
+}