Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Close field consumption in instantiated templates and feature construction

Yuechen Li83c2346a76aa
diff --git a/Aetheris.CLI.Tests/ReleaseAdmissionRegressionTests.cs b/Aetheris.CLI.Tests/ReleaseAdmissionRegressionTests.cs
index e6b617c0..8cb40ec4 100644
--- a/Aetheris.CLI.Tests/ReleaseAdmissionRegressionTests.cs
+++ b/Aetheris.CLI.Tests/ReleaseAdmissionRegressionTests.cs
@@ -23,9 +23,23 @@ public sealed class ReleaseAdmissionRegressionTests
[InlineData("Offset/prism-pad.firmament", "AddOffset<Prism> LocalPad {", "AddOffset<Prism> LocalPad { zzUnknownField: 1mm;")]
[InlineData("Offset/prism-pad.firmament", "Height: 3mm", "Height: 3mm; Axis: +Z; Along: -Z")]
[InlineData("Offset/prism-pad.firmament", "Height: 3mm", "Height: 3mm; Axis: WrongDirection")]
+ [InlineData("Assembly/template-block-pair.firmament", "Struct AssemblyBlock: AssemblyBlockConcept {", "Struct AssemblyBlock: AssemblyBlockConcept { zzUnknownField: 1mm;")]
+ [InlineData("Assembly/template-block-pair.firmament", "EdgeFinish ProofBreak {", "EdgeFinish ProofBreak { zzUnknownField: 1mm;")]
+ [InlineData("Feature/feature-pattern.firmament", "return Hole<Shaft> {", "return Hole<Shaft> { zzUnknownField: 1mm;")]
+ [InlineData("Feature/pickup-functional.firmament", "Profile Section {", "Profile Section { zzUnknownField: 1mm;")]
+ [InlineData("Feature/pickup-functional.firmament", "Axis2 Longitudinal {", "Axis2 Longitudinal { zzUnknownField: 1mm;")]
+ [InlineData("Templates/local-closed-boundaries.firmament", "Struct Plate {", "Struct Plate { zzUnknownField: 1mm;")]
+ [InlineData("Templates/local-closed-boundaries.firmament", "Rect2 Outside {", "Rect2 Outside { zzUnknownField: 1mm;")]
+ [InlineData("Templates/local-closed-boundaries.firmament", "Profile Section {", "Profile Section { zzUnknownField: 1mm;")]
+ [InlineData("Templates/local-closed-boundaries.firmament", "Loop Outer {", "Loop Outer { zzUnknownField: 1mm;")]
+ [InlineData("Templates/local-closed-boundaries.firmament", "Extrude Body {", "Extrude Body { zzUnknownField: 1mm;")]
public void UnconsumedIntentAndWrongDimensionsRejectBothCommands(string fixture, string original, string replacement)
{
var source = File.ReadAllText(Path.Combine(Root(), "fixtures/Canonical", fixture));
+ // The other definition is deliberately unused by the original fixture.
+ // Qualify that its fields reject when that exact recipe is selected.
+ if (fixture == "Templates/local-closed-boundaries.firmament")
+ source = source.Replace("Struct Selected = Disc<R: 20mm>", "Struct Selected = Plate<Width: 40mm>", StringComparison.Ordinal);
Assert.Contains(original, source);
var directory = Directory.CreateTempSubdirectory("aetheris-release-admission-").FullName;
try
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
index d34dc84e..49f7047b 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
@@ -303,6 +303,8 @@ internal static class ConceptIrResolver
var allInstances = instanceList.ToDictionary(i => i.Name, StringComparer.Ordinal);
var boxBody = source[(boxOpen + 1)..boxClose];
var syntaxDeclarations = FirmamentSyntaxTraversal.Declarations(FirmamentSyntaxParser.Parse(source).Document).ToArray();
+ var materializedSyntax = syntaxDeclarations.FirstOrDefault(d => d.Body?.Span.Start == materializedOpen);
+ if (materializedSyntax?.Body is not null) FirmamentV2Parser.BindMechanicalScope(materializedSyntax.Body.Statements, diagnostics);
var boxSyntax = syntaxDeclarations.FirstOrDefault(d => d.Type.Name.Text == "Box" && d.Body?.Span.Start == boxOpen);
if (boxSyntax is null) { diagnostics.Add(FirmamentV2Parser.CanonicalPrimitiveMalformed); return null; }
var boxFields = new FirmamentSyntaxFields(boxSyntax, diagnostics);
@@ -357,7 +359,10 @@ internal static class ConceptIrResolver
var edgeClose = FindMatchingBrace(source, edgeOpen);
if (edgeClose < 0) { diagnostics.Add(FirmamentV2Parser.Phase3EdgeFinishSyntaxInvalid); return null; }
var edgeBody = source[(edgeOpen + 1)..edgeClose];
- var faceSource = FieldValue(edgeBody, "Face");
+ var edgeSyntax = syntaxDeclarations.First(d => d.Type.Name.Text == "EdgeFinish" && d.Body?.Span.Start == edgeOpen);
+ var edgeFields = new FirmamentSyntaxFields(edgeSyntax, diagnostics);
+ string EdgeField(string name) => edgeFields.Take(name) is { } value ? FirmamentSyntaxWriter.Expression(value) : "";
+ var faceSource = EdgeField("Face");
var faceAxis = faceSource;
var faceProvenance = $"{materialized.Groups["name"].Value}.{edge.Groups["name"].Value}.Face";
var faceRef = Regex.Match(faceSource, @"^(?<instance>[A-Za-z_][A-Za-z0-9_]*)\.(?<member>[A-Za-z_][A-Za-z0-9_]*)$", RegexOptions.CultureInvariant);
@@ -366,9 +371,10 @@ internal static class ConceptIrResolver
faceAxis = AxisOf(plane!.Normal);
faceProvenance = plane.Provenance;
}
- var target = FieldValue(edgeBody, "Target");
- var kind = FieldValue(edgeBody, "Kind");
- var distanceSource = FieldValue(edgeBody, "Distance");
+ var target = EdgeField("Target");
+ var kind = EdgeField("Kind");
+ var distanceSource = EdgeField("Distance");
+ edgeFields.Complete();
var distance = ParseLength(distanceSource);
var distanceProvenance = $"{materialized.Groups["name"].Value}.{edge.Groups["name"].Value}.Distance";
var distanceRef = Regex.Match(distanceSource, @"^(?<instance>[A-Za-z_][A-Za-z0-9_]*)\.(?<member>[A-Za-z_][A-Za-z0-9_]*)$", RegexOptions.CultureInvariant);
@@ -464,6 +470,12 @@ internal static class ConceptIrResolver
var open = body.IndexOf('{', header.Index); var close = FindMatchingBrace(body, open);
if (close < 0) { diagnostics.Add(FirmamentV2Parser.RegionUnsupported); continue; }
var holeBody = body[(open + 1)..close];
+ var holeSyntax = FirmamentSyntaxParser.Parse(body.Substring(header.Index, close - header.Index + 1))
+ .Document.Statements.OfType<DeclarationSyntax>().FirstOrDefault();
+ if (holeSyntax is null) { diagnostics.Add(FirmamentV2Parser.CanonicalModifyMalformed); continue; }
+ var holeFields = new FirmamentSyntaxFields(holeSyntax, diagnostics);
+ foreach (var field in ConceptHoleFields) holeFields.Take(field);
+ holeFields.Complete();
var from = FieldValue(holeBody, "from");
var on = FieldValue(holeBody, "on");
if (FieldCount(holeBody, "from") > 1 || FieldCount(holeBody, "on") > 1)
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/LinearFeatureAuthoring.cs b/Aetheris.Kernel.Firmament/FirmamentV2/LinearFeatureAuthoring.cs
index 58a65669..aee114a7 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/LinearFeatureAuthoring.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/LinearFeatureAuthoring.cs
@@ -13,6 +13,7 @@ internal static class LinearFeatureAuthoring
{
var reports = new List<FirmamentV2LinearPatternDecl>();
var axes = new Dictionary<string, FirmamentV2Axis2Decl>(StringComparer.Ordinal);
+ var declarations = FirmamentSyntaxTraversal.Declarations(FirmamentSyntaxParser.Parse(source).Document).ToArray();
foreach (Match axis in Regex.Matches(source, @"\bAxis2\s+(?<name>[A-Za-z_]\w*)\s*\{"))
{
var end = Matching(source, source.IndexOf('{', axis.Index));
@@ -21,9 +22,13 @@ internal static class LinearFeatureAuthoring
if (axis.Index > owner.Index && axis.Index < Matching(source, source.IndexOf('{', owner.Index)))
identity = owner.Groups["name"].Value + "." + axis.Groups["name"].Value;
if (end < 0) { Error("axis-malformed", identity); continue; }
- var fields = source[(source.IndexOf('{', axis.Index) + 1)..end];
- var origin = Regex.Match(fields, @"\bOrigin\s*:\s*\[(?<x>[^,]+),(?<y>[^]]+)\]");
- var vector = Regex.Match(fields, @"\bDirection\s*:\s*\[(?<x>[^,]+),(?<y>[^]]+)\]");
+ var declaration = declarations.FirstOrDefault(d => d.Type.Name.Text == "Axis2" && d.Body?.Span.Start == source.IndexOf('{', axis.Index));
+ if (declaration is null) { Error("axis-malformed", identity); continue; }
+ var fields = new FirmamentSyntaxFields(declaration, diagnostics);
+ string FieldSource(string name) => fields.Take(name) is { } value ? name + ": " + source.Substring(value.Span.Start, value.Span.Length) : "";
+ var origin = Regex.Match(FieldSource("Origin"), @"\bOrigin\s*:\s*\[(?<x>[^,]+),(?<y>[^]]+)\]");
+ var vector = Regex.Match(FieldSource("Direction"), @"\bDirection\s*:\s*\[(?<x>[^,]+),(?<y>[^]]+)\]");
+ fields.Complete();
if (!origin.Success || !vector.Success
|| !FirmamentNumericEvaluation.TryEvaluateScalar(origin.Groups["x"].Value, out var x, out var xu) || xu != "mm"
|| !FirmamentNumericEvaluation.TryEvaluateScalar(origin.Groups["y"].Value, out var y, out var yu) || yu != "mm"
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
index 7c1dcd71..e18cf4cd 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
@@ -218,6 +218,8 @@ public static class ProfileAuthoringParser
// This is the canonical semantic-profile adapter used by Compose and SectionChain.
// Its historical name remains source-compatible; pipeline syntax is erased here too.
source = ProfileModificationTemplateLibrary.ResolveImports(source);
+ foreach (var authored in SourceDeclarations(FirmamentSyntaxParser.Parse(source).Document.Statements).Where(d => d.Type.Name.Text == "Profile"))
+ ValidateProfileBody(authored, diagnostics);
source = ExpandBuiltInPolygons(source, diagnostics);
var templates = FirmamentV2TemplateExpansion.Expand(source, diagnostics);
if (templates is not null) source = templates.Source;
diff --git a/docs/development/reports/2026-10/RELEASE-2.0.0-CLOSEOUT.md b/docs/development/reports/2026-10/RELEASE-2.0.0-CLOSEOUT.md
index 65cd220a..3ae12426 100644
--- a/docs/development/reports/2026-10/RELEASE-2.0.0-CLOSEOUT.md
+++ b/docs/development/reports/2026-10/RELEASE-2.0.0-CLOSEOUT.md
@@ -90,9 +90,31 @@ finally blocks. Accepted probes require classification: authored publications,
named mappings and unused definitions are not automatically correctness defects.
Replay fails if it accidentally matches no specimens.
-The first broad run covered 3,317 declaration bodies. Repairs were followed by
-replay and full regression; the final counts and geometry-parity verdict are
-recorded below only after completion.
+The first broad run covered 3,317 declaration bodies. An expanded run then
+covered 3,752 declaration/object bodies. It caught eleven additional accepted
+cases in instantiated recipes: semantic Struct roots and EdgeFinish, Feature
+return holes, private Profiles and Axis2. Those are closed at ConceptIR,
+profile-binding and linear-pattern ownership, before erasure or geometry work.
+
+A replay of all seventeen accepted non-data cases now leaves six deliberate
+admissions: one named Stations entry and five edits inside the unselected Plate
+recipe in local-closed-boundaries. The Stations witness compiles both variants:
+adding the named entry increases realized part occurrences from four to five,
+with the new stable name retained. Five regression cases select that previously
+unused Plate recipe and confirm each inserted field rejects validate and build.
+These are explicit classifications, not a blanket exemption for Template bodies.
+
+The public-byte build passed 5,988 tests before those final eleven closures.
+The resulting source passes sixty focused CLI/edge-finish cases. A new complete
+solution run and final source qualification remain gates. Both completed
+380-file comparisons so far retained identical exits and byte-identical STEP
+for all 297 successful engineering builds. The remaining 83 files comprise
+library/inspection sources, garment sources needing body input, and non-STEP
+products; they are not relabeled as geometry regressions.
+
+The real product-path rehearsal also generated a production PDF/SVG/PPTX drawing,
+a warehouse GLB and cantilever analysis artifacts. Raw evidence is retained
+alongside the corresponding source and command results.
Qualification is in progress. No Aetheris stable tag has been published by this
pass while the final gates remain open.
diff --git a/test-support/ReleaseAdmissionProbe/Program.cs b/test-support/ReleaseAdmissionProbe/Program.cs
index cfab890e..9818b488 100644
--- a/test-support/ReleaseAdmissionProbe/Program.cs
+++ b/test-support/ReleaseAdmissionProbe/Program.cs
@@ -8,7 +8,7 @@ var output = Path.GetFullPath(args[0]);
Directory.CreateDirectory(output);
if (File.Exists(Path.Combine(output, "probes.jsonl"))) throw new ArgumentException("Use a fresh evidence directory.");
var replay = args.Length == 2 ? JsonDocument.Parse(File.ReadAllText(args[1])).RootElement.EnumerateArray()
- .Where(r => r.GetProperty("accepted").GetBoolean() && r.GetProperty("category").GetString() == "closed-authoring")
+ .Where(r => r.GetProperty("accepted").GetBoolean() && r.GetProperty("category").GetString() != "authored-data")
.Select(r => (Path.GetFullPath(r.GetProperty("source").GetString()!), r.GetProperty("offset").GetInt32())).ToHashSet() : null;
var results = new List<object>();
var files = Directory.GetFiles(Path.Combine(root, "fixtures/Canonical"), "*", SearchOption.AllDirectories)