Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Reject Modify features on a plain Extrude; declare Profile constructs in the schema
Clauded9ef628624bf
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.csindex c0e5e9c6..795da549 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.cs@@ -11,10 +11,10 @@ public sealed class FirmamentSemanticSchemaTestsstring[] expectedNames =["Appearance", "FrameTransform", "Placement", "Pmi", "Note", "Provenance",- "Box", "Concept", "Points", "Door", "Drape", "EdgeFinish", "Ellipsoid", "Fabric", "FigureFit", "Fitting", "Garment",+ "Box", "Circle2", "Compose", "Base", "Concept", "Points", "Door", "Drape", "EdgeFinish", "Ellipsoid", "Extrude", "Fabric", "FigureFit", "Fitting", "Garment","Helix", "Hole", "Interface<Fixed>", "Interface<Prismatic>", "Interface<Revolute>","Interface<Stitch>", "Inventory", "Joint", "Loft", "Panel", "Perforation", "Material", "Linear", "Series", "Polyhedron", "Pose", "PoseTransition",- "Room", "Scene", "Camera", "Section", "Thread", "Window", "Follow", "WireRoute",+ "Profile", "Rect2", "Room", "RoundedRect2", "Scene", "Camera", "Section", "Slot2", "Thread", "Window", "Follow", "WireRoute",];Assert.Equal(expectedNames, FirmamentSemanticSchemas.All.Select(schema => schema.Name));var hole = Assert.IsType<FirmamentConstructSchema>(FirmamentSemanticSchemas.Get("Hole"));@@ -67,6 +67,35 @@ public sealed class FirmamentSemanticSchemaTests}}+ [Fact]+ public void ProfileWorkflowEntries_BuildAsWritten()+ {+ // Agents and completion copy these entries verbatim; each must compile in its documented host.+ string Entry(string name) => FirmamentSemanticSchemas.Get(name)!.Entry!;+ foreach (var shape in new[] { "Rect2", "RoundedRect2", "Circle2", "Slot2" })+ {+ var guide = Entry(shape);+ var profile = guide[(guide.IndexOf(' ') + 1)..guide.IndexOf('{')].Trim();+ var source = $"Model M {{ units: mm {guide} Profile P {{ Loop Outer {{ {profile} |> TraceLoop }} }} Extrude Body {{ profile: P; from: 0mm; to: 5mm }} }}";+ Assert.True(FirmamentBuildAndExport.CompileSource(source).IsSuccess, shape);+ }+ var plate = $"Model M {{ units: mm {Entry("Profile")} {Entry("Extrude")} }}";+ Assert.True(FirmamentBuildAndExport.CompileSource(plate).IsSuccess, plate);+ var composed = $"Model M {{ units: mm {Entry("Profile")} {Entry("Compose")} Modify Plate {{ Hole<Shaft> H {{ on: +Z center: Point2(19mm, 14mm) diameter: 5.5mm end: ThroughAll }} }} }}";+ Assert.True(FirmamentBuildAndExport.CompileSource(composed).IsSuccess, composed);+ }++ [Fact]+ public void ModifyFeaturesOnAPlainExtrude_RejectInsteadOfVanishing()+ {+ var source = "Model M { units: mm Profile P = Rect2 { center: [0mm, 0mm]; size: [50mm, 40mm] } Extrude Plate { profile: P; from: 0mm; to: 8mm } "+ + "Modify Plate { Hole<Shaft> H { on: +Z center: Point2(0mm, 0mm) diameter: 6mm end: ThroughAll } } }";+ var build = FirmamentBuildAndExport.CompileSource(source);+ Assert.False(build.IsSuccess);+ var diagnostic = Assert.Single(build.Diagnostics, d => d.Message.Contains("Compose Plate", StringComparison.Ordinal));+ Assert.Contains("Hole H would not be cut", diagnostic.Message, StringComparison.Ordinal);+ }+[Fact]public void ConceptAndBox_KeepTheirSemanticBoundaries(){diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.csindex c208662f..567ae6ec 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs@@ -77,6 +77,7 @@ public static partial class FirmamentV2Parserpublic const string AssertVolumeToleranceNegative = "firmament-v2-assert-volume-tolerance-negative";public const string CanonicalConstructNotYetSupported = "firmament-v2-canonical-construct-not-yet-supported";public const string EdgeFinishProfileComposeBoundaryUnsupported = "EdgeFinishProfileComposeBoundaryUnsupported";+ public const string ExtrudeModifyFeatureUnsupported = "firmament-v2-extrude-modify-feature-unsupported";public const string CanonicalFieldUnknown = "firmament-v2-canonical-field-unknown";public const string SelectionMalformed = "firmament-v2-selection-malformed";public const string SelectionDuplicateName = "firmament-v2-selection-duplicate-name";@@ -1307,6 +1308,19 @@ public static partial class FirmamentV2Parserreturn CanonicalFailure(diagnostics, CanonicalDocumentMalformed);}var resolved = profile.Profile;+ // A plain Extrude lowers its Profile alone. Holes, perforations and+ // patterns in a Modify block would otherwise be admitted and then+ // never cut; reject them and name the construction that cuts them.+ if (declarations.Where(d => d.Type.Name.Text == "Modify").SelectMany(d => d.Body?.Statements.OfType<DeclarationSyntax>() ?? [])+ .FirstOrDefault(d => d.Type.Name.Text != "EdgeFinish") is { } dropped)+ {+ var extrude = declarations.First(d => d.Type.Name.Text == "Extrude");+ var message = $"Extrude {extrude.Name?.Text} lowers only its Profile, so {dropped.Type.Name.Text} {dropped.Name?.Text} would not be cut. "+ + $"Build the body with Compose for holes and other Modify features: Compose {extrude.Name?.Text} {{ Base Stock {{ Profile: {resolved.Name}; From: ...; To: ...; Role: Stock }} }}.";+ diagnostics.Add($"{ExtrudeModifyFeatureUnsupported}: {message}");+ return CanonicalFailure(diagnostics, CanonicalDocumentMalformed) with+ { SyntaxDiagnostics = [new(ExtrudeModifyFeatureUnsupported, "fatal", message) { SourceSpan = dropped.Span, Stage = "Capability" }] };+ }var profileSelectionDiagnostics = new List<string>();var profileSelections = ParseCanonicalSelections(body, bodySpan.Start, profileSelectionDiagnostics);ValidateCanonicalSelectionSources(body, profileSelections, [resolved.Name], profileSelectionDiagnostics);diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringDeclarations.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringDeclarations.csnew file mode 100644index 00000000..87642fab--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringDeclarations.cs@@ -0,0 +1,55 @@+namespace Aetheris.Kernel.Firmament.FirmamentV2;++// The everyday part workflow: a closed 2D Profile given to Extrude or Compose.+// These describe the ProfileAuthoringParser and Compose surfaces; those parsers+// remain the execution authority. See docs/public/reference/language/profiles.md.++[FirmamentConstruct("Profile", "Profile", Context = "Model", Entry = "Profile Outline = RoundedRect2 { center: [0mm, 0mm]; size: [50mm, 40mm]; radius: 3mm }",+ Description = "A closed 2D boundary for Extrude or Compose: one closed shape directly, or Loops traced from named construction guides with |>.")]+public static class ProfileSemanticDeclaration { }++[FirmamentConstruct("Extrude", "Extrude", Context = "Model", Entry = "Extrude Plate { profile: Outline; from: 0mm; to: 8mm }",+ Description = "A plain prism from a Profile along its layout normal. Holes and other Modify features are not admitted on an Extrude; use Compose with a Base for those.")]+[FirmamentField("Profile", "Profile", FirmamentSchemaValueKind.Profile, Required = true, Description = "Name of the Profile to extrude.")]+[FirmamentField("From", "From", FirmamentSchemaValueKind.Length, Required = true, Description = "Start height along the layout normal.")]+[FirmamentField("To", "To", FirmamentSchemaValueKind.Length, Required = true, Description = "End height; greater than From.")]+public static class ExtrudeSemanticDeclaration { }++[FirmamentConstruct("Compose", "Compose", Context = "Model", Entry = "Compose Plate {\n Base Stock { Profile: Outline; From: 0mm; To: 8mm; Role: Stock }\n}",+ Description = "A Profile-based body built from a Base and optional Boss, Pocket and Hole operations. A later Modify on the Compose name admits holes and top-rim chamfers; Fillet finishes are rejected on Compose bodies, so round corners in the Profile instead.")]+public static class ComposeSemanticDeclaration { }++[FirmamentConstruct("ComposeBase", "Base", Context = "Compose", Entry = "Base Stock { Profile: Outline; From: 0mm; To: 8mm; Role: Stock }",+ Description = "The starting stock of a Compose body.")]+[FirmamentField("Profile", "Profile", FirmamentSchemaValueKind.Profile, Required = true, Description = "Name of the Profile that bounds the stock.")]+[FirmamentField("From", "From", FirmamentSchemaValueKind.Length, Required = true, Description = "Bottom of the stock.")]+[FirmamentField("To", "To", FirmamentSchemaValueKind.Length, Required = true, Description = "Top of the stock; greater than From.")]+[FirmamentField("Role", "Role", FirmamentSchemaValueKind.String, Default = "Stock", Choices = ["Stock"], Description = "Stock for starting material.")]+public static class ComposeBaseSemanticDeclaration { }++[FirmamentConstruct("Rect2", "Rect2", Context = "Model, Profile or layout", Entry = "Rect2 Outline { center: [0mm, 0mm]; size: [50mm, 40mm] }",+ Description = "Closed axis-aligned rectangle. Named sides and corners (Top, BottomLeft, ...) can be traced into Profiles.")]+[FirmamentField("Center", "Center", FirmamentSchemaValueKind.Point, Required = true, Description = "Center in the layout plane.")]+[FirmamentField("Size", "Size", FirmamentSchemaValueKind.Vector, Unit = FirmamentUnitKind.Length, Required = true, Description = "Two full lengths, X then Y.")]+public static class Rect2SemanticDeclaration { }++[FirmamentConstruct("RoundedRect2", "RoundedRect2", Context = "Model, Profile or layout", Entry = "RoundedRect2 Outline { center: [0mm, 0mm]; size: [50mm, 40mm]; radius: 3mm }",+ Description = "Closed rectangle with four circular corner arcs. Extruded, it gives a block with rounded vertical edges.")]+[FirmamentField("Center", "Center", FirmamentSchemaValueKind.Point, Required = true, Description = "Center in the layout plane.")]+[FirmamentField("Size", "Size", FirmamentSchemaValueKind.Vector, Unit = FirmamentUnitKind.Length, Required = true, Description = "Two full lengths, X then Y.")]+[FirmamentField("Radius", "Radius", FirmamentSchemaValueKind.Length, Required = true, Description = "Corner radius, at most half the shorter side.")]+public static class RoundedRect2SemanticDeclaration { }++[FirmamentConstruct("Circle2", "Circle2", Context = "Model, Profile or layout", Entry = "Circle2 Disc { center: [0mm, 0mm]; diameter: 20mm }",+ Description = "Closed circle. Supply exactly one of Radius or Diameter.")]+[FirmamentField("Center", "Center", FirmamentSchemaValueKind.Point, Required = true, Description = "Center in the layout plane.")]+[FirmamentField("Radius", "Radius", FirmamentSchemaValueKind.Length, Description = "Radius; omit when Diameter is given.")]+[FirmamentField("Diameter", "Diameter", FirmamentSchemaValueKind.Length, Description = "Diameter; omit when Radius is given.")]+public static class Circle2SemanticDeclaration { }++[FirmamentConstruct("Slot2", "Slot2", Context = "Model, Profile or layout", Entry = "Slot2 Track { center: [0mm, 0mm]; length: 30mm; width: 8mm }",+ Description = "Closed obround along X. Length is overall, including both round ends.")]+[FirmamentField("Center", "Center", FirmamentSchemaValueKind.Point, Required = true, Description = "Center in the layout plane.")]+[FirmamentField("Length", "Length", FirmamentSchemaValueKind.Length, Required = true, Description = "Overall length; at least Width.")]+[FirmamentField("Width", "Width", FirmamentSchemaValueKind.Length, Required = true, Description = "Slot width.")]+public static class Slot2SemanticDeclaration { }diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs b/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.csindex 977c60ab..d91c20bd 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs@@ -15,7 +15,7 @@ public static class EllipsoidSemanticDeclaration { }public static class PolyhedronSemanticDeclaration { }[FirmamentConstruct("Hole", "Hole", Context = "Modify body", Entry = "Modify Body { Hole<Shaft> H { On: +Z; Center: Point2(0mm, 0mm); Diameter: 6mm; End: ThroughAll } }", Description = "Semantic drilled hole.")]-[FirmamentField("On", "On", FirmamentSchemaValueKind.FaceSelector, Required = true, Choices = ["+Z", "-Z"], Description = "Entry face. Top/+Z and bottom/-Z are admitted on profile-stack stock. Other selectors require their specific supported body lane. Center X/Y are coordinates in this face's local frame, not screen coordinates.")]+[FirmamentField("On", "On", FirmamentSchemaValueKind.FaceSelector, Required = true, Choices = ["+Z", "-Z"], Description = "Entry face. Top/+Z and bottom/-Z are admitted on Box and Compose stock (not on a plain Extrude). Other selectors require their specific supported body lane. Center X/Y are coordinates in this face's local frame, not screen coordinates.")][FirmamentField("Center", "Center", FirmamentSchemaValueKind.Point, Required = true, Description = "Center in the support face.")][FirmamentField("Diameter", "Diameter", FirmamentSchemaValueKind.Length, Required = true, Description = "Shaft diameter.", SourceEditable = true, ProjectionMember = nameof(ProjectDiameter))][FirmamentField("End", "End", FirmamentSchemaValueKind.String, Required = true, Choices = ["ThroughAll", "Blind(5mm)"], Description = "ThroughAll cuts through the body. Blind(5mm) cuts to a finite depth; edit the expression for another depth.")]diff --git a/docs/development/reports/2026-10/extrude-modify-and-profile-schema.md b/docs/development/reports/2026-10/extrude-modify-and-profile-schema.mdnew file mode 100644index 00000000..aaed3edd--- /dev/null+++ b/docs/development/reports/2026-10/extrude-modify-and-profile-schema.md@@ -0,0 +1,29 @@+# Extrude with Modify features rejects; Profile constructs join the schema++## What changed++- A single `Extrude` lowers only its Profile. A `Modify` on it holding a Hole, Perforation or+ Pattern was admitted and then never cut: the build succeeded with the feature missing.+ It now rejects with `firmament-v2-extrude-modify-feature-unsupported`, naming the dropped+ feature and the `Compose { Base ... }` form that does cut it. EdgeFinish on an Extrude keeps+ its existing profile-boundary route.+- The semantic schema declares the everyday part path: `Profile`, `Extrude`, `Compose`, `Base`,+ `Rect2`, `RoundedRect2`, `Circle2` and `Slot2`, with field kinds and buildable entries.+ Completion offers them as construct entries. The Hole `On` help now says Box and Compose stock.++Found while an agent used Helios through MCP: the hole vanished without a diagnostic, and the+schema gave no route to a Profile-based body (see HeliosCAD+`docs/development/reports/2026-10/agent-dogfooding-mcp.md`).++## Evidence++- `FirmamentSemanticSchemaTests.ProfileWorkflowEntries_BuildAsWritten` compiles every new entry+ in its documented host, including Compose with a Modify hole.+- `ModifyFeaturesOnAPlainExtrude_RejectInsteadOfVanishing`.+- No fixture used Extrude with Modify holes; the one Extrude + Modify fixture is an EdgeFinish.+- Targeted subset (schema, completion, profile, outline, sketch, IntelliDraft, hole, grammar): 510 pass.++## Verdict++Success. The location of this rejection in CLI/web output is the document anchor (line 1); the+parser's feature span is not carried through the string-code admission path.diff --git a/docs/public/reference/language/solids-and-features.md b/docs/public/reference/language/solids-and-features.mdindex 037a734f..7dc3a1c9 100644--- a/docs/public/reference/language/solids-and-features.md+++ b/docs/public/reference/language/solids-and-features.md@@ -37,6 +37,11 @@ different construction.patterns. `Modify Base {}` with no features is a valid no-op, as long as `Base`exists.+A plain `Extrude` takes only edge finishes in its Modify. Holes, perforations and+patterns need a Profile-based `Compose` body (`Compose Plate { Base Stock { profile:+Outline; from: 0mm; to: 8mm } }`); on an `Extrude` they reject rather than build+without the feature.+Angular mold `Draft` is not currently a V2 `Modify` feature. Its bounded legacyoperation does not imply support on the modern authoring path.