Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Improve Firmament validation admission and diagnostics

Yuechen Lie73eb0b2ea63
diff --git a/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs b/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs
index bd06ba20..c5a5b2f9 100644
--- a/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs
+++ b/Aetheris.CLI.Tests/FirmamentFixtureCorpusTests.cs
@@ -153,7 +153,7 @@ public sealed class FirmamentFixtureCorpusTests
var validationStatus = validation.GetProperty("status").GetString();
if (metadata["expected"] == "valid")
{
- Assert.Contains(validationStatus, new[] { "valid", "valid-with-deferred-export" });
+ Assert.Contains(validationStatus, new[] { "parsed-not-built" });
}
else
{
@@ -487,7 +487,7 @@ public sealed class FirmamentFixtureCorpusTests
private static JsonDocument Validate(string fixturePath)
{
var stdout = new StringWriter(); var stderr = new StringWriter();
- var exit = Aetheris.CLI.CliRunner.Run(["validate", fixturePath, "--json"], stdout, stderr);
+ var exit = Aetheris.CLI.CliRunner.Run(["validate", fixturePath, "--parse-only", "--json"], stdout, stderr);
var metadata = LoadMetadata(fixturePath);
Assert.Equal(metadata["expected"] == "valid" ? 0 : 1, exit);
Assert.Equal(string.Empty, stderr.ToString());
diff --git a/Aetheris.CLI.Tests/FirmamentFrontendX0CliTests.cs b/Aetheris.CLI.Tests/FirmamentFrontendX0CliTests.cs
new file mode 100644
index 00000000..0b0a09d1
--- /dev/null
+++ b/Aetheris.CLI.Tests/FirmamentFrontendX0CliTests.cs
@@ -0,0 +1,63 @@
+using System.Text.Json;
+
+namespace Aetheris.CLI.Tests;
+
+public sealed class FirmamentFrontendX0CliTests
+{
+ [Theory]
+ [InlineData("malformed-v2")]
+ [InlineData("unknown-model-statement")]
+ [InlineData("unknown-modify-statement")]
+ [InlineData("unknown-box-field")]
+ [InlineData("unsupported-xz-layout")]
+ [InlineData("combined-fillet-hole")]
+ [InlineData("unresolved-semantic-source")]
+ [InlineData("edgefinish-generic-variant")]
+ public void ValidateAndBuild_RejectSameSource_WithStructuredDiagnostics(string fixture)
+ {
+ var path = Fixture(fixture);
+ var validation = new StringWriter(); var build = new StringWriter();
+ Assert.Equal(1, CliRunner.Run(["validate", path, "--json"], validation, new StringWriter()));
+ Assert.Equal(1, CliRunner.Run(["build", path, "--json"], build, new StringWriter()));
+ using var v = JsonDocument.Parse(validation.ToString()); using var b = JsonDocument.Parse(build.ToString());
+ Assert.Equal("invalid", v.RootElement.GetProperty("firmamentV2Validation").GetProperty("status").GetString());
+ Assert.False(b.RootElement.GetProperty("success").GetBoolean());
+ foreach (var diagnostic in v.RootElement.GetProperty("firmamentV2Validation").GetProperty("diagnostics").EnumerateArray()
+ .Concat(b.RootElement.GetProperty("diagnostics").EnumerateArray()))
+ {
+ Assert.Equal(JsonValueKind.Object, diagnostic.ValueKind);
+ Assert.False(string.IsNullOrWhiteSpace(diagnostic.GetProperty("code").GetString()));
+ Assert.False(string.IsNullOrWhiteSpace(diagnostic.GetProperty("message").GetString()));
+ Assert.Equal("fatal", diagnostic.GetProperty("severity").GetString());
+ Assert.Equal(path, diagnostic.GetProperty("sourceFile").GetString());
+ Assert.True(diagnostic.GetProperty("line").GetInt32() > 0);
+ }
+ }
+
+ [Fact]
+ public void ParseOnly_IsExplicitlyQualified_AndExplainIdentifiesTheRoute()
+ {
+ var stdout = new StringWriter();
+ Assert.Equal(0, CliRunner.Run(["validate", Fixture("combined-fillet-hole"), "--parse-only", "--explain"], stdout, new StringWriter()));
+ Assert.Contains("parsed-not-built", stdout.ToString(), StringComparison.Ordinal);
+ Assert.Contains("Canonical", stdout.ToString(), StringComparison.Ordinal);
+ Assert.Contains("ParsedNotBuilt", stdout.ToString(), StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void TextBuildSummary_IdentifiesDocumentOwner()
+ {
+ var path = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Canonical/Features/EdgeFinish/semantic-selection-chamfer.firmament"));
+ var output = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".step");
+ try
+ {
+ var stdout = new StringWriter();
+ Assert.Equal(0, CliRunner.Run(["build", path, "--output", output], stdout, new StringWriter()));
+ Assert.Contains("Model: SelectionChamferPart", stdout.ToString(), StringComparison.Ordinal);
+ }
+ finally { File.Delete(output); }
+ }
+
+ private static string Fixture(string name) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory,
+ "../../../../fixtures/Regression/FrontendX0", name + ".firmament"));
+}
diff --git a/Aetheris.CLI.Tests/FirmamentV2RuntimeConceptValidationCliTests.cs b/Aetheris.CLI.Tests/FirmamentV2RuntimeConceptValidationCliTests.cs
index e7512211..3cf6b06c 100644
--- a/Aetheris.CLI.Tests/FirmamentV2RuntimeConceptValidationCliTests.cs
+++ b/Aetheris.CLI.Tests/FirmamentV2RuntimeConceptValidationCliTests.cs
@@ -128,7 +128,8 @@ public sealed class FirmamentV2RuntimeConceptValidationCliTests
using var document = JsonDocument.Parse(stdout.ToString());
var validation = document.RootElement.GetProperty("firmamentV2Validation");
- Assert.Equal("valid", validation.GetProperty("status").GetString());
+ Assert.Equal("parsed-not-built", validation.GetProperty("status").GetString());
+ Assert.Equal("ParsedNotBuilt", validation.GetProperty("validationLevel").GetString());
Assert.Contains(
validation.GetProperty("diagnostics").EnumerateArray(),
diagnostic => diagnostic.GetProperty("code").GetString() == "testforge.boss-hole.seen"
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index 215faaf1..8347a49a 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -136,7 +136,7 @@ public static class CliRunner
private const string TopLevelUsage = "Usage: aetheris <command> [options]";
private const string BuildUsage = "Usage: aetheris build <file.firmament|file.firmasm> [--output <path>] [--json]";
private const string MeshUsage = "Usage: aetheris mesh <file.firmament|file.firmfixture|file.firmasm|file.step> [--format stl|obj|assembly-json] [--output <path>] [--debug-ir <path>] [--json]";
- private const string ValidateUsage = "Usage: aetheris validate <file.firmament|file.firmfixture> [--forge-pack <path>] [--json]";
+ private const string ValidateUsage = "Usage: aetheris validate <file.firmament|file.firmfixture> [--forge-pack <path>] [--parse-only] [--explain] [--json]";
private const string InspectProfileUsage = "Usage: aetheris inspect-profile <file.firmament> [--json]";
private const string InspectSpansUsage = "Usage: aetheris inspect-spans <file.firmament> --json";
private const string InspectComposeUsage = "Usage: aetheris inspect-compose <file.firmament> --json [--materialize]";
@@ -507,6 +507,7 @@ public static class CliRunner
return RunSculptingBuild(sourcePath, outPath, json, stdout, stderr);
var build = FirmamentBuildAndExport.Run(sourcePath, outPath);
+ var diagnosticSource = File.ReadAllText(sourcePath);
if (!build.IsSuccess)
{
if (json)
@@ -516,7 +517,7 @@ public static class CliRunner
command = "build",
success = false,
input = Path.GetFullPath(sourcePath),
- diagnostics = build.Diagnostics.Select(d => new { d.Source, d.Message, severity = d.Severity.ToString() })
+ diagnostics = build.Diagnostics.Select(d => FirmamentBuildAdmissionValidation.Present(d, sourcePath, diagnosticSource))
}, JsonOptions));
}
else
@@ -524,7 +525,8 @@ public static class CliRunner
stderr.WriteLine("Build failed:");
foreach (var diagnostic in build.Diagnostics)
{
- stderr.WriteLine($"- [{diagnostic.Severity}] {diagnostic.Source}: {diagnostic.Message}");
+ var presented = FirmamentBuildAdmissionValidation.Present(diagnostic, sourcePath, diagnosticSource);
+ stderr.WriteLine($"{sourcePath}({presented.Line},{presented.Column}): {presented.Severity} {presented.Code}: {presented.Message}");
}
}
@@ -541,6 +543,7 @@ public static class CliRunner
output = build.Value.OutputPath,
sourcePath = build.Value.SourcePath,
outputPath = build.Value.OutputPath,
+ model = build.Value.Export.DocumentName ?? build.Value.Export.ExportedFeatureId,
conceptIr = build.Value.Export.ConceptIr,
air = build.Value.Export.Air,
plateau = build.Value.Export.Plateau,
@@ -563,7 +566,7 @@ public static class CliRunner
featureCount = (build.Value.Export.Features?.Count ?? 0) + (build.Value.Export.EngineeringFeatures?.Count ?? 0) + (build.Value.Export.Perforation is null ? 0 : 1),
inlineStepMigration = build.Value.Export.InlineStepMigration,
inlineStepReplacementAssist = build.Value.Export.InlineStepReplacementAssist,
- diagnostics = build.Diagnostics.Select(d => new { d.Source, d.Message, severity = d.Severity.ToString() }),
+ diagnostics = build.Diagnostics.Select(d => FirmamentBuildAdmissionValidation.Present(d, sourcePath, diagnosticSource)),
pmiExportEvidence = new
{
datum = (build.Value.Export.DatumInspection ?? []).Select(d => new { kind = "datum", name = d.Label, exportSupport = "supported", exportEvidence = "found", target = d.Target }),
@@ -575,7 +578,7 @@ public static class CliRunner
{
stdout.WriteLine($"Built {Path.GetFileName(build.Value.SourcePath)}");
stdout.WriteLine($"STEP: {build.Value.OutputPath}");
- stdout.WriteLine($"Model: {build.Value.Export.ExportedFeatureId}");
+ stdout.WriteLine($"Model: {build.Value.Export.DocumentName ?? build.Value.Export.ExportedFeatureId}");
if (build.Value.Export.StandardPart is { } standardPart)
stdout.WriteLine($"Standard part: {standardPart.Family} via {standardPart.Template ?? "direct record"} ({standardPart.SemanticDescendants.Count} semantic descendants)");
if (build.Value.Export.WireForm is { } wireForm)
@@ -2296,6 +2299,8 @@ Model CanonicalPanel {
var sourcePath = args[0];
var json = false;
+ var explain = false;
+ var parseOnly = false;
var forgePackPaths = new List<string>();
for (var i = 1; i < args.Length; i++)
{
@@ -2308,6 +2313,12 @@ Model CanonicalPanel {
stderr.WriteLine("Validate option --forge-pack requires a local assembly path.");
stderr.WriteLine(ValidateUsage);
return 1;
+ case "--explain":
+ explain = true;
+ break;
+ case "--parse-only":
+ parseOnly = true;
+ break;
case "--json":
json = true;
break;
@@ -2479,9 +2490,20 @@ Model CanonicalPanel {
Path.GetDirectoryName(Path.GetFullPath(sourcePath)),
runtimeConfiguration.Catalog);
var runtimeValidation = FirmamentV2RuntimeConceptValidation.Validate(parse.Document, runtimeConfiguration);
- var report = FirmamentV2ValidationReportBuilder.Build(parse, sourcePath, runtimeValidation, runtimeConfiguration.Catalog);
+ var report = FirmamentV2ValidationReportBuilder.Build(parse, sourcePath, runtimeValidation, runtimeConfiguration.Catalog, validationSource);
+ if (parseOnly || forgePackPaths.Count > 0)
+ {
+ if (report.Status != "invalid") report = report with { Status = "parsed-not-built" };
+ }
+ else report = FirmamentBuildAdmissionValidation.Admit(report, validationSource, Path.GetDirectoryName(Path.GetFullPath(sourcePath)));
if (json) stdout.WriteLine(JsonSerializer.Serialize(new { firmamentV2Validation = report }, JsonOptions));
else stdout.WriteLine($"Firmament V2 validation: {report.Status} ({report.Summary.FatalDiagnosticCount} fatal, {report.Summary.WarningDiagnosticCount} warning)");
+ if (!json)
+ {
+ if (explain) stdout.WriteLine($"Language: {report.LanguageVersion}; parser route: {report.ParserRoute ?? "Expansion/Unselected"}; admission: {report.ValidationLevel}; templates: {parse.Document?.TemplateInstantiations?.Count ?? 0}; solids: {parse.Document?.Solids.Count ?? 0}");
+ foreach (var diagnostic in report.Diagnostics)
+ stderr.WriteLine($"{sourcePath}({diagnostic.Line},{diagnostic.Column}): {diagnostic.Severity} {diagnostic.Code}: {diagnostic.Message}");
+ }
return report.Status == "invalid" ? 1 : 0;
}
@@ -5132,11 +5154,13 @@ Model CanonicalPanel {
private static void WriteValidateHelp(TextWriter stdout)
{
- stdout.WriteLine("Check syntax, binding, dimensions, and static semantics without materializing geometry.");
- stdout.WriteLine("Use build for materialization, STEP generation, and build-time assertions.");
+ stdout.WriteLine("Check V2 syntax and binding, then run engineering compilation to verify build admission.");
+ stdout.WriteLine("Generic V2 validation includes in-memory geometry/STEP preflight and writes no output file. Domain-specific reports retain their stated validation scope.");
stdout.WriteLine();
stdout.WriteLine(ValidateUsage);
- stdout.WriteLine(" --json Emit Firmament V2 validation report JSON.");
+ stdout.WriteLine(" --json Emit Firmament V2 validation report JSON, including validation level and parser route.");
+ stdout.WriteLine(" --explain Show V2 parser route, admission level and available instance counts.");
+ stdout.WriteLine(" --parse-only Check static semantics only; success is labelled parsed-not-built.");
stdout.WriteLine(" --forge-pack <path> Load a trusted local .NET assembly containing IForgeConceptPack implementations. This executes local code; Aetheris does not sandbox external packs. Do not load untrusted packs.");
}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentFrontendX0Tests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentFrontendX0Tests.cs
new file mode 100644
index 00000000..a7768ab1
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentFrontendX0Tests.cs
@@ -0,0 +1,142 @@
+using Aetheris.Forge.Abstractions.FirmamentInterop;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Firmament.FirmamentV2;
+using Aetheris.Kernel.Firmament.FirmamentV2.FirmamentInterop;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class FirmamentFrontendX0Tests
+{
+ [Theory]
+ [InlineData("malformed-v2", "Canonical")]
+ [InlineData("unknown-model-statement", "Canonical")]
+ [InlineData("unknown-modify-statement", "Canonical")]
+ [InlineData("unknown-box-field", "Canonical")]
+ [InlineData("unsupported-xz-layout", "StandaloneProfile")]
+ public void InvalidSource_IsRejectedByParserReportAndEngineeringCompiler(string fixture, string route)
+ {
+ var source = Read(fixture);
+ var parse = FirmamentV2Parser.Parse(source);
+ var build = FirmamentBuildAndExport.CompileSource(source);
+ var report = FirmamentV2ValidationReportBuilder.Build(parse, fixture);
+ Assert.False(parse.IsSuccess);
+ Assert.Equal(FirmamentV2ParseDisposition.RecognizedInvalid, parse.Disposition);
+ Assert.Equal(route, parse.ParserRoute);
+ Assert.False(build.IsSuccess);
+ Assert.Equal("invalid", report.Status);
+ Assert.Contains(report.Diagnostics, diagnostic => diagnostic.Severity == "fatal");
+ Assert.DoesNotContain(build.Diagnostics, diagnostic => diagnostic.Message.Contains("TOON", StringComparison.Ordinal));
+ }
+
+ [Theory]
+ [InlineData("combined-fillet-hole")]
+ [InlineData("unresolved-semantic-source")]
+ [InlineData("edgefinish-generic-variant")]
+ public void BuildAdmission_RejectsParsedButUnbuildablePrograms(string fixture)
+ {
+ var source = Read(fixture);
+ var parse = FirmamentV2Parser.Parse(source);
+ Assert.True(parse.IsSuccess, string.Join("; ", parse.Diagnostics));
+ var report = FirmamentBuildAdmissionValidation.Admit(FirmamentV2ValidationReportBuilder.Build(parse), source);
+ Assert.Equal("invalid", report.Status);
+ Assert.Equal("BuildRejected", report.ValidationLevel);
+ Assert.True(report.Summary.FatalDiagnosticCount > 0);
+ Assert.False(FirmamentBuildAndExport.CompileSource(source).IsSuccess);
+ }
+
+ [Fact]
+ public void XzBracket_CannotSilentlyEmitTheXyWitness()
+ {
+ var xz = Read("unsupported-xz-layout");
+ var xy = xz.Replace("On XZ", "On XY", StringComparison.Ordinal);
+ var accepted = FirmamentBuildAndExport.CompileSource(xy);
+ Assert.True(accepted.IsSuccess, string.Join("; ", accepted.Diagnostics.Select(d => d.Message)));
+ var imported = Step242Importer.ImportBody(accepted.Value.StepText);
+ Assert.True(imported.IsSuccess);
+ var points = imported.Value.Topology.Vertices.Select(vertex =>
+ {
+ Assert.True(imported.Value.TryGetVertexPoint(vertex.Id, out var point));
+ return point;
+ }).ToArray();
+ Assert.Equal(60d, points.Max(point => point.X) - points.Min(point => point.X), 8);
+ Assert.Equal(30d, points.Max(point => point.Y) - points.Min(point => point.Y), 8);
+ Assert.Equal(3d, points.Max(point => point.Z) - points.Min(point => point.Z), 8);
+ Assert.Equal(8, imported.Value.Topology.Faces.Count());
+ Assert.False(FirmamentBuildAndExport.CompileSource(xz).IsSuccess);
+ Assert.False(FirmamentBuildAndExport.CompileSource(xy.Replace("Using Layout", "Using MissingFrame", StringComparison.Ordinal)).IsSuccess);
+ }
+
+ [Fact]
+ public void UnknownField_HasAnOriginalTokenSpan_AndLanguageServiceMarker()
+ {
+ var source = Read("unknown-box-field");
+ var report = FirmamentV2ValidationReportBuilder.Build(FirmamentV2Parser.Parse(source), "field.firmament");
+ var diagnostic = Assert.Single(report.Diagnostics, diagnostic => diagnostic.Code.StartsWith(FirmamentV2Parser.CanonicalFieldUnknown + ":", StringComparison.Ordinal));
+ Assert.Equal("heigth", source.Substring(diagnostic.SourceSpan!.Start, diagnostic.SourceSpan.Length));
+ Assert.Equal("field.firmament", diagnostic.SourceFile);
+ Assert.True(diagnostic.Line > 0);
+ Assert.Null(diagnostic.LocationNote);
+ var marker = Assert.Single(FirmamentLanguageAnalysisService.Analyze(source, "field.firmament", "1").Diagnostics,
+ diagnostic => diagnostic.Code.StartsWith(FirmamentV2Parser.CanonicalFieldUnknown + ":", StringComparison.Ordinal));
+ Assert.Equal("heigth", source.Substring(marker.Start, marker.Length));
+ }
+
+ [Fact]
+ public void SchemaSelection_PreservesOriginalDiagnosticOffsets()
+ {
+ var original = "schema Mechanical\n" + Read("unknown-box-field");
+ var selection = FirmamentFrontendSchemas.Select(original);
+ Assert.Equal(original.Length, selection.Source.Length);
+ var report = FirmamentV2ValidationReportBuilder.Build(FirmamentV2Parser.Parse(selection.Source));
+ var diagnostic = Assert.Single(report.Diagnostics, diagnostic => diagnostic.Code.StartsWith(FirmamentV2Parser.CanonicalFieldUnknown + ":", StringComparison.Ordinal));
+ Assert.Equal("heigth", original.Substring(diagnostic.SourceSpan!.Start, diagnostic.SourceSpan.Length));
+ Assert.Equal(4, diagnostic.Line);
+ }
+
+ [Fact]
+ public void SemanticSourceFailure_PreservesTheMissingSourceAndExplanation()
+ {
+ var result = FirmamentBuildAndExport.CompileSource(Read("unresolved-semantic-source"));
+ Assert.False(result.IsSuccess);
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.Contains("No provenance source for:", StringComparison.Ordinal)
+ && diagnostic.Message.Contains("AbsentEdge", StringComparison.Ordinal));
+ }
+
+ [Fact]
+ public void UnknownDiagnostic_IsAnError_WhileDeclaredWarningAndTraceRemainNonfatal()
+ {
+ Assert.Equal(FirmamentDiagnosticSeverity.Fatal, FirmamentV2DiagnosticAdapter.FromParserDiagnosticCode("future-owner-new-error").Severity);
+ Assert.Equal(FirmamentDiagnosticSeverity.Warning, FirmamentV2DiagnosticAdapter.FromParserDiagnosticCode(FirmamentV2Parser.ToleranceDroppedThroughArithmetic).Severity);
+ Assert.Equal(FirmamentDiagnosticSeverity.Info, FirmamentV2DiagnosticAdapter.FromParserDiagnosticCode("firmament-concept-ir-resolved").Severity);
+ var report = FirmamentV2ValidationReportBuilder.Build(FirmamentV2ParseResult.Failure(["future-owner-new-error"]));
+ Assert.Equal("invalid", report.Status);
+ var emptyFailure = FirmamentV2ValidationReportBuilder.Build(FirmamentV2ParseResult.Failure([]));
+ Assert.Equal("invalid", emptyFailure.Status);
+ Assert.Equal(1, emptyFailure.Summary.FatalDiagnosticCount);
+ }
+
+ internal static string Read(string fixture) => File.ReadAllText(Path.Combine(AppContext.BaseDirectory,
+ "../../../../fixtures/Regression/FrontendX0", fixture + ".firmament"));
+
+ [Theory]
+ [InlineData("Model")]
+ [InlineData("Template")]
+ public void ExplicitV1_DataKeywordsCannotSelectTheV2Frontend(string modelName)
+ {
+ var source = File.ReadAllText(Path.Combine(AppContext.BaseDirectory,
+ "../../../../fixtures/Compatibility/LegacyV1/Examples/box_basic.firmament"))
+ .Replace("name: box_basic", "name: " + modelName, StringComparison.Ordinal);
+ var parsed = FirmamentV2Parser.Parse(source);
+ Assert.Equal(FirmamentV2ParseDisposition.NotRecognized, parsed.Disposition);
+ Assert.Equal("LegacySerialization", parsed.ParserRoute);
+ var path = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".firmament");
+ var output = Path.ChangeExtension(path, ".step");
+ try
+ {
+ File.WriteAllText(path, source);
+ var built = FirmamentBuildAndExport.Run(path, output);
+ Assert.True(built.IsSuccess, string.Join("; ", built.Diagnostics.Select(diagnostic => diagnostic.Message)));
+ }
+ finally { File.Delete(path); File.Delete(output); }
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
index e1bbed8d..3134c437 100644
--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
@@ -170,6 +170,7 @@ public static class FirmamentBuildAndExport
{
var parsed = ParseSemanticSource(source, sourceDirectory);
if (!parsed.IsSuccess || parsed.Document is null) return export;
+ export = export with { DocumentName = parsed.Document.ModelName };
var edgeFinishes = (parsed.Document.ModifyBlocks ?? [])
.SelectMany(modification => (modification.EdgeFinishes ?? []).Select(finish => new FirmamentEngineeringFeatureReport(
@@ -447,6 +448,10 @@ public static class FirmamentBuildAndExport
authored.Value.Path.StableId, "Circle", authored.Value.Diameter, "Diameter", "Add", PolicySource: "CircularSweepFeatureAir", MaterializationRoute: "CircularSweepBRepPlan")]),
[]);
}
+ // Profile/Compose adapters still own additional admitted syntax (junction
+ // selections and derived profiles) absent from the generic V2 document.
+ // A blanket V2 gate here breaks established engineering fixtures. X0 keeps
+ // this boundary explicit pending consumed-source admission (see release report).
if (PrismaticProfileCompositionParser.IsCompositionSource(materializerSource))
{
var parsed = PrismaticProfileCompositionParser.Parse(materializerSource);
@@ -644,15 +649,8 @@ public static class FirmamentBuildAndExport
"FirmamentV2.InlineStep")).ToArray());
}
- var fatalV2Diagnostics = v2Parse.Diagnostics.Where(FirmamentV2Parser.IsFatalDiagnosticCode).Distinct(StringComparer.Ordinal).ToArray();
- if (v2Parse.Disposition == FirmamentV2ParseDisposition.RecognizedInvalid && fatalV2Diagnostics.Length > 0)
- {
- return KernelResult<FirmamentStepExportResult>.Failure(fatalV2Diagnostics.Select(code => new Kernel.Core.Diagnostics.KernelDiagnostic(
- Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,
- Kernel.Core.Diagnostics.KernelDiagnosticSeverity.Error,
- code,
- "FirmamentV2.Parse")).ToArray());
- }
+ if (v2Parse.Disposition == FirmamentV2ParseDisposition.RecognizedInvalid)
+ return V2ParseFailure(v2Parse);
if (!allowV1Compatibility)
{
@@ -741,6 +739,14 @@ public static class FirmamentBuildAndExport
message,
"FirmamentV2.LibraryResolution")).ToArray();
+ private static KernelResult<FirmamentStepExportResult> V2ParseFailure(FirmamentV2ParseResult parse)
+ {
+ var errors = parse.Diagnostics.Where(FirmamentV2Parser.IsFatalDiagnosticCode).Distinct(StringComparer.Ordinal).ToArray();
+ if (errors.Length == 0) errors = ["firmament-v2-parse-failed"];
+ return KernelResult<FirmamentStepExportResult>.Failure(errors.Select(code => new KernelDiagnostic(
+ KernelDiagnosticCode.ValidationFailed, KernelDiagnosticSeverity.Error, code, "FirmamentV2.Parse")).ToArray());
+ }
+
private static KernelResult<FirmamentStepExportResult> V2SourceRequired(FirmamentV2ParseResult parse)
{
var fatal = parse.Diagnostics
@@ -1146,7 +1152,8 @@ public static class FirmamentBuildAndExport
var selections = SemanticSelectionSourceParser.Parse(source, parsed.Profiles.Values.First(), stack.Feature.Name, out var diagnostics);
if (diagnostics.Count != 0 || selections.Count != 1) return Fail(diagnostics.FirstOrDefault() ?? "SemanticSourceNotFound");
var selection = SemanticTopologySelectionResolver.Resolve(emitted.Body, emitted.Correspondence, selections[0]);
- if (!selection.Succeeded || !selection.IsClosed || selection.Request.Require != SemanticSelectionRequirement.ClosedLoop) return Fail(selection.Failure == SemanticSelectionFailure.None ? "SelectionConsumerMismatch" : selection.Failure.ToString());
+ if (!selection.Succeeded) return Fail(string.Join("; ", selection.Diagnostics.Select(diagnostic => $"{diagnostic.Code}: {diagnostic.Message}")));
+ if (!selection.IsClosed || selection.Request.Require != SemanticSelectionRequirement.ClosedLoop) return Fail("SelectionConsumerMismatch: EdgeFinish requires a closed semantic boundary loop.");
var finish = Regex.Match(source, @"\bEdgeFinish\s+(?<name>\w+)\s*\{\s*Target\s*:\s*(?<target>\w+)\s*;?\s*Kind\s*:\s*(?<kind>Chamfer)\s*;?\s*Distance\s*:\s*(?<amount>[-+.\d]+)mm", RegexOptions.Singleline | RegexOptions.CultureInvariant);
if (!finish.Success || finish.Groups["target"].Value != selection.Request.Label) return Fail("SelectionConsumerMismatch");
var topSlab = stack.Slabs.MaxBy(s => s.To)!;
@@ -1231,7 +1238,7 @@ public static class FirmamentBuildAndExport
var selections = SemanticSelectionSourceParser.Parse(source, profile, profile.Name, out var selectionDiagnostics);
if (selectionDiagnostics.Count > 0 || selections.Count != 1) return Fail(selectionDiagnostics.FirstOrDefault() ?? "SemanticSourceNotFound");
var selection = SemanticTopologySelectionResolver.Resolve(emitted.Body, emitted.Correspondence, selections[0]);
- if (!selection.Succeeded) return Fail(selection.Failure.ToString());
+ if (!selection.Succeeded) return Fail(string.Join("; ", selection.Diagnostics.Select(diagnostic => $"{diagnostic.Code}: {diagnostic.Message}")));
var finish = Regex.Match(source, @"\bEdgeFinish\s+(?<name>\w+)\s*\{\s*Target\s*:\s*(?<target>\w+)\s*;?\s*Kind\s*:\s*(?<kind>Chamfer|Fillet)\s*;?\s*(?:Distance|Radius)\s*:\s*(?<amount>[-+.\d]+)mm", RegexOptions.Singleline | RegexOptions.CultureInvariant);
if (!finish.Success || !string.Equals(finish.Groups["target"].Value, selection.Request.Label, StringComparison.Ordinal)) return Fail("SelectionConsumerMismatch");
if (!string.Equals(finish.Groups["kind"].Value, "Chamfer", StringComparison.Ordinal) || selection.Request.Require != SemanticSelectionRequirement.ClosedLoop || !selection.IsClosed) return Fail("SelectionConsumerMismatch");
diff --git a/Aetheris.Kernel.Firmament/FirmamentFrontendSchema.cs b/Aetheris.Kernel.Firmament/FirmamentFrontendSchema.cs
index c204714b..d5825239 100644
--- a/Aetheris.Kernel.Firmament/FirmamentFrontendSchema.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentFrontendSchema.cs
@@ -32,7 +32,9 @@ public static class FirmamentFrontendSchemas
var name = declaration.Groups["name"].Value;
if (!Enum.TryParse<FirmamentFrontendSchema>(name, false, out var schema))
return new(null, source, [$"firmament-schema-unknown:{name}:available={string.Join(',', Names)}"]);
- var normalized = source.Remove(declaration.Index, declaration.Length);
+ // Erase the selector without moving author-source diagnostic offsets.
+ var erased = new string(declaration.Value.Select(character => character is '\r' or '\n' ? character : ' ').ToArray());
+ var normalized = source.Remove(declaration.Index, declaration.Length).Insert(declaration.Index, erased);
if (schema != FirmamentFrontendSchema.Mechanical && schema != FirmamentFrontendSchema.Garment
&& Regex.IsMatch(normalized, @"\bFeature\s+[A-Za-z_]\w*\s*\(", RegexOptions.CultureInvariant))
return new(schema, normalized, [$"firmament-feature-schema-unsupported:{schema}"]);
diff --git a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
index f5c72400..3cf095fa 100644
--- a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
@@ -37,6 +37,7 @@ public sealed record FirmamentStepExportResult(
FirmamentPerforationReport? Perforation = null,
FirmamentThreadReport? Thread = null)
{
+ public string? DocumentName { get; init; }
// In-process display can use the exact body that was exported to STEP.
// It is intentionally absent from CLI/JSON artifact serialization.
[JsonIgnore] public BrepBody? RuntimeBody { get; init; }
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs b/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs
index c31a83a9..2efa4f0d 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs
@@ -151,8 +151,10 @@ internal static class FirmamentV2CanonicalSymbolBinder
}
private static bool CanShareName(FirmamentV2CanonicalSymbolKind left, FirmamentV2CanonicalSymbolKind right) =>
- (left == FirmamentV2CanonicalSymbolKind.Profile && right is FirmamentV2CanonicalSymbolKind.Boss or FirmamentV2CanonicalSymbolKind.Pocket)
- || (right == FirmamentV2CanonicalSymbolKind.Profile && left is FirmamentV2CanonicalSymbolKind.Boss or FirmamentV2CanonicalSymbolKind.Pocket);
+ (left is FirmamentV2CanonicalSymbolKind.Profile or FirmamentV2CanonicalSymbolKind.ClosedBoundary2 or FirmamentV2CanonicalSymbolKind.Polygon2
+ && right is FirmamentV2CanonicalSymbolKind.Boss or FirmamentV2CanonicalSymbolKind.Pocket)
+ || (right is FirmamentV2CanonicalSymbolKind.Profile or FirmamentV2CanonicalSymbolKind.ClosedBoundary2 or FirmamentV2CanonicalSymbolKind.Polygon2
+ && left is FirmamentV2CanonicalSymbolKind.Boss or FirmamentV2CanonicalSymbolKind.Pocket);
private static (string Name, FirmamentV2CanonicalSymbolKind Kind)? ParseSelectionReference(string source)
{
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
index 71f2919a..ee3c6838 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
@@ -322,7 +322,7 @@ internal static class ConceptIrResolver
holes = holes.Concat(patternHoles).ToArray();
if (holes.Count == 0 && finishes.Count == 0)
{
- if (!diagnostics.Any(FirmamentV2Parser.IsConceptFatalDiagnostic)) diagnostics.Add(FirmamentV2Parser.Phase3EdgeFinishSyntaxInvalid);
+ if (!diagnostics.Any(FirmamentV2Parser.IsFatalDiagnosticCode)) diagnostics.Add(FirmamentV2Parser.Phase3EdgeFinishSyntaxInvalid);
return null;
}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentBuildAdmissionValidation.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentBuildAdmissionValidation.cs
new file mode 100644
index 00000000..0fbae804
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentBuildAdmissionValidation.cs
@@ -0,0 +1,75 @@
+using Aetheris.Kernel.Core.Diagnostics;
+
+namespace Aetheris.Kernel.Firmament.FirmamentV2;
+
+/// <summary>Validation uses the existing engineering compiler, including selection
+/// binding, capability checks, materialization and export. No output file is written.</summary>
+public static class FirmamentBuildAdmissionValidation
+{
+ public static FirmamentV2ValidationReport Admit(
+ FirmamentV2ValidationReport report, string source, string? sourceDirectory = null)
+ {
+ if (report.Status == "invalid") return report;
+ var compilation = FirmamentBuildAndExport.CompileSource(source, sourceDirectory);
+ var diagnostics = report.Diagnostics.Concat(compilation.Diagnostics.Select(diagnostic =>
+ Present(diagnostic, report.Source, source))).Distinct().ToArray();
+ var fatal = diagnostics.Count(diagnostic => diagnostic.Severity == "fatal");
+ return report with
+ {
+ Status = !compilation.IsSuccess || fatal > 0 ? "invalid" : report.Status,
+ ValidationLevel = compilation.IsSuccess ? "Built" : "BuildRejected",
+ Diagnostics = diagnostics,
+ Summary = report.Summary with
+ {
+ FatalDiagnosticCount = fatal,
+ WarningDiagnosticCount = diagnostics.Count(diagnostic => diagnostic.Severity == "warning")
+ }
+ };
+ }
+
+ public static FirmamentV2ValidationDiagnostic Present(KernelDiagnostic diagnostic, string sourceFile, string? source = null)
+ {
+ var separator = diagnostic.Message.IndexOf(':');
+ var code = separator > 0 && !diagnostic.Message[..separator].Any(char.IsWhiteSpace)
+ ? diagnostic.Message[..separator]
+ : diagnostic.Message.All(character => char.IsLetterOrDigit(character) || character is '-' or '_' or '.')
+ ? diagnostic.Message : diagnostic.Code.ToString();
+ return Locate(new(diagnostic.Message, diagnostic.Severity switch
+ {
+ KernelDiagnosticSeverity.Error => "fatal",
+ KernelDiagnosticSeverity.Warning => "warning",
+ _ => "info"
+ }, diagnostic.Message)
+ {
+ SourceFile = sourceFile,
+ Stage = diagnostic.Source,
+ Source = diagnostic.Source,
+ LocationNote = "The owning build stage did not provide an original-source span."
+ }, source, sourceFile) with { Code = code, Message = FirmamentInterop.FirmamentV2DiagnosticAdapter.MessageFor(diagnostic.Message) };
+ }
+
+ public static FirmamentV2ValidationDiagnostic Locate(
+ FirmamentV2ValidationDiagnostic diagnostic, string? source, string sourceFile)
+ {
+ if (source is null) return diagnostic with { SourceFile = sourceFile, LocationNote = "Original source is unavailable." };
+ var tokens = FirmamentLanguageAnalysisService.Lex(source).Where(token => token.Shape != "comment").ToArray();
+ // Only these parser-owned diagnostics identify a specific original token.
+ // All other legacy producers receive a disclosed enclosing declaration span.
+ var parts = diagnostic.Code.Split(':');
+ string? subject = parts[0] is FirmamentV2Parser.CanonicalFieldUnknown or FirmamentV2Parser.CanonicalDeclarationUnknown
+ && parts.Length > 1 ? parts[^1] : null;
+ var matches = subject is null ? [] : tokens.Where(token => token.Shape == "identifier" && token.Text == subject).ToArray();
+ var exact = matches.Length == 1;
+ var token = exact ? matches[0] : tokens.FirstOrDefault(token => token.Shape == "identifier"
+ && token.Text is "Model" or "model" or "Struct" or "Concept" or "Profile" or "Template" or "Assembly" or "Scene");
+ if (token is null) return diagnostic with { SourceFile = sourceFile, LocationNote = "The producer supplied no original-source location." };
+ var line = 1; var column = 1;
+ for (var index = 0; index < token.Start; index++)
+ if (source[index] == '\n') { line++; column = 1; } else column++;
+ return diagnostic with
+ {
+ SourceFile = sourceFile, SourceSpan = new(token.Start, token.Length), Line = line, Column = column,
+ LocationNote = exact ? null : "Document declaration anchor; the producer supplied no precise original-source span."
+ };
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentInterop/FirmamentV2DiagnosticAdapter.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentInterop/FirmamentV2DiagnosticAdapter.cs
index ffd22993..b73605cb 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentInterop/FirmamentV2DiagnosticAdapter.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentInterop/FirmamentV2DiagnosticAdapter.cs
@@ -32,19 +32,39 @@ public static class FirmamentV2DiagnosticAdapter
string? fieldName = null) =>
new(
diagnosticCode,
- diagnosticCode.StartsWith("offset-", StringComparison.Ordinal) || FirmamentV2Parser.IsFatalDiagnosticCode(diagnosticCode)
- ? FirmamentDiagnosticSeverity.Fatal : FirmamentDiagnosticSeverity.Warning,
+ ParserSeverity(diagnosticCode),
MessageFor(diagnosticCode),
FirmamentV2InteropValueAdapter.AdaptSourceSpan(sourceSpan),
target,
fieldName);
- private static string MessageFor(string diagnosticCode) => diagnosticCode switch
+ // Legacy producers still return strings. At this boundary unclassified diagnostics
+ // are errors; adding an error must never require updating an admission allowlist.
+ public static FirmamentDiagnosticSeverity ParserSeverity(string code) => code switch
{
+ FirmamentV2Parser.ToleranceDroppedThroughArithmetic => FirmamentDiagnosticSeverity.Warning,
+ "firmament-v2-parser-invoked" or "firmament-v2-parse-succeeded"
+ or "firmament-concept-ir-resolved" or "firmament-concept-struct-erased-before-feature-air"
+ or "firmament-template-expanded-before-feature-air" => FirmamentDiagnosticSeverity.Info,
+ _ when code.EndsWith("-parsed", StringComparison.Ordinal)
+ || code.EndsWith("-adapted", StringComparison.Ordinal)
+ || code.EndsWith("-symbols-bound", StringComparison.Ordinal) => FirmamentDiagnosticSeverity.Info,
+ _ => FirmamentDiagnosticSeverity.Fatal
+ };
+
+ public static string MessageFor(string diagnosticCode) => diagnosticCode switch
+ {
+ FirmamentV2Parser.CanonicalPrimitiveMalformed => "Malformed primitive: check the required dimension fields and their length units.",
+ FirmamentV2Parser.CanonicalDocumentMalformed => "Malformed Model document. Check its declarations and closing braces.",
+ "firmament-v2-parse-failed" => "Firmament V2 parsing or binding failed; the program has not been admitted for compilation.",
FirmamentV2Parser.PmiDimensionMissingTolerance => "PMI dimension resolves to a value without tolerance evidence.",
FirmamentV2Parser.ConceptMissingRequiredField => "Forge concept application is missing a required descriptor field.",
FirmamentV2Parser.PmiUnknownDatum => "PMI relation references an unknown datum.",
FirmamentV2Parser.ToleranceDroppedThroughArithmetic => "A toleranced value was used in arithmetic and only the nominal value was preserved.",
+ _ when diagnosticCode.StartsWith(FirmamentV2Parser.CanonicalFieldUnknown + ":", StringComparison.Ordinal)
+ => $"Unknown field '{diagnosticCode.Split(':')[^1]}' in {diagnosticCode.Split(':')[1]}. Check this construct's documented fields.",
+ _ when diagnosticCode.StartsWith(FirmamentV2Parser.CanonicalDeclarationUnknown + ":", StringComparison.Ordinal)
+ => $"Unknown statement '{diagnosticCode.Split(':')[^1]}'. Use an admitted construct in this context.",
_ => diagnosticCode
};
}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageAnalysis.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageAnalysis.cs
index ac12ddc8..578c48d0 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageAnalysis.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageAnalysis.cs
@@ -289,13 +289,10 @@ public static class FirmamentLanguageAnalysisService
private static FirmamentLanguageDiagnostic LocateDiagnostic(string source, IReadOnlyList<Lexeme> tokens, string diagnostic)
{
- var separator = diagnostic.LastIndexOf(':');
- var code = separator > 0 ? diagnostic[..separator] : diagnostic;
- var subject = separator > 0 ? diagnostic[(separator + 1)..] : string.Empty;
- var match = tokens.FirstOrDefault(token => token.Text == subject);
- var start = match?.Start ?? Math.Max(0, source.Length - 1);
- var length = match?.Length ?? (source.Length == 0 ? 0 : 1);
- return new("error", code, diagnostic.Replace('-', ' '), start, length);
+ var presented = FirmamentBuildAdmissionValidation.Locate(
+ new(diagnostic, "fatal", FirmamentInterop.FirmamentV2DiagnosticAdapter.MessageFor(diagnostic)), source, "inline");
+ var message = presented.LocationNote is null ? presented.Message : presented.Message + " " + presented.LocationNote;
+ return new("error", diagnostic, message, presented.SourceSpan?.Start ?? 0, presented.SourceSpan?.Length ?? 0);
}
internal static List<Lexeme> Lex(string source)
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
index ea5b4312..5ab53d18 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
@@ -318,6 +318,10 @@ public sealed record FirmamentV2ParseResult(
IReadOnlyList<string> Diagnostics,
FirmamentV2ParseDisposition Disposition = FirmamentV2ParseDisposition.NotRecognized)
{
+ /// <summary>Debug metadata, assigned where the existing parser route is selected.</summary>
+ public string? ParserRoute { get; init; }
+ internal string? OriginalSource { get; init; }
+
public static FirmamentV2ParseResult Success(FirmamentV2Document document, IReadOnlyList<string> diagnostics) => new(true, document, diagnostics, FirmamentV2ParseDisposition.RecognizedValid);
public static FirmamentV2ParseResult Failure(IReadOnlyList<string> diagnostics, FirmamentV2ParseDisposition disposition = FirmamentV2ParseDisposition.RecognizedInvalid) => new(false, null, diagnostics, disposition);
}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
index dc1d79ae..57fbb7a9 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
@@ -94,9 +94,6 @@ public static class FirmamentV2Parser
public const string LetDuplicateName = "firmament-v2-let-duplicate-name";
public const string LetUnknownType = "firmament-v2-let-unknown-type";
public const string LetTypeMismatch = "firmament-v2-let-type-mismatch";
- // Alias retained inside the compact fatal-diagnostic switch below; both
- // spellings denote the same public diagnostic.
- private const string LetMismatch = LetTypeMismatch;
public const string LetInvalidLiteral = "firmament-v2-let-invalid-literal";
public const string LetUnitMismatch = "firmament-v2-let-unit-mismatch";
public const string LetLiteralOnly = "firmament-v2-let-literal-only";
@@ -313,7 +310,7 @@ public static class FirmamentV2Parser
// immutable records, except InlineStep, which reads a STEP file; those, and parses with a
// concept catalog, always run.
if (conceptCatalog is not null || sourceText.Contains("InlineStep", StringComparison.OrdinalIgnoreCase))
- return ParseUncached(sourceText, sourceDirectory, conceptCatalog);
+ return CompleteAdmission(ParseUncached(sourceText, sourceDirectory, conceptCatalog), sourceText);
var key = (sourceDirectory ?? string.Empty) + "\0" + sourceText;
lock (RecentParses)
{
@@ -326,7 +323,7 @@ public static class FirmamentV2Parser
return hit.Result;
}
}
- var result = ParseUncached(sourceText, sourceDirectory, conceptCatalog);
+ var result = CompleteAdmission(ParseUncached(sourceText, sourceDirectory, conceptCatalog), sourceText);
lock (RecentParses)
{
RecentParses.Add((key, result));
@@ -338,11 +335,30 @@ public static class FirmamentV2Parser
private const int RecentParseCapacity = 8;
private static readonly List<(string Key, FirmamentV2ParseResult Result)> RecentParses = [];
+ private static FirmamentV2ParseResult CompleteAdmission(FirmamentV2ParseResult result, string originalSource)
+ {
+ var hasErrors = result.Diagnostics.Any(IsFatalDiagnosticCode);
+ return result with
+ {
+ OriginalSource = originalSource,
+ IsSuccess = result.IsSuccess && !hasErrors,
+ Disposition = hasErrors && result.Disposition != FirmamentV2ParseDisposition.NotRecognized
+ ? FirmamentV2ParseDisposition.RecognizedInvalid : result.Disposition
+ };
+ }
+
private static FirmamentV2ParseResult ParseUncached(
string sourceText,
string? sourceDirectory,
FirmamentV2ForgeConceptCatalog? conceptCatalog)
{
+ // Serialization roots belong to the historical reader, which still must
+ // prove explicit version 1 before execution. Their data values may be V2
+ // keywords; those values must not turn a legacy document into V2 source.
+ var leading = FirmamentLanguageAnalysisService.Lex(sourceText).Where(token => token.Shape != "comment").Take(2).ToArray();
+ if (leading.Length == 2 && (leading[0].Text is "firmament" or "model" && leading[1].Text == ":"
+ || leading[0].Text == "{" && leading[1].Shape == "string"))
+ return FirmamentV2ParseResult.Failure([], FirmamentV2ParseDisposition.NotRecognized) with { ParserRoute = "LegacySerialization" };
sourceText = FirmamentSourceSpelling.Normalize(sourceText);
sourceText = ProfileModificationTemplateLibrary.ResolveImports(sourceText);
var diagnostics = new List<string> { "firmament-v2-parser-invoked" };
@@ -422,12 +438,12 @@ public static class FirmamentV2Parser
diagnostics.AddRange(panelCompilation.Diagnostics);
diagnostics.Add(panelCompilation.IsSuccess ? "firmament-v2-parse-succeeded" : "firmament-v2-parse-failed");
if (!panelCompilation.IsSuccess)
- return FirmamentV2ParseResult.Failure(diagnostics.Distinct(StringComparer.Ordinal).Order().ToArray());
+ return FirmamentV2ParseResult.Failure(diagnostics.Distinct(StringComparer.Ordinal).Order().ToArray()) with { ParserRoute = "Panel" };
var panelDocument = new FirmamentV2Document(panelCompilation.ModelName, "mm", [],
TemplateInstantiations: templateExpansion.Instantiations, Panels: panelCompilation.Panels,
FeatureDefinitions: featureExpansion.Definitions, FeatureInvocations: featureExpansion.Invocations,
FeatureExpansion: featureExpansion.Metrics, Polygons: polygonExpansion.Polygons, Boundaries: polygonExpansion.Boundaries);
- return FirmamentV2ParseResult.Success(panelDocument, diagnostics.Distinct(StringComparer.Ordinal).Order().ToArray());
+ return FirmamentV2ParseResult.Success(panelDocument, diagnostics.Distinct(StringComparer.Ordinal).Order().ToArray()) with { ParserRoute = "Panel" };
}
// Canonical V2 is parsed as one document, before compatibility adapters. The
@@ -439,39 +455,40 @@ public static class FirmamentV2Parser
if (declarationDiagnostics.Count > 0)
{
diagnostics.AddRange(declarationDiagnostics);
- return Recognized(CanonicalFailure(diagnostics, CanonicalDocumentMalformed));
+ return Recognized(CanonicalFailure(diagnostics, CanonicalDocumentMalformed)) with { ParserRoute = "Canonical" };
}
var parsed = Recognized(ContainsCanonicalAdvancedDeclaration(source)
? ParseCanonicalAdvancedDocument(source, diagnostics, templateExpansion.Instantiations)
: ParseCanonicalDocument(source, diagnostics, sourceDirectory));
+ parsed = parsed with { ParserRoute = ContainsCanonicalAdvancedDeclaration(source) ? "CanonicalAdvanced" : "Canonical" };
if (parsed.Document is null) return parsed;
return WithFeatureMetadata(
AttachVolumeAssertionsAndSymbols(WithPolygonMetadata(parsed, polygonExpansion), source, canonicalStaticExpansion.Document, diagnostics),
- featureExpansion);
+ featureExpansion) with { ParserRoute = parsed.ParserRoute };
}
if (Regex.IsMatch(source, @"\b(?:RoundedBox|Frustum|Cylinder|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant))
- return Recognized(ParsePrimitiveConstructionPolicyDocument(source, diagnostics));
+ return Recognized(ParsePrimitiveConstructionPolicyDocument(source, diagnostics)) with { ParserRoute = "PrimitiveConstructionPolicy" };
if (Regex.IsMatch(source, @"\bRoundedBox\s+[A-Za-z_]", RegexOptions.CultureInvariant))
- return Recognized(ParseRoundedBoxModelingDocument(source, diagnostics));
+ return Recognized(ParseRoundedBoxModelingDocument(source, diagnostics)) with { ParserRoute = "RoundedBox" };
// Standalone Profile documents predate the canonical Model wrapper. Keep that
// bounded document form usable when its body uses the preferred pipeline surface,
// including inline guide declarations, instead of falling into an unrelated
// historical modeling parser merely because a Construction Plane has a Concept owner.
if (ProfileAuthoringParser.IsProfileSource(source) && Regex.IsMatch(source, @"\bExtrude\s+[A-Za-z_]\w*\s*\{", RegexOptions.CultureInvariant))
- return Recognized(ParseStandaloneProfileDocument(source, diagnostics));
+ return Recognized(ParseStandaloneProfileDocument(source, diagnostics)) with { ParserRoute = "StandaloneProfile" };
if (Regex.IsMatch(source, @"\bConcept\s+(?:Struct\s+)?[A-Za-z_]", RegexOptions.CultureInvariant)
|| Regex.IsMatch(source, @"\b(?:Struct|Model)\s+[A-Za-z_][A-Za-z0-9_]*\s*(?::\s*[A-Za-z_][A-Za-z0-9_]*)?\s*\{", RegexOptions.CultureInvariant))
return Recognized(WithFeatureMetadata(
AttachVolumeAssertionsAndSymbols(WithPolygonMetadata(ParseConceptModelingDocument(RemoveCanonicalVolumeAssertions(source), diagnostics, templateExpansion.Instantiations), polygonExpansion), source, canonicalStaticExpansion.Document, diagnostics),
- featureExpansion));
+ featureExpansion)) with { ParserRoute = "ConceptModeling" };
if (Regex.IsMatch(source, @"^\s*Model\b", RegexOptions.CultureInvariant))
- return Recognized(ParsePhase3ModelingDocument(source, diagnostics));
+ return Recognized(ParsePhase3ModelingDocument(source, diagnostics)) with { ParserRoute = "Phase3" };
if (ContainsRawBackendId(source)) diagnostics.Add(RawBackendIdReferenceForbidden);
if (ContainsUnsupportedConstruct(source)) diagnostics.Add(UnsupportedConstruct);
@@ -536,12 +553,12 @@ public static class FirmamentV2Parser
return FirmamentV2ParseResult.Failure(diagnostics, FirmamentV2ParseDisposition.NotRecognized);
return document is null
- ? FirmamentV2ParseResult.Failure(diagnostics)
+ ? FirmamentV2ParseResult.Failure(diagnostics) with { ParserRoute = "LegacyLowercase" }
: new FirmamentV2ParseResult(
!hasFatalDiagnostics,
document,
diagnostics,
- hasFatalDiagnostics ? FirmamentV2ParseDisposition.RecognizedInvalid : FirmamentV2ParseDisposition.RecognizedValid);
+ hasFatalDiagnostics ? FirmamentV2ParseDisposition.RecognizedInvalid : FirmamentV2ParseDisposition.RecognizedValid) { ParserRoute = "LegacyLowercase" };
}
private static FirmamentV2ParseResult Recognized(FirmamentV2ParseResult result) =>
@@ -574,15 +591,17 @@ public static class FirmamentV2Parser
? result
: result with { Document = result.Document with { Polygons = expansion.Polygons, Boundaries = expansion.Boundaries } };
- private static bool IsV2AdmissionCandidate(string source) =>
- ModelRegex.IsMatch(source)
- || Regex.IsMatch(source, @"^\s*model\s+[A-Za-z_][A-Za-z0-9_]*\b", RegexOptions.CultureInvariant)
- || TemplateHeaderRegex.IsMatch(source)
- || Regex.IsMatch(source, @"\b(?:RoundedBox|Frustum|Cylinder|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant)
- || Regex.IsMatch(source, @"\bRoundedBox\s+[A-Za-z_]", RegexOptions.CultureInvariant)
- || Regex.IsMatch(source, @"\bConcept\s+(?:Struct\s+)?[A-Za-z_]", RegexOptions.CultureInvariant)
- || Regex.IsMatch(source, @"\b(?:Struct|Model)\s+[A-Za-z_][A-Za-z0-9_]*\s*(?::\s*[A-Za-z_][A-Za-z0-9_]*)?\s*\{", RegexOptions.CultureInvariant)
- || Regex.IsMatch(source, @"^\s*Model\b", RegexOptions.CultureInvariant);
+ private static bool IsV2AdmissionCandidate(string source)
+ {
+ // Classification is independent of whether a declaration is well formed.
+ // Serialization-shaped V1 uses `model:` / `firmament:` instead.
+ var tokens = FirmamentLanguageAnalysisService.Lex(source).Where(token => token.Shape != "comment").ToArray();
+ for (var index = 0; index < tokens.Length; index++)
+ if (tokens[index].Shape == "identifier"
+ && tokens[index].Text is "Model" or "model" or "Struct" or "Assembly" or "Scene" or "Concept" or "Interface" or "Template" or "template" or "Pattern" or "Profile" or "Panel"
+ && (index + 1 == tokens.Length || tokens[index + 1].Text != ":")) return true;
+ return false;
+ }
private static IReadOnlyList<FirmamentV2LetRecordDeclaration> ParseLetRecords(string source, IEnumerable<string> topLevelNames, List<string> diagnostics)
{
@@ -1021,22 +1040,40 @@ public static class FirmamentV2Parser
var known = new HashSet<string>(StringComparer.Ordinal)
{
- "Box", "Cylinder", "Cone", "Sphere", "Torus", "RoundedBox", "Frustum", "StandardPart", "ExactCoaxialPart", "Plane", "Axis2", "Point2", "Line2", "Rect2", "Circle2", "Ellipse2Guide", "SmoothRoundedRect2", "Plateau", "Concept", "Struct", "Construction", "Profile", "Span", "Compose", "Boss", "Pocket", "AddOffset", "RemoveOffset", "EdgeFinish",
- "Record", "Static", "Template", "template", "ProfileDelta", "Selection", "InlineStep", "Recognize", "Replace", "Pmi", "Modify", "Match", "Require", "Assert", "Thread"
+ "Box", "Cylinder", "Cone", "Sphere", "Torus", "RoundedBox", "Frustum", "StandardPart", "ExactCoaxialPart", "Plane", "Axis2", "Point2", "Line2", "CubicBezier2", "Rect2", "Circle2", "Ellipse2Guide", "SmoothRoundedRect2", "Plateau", "Concept", "Struct", "Construction", "Profile", "Span", "Compose", "Boss", "Pocket", "AddOffset", "RemoveOffset", "EdgeFinish",
+ "Extrude", "Record", "Static", "Template", "template", "ProfileDelta", "Selection", "InlineStep", "Recognize", "Replace", "Pmi", "Modify", "Match", "Require", "Assert", "Thread"
};
var compatibilityOnly = new HashSet<string>(StringComparer.Ordinal)
{
"Solid", "Let", "Fill", "Manufacturing", "Feature", "Expose"
};
var diagnostics = new List<string>();
- var header = new Regex(@"(?m)^\s*(?<keyword>[A-Za-z_][A-Za-z0-9_]*)(?:\s*<[^{}>]+>)?(?:\s+[A-Za-z_][A-Za-z0-9_]*){0,4}\s*\{", RegexOptions.CultureInvariant);
- foreach (Match candidate in header.Matches(source[(rootOpen + 1)..rootClose]))
- {
- var absolute = rootOpen + 1 + candidate.Index;
- if (BraceDepth(source, rootOpen + 1, absolute) != 0) continue;
- var keyword = candidate.Groups["keyword"].Value;
- if (known.Contains(keyword)) continue;
- diagnostics.Add((compatibilityOnly.Contains(keyword) ? CanonicalConstructNotYetSupported : CanonicalDeclarationUnknown) + ":" + keyword);
+ var tokens = FirmamentLanguageAnalysisService.Lex(source[(rootOpen + 1)..rootClose])
+ .Where(token => token.Shape != "comment").ToArray();
+ for (var index = 0; index < tokens.Length;)
+ {
+ if (tokens[index].Text == ";") { index++; continue; }
+ var keyword = tokens[index].Text;
+ if (keyword is "Units" or "units" && index + 2 < tokens.Length && tokens[index + 1].Text == ":")
+ { index += 3; continue; }
+ if (!known.Contains(keyword))
+ {
+ if (!compatibilityOnly.Contains(keyword)) diagnostics.Add(CanonicalDeclarationUnrecognized);
+ diagnostics.Add((compatibilityOnly.Contains(keyword) ? CanonicalConstructNotYetSupported : CanonicalDeclarationUnknown) + ":" + keyword);
+ }
+ // The admitted unbraced Profile form has four tokens and no executable body.
+ if (keyword == "Profile" && index + 3 < tokens.Length && tokens[index + 2].Text == "From")
+ { index += 4; continue; }
+ while (index < tokens.Length && tokens[index].Text != "{") index++;
+ if (index == tokens.Length) { diagnostics.Add(CanonicalDocumentMalformed); break; }
+ var depth = 0;
+ do
+ {
+ if (tokens[index].Text == "{") depth++;
+ else if (tokens[index].Text == "}") depth--;
+ index++;
+ } while (index < tokens.Length && depth > 0);
+ if (depth != 0) diagnostics.Add(CanonicalDocumentMalformed);
}
return diagnostics.Distinct(StringComparer.Ordinal).ToArray();
}
@@ -1540,6 +1577,8 @@ public static class FirmamentV2Parser
var close = FindMatchingBrace(body, open);
if (close < 0) return CanonicalFailure(diagnostics, CanonicalModifyMalformed);
var modifyBody = body[(open + 1)..close];
+ diagnostics.AddRange(ValidateCanonicalModifyStatements(modifyBody));
+ if (diagnostics.Any(IsFatalDiagnosticCode)) return CanonicalFailure(diagnostics, CanonicalModifyMalformed);
if (solid.Box is null && !CanonicalPerforationHeaderRegex.IsMatch(modifyBody)) return CanonicalFailure(diagnostics, ModifyTargetNotSolid);
var holes = ParseCanonicalHoles(modifyBody, solid, rootOpen + 1 + open + 1, diagnostics);
var perforations = ParseCanonicalPerforations(modifyBody, rootOpen + 1 + open + 1, diagnostics);
@@ -1681,6 +1720,15 @@ public static class FirmamentV2Parser
private static FirmamentV2PrimitiveRecord? ParseCanonicalPrimitive(string type, string body, List<string> diagnostics)
{
+ // Product recipes have separately owned, family-dependent schemas.
+ if (type is not ("StandardPart" or "ExactCoaxialPart") && FirmamentSemanticSchemas.Get(type) is { } schema)
+ {
+ var unknown = ReadAuthoredFields(body, 0)
+ .Where(field => !schema.Fields.Any(known => known.Name == field.Name
+ || FirmamentSourceSpelling.PreferredField(known.Name) == field.Name)).ToArray();
+ foreach (var field in unknown) diagnostics.Add($"{CanonicalFieldUnknown}:{type}:{field.Name}");
+ if (unknown.Length > 0) return null;
+ }
double Number(string field, bool allowZero = false)
{
var match = Regex.Match(body, $@"\b{field}\s*:\s*(?<value>[-+0-9.eE]+)mm\b", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
@@ -1727,6 +1775,34 @@ public static class FirmamentV2Parser
};
}
+ private static IReadOnlyList<string> ValidateCanonicalModifyStatements(string body)
+ {
+ var tokens = FirmamentLanguageAnalysisService.Lex(body).Where(token => token.Shape != "comment").ToArray();
+ var diagnostics = new List<string>();
+ for (var index = 0; index < tokens.Length;)
+ {
+ if (tokens[index].Text == ";") { index++; continue; }
+ var keyword = tokens[index].Text;
+ var admitted = keyword is "Hole" or "EdgeFinish" or "Perforation"
+ || keyword is "Radial" or "Linear" && index + 1 < tokens.Length && tokens[index + 1].Text == "Pattern"
+ || keyword == "Mirrored" && index + 1 < tokens.Length && tokens[index + 1].Text == "Feature";
+ if (!admitted) diagnostics.Add($"{CanonicalDeclarationUnknown}:Modify:{keyword}");
+ // Existing feature parsers own headers and fields. Consume exactly one
+ // balanced statement block here, so unowned neighbours cannot disappear.
+ while (index < tokens.Length && tokens[index].Text != "{") index++;
+ if (index == tokens.Length) { diagnostics.Add(CanonicalModifyMalformed); break; }
+ var depth = 0;
+ do
+ {
+ if (tokens[index].Text == "{") depth++;
+ else if (tokens[index].Text == "}") depth--;
+ index++;
+ } while (index < tokens.Length && depth > 0);
+ if (depth != 0) diagnostics.Add(CanonicalModifyMalformed);
+ }
+ return diagnostics;
+ }
+
private static IReadOnlyList<FirmamentV2PerforationDecl> ParseCanonicalPerforations(string body, int bodyOffset, List<string> diagnostics)
{
var result = new List<FirmamentV2PerforationDecl>();
@@ -1859,9 +1935,7 @@ public static class FirmamentV2Parser
}
private static bool CanonicalBodyHasUnknownField(string body, IReadOnlyCollection<string> knownFields) =>
- Regex.Matches(body, @"(?m)^\s*(?<field>[A-Za-z_][A-Za-z0-9_]*)\s*:", RegexOptions.CultureInvariant)
- .Cast<Match>()
- .Any(match => !knownFields.Contains(match.Groups["field"].Value, StringComparer.Ordinal));
+ ReadAuthoredFields(body, 0).Any(field => !knownFields.Contains(field.Name, StringComparer.Ordinal));
// Canonical semantic STEP declarations bind directly to the normalized V2 nodes
// used by the compatibility parser. FaceRefs deliberately remain STEP entities
@@ -2291,7 +2365,7 @@ public static class FirmamentV2Parser
private static FirmamentV2ParseResult ParseConceptModelingDocument(string source, List<string> diagnostics, IReadOnlyList<ConceptIrTemplateInstantiation>? templateInstantiations = null)
{
var resolution = ConceptIrResolver.Resolve(source, diagnostics);
- if (resolution is null || diagnostics.Any(IsConceptFatalDiagnostic))
+ if (resolution is null || diagnostics.Any(IsFatalDiagnosticCode))
{
diagnostics.Add("firmament-v2-parse-failed");
diagnostics.Sort(StringComparer.Ordinal);
@@ -2326,27 +2400,9 @@ public static class FirmamentV2Parser
return double.TryParse(source[..^2], NumberStyles.Float, CultureInfo.InvariantCulture, out var value) ? value : double.NaN;
}
- internal static bool IsConceptFatalDiagnostic(string code) =>
- code is HoleConstructionPlaneNotFound or HolePlacementMixed or HolePlacementDuplicate or HoleConstructionPlaneCenterMissing or HoleConstructionPlaneExtentUnsupported or HoleConstructionPlaneHostUnsupported or HoleBlindDepthMissing or HoleBlindDepthInvalid or HoleDrillPointAngleInvalid or HoleTerminationConflictsWithExtent
- ||
- code.StartsWith(ConceptIrResolver.MissingMember, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.UnknownMember, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.TypeMismatch, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.InvalidSpatialDerivation, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.IndexOutOfRange, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.CircularDependency, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.MaterializedPhaseReference, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.DuplicateDeclaration, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.DuplicateExposedMember, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.InvalidMaterializedReference, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.ExposedMemberUnrepresentable, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.CircularExposureDependency, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.PointNotOnPlacementPlane, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.PointOutsidePlacementFace, StringComparison.Ordinal)
- || code.StartsWith(ConceptIrResolver.PointProjectionUnsupported, StringComparison.Ordinal)
- || code.StartsWith("firmament-static-", StringComparison.Ordinal);
-
- public static bool IsFatalDiagnosticCode(string code) => code.StartsWith("firmament-v2-thread-", StringComparison.Ordinal) || code.StartsWith("perforation-", StringComparison.Ordinal) || code.StartsWith("firmament-v2-hole-wall-", StringComparison.Ordinal) || code.StartsWith(RevolveAuthoringParser.Prefix, StringComparison.Ordinal) || code.StartsWith(FirmamentV2FeatureExpansion.Prefix, StringComparison.Ordinal) || code.StartsWith("firmament-pipeline-", StringComparison.Ordinal) || code.StartsWith("firmament-profile-pipeline-", StringComparison.Ordinal) || code.StartsWith("firmament-profile-traceloop-", StringComparison.Ordinal) || code.StartsWith("firmament-profile-segment-", StringComparison.Ordinal) || code.StartsWith("firmament-boss-", StringComparison.Ordinal) || code.StartsWith("firmament-pocket-", StringComparison.Ordinal) || code.StartsWith("feature-support-", StringComparison.Ordinal) || code.StartsWith("compose-role-cardinality:", StringComparison.Ordinal) || code.StartsWith(ModifyTargetNotBoundToActiveCompose, StringComparison.Ordinal) || code.StartsWith("firmament-v2-assert-volume-", StringComparison.Ordinal) || code.StartsWith(SemanticConstraintMalformed, StringComparison.Ordinal) || code.StartsWith(SemanticConstraintUnsupported, StringComparison.Ordinal) || code.StartsWith(SemanticConstraintDimensionMismatch, StringComparison.Ordinal) || code.StartsWith(SemanticConstraintValidationFailed, StringComparison.Ordinal) || code.StartsWith(PmiProjectionUnknownRequire, StringComparison.Ordinal) || code.StartsWith(PmiProjectionUnsupportedKind, StringComparison.Ordinal) || code.StartsWith(PmiProjectedFieldMustNotOverrideSourceConstraint, StringComparison.Ordinal) || code.StartsWith(AssertVolumeKindUnsupported, StringComparison.Ordinal) || code.StartsWith(CanonicalDeclarationUnknown + ":", StringComparison.Ordinal) || code.StartsWith(CanonicalConstructNotYetSupported + ":", StringComparison.Ordinal) || code.StartsWith(EdgeFinishProfileComposeBoundaryUnsupported, StringComparison.Ordinal) || IsConceptFatalDiagnostic(code) || code is UnknownConstructionPolicy or PrimitiveDoesNotSatisfyHollowConstructible or WallThicknessRequired or WallThicknessMustBePositive or UnsupportedOpening or MultipleOpeningsNotSupported or Phase3EdgeFinishSyntaxInvalid or PrimitiveFieldMissing or PrimitiveFieldUnknown or PrimitiveFieldInvalid or MissingModel or MissingUnits or MissingSolid or UnsupportedConstruct or UnknownRecordType or BoxMissingSize or BoxSizeArity or DegenerateDimension or NameUnresolved or DuplicateName or WithRequiresRecord or WithRequiresBoxRecord or WithFieldNotFound or WithFieldTypeMismatch or WithForwardReference or WithDerivedRecordInvalid or ExposeBlockUnsupported or ExposeRequiresBoxRecord or ExposeAliasDuplicate or ExposeAliasInvalid or SelectorUnsupported or SelectorAxisInvalid or SelectorSubselectorUnsupported or FatArrowOutsideExpose or RawBackendIdReferenceForbidden or ModifyTargetUnresolved or ModifyTargetNotSolid or RegionUnsupported or RegionAttachmentSelectorUnsupported or CutUnsupported or CutToolUnsupported or CylinderRadiusMissing or CylinderRadiusInvalid or CylinderRadiusNotFinite or ThroughSelectorUnsupported or AliasUnresolved or AliasRefTypeUnsupported or SideHoleAliasMustResolveToFace or SideHoleAliasResolvesToUnsupportedFace or SideHoleOnlyPlusXMinusXSupported or SideHoleRouteUnsupported or SideHoleSameFaceUnsupported or SideHoleAxisNotYetSupported or SideHoleRadiusExceedsClearance or CylinderCenterInvalid or CylinderCenterArityInvalid or CylinderCenterNotFinite or SideHoleCenterExceedsClearance or HoleVariantUnknown or HoleEntryFaceMissing or HoleCenterMissing or HoleShaftMissing or HoleEndMissing or HoleDiameterInvalid or HoleDepthInvalid or HoleCounterboreInvalid or HoleCountersinkInvalid or PmiKindUnknown or PmiTargetMissing or PmiTargetUnresolved or PmiDiameterInvalid or PmiDuplicateName or InlineStepUnknownBody or InlineStepUnknownFace or PmiImportedTargetNotFace or PmiImportedTargetRequiresCanonicalStep or PmiInvalidImportedTarget or InlineStepPathMissing or InlineStepPathInvalid or InlineStepFileMissing or InlineStepRequiresCanonical or UnknownRecognitionBody or UnknownRecognitionFace or DuplicateRegion or UnknownRecognitionRegion or InvalidRecognitionKind or InvalidRecognitionConfidence or PmiRecognizedRegionKindMismatch or UnknownReplacementBody or UnknownReplacementRegion or ReplacementKindMismatch or ReplacementFaceUnresolved or ReplacementUnsupportedKind or ReplacementVerificationFailed or ReplacementRadiusInvalid or ReplacementEndUnsupported or LetDuplicateName or LetUnknownType or LetMismatch or LetInvalidLiteral or LetUnitMismatch or LetLiteralOnly or LetRecordDuplicateName or LetRecordDuplicateField or LetReferenceUnknownRecord or LetReferenceUnknownField or LetReferenceNonRecord or LetReferenceRecordUsedAsValue or ExpressionUnknownSymbol or ExpressionUnknownRecord or ExpressionUnknownField or ExpressionRecordUsedAsValue or ExpressionScalarUsedAsRecord or ExpressionTypeMismatch or ExpressionInvalidOperator or ExpressionDivisionByZero or ExpressionCycle or ExpressionUnsupported or ToleranceInvalidType or ToleranceUnitMismatch or ToleranceInvalidLiteral or ToleranceNegativeBilateral or ToleranceMissingMinus or ToleranceMissingPlus or ToleranceUnsupported or RecognitionEvidenceRadiusInvalid or RecognitionEvidenceSurfaceFamilyUnknown or RecognitionEvidenceAxisInvalid or SemanticProposalKindMismatch or SemanticProposalRadiusInvalid or SemanticProposalTargetUnresolved or SemanticProposalEndUnsupported or ConceptUnknownFamily or ConceptUnknownConcept or ConceptMissingRequiredField or ConceptUnknownField or ConceptDuplicateField or ConceptFieldTypeMismatch or ConceptInvalidTarget or ConceptDescriptorUnavailable or PmiDuplicateBlock or PmiDuplicateRecord or PmiDuplicateDatum or PmiUnknownRecordKind or PmiMissingRequiredField or PmiUnknownField or PmiDuplicateField or PmiInvalidTarget or PmiUnknownDatum or PmiDimensionTypeMismatch or PmiDimensionMissingTolerance or PmiToleranceTypeMismatch or StandaloneFillRegionRequired or UnsupportedStandaloneFillPattern or InvalidCellCount or CellSizeMustBePositive or StrutRadiusMustBePositive or NodeRadiusMustBePositive or MaterialBoundsMismatch or StandaloneFillMultipleUnsupported;
+ public static bool IsFatalDiagnosticCode(string code) =>
+ FirmamentInterop.FirmamentV2DiagnosticAdapter.ParserSeverity(code)
+ == Aetheris.Forge.Abstractions.FirmamentInterop.FirmamentDiagnosticSeverity.Fatal;
private static IReadOnlyList<FirmamentV2Exposure> ParseExposures(string body, List<string> diagnostics)
{
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2ValidationReport.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2ValidationReport.cs
index 105c6894..26bb9e37 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2ValidationReport.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2ValidationReport.cs
@@ -13,10 +13,24 @@ public sealed record FirmamentV2ValidationReport(
IReadOnlyList<FirmamentV2ValidationConceptPmiObligation> ConceptPmiObligations,
FirmamentV2ValidationExportSupport ExportSupport,
IReadOnlyList<FirmamentV2ValidationDiagnostic> Diagnostics,
- FirmamentV2ValidationSummary Summary);
+ FirmamentV2ValidationSummary Summary)
+{
+ public string ValidationLevel { get; init; } = "ParsedNotBuilt";
+ public string? ParserRoute { get; init; }
+ public string LanguageVersion { get; init; } = "V2";
+}
public sealed record FirmamentV2ValidationSummary(int LetCount, int TolerancedLetCount, int ConceptCount, int ValidConceptCount, int PmiRecordCount, int ExportSupportedPmiCount, int ExportDeferredPmiCount, int PmiObligationCount, int SatisfiedPmiObligationCount, int MissingPmiObligationCount, int FatalDiagnosticCount, int WarningDiagnosticCount);
-public sealed record FirmamentV2ValidationDiagnostic(string Code, string Severity, string Message, string? FieldName = null, string? Target = null);
+public sealed record FirmamentV2ValidationDiagnostic(string Code, string Severity, string Message, string? FieldName = null, string? Target = null)
+{
+ public string? SourceFile { get; init; }
+ public FirmamentV2SourceSpan? SourceSpan { get; init; }
+ public string? LocationNote { get; init; }
+ public string? Stage { get; init; }
+ public string? Source { get; init; }
+ public int? Line { get; init; }
+ public int? Column { get; init; }
+}
public sealed record FirmamentV2ValidationExportSupport(int SupportedPmiCount, int DeferredPmiCount, IReadOnlyDictionary<string, string> Matrix);
public sealed record FirmamentV2ValidationLet(string Name, string Type, string Nominal, FirmamentV2ValidationTolerance? Tolerance, string Source, IReadOnlyList<string> Dependencies, IReadOnlyList<FirmamentV2ValidationDiagnostic> Diagnostics);
public sealed record FirmamentV2ValidationTolerance(string Kind, string Plus, string Minus);
@@ -33,7 +47,8 @@ public static class FirmamentV2ValidationReportBuilder
FirmamentV2ParseResult parse,
string source = "inline",
FirmamentV2RuntimeConceptValidationResult? runtimeValidation = null,
- FirmamentV2ForgeConceptCatalog? conceptCatalog = null)
+ FirmamentV2ForgeConceptCatalog? conceptCatalog = null,
+ string? sourceText = null)
{
runtimeValidation ??= FirmamentV2RuntimeConceptValidation.Validate(parse.Document);
conceptCatalog ??= FirmamentV2ForgeConceptRegistry.Catalog;
@@ -45,6 +60,9 @@ public static class FirmamentV2ValidationReportBuilder
.Distinct()
.ToArray();
+ if (!parse.IsSuccess && diagnostics.All(diagnostic => diagnostic.Severity != "fatal"))
+ diagnostics = [.. diagnostics, ToParserDiagnostic("firmament-v2-parse-failed")];
+
var fatalCount = diagnostics.Count(diagnostic => diagnostic.Severity == "fatal");
var warningCount = diagnostics.Count(diagnostic => diagnostic.Severity == "warning");
var document = parse.Document;
@@ -57,12 +75,13 @@ public static class FirmamentV2ValidationReportBuilder
diagnostics = diagnostics
.Concat(conceptPmiEvaluation.Diagnostics)
.Distinct()
+ .Select(diagnostic => FirmamentBuildAdmissionValidation.Locate(diagnostic, sourceText ?? parse.OriginalSource, source))
.ToArray();
fatalCount = diagnostics.Count(diagnostic => diagnostic.Severity == "fatal");
warningCount = diagnostics.Count(diagnostic => diagnostic.Severity == "warning");
var supported = pmi.Count(record => record.ExportSupport is "supported" or "supported-when-target-resolves");
var deferred = pmi.Count(record => record.ExportSupport == "deferred");
- var status = fatalCount > 0 ? "invalid" : deferred > 0 ? "valid-with-deferred-export" : "valid";
+ var status = !parse.IsSuccess || fatalCount > 0 ? "invalid" : deferred > 0 ? "valid-with-deferred-export" : "valid";
var summary = new FirmamentV2ValidationSummary(
lets.Count,
lets.Count(row => row.Tolerance is not null),
@@ -87,7 +106,11 @@ public static class FirmamentV2ValidationReportBuilder
conceptPmiEvaluation.Obligations,
new FirmamentV2ValidationExportSupport(supported, deferred, ExportMatrix),
diagnostics,
- summary);
+ summary)
+ {
+ ParserRoute = parse.ParserRoute,
+ LanguageVersion = parse.Disposition == FirmamentV2ParseDisposition.NotRecognized ? "Unrecognized" : "V2"
+ };
}
private static IReadOnlyList<FirmamentV2ValidationLet> BuildLets(FirmamentV2Document document)
@@ -306,18 +329,10 @@ public static class FirmamentV2ValidationReportBuilder
private static FirmamentV2ValidationDiagnostic ToParserDiagnostic(string code) =>
new(code, IsFatal(code) ? "fatal" : "warning", Message(code));
- private static bool IsFatal(string code) =>
- code.StartsWith("offset-", StringComparison.Ordinal)
- || code.StartsWith(SemanticSymmetryAuthoring.Prefix, StringComparison.Ordinal)
- || code.StartsWith("firmament-span-", StringComparison.Ordinal)
- || code.StartsWith("firmament-feature-footprint-outside-span:", StringComparison.Ordinal)
- || FirmamentV2Parser.IsFatalDiagnosticCode(code);
+ private static bool IsFatal(string code) => FirmamentV2Parser.IsFatalDiagnosticCode(code);
private static bool IsParserTraceDiagnostic(string code) =>
- code is "firmament-v2-parser-invoked" or "firmament-v2-parse-succeeded"
- || code.EndsWith("-parsed", StringComparison.Ordinal)
- || code.EndsWith("-adapted", StringComparison.Ordinal)
- || code.EndsWith("-symbols-bound", StringComparison.Ordinal);
+ FirmamentInterop.FirmamentV2DiagnosticAdapter.ParserSeverity(code) == FirmamentDiagnosticSeverity.Info;
private static FirmamentV2ValidationDiagnostic ToRuntimeDiagnostic(FirmamentDiagnostic diagnostic) =>
new(
@@ -332,14 +347,7 @@ public static class FirmamentV2ValidationReportBuilder
diagnostic.FieldName,
diagnostic.Target);
- private static string Message(string code) => code switch
- {
- FirmamentV2Parser.PmiDimensionMissingTolerance => "PMI dimension resolves to a value without tolerance evidence.",
- FirmamentV2Parser.ConceptMissingRequiredField => "Forge concept application is missing a required descriptor field.",
- FirmamentV2Parser.PmiUnknownDatum => "PMI relation references an unknown datum.",
- FirmamentV2Parser.ToleranceDroppedThroughArithmetic => "A toleranced value was used in arithmetic and only the nominal value was preserved.",
- _ => code
- };
+ private static string Message(string code) => FirmamentInterop.FirmamentV2DiagnosticAdapter.MessageFor(code);
private static FirmamentV2ValidationTolerance? ToTolerance(FirmamentV2Tolerance? tolerance) =>
tolerance is null
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
index 7d47b8bb..e1e08837 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
@@ -1088,7 +1088,21 @@ public static class ProfileAuthoringParser
{
if (frame is null) return ConstructionPlane.WorldXY;
var plane = ConstructionPlaneDeclaration.Matches(source).Cast<Match>().SingleOrDefault(x => x.Groups["name"].Value == frame);
- if (plane is null) return ConstructionPlane.WorldXY;
+ if (plane is null)
+ {
+ if (frame == "XY") return ConstructionPlane.WorldXY;
+ var tokens = FirmamentLanguageAnalysisService.Lex(source).Where(token => token.Shape != "comment").ToArray();
+ for (var index = 0; index + 3 < tokens.Length; index++)
+ {
+ if (tokens[index].Text != "Concept" || tokens[index + 1].Text != "Struct" || tokens[index + 2].Text != frame) continue;
+ if (tokens[index + 3].Text is not ("On" or "on")) return ConstructionPlane.WorldXY;
+ if (index + 4 < tokens.Length && tokens[index + 4].Text == "XY") return ConstructionPlane.WorldXY;
+ diagnostics.Add($"profile-layout-placement-unsupported:{frame}:{(index + 4 < tokens.Length ? tokens[index + 4].Text : "missing")}:Concept Struct layouts currently require On XY; use a traced Construction Plane for oriented profiles.");
+ return null;
+ }
+ diagnostics.Add($"profile-frame-unresolved:{frame}:Using must name a declared Concept Struct or Construction Plane.");
+ return null;
+ }
if (!ConceptIrResolver.TryResolvePlane(source, plane.Groups["trace"].Value, out var conceptPlane, out var traceDiagnostic) || conceptPlane is null) { diagnostics.Add(traceDiagnostic ?? "ConstructionPlaneTraceMissing"); return null; }
if (!ConstructionPlane.TryTrace("construction:" + frame, conceptPlane, $"offset:{plane.Index}", out var result, out var frameDiagnostic)) diagnostics.Add(frameDiagnostic ?? "ConstructionPlaneFrameInvalid");
return result;
diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
index 1df096be..5bacc0c8 100644
--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
@@ -396,7 +396,7 @@ public static class PrismaticProfileCompositionParser
}
if (remaining <= 1e-7d)
{
- diagnostics.Add($"firmament-pocket-through-depth:{name}:host={compose.Groups["n"].Value}:depth={depth:R}mm:hostThickness={hostThickness:R}mm:remainingFloor={remaining:R}mm:requiredFloor={minimumFloor:R}mm");
+ diagnostics.Add($"firmament-pocket-through-depth:{name}:host={compose.Groups["n"].Value}:depth={depth:R}mm:hostThickness={hostThickness:R}mm:remainingFloor={remaining:R}mm:requiredFloor={minimumFloor:R}mm:Use Remove with Role: ThroughCut for a through cut; Pocket requires a remaining floor.");
continue;
}
if (remaining + 1e-7d < minimumFloor)
diff --git a/docs/development/FIRMAMENT-LANGUAGE-DECISIONS-2026-10.md b/docs/development/FIRMAMENT-LANGUAGE-DECISIONS-2026-10.md
new file mode 100644
index 00000000..a60a4be5
--- /dev/null
+++ b/docs/development/FIRMAMENT-LANGUAGE-DECISIONS-2026-10.md
@@ -0,0 +1,38 @@
+# October 2026 Firmament language decision register
+
+Source: [Claude's original authoring audit](firmament-authoring-pass-2026-10.md).
+This register preserves its 24 recommendations and their rationale. A future
+milestone assignment is a disposition, not an implemented feature. X0 remains
+partially qualified; see [the release report](../release/FIRMAMENT-FRONTEND-X0.md).
+
+| # | Original recommendation and rationale | Disposition | Decision / remaining boundary |
+| --- | --- | --- | --- |
+| 1 | Validate through parsing, binding and capability admission; F2/F5/F10/F18/F22 contradicted builds | Fixed in X0, bounded | Generic mechanical validation invokes existing CompileSource; static/external-pack analysis is explicitly ParsedNotBuilt. Specialized domains and source consumption remain unqualified. |
+| 2 | Every V2 error stops compilation; no fatal-code allowlist or accidental V1 fallback | Fixed in X0 for fallback; X1 unified parser for profile admission | Shared severity adapter defaults legacy diagnostic strings to errors; explicit traces/information and the existing tolerance warning remain nonfatal. The attempted universal gate exposed legitimate junction/derived-profile admission missing from the generic parser and was backed out; this remains an explicit gap. Serialization-shaped roots remain with the legacy reader even when data values are V2 keywords; that reader must prove explicit version 1. |
+| 3 | Unknown statements/fields must error; never silently omit Fillet | X1 unified parser, partially fixed in X0 | Canonical root/Modify block checks use lexer boundaries; Box fields reuse generated metadata. Advanced Compose and erased boundary fields still need consumption receipts. |
+| 4 | Every error has a sentence, span and consistent JSON; preserve SemanticSourceNotFound text | X1 unified parser, partially fixed in X0 | Generic build/report share an object shape and original token spans where identifiable. Enclosing locations disclose lost provenance. Legacy/domain producers still need typed located diagnostics. |
+| 5 | Reject ignored frames such as On XZ | Fixed in X0, bounded | Profile layout frame resolution rejects unsupported XZ and unresolved Using frames. Asymmetric bounds witness retained. This does not qualify every attachment/frame owner. |
+| 6 | Correct Model summary and suggest through-cut vocabulary for Pocket | Fixed in X0 | Document owner is projected from existing semantic parse metadata; Pocket through-depth error suggests Remove with Role: ThroughCut. |
+| 7 | Parse once into an AST over Lex, migrate construct families in shadow mode | X1 unified parser | Route metadata now comes from actual branch selection. No AST or new route architecture added. |
+| 8 | Replace text rewrites with AST transforms; lexical Pattern substitution leaks scope | X1 unified parser | First retain consumed spans and expansion origin receipts; then migrate transforms in shadow mode. |
+| 9 | One expression evaluator in every value position | X2 semantic consolidation | Do not expand arithmetic admission during X0. Existing owner-specific evaluators remain. |
+| 10 | One point literal: arrays and typed Point2 constructor mean the same thing | X3 syntax reconciliation | Preserve existing route-dependent aliases; do not broaden syntax by accidental regex acceptance. |
+| 11 | One generic variant mechanism; EdgeFinish<Chamfer/Fillet>, retaining Kind alias | X3 syntax reconciliation | Generic EdgeFinish is not implemented. Its failed build is now rejected by normal validation. |
+| 12 | Unify five Pattern spellings around finite sources and feature expressions | X3 syntax reconciliation | Binding and source provenance prerequisites belong to X1/X2; no Pattern rewrite in X0. |
+| 13 | One cut vocabulary; through-Pocket and Add/Remove aliases | X3 syntax reconciliation | Existing finite Pocket versus Remove ThroughCut distinction is retained and diagnosed. Adding termination semantics is not an X0 repair. |
+| 14 | One rule for optional/required Model roots | X3 syntax reconciliation | Preserve current roots until route identity and consumed-source equivalence are established in X1. |
+| 15 | Remove nonexistent documented schema and invalid nesting examples | Fixed in X0 in part; X4 authoring retest | Removed nonexistent schema Revolve and reconciled casing prose. Complete Feature/Pattern nesting retest remains X4. |
+| 16 | Newline and semicolon separators everywhere | X3 syntax reconciliation | Existing separators preserved; root and Modify unknown checks no longer depend on line-start regex matching. |
+| 17 | One casing doctrine, with preserved domain symbols; reconcile Pmi/PMI | X3 syntax reconciliation | Documentation now states PascalCase constructs, camelCase fields, accepted owner-specific aliases. Global normalization and Pmi reconciliation deferred. |
+| 18 | Retire or justify rare one-off constructs; consider library Features | Rejected/deferred with reason | Frequency alone is insufficient evidence to delete admitted engineering constructs or churn stable identities. Review after X1 corpus equivalence. |
+| 19 | Scope-local named values with arithmetic | X2 semantic consolidation | General Let remains a non-goal for X0; decide syntax only after binding ownership is unified. |
+| 20 | Inline vertex lists for polygon/revolve outlines | X3 syntax reconciliation | No new polygon/revolve grammar during X0. Existing named-point diagnostics retained. |
+| 21 | Uniform planar-face references (+Z, face(+Z), Body.Top, Top) | X2 semantic consolidation | Typed target binding must precede alias expansion; current owner-specific constraints remain explicit. |
+| 22 | Explain route, expansion and bound Pattern instances | Fixed in X0, bounded; X1 unified parser for full expansion | --explain prints actual selected route, admission level and readily available template/solid counts. Complete expanded-source/source-map explanation deferred. |
+| 23 | Generate a grammar reference from the AST | X1 unified parser | Existing opt-in semantic field metadata is not a complete grammar; do not present it as one. |
+| 24 | Fillet+Hole, box shell/hollow, non-XY Compose capability gaps | Separate geometry/kernel feature | Improve rejection and preserve existing admitted frame mechanisms. No new kernel feature or general plane capability added. |
+
+The September [profile-pipeline audit](firmament-v2-language-audit.md) and earlier
+[reconciliation register](firmament-language-inconsistencies.md) are historical
+evidence, not proof that October's route-dependent behavior is resolved. Their
+previous resolved classifications must be read with this qualification.
diff --git a/docs/development/firmament-authoring-pass-2026-10.md b/docs/development/firmament-authoring-pass-2026-10.md
new file mode 100644
index 00000000..277ea000
--- /dev/null
+++ b/docs/development/firmament-authoring-pass-2026-10.md
@@ -0,0 +1,276 @@
+# Firmament V2: authoring pass and language tuning list
+
+Date: 2026-10-13. Method: Claude wrote twelve ordinary parts from a one-line engineering
+brief each, using only `docs/public/firmament`. It ran `aetheris validate --json` and
+`aetheris build`, checked the STEP bounds and face counts, and then read the parser to
+find the cause of every failure. The parser is the source of truth for this document.
+Earlier audits ([language audit](firmament-v2-language-audit.md), which covers profile
+pipelines, and the [reconciliation register](firmament-language-inconsistencies.md))
+are referenced where this pass contradicts them.
+
+## 1. Scoreboard
+
+| # | Part | First try | Outcome |
+|---|---|---|---|
+| 1 | Plate with holes and a fillet | ✗ | Built after 10 variants; the fillet could not be combined with holes |
+| 2 | L-bracket from a point outline | ✗ | Built, **in the wrong plane** (`On XZ` silently ignored) |
+| 3 | Revolved bushing | ✗ | `schema Revolve` is documented but does not exist; worked under `Mechanical` |
+| 4 | Spacer family (Record + Template) | ✓ | |
+| 5 | Plate with a 3×2 hole grid | ✗ | Worked only as a bare `Struct`; wrapping it in `Model` breaks it |
+| 6 | Enclosure tray (Compose + Pocket) | ✓ | |
+| 7 | Two-part assembly with datum ports | ✓ | |
+| 8 | Spring and hook (WireForm) | ✓ | |
+| 9 | NEMA17 plate (Static + Feature + Pattern) | ✗ | Worked only inside `Model` and only with literal coordinates; the opposite of #5 |
+| 10 | Flange with a radial bolt circle | ✓ | |
+| 11 | Bent tube (Sweep) | ✓ | |
+| 12 | Slot block: slot, counterbores, chamfer | ✗ | Built after 9 variants |
+
+6 of 12 parts built on the first try, and 11 of 12 built correct geometry in the end.
+**The failures are not spread evenly.** Every domain with a single owner worked on the
+first try: WireForm, Sweep, Revolve, Record/Template, Assembly and radial Pattern. Every
+failure is in the general mechanical core: Box/Hole/Modify/Compose/Pattern/EdgeFinish.
+Those are the constructs a new user writes first, and the core is where several
+parsers overlap.
+
+## 2. Why: what the parser does
+
+`FirmamentV2Parser.ParseUncached` is not a grammar. It works like this:
+
+1. **Five text-to-text rewrites** run before anything is parsed: spelling
+ normalization, template imports, `ClosedBoundary2Authoring` (which runs twice),
+ Template expansion, Feature expansion, and `CanonicalStaticAuthoring`. Each one is a
+ regex pass over the source string.
+2. **A whole-document regex dispatch** then picks one of nine document parsers:
+ Panel, CanonicalAdvanced, Canonical, PrimitiveConstructionPolicy, RoundedBox,
+ StandaloneProfile, ConceptModeling, Phase3, and the legacy lowercase route
+ (`FirmamentV2Parser.cs:419-474`). The choice depends on *which other constructs
+ appear anywhere in the file*.
+3. The front end has **869 `Regex` call sites** (323 in `FirmamentV2Parser.cs` alone).
+ A real lexer already exists (`FirmamentLanguageAnalysisService.Lex`, used by the
+ spelling normalizer and the formatter), but the parser does not use it.
+
+Most of the findings follow directly from this design:
+
+- **The same statement means different things on different routes.**
+ - `Hole<Shaft> { On: +Z; Center: Point2(0mm,0mm) ... }` builds under `Model` (#9).
+ - Under a top-level `Struct`, the ConceptModeling route rejects `On: +Z` with
+ "only planar +Z placement is admitted" (`ConceptIr.cs:428-434`). That route admits
+ only `face(+Z)` or `Body.Top`. It then rejects `Point2(...)`, because it admits only
+ `Center: Inst.Member[i]` (`ConceptIr.cs:437`).
+ - Adding a `Slot2`, a top-level `Static`, or a grid Pattern inside `Model` moves the
+ whole file to the Phase3 route. That route reports `edge-finish-syntax-invalid`
+ for files that contain no EdgeFinish (#1, #5, #12).
+- **Macro semantics leak.**
+ - The concept-route Pattern substitutes the item name textually:
+ `Regex.Replace(featureBody, \bItem\b, Source[i])` (`ConceptIr.cs:493`). That is why
+ the documented form is `Hole<Shaft> Item { Center: Item }`, where `Item` is both the
+ instance name and the loop variable.
+ - Arithmetic is legal only in fields that some rewrite stage happens to evaluate.
+ `Point2(spacing / 2, ...)` in a `Set<Point2>` is a type mismatch (#9). Boundary
+ fields accept `Spec.Width / 2`, but only after Template specialization
+ (`boundaries.md`).
+- **Casing is a lookup table per owner** (`FirmamentSourceSpelling.Fields`). Lowercase
+ `on:` therefore works on Hole, while `face:` fails on EdgeFinish (#1).
+- **"Fatal" is an allowlist.** The build fails on a V2 diagnostic only if
+ `IsFatalDiagnosticCode` lists it. That is a single expression with 26 prefix checks
+ and 160 exact codes (`FirmamentV2Parser.cs:2349`, used at
+ `FirmamentBuildAndExport.cs:647`). Any other V2
+ failure falls through toward V1, and the user sees "must be valid canonical
+ TOON-style text or JSON" for a file that was never V1 (#1).
+
+## 3. Recommendations, ranked
+
+Each item names the findings it fixes. Findings F1–F23 are listed in the appendix.
+
+### P0: the toolchain must not lie (small, high value; do first)
+
+1. **`validate` returns `valid` only when parse *and* bind succeed.** Today it says
+ `valid` in all of these cases:
+ - alongside `parse-failed` (F2, F18);
+ - before a build that fails at capability checks (F5);
+ - before a build that fails at selection binding (F22);
+ - for a file the build routes differently (F10).
+
+ Run the same front end, through semantic binding, in both commands, or report a
+ distinct `parsed-not-bound` status.
+2. **Every V2 failure is fatal.** Invert `IsFatalDiagnosticCode`: once a document is
+ recognized as V2, any error stops the build. Reach V1 only through an explicit
+ version header. The code comment above the fallback already states that intent.
+ Fixes F2 and F6.
+3. **Unknown statements and unknown fields are errors.** `Fillet corners { ... }` in a
+ Model is silently dropped, and the part builds without the fillet (F3). Give every
+ block a closed set of statements and fields, and report the nearest valid spelling.
+4. **Every diagnostic has a span and a sentence, and the CLI prints both.**
+ - `canonical-primitive-malformed` has no field or line (F1).
+ - `SemanticSourceNotFound` drops its message ("No provenance source for: …") (F22).
+ - JSON diagnostics are objects in some cases and bare strings in others (F14).
+5. **No silent frame or placement drops.** `Concept Struct … On XZ` built in XY (F9).
+ If a frame is unsupported on a route, fail.
+6. **Small fixes:**
+ - The build summary should name the Model, not the last feature (F8).
+ - A pocket at through depth should suggest the through-cut spelling (F21).
+
+### P1: one grammar (the structural fix)
+
+7. **Parse once, into one AST, with the existing lexer.** Routes stay, but as lowering
+ choices per body, not as document parsers chosen by regex. How to get there without
+ breaking anything:
+ 1. Make the current route explicit: `validate --json` reports `route`, and any
+ diagnostic that depends on the route names it.
+ 2. Write a recursive-descent parser over `Lex` that produces today's
+ `FirmamentV2Document`. Run it in shadow mode against the 281-file corpus that the
+ [language audit](firmament-v2-language-audit.md) already uses as a parse-identity
+ oracle.
+ 3. Switch over construct family by construct family once parse identity holds.
+
+ This removes route-dependent meaning (F6, F10, F12, F16, F19, F20) and produces
+ spans for free (item 4).
+8. **Turn the expansion stages into AST transforms.** Template, Feature, Static,
+ ClosedBoundary and Pattern currently rewrite text. As tree transforms, binding is
+ by scope, not by `\bName\b` replacement (F17). The two `ClosedBoundary2Authoring`
+ passes also collapse into one.
+9. **One expression evaluator, everywhere a value is expected.**
+ - Length, angle and Point2 arithmetic should work in Set entries, Hole fields,
+ Static initializers and Model scope (F1, F18).
+ - The evaluator already exists for profiles and boundaries; make it the only one.
+
+### P2: cut or merge (language surface)
+
+10. **One point literal.** Hole `Center` accepts `Point2(x,y)` in Modify, `[x,y]` in
+ Compose, and only `Inst.Member[i]` on the concept route (F23). Pick `[x, y]` (it is
+ shorter and already used by every boundary type), and keep `Point2(...)` as the
+ typed constructor that means the same thing.
+11. **One variant mechanism.**
+ - Holes use a generic argument (`Hole<Counterbore>`).
+ - EdgeFinish uses a field (`Kind: Chamfer`), and `EdgeFinish<Chamfer>` validates
+ but fails at build (F22).
+ - Polygons use both (`Polygon2<Rhombus>` next to `Slot2` and `RegularPolygon2<6>`).
+
+ Rule: a type variant is a generic argument. Make it `EdgeFinish<Chamfer|Fillet>`
+ and keep `Kind:` as an alias.
+12. **One Pattern construct.** Five spellings exist today:
+ - `Pattern X Over Records { Template<Current> }`
+ - `Pattern X { Source: S; Hole<Shaft> Item {...} }`
+ - `Pattern X Over Set { p => F(p) }`
+ - `Radial Pattern X { Source; About; Count }`
+ - `Mirrored Feature X From Y { Across }`
+
+ Proposal: `Pattern Name over <source> { item => <feature expression> }`, where
+ `<source>` is a Set, a Table, `Grid(...)`, `Radial(axis, count, angle)` or
+ `Mirror(plane)`. Keep Mirror as sugar if it reads better. Fixes F15 and F17.
+13. **One cut vocabulary in Compose.**
+ - `Boss`/`Pocket` and `Add`/`Remove` cover the same intents (2 canonical fixtures
+ use Add/Remove).
+ - A through-slot needs `Remove { ...; Role: ThroughCut }` (F21), while Hole uses
+ `End: ThroughAll`.
+
+ Give Pocket `End: ThroughAll | Depth: d`, matching Hole, and make Add/Remove
+ aliases. The [register](firmament-language-inconsistencies.md) classifies this as
+ "RetainedCompatibility", but in practice Remove is the *only* through-cut.
+14. **One document root rule.** Today `Model` is required by some constructs and
+ forbidden by others (F16 versus #9). Either `Model` is always optional, with
+ top-level declarations forming an implicit model, or it is always required.
+15. **Drop documented constructs that do not exist.**
+ - Remove `schema Revolve` from `syntax.md`, or add it (F13).
+ - Remove the `Feature` + `Pattern` example that only works in one nesting (F15).
+16. **One separator rule.** Docs mix `{ A: 1; B: 2 }` and `{ A: 1 B: 2 }`, and some
+ grammars (Function, Points, PMI, assemblies) require `;`. Make both a newline and
+ `;` separate statements everywhere.
+17. **One casing rule, applied in the lexer.**
+ - Case-fold field labels globally, or not at all. Never per construct (F4).
+ - The style guide (prefers camelCase) and `syntax.md` (says PascalCase is
+ canonical) contradict each other. Pick one.
+ - Also fix `Pmi` versus `PMI`.
+18. **Retire one-off constructs, or justify them.** Usage across
+ `fixtures/Canonical`, the showcase projects included, by number of files:
+
+ | Construct | Files |
+ |---|---|
+ | `RoundedBox` | 1 |
+ | `Plateau` | 1 |
+ | `Polygon2<Parallelogram>` | 1 |
+ | `Polygon2<Trapezoid>` | 1 |
+ | `Polygon2<Rhombus>` | 2 |
+ | `SmoothRoundedRect2` | 2 |
+ | `Span` | 2 |
+ | `Slot` (feature) | 2 |
+ | `Add` / `Remove` | 2 / 2 |
+ | `Match` | 0 (5 regression only) |
+
+ Each of these brings its own route, admission regex and alias table. Candidates:
+ - Fold the Polygon2 variants into `Polygon2<Explicit>` plus helper Features.
+ - Fold `RoundedBox` into `Box` + `EdgeFinish`.
+ - Keep the ones a showcase project needs, and make them library Features rather
+ than grammar.
+
+### P3: add
+
+19. **Local named values in any scope**, with arithmetic: `Let pitch = 31mm` inside
+ `Model`/`Struct` (F1). Today, parameterizing a plate requires Record + Static +
+ Template.
+20. **Inline vertex lists.**
+ - `Polygon2 Outline { Points: [[0,0],[60,0],[60,5],...] }` (F11). A 6-vertex
+ outline currently needs 7 constructs.
+ - `Revolve` from a point list (F13). Today it needs a `Point2` + `Line2` per vertex.
+21. **Uniform face references.** `+Z`, `face(+Z)`, `Body.Top` and `Top` should all be
+ accepted wherever a planar face is expected (F19).
+22. **`validate --explain`**: print the route, the lowered source after expansion, and
+ the resolved Pattern instances. This helps a model and a human equally, and makes
+ item 7 easy to test.
+23. **A generated grammar reference** (EBNF, or a table produced from the AST), so the
+ documentation cannot drift from the parser.
+24. **Capability gaps, not grammar** (kernel work, listed for completeness):
+ - fillet combined with holes in one Modify (F5);
+ - shell/hollow for a box;
+ - frames other than XY for Compose (F9).
+
+### Suggested order
+
+1. P0 items 1–6: a few days, no language change. They turn every silent or misleading
+ case found in this pass into a precise error.
+2. Items 22, 10, 11 and 15: cheap, and they make the language learnable.
+3. Item 7 in shadow mode, then 8 and 9 on the new AST.
+4. Items 12–14 and 16–18 once there is one parser, since they become edits to one
+ grammar.
+5. P3 additions.
+
+## Appendix A: findings
+
+| # | Finding |
+|---|---|
+| F1 | `let`/`Static` constants inside `Model` → `canonical-primitive-malformed`, with no field or line. |
+| F2 | `validate` says `valid` alongside `parse-failed`; `build` then reports a V1 TOON error. |
+| F3 | Unknown statement `Fillet corners {...}` is silently ignored. |
+| F4 | Lowercase fields are accepted on Hole but rejected on EdgeFinish. |
+| F5 | Fillet + Hole in one Modify: validate says valid, build fails ("CombinedHoleEdgeFinish requires Chamfer"). |
+| F6 | A top-level `Static` before `Model` → Phase3 route → `edge-finish-syntax-invalid` with no EdgeFinish in the file. |
+| F7 | EdgeFinish has two selector grammars: `Face: +Z; Target: Boundary` and `Target: Profile.Outer; On: Top`. |
+| F8 | The build summary "Model:" names the last feature or profile. |
+| F9 | `Concept Struct … On XZ` is ignored; the part is built in XY. |
+| F10 | `Extrude` at Model scope: unknown to validate, built through another route by build. |
+| F11 | `Segment` endpoints must be named Point2s; there is no inline-coordinate polyline. |
+| F12 | Box Z placement depends on the route (documented in geometry.md). |
+| F13 | `schema Revolve` is documented but unknown; Revolve needs a Point2 + Line2 per vertex. |
+| F14 | `validate --json` diagnostics are objects or bare strings, depending on the failure. |
+| F15 | The syntax.md Feature + Pattern example is not admitted at Model scope. |
+| F16 | The same body fails when wrapped in `Model` and works as a bare `Struct` (#5); the reverse holds for #9. |
+| F17 | `Item` is both the Pattern instance name and the loop variable (textual substitution). |
+| F18 | `Point2(spacing / 2, …)` in `Set<Point2>` → `static-set-entry-type-mismatch`. |
+| F19 | Concept route: `On: +Z` is rejected as "only +Z admitted"; `Center` must be `Inst.Member[i]`. |
+| F20 | `Slot2` at Model scope moves the file to the Phase3 route. |
+| F21 | There is no through-Pocket; a through-cut is `Remove {…; Role: ThroughCut}`, with no hint. |
+| F22 | `EdgeFinish<Chamfer>` validates, then fails at build with `SemanticSourceNotFound`, message dropped. |
+| F23 | Hole `Center`: `Point2(x,y)`, `[x,y]` or `Inst.Member[i]`, depending on the route. |
+
+## Appendix B: forms that worked first try
+
+These are the shapes the corpus should hold up as canonical, and the shapes a
+recursive-descent grammar should preserve exactly:
+
+- WireForm `Straight`/`Helix`/`Bend`.
+- `Concept Path` + `Sweep`.
+- `Axis` + `Revolve { Profile; About; Angle: full }`.
+- `Record` + `Static` + `Template<Spec: T> Struct` + `Struct Part = T<Spec: S>`.
+- Assembly with `expose { Semantic … DatumFrame … }` and `Interface<Fixed>`.
+- `Model` + `Box` + `Modify { Hole<Shaft> …; Radial Pattern … }`.
+- Compose `Base` + `Pocket` with `RoundedRect2` profiles.
diff --git a/docs/development/firmament-language-inconsistencies.md b/docs/development/firmament-language-inconsistencies.md
index 1a291efc..eb41f538 100644
--- a/docs/development/firmament-language-inconsistencies.md
+++ b/docs/development/firmament-language-inconsistencies.md
@@ -1,5 +1,7 @@
# Firmament language reconciliation register
+October 2026 qualification: historical resolved classifications below do not close the route-dependent correctness gaps in the [October decision register](FIRMAMENT-LANGUAGE-DECISIONS-2026-10.md) and [frontend X0 report](../release/FIRMAMENT-FRONTEND-X0.md). In particular, root admission and consumed-source integrity remain incomplete.
+
This A5d register classifies the language seams first exposed by A5b and completes the Template reconciliation begun in A5c. The public dialect is defined by [`docs/public/firmament`](../public/firmament/overview.md), especially the [language-style contract](../public/firmament/language-style.md) and [Templates guide](../public/firmament/templates.md). Parser/lowering ownership is recorded in the [active grammar inventory](firmament-v2-grammar-inventory.md).
| Area | Final classification | Decision and evidence |
diff --git a/docs/public/firmament/syntax.md b/docs/public/firmament/syntax.md
index 5c6f826b..314d1952 100644
--- a/docs/public/firmament/syntax.md
+++ b/docs/public/firmament/syntax.md
@@ -9,7 +9,6 @@
| `Mechanical` | Ordinary V2 mechanical parts and features. |
| `WireForm` | Formed wire, bends, coils, and knots. |
| `Sweep` | Circular-section Concept Path sweeps. |
-| `Revolve` | Bounded Profile revolution about an explicit coplanar Axis. |
| `SectionChain` | Standalone ruled/G1 section-chain bodies. |
| `Garment` | Profile panels, stitch interfaces, figure measurements and declarative fitting poses. See [garment authoring](garments.md). |
@@ -29,19 +28,11 @@ Model Plate {
}
```
-Firmament-owned vocabulary is canonically PascalCase: declarations, semantic features, built-in values, and field names such as `Size`, `Body`, and `Region`. User-defined identifiers are case-preserving and stylistically unrestricted. External engineering identifiers such as `Standard.Materials.Aluminum.5052_H32`, standards, imported identities, and part numbers preserve their source spelling. New Firmament-owned V2 vocabulary does not use snake_case.
+Constructs and types use PascalCase; built-in fields prefer camelCase under the [language-style contract](language-style.md). Existing owner-specific PascalCase field aliases remain compatible, and many examples below retain those aliases. User-defined identifiers and external domain symbols preserve their spelling. There is no global case folding; unsupported casing must be diagnosed by its owner rather than silently ignored.
-Accepted lowercase or historical spellings remain compatibility inputs where they are cheap and unambiguous. They select the same semantic route and produce no style warning. Canonical documentation, snippets, and fixtures use only the preferred spelling; casing is not a type-system distinction.
+`Revolve` is a construct under `schema Mechanical`; `schema Revolve` is not an available frontend selector.
-Canonical fields use a colon between name and value. Braces delimit declarations, brackets delimit lists, and semicolons are optional where the owning line/block grammar is unambiguous. `Model`, `SheetMetal`, `Analysis`/import, and Assembly retain domain-appropriate target grammars; the [target reference](../reference/targets.md) records the intentional distinctions. Assembly definitions may use compile-time `Include`, first-class `Subassembly`, typed `Interface<T>`, atomic `Mate`, and explicit `Expose`; see [typed interfaces and reusable subassemblies](assemblies.md).
-
-Firmament V1 is compatibility history rather than canonical V2 authoring. Bodies embedded in `.firmfixture` entries marked future, not implemented, or invalid are corpus evidence and do not define the public language.
-
-An untransformed `Box` stock is centered in X/Y with `Bottom` at Z=0 and `Top` at Z=`Height`. Its local feature coordinates use that same stock frame: adding holes or edge finishes does not translate the stock.
-
-Firmament admits declarations through typed semantic namespaces. Construction `Profile` names may coincide with `Boss` or `Pocket` feature names because feature `Profile:` references are explicitly typed; these identities remain distinct in structured inspection. Names may not otherwise shadow another declaration in the same semantic namespace.
-
-Use `aetheris validate file.firmament --json` before building. Diagnostics are codes intended for automation plus short corrective messages. See [diagnostics](../reference/diagnostics.md).
+Use `aetheris validate file.firmament --json` before building. Generic mechanical validation runs engineering compilation in memory; `--parse-only` reports `parsed-not-built`. This X0 qualification is incomplete for advanced Compose/boundary source consumption; see the [qualification report](../../release/FIRMAMENT-FRONTEND-X0.md). See [diagnostics](../reference/diagnostics.md) for the diagnostic representation.
## Reusable semantic construction with Feature
diff --git a/docs/public/reference/cli.md b/docs/public/reference/cli.md
index 1bda65ca..9a871f9a 100644
--- a/docs/public/reference/cli.md
+++ b/docs/public/reference/cli.md
@@ -20,6 +20,10 @@ Primary public commands:
| `wireframe <model.step> [--out preview.svg] [--view iso\|front\|top\|right] [--density N] [--json]` | Render deterministic exact-edge and trim-clipped surface-isoline SVG evidence |
| `asm ...` | Inspect/execute/import/export assemblies |
+Generic mechanical `validate` now runs the existing engineering compilation in memory, including selection binding, capability checks and geometry/STEP preflight. It writes no output file. Its report includes `validationLevel` (`Built`, `BuildRejected`, or `ParsedNotBuilt`) and developer-only `parserRoute` metadata. `--explain` prints the route, admission level and available instance counts. `--parse-only` explicitly requests static analysis and reports `parsed-not-built` on success. External `--forge-pack` validation is also labelled `parsed-not-built`: those descriptor providers are not installed into normal build. Domain-specific validators retain their separate scope; inspect their reports. This is not a promise that unchanged source can never encounter a later environment or kernel failure.
+
+X0 remains partially qualified: the advanced Compose/boundary route still lacks complete statement/field consumption checking. Successful compilation alone does not close that known source-intent gap; see the [X0 qualification report](../../release/FIRMAMENT-FRONTEND-X0.md).
+
Run `aetheris <command> --help` for exact options. JSON is a public automation surface, but its root is command-specific: process exit status is authoritative, `validate` reports `firmamentV2Validation.status`, and materializing/analysis commands report `success` where documented. Diagnostics are structured; artifact paths are explicit; wireframe reports trim/pcurve coverage and a deterministic SVG hash; Sheet Metal reports regions, bends, and lowered features separately; FEA reports requested/result artifacts; sculpting builds report every `BodyState`, `GeometricDelta`, validation evidence, surface-family inventory, and the sibling `.delta.json` path; other builds report emitted features and PMI export evidence. Counts describe semantic items at the stated layer, not arbitrary STEP entity counts.
Generic STEP analysis reports analytic placement and size information where it is present: planes include origin and normal; bounded cylinders and cones include axis, axial extent, and circular-boundary angular extent; spheres include center and radius; and circles include center, axis, radius, sweep, orientation, and their actual trimmed endpoints. Circular-edge bounds and section output are computed from those trims rather than from the supporting full circle. `analyze section` returns normalized closed loops with deterministic orientation and nesting metadata; `--out` is intended as compact geometry evidence, not a substitute for the JSON record.
diff --git a/docs/public/reference/diagnostics.md b/docs/public/reference/diagnostics.md
index ae678660..0f0546e3 100644
--- a/docs/public/reference/diagnostics.md
+++ b/docs/public/reference/diagnostics.md
@@ -1,5 +1,9 @@
# Diagnostics and failure recovery
+Generic V2 build/validation errors use structured objects with `code`, `severity`, `message`, `sourceFile`, optional `sourceSpan`, `line`, `column`, and `locationNote`. The existing `fatal` spelling means an error that prevents admission; `warning` remains nonfatal. Parser route metadata is for debugging. An enclosing-declaration span is explicitly labelled when the legacy producer supplied no precise original-source provenance. Monaco consumes the same compiler presentation. Specialized domain commands are not yet all migrated to this representation.
+
+Unknown canonical statements and Box fields are errors. `profile-layout-placement-unsupported` rejects unsupported Concept Struct layout planes instead of substituting XY. Use a traced Construction Plane for supported oriented profile workflows. `SemanticSourceNotFound` preserves the missing source and the provenance explanation. A through-depth Pocket diagnostic points to `Remove` with `Role: ThroughCut`; X0 does not add through-Pocket or combined Fillet/Hole capabilities.
+
## Circular Sweep (X0)
- `firmament-sweep-section-invalid`: circular diameter is missing, non-finite, or non-positive.
diff --git a/docs/release/FIRMAMENT-FRONTEND-X0.md b/docs/release/FIRMAMENT-FRONTEND-X0.md
new file mode 100644
index 00000000..b028d737
--- /dev/null
+++ b/docs/release/FIRMAMENT-FRONTEND-X0.md
@@ -0,0 +1,253 @@
+# FIRMAMENT-FRONTEND-X0 — compiler honesty qualification
+
+Date: 2026-10-14. Executive verdict: **Meaningful progression; not Accepted.**
+
+The generic mechanical path now closes reproduced parse-failed/valid reporting,
+capability/selection validation gaps, implicit V1 fallback, unknown canonical
+Model/Modify statements, unknown Box fields, and ignored profile-layout XZ frames.
+It preserves semantic-selection explanations and identifies the enclosing Model.
+It does **not** establish closed source consumption across the advanced
+Compose/boundary family or every specialized domain. The non-negotiable universal
+source-intent invariant therefore remains unqualified.
+
+## Inputs and provenance
+
+Read [Claude's original October audit](../development/firmament-authoring-pass-2026-10.md),
+the [September pipeline audit](../development/firmament-v2-language-audit.md), and
+the [earlier reconciliation register](../development/firmament-language-inconsistencies.md).
+The October report was supplied from Downloads and is preserved verbatim as
+development evidence. It contains findings/fragments and a twelve-part scoreboard,
+but not the twelve complete attempted programs. New
+[source specimens](../../fixtures/Regression/FrontendX0/README.md) are explicitly
+reconstructed, not passed off as Claude's originals. The twelve-family coverage
+map is in that README. A first-try authoring success-rate retest remains X4.
+
+## Reproduction register
+
+“Partially reproduced” below distinguishes inspected implementation evidence or a
+reconstructed fragment from a byte-exact replay of missing original source.
+
+| Finding | Current reproduction classification | Observed behavior / disposition |
+| --- | --- | --- |
+| F1 Local constants produce primitive-malformed without location | Partially reproduced | Canonical root owns a bounded construct vocabulary; this is not general Let. Malformed primitive errors now have a sentence and disclosed declaration anchor. Scope-wide arithmetic remains X2. |
+| F2 Valid alongside parse-failed, then V1 TOON error | Confirmed | Two-element Box Size validated successfully and built with FIRM-PARSE-0001 at baseline. Now parser/report/build all reject V2; no V1 retry. |
+| F3 Unknown Fillet silently omitted | Partially reproduced | Existing multiline Model-level specimen was already rejected. Modify-level specimen validated at baseline and failed only at export. Canonical Model/Modify checks now reject unowned statement blocks independent of line layout. Advanced Compose still omits nested Fillet. |
+| F4 Hole/EdgeFinish casing asymmetry | Requires X3 | Owner-specific spelling vocabularies still exist. Canonical style prose was reconciled; global case folding was not introduced. |
+| F5 Fillet + Hole passes validate then fails capability | Confirmed; separate capability limitation | Reconstructed case validated successfully at baseline and failed CombinedHoleEdgeFinish admission. Now normal validation executes that same check and rejects. Missing geometry capability not implemented. |
+| F6 Top-level Static selects Phase3 with unrelated EdgeFinish error | Partially reproduced; requires X1 | Existing whole-document route selection remains inspectable. Phase3's bounded structure assumptions remain; route-dependent syntax is not repaired by more dispatch patterns. |
+| F7 Two EdgeFinish selector grammars | Requires X2/X3 | Primitive Face/Target and semantic Profile boundary selectors remain distinct typed owners. Both have existing production tests. |
+| F8 Model summary names last feature/profile | Confirmed | Summary used ExportedFeatureId. DocumentName now comes from the existing semantic parse metadata; CLI test asserts SelectionChamferPart rather than its finish feature. Feature IDs remain unchanged. |
+| F9 Concept Struct On XZ silently becomes XY | Confirmed | Baseline six-edge L outline built despite On XZ. Profile frame resolution now rejects it; accepted XY control measures 60 x 30 x 3 mm and eight faces after STEP reimport. Unknown Using frames also fail. Other domain placement owners are not globally qualified. |
+| F10 Model-scope Extrude uses different build/parser behavior | Partially reproduced | Extrude is acknowledged by the canonical root checker as an existing profile materializer input. Normal validation uses existing CompileSource, but the generic document parser still disagrees with dedicated profile admission. A blanket mechanical gate was rejected by existing geometry regressions. No new extrusion grammar added. |
+| F11 Named Segment endpoints, no inline polyline | Separate language feature / requires X3 | Existing named-point diagnostics and regressions remain. No inline vertex syntax added. |
+| F12 Route-dependent Box Z placement | Confirmed by existing source/documentation; requires X2 | geometry.md explicitly records direct Box versus Hole stock placement. X0 does not silently reposition existing geometry. This discrepancy prevents a universal geometry-stability claim. |
+| F13 Nonexistent schema Revolve, verbose point outline | Confirmed schema mismatch; requires X3 for syntax | Available enum/selectors omit Revolve. Removed the incorrect public table row; Revolve is a construct under Mechanical. Point-list grammar remains deferred. |
+| F14 JSON diagnostics alternate objects/strings | Confirmed; partially repaired | Generic build and V2 validation now use the same object representation. Specialized domain/early-error branches still have legacy shapes; migration is incomplete. |
+| F15 Feature/Pattern documentation nesting not admitted | Partially reproduced; requires X1/X4 | Existing FeatureFunction, NamedSet and TemplatePattern cases test admitted nestings. No original NEMA17 source was supplied, so no claim of a successful replay. |
+| F16 Wrapping Struct in Model changes admission | Requires X1 | Existing document-level dispatch remains; metadata identifies Canonical/CanonicalAdvanced/ConceptModeling etc. Root grammar reconciliation is deferred. |
+| F17 Item doubles as instance name and loop variable | Confirmed by source; requires X1/X2 | ConceptIr still performs textual Pattern expansion. No Pattern rewrite or new substitution pass added. |
+| F18 Point2 arithmetic in Set causes type mismatch | Confirmed by owning admission code; requires X2 | Static Set typing remains bounded. Newly encountered errors cannot become nonfatal because their code is absent from a list. Original arithmetic source was not supplied. |
+| F19 Concept route +Z/Point2 admission differs | Confirmed by ConceptIr owner; requires X2 | Face and center forms remain route-dependent. No global face alias normalization added. |
+| F20 Slot2 changes route | Partially reproduced; requires X1 | ClosedBoundary expansion still changes the document before route choice. Actual route metadata is captured at selection; original slot-block source was absent. |
+| F21 Through-Pocket lacks alternative hint | Confirmed by owner; separate capability limitation | Finite Pocket retains its floor contract. Through-depth rejection now suggests Remove with Role: ThroughCut. |
+| F22 Generic EdgeFinish validates; missing semantic source loses text | Confirmed in two reconstructed cases | Generic spelling is rejected at actual build admission; validation now agrees. An AbsentEdge selection preserves “No provenance source for” and the exact missing source. No generic EdgeFinish syntax added. |
+| F23 Hole center spelling depends on route | Confirmed by source; requires X2/X3 | Existing Point2, array and Concept member forms remain owner-specific. No new evaluator or alias parser added. |
+
+Every numbered recommendation has an explicit disposition in the
+[24-item decision register](../development/FIRMAMENT-LANGUAGE-DECISIONS-2026-10.md).
+
+## Root causes and repairs
+
+1. The validation report derived success solely from a fatal-code count. Parse
+ failure now makes the report invalid independently of its diagnostic spellings.
+2. Parser/binder strings crossed several severity adapters, each with its own
+ fatal-prefix list. The existing adapter now assigns severity once: known
+ informational trace events remain information, the deliberate nominal-only
+ tolerance warning remains a warning, and unclassified diagnostics are errors.
+ Parser completion enforces that severity. The former error allowlists were
+ removed, including the Concept-specific one.
+3. The mechanical exporter could retry materializers or V1 after failed parsing.
+ RecognizedInvalid now prevents V1 retry. A trial gate before all mechanical materializers was backed out after it rejected established profile-boundary fixtures; those adapters retain their existing owner-specific admission.
+ Serialization-shaped roots are classified before expansion, so V2 keywords used as V1 data (tested with model names Model and Template) cannot hijack routing. Explicit version-1 file compatibility remains on its existing reader; canonical
+ in-memory compilation retains its V2 firewall. Dedicated Revolve/Sweep/WireForm
+ and other domain owners retain their own admission paths.
+4. Generic validation stopped before build capability and topology selection
+ binding. FirmamentBuildAdmissionValidation calls existing CompileSource,
+ including in-memory materialization/export and build assertions. It does not
+ create another validator or write STEP files. Static-only validation and
+ externally loaded Forge descriptors report parsed-not-built explicitly.
+5. The canonical root scan was line-anchored, and Modify lacked a closed neighbour
+ check. Their existing owners now use the existing lexer and balanced block
+ boundaries. Primitive field checking reuses generated field metadata where it
+ exists (notably Box). This is not complete per-route field consumption.
+6. Profile frame lookup defaulted unresolved named frames to WorldXY. It now
+ resolves declared XY layouts, rejects unsupported On XZ, rejects unknown frames,
+ and retains traced Construction Plane resolution.
+7. Semantic-selection exporters replaced detailed resolver diagnostics with only
+ the failure enum. They now retain code and message. Through-Pocket diagnosis
+ names the admitted through-cut mechanism. Generic build summaries project
+ DocumentName instead of the last materialized feature identity.
+8. A canonical Pocket witness reused its boundary's display name. The symbol
+ binder already permitted typed Profile/Boss/Pocket name sharing; that same
+ rule now includes ClosedBoundary2/Polygon2 construction inputs. This preserves
+ admitted engineering semantics without suppressing duplicate-name errors.
+
+## Diagnostic and validation contract
+
+Generic V2 errors are objects with code, severity, message, sourceFile, optional
+sourceSpan, line/column, stage/source and locationNote. Legacy `fatal` means error;
+warning/info remain nonfatal. Existing dynamic code suffixes are retained for
+compatibility. Kernel-only failures without a specific diagnostic ID retain their
+KernelDiagnosticCode; legacy bare semantic codes are preserved as codes.
+
+Unknown field/statement diagnostics can identify an unambiguous original token.
+Other legacy producers receive a document declaration anchor with an explicit
+limitation note. No claim is made that an expanded-source offset is an exact
+original-source location. Schema selector erasure preserves character/newline
+offsets; the CLI presents diagnostics against author source rather than expanded
+library text. Full include/expansion origin mapping remains an X1 prerequisite.
+The language service uses the same presentation for parser diagnostics; hover,
+completion and last-valid-model retention were not redesigned. An independent
+Helios application run was not performed; no files in that repository were changed.
+
+Normal generic mechanical `valid` requires successful existing engineering
+compilation in the current environment, with validationLevel Built. Rejection is
+invalid / BuildRejected (or invalid at the earlier static stage). ParsedNotBuilt
+never claims build admission. --explain exposes actual branch metadata and
+available template/solid counts, not a fabricated expansion tree. Specialized
+domain validators retain their narrower current contracts and legacy JSON shapes.
+
+## Remaining blocker and smallest prerequisite
+
+Two retained advanced witnesses still accept intent they do not execute:
+
+- unknown-compose-statement inserts `Fillet LostIntent { Radius: 1mm }` into an
+ otherwise admitted Compose. The operation parser searches for recognized
+ matches; it does not account for the remaining tokens.
+- unknown-boundary-field adds `heigth: 99mm` to a Rect2 consumed by Compose.
+ ClosedBoundary2Authoring and subsequent guide readers bind their known fields
+ without retaining field-consumption receipts. The extra field disappears.
+
+These are open correctness defects, not compatibility aliases. Shared build
+preflight cannot detect intent that both parser and build have discarded. Further
+global keyword/field scans would duplicate partial grammars, and a new global
+rewrite or fatal-code allowlist would violate X0's ownership rules.
+
+A trial early gate also failed the established ProfileBoundaryChamferFixtureTests junction selections (for example ReflexNotch and CornerPair) with firmament-v2-selection-malformed, and ProfileBoundaryAuthoringTests derived profiles with canonical-document-malformed. Their existing production owners successfully build geometry with pinned topology/volume expectations. The generic parser cannot be made the sole gate without first projecting those existing admitted constructs. The trial gate was removed instead of adding diagnostic exemptions or breaking those fixtures.
+
+The smallest next unit is **project existing profile junction/derived-profile admission into the generic document contract, then add consumed-token/field spans and original-source origin
+receipts for the CanonicalAdvanced Compose/ClosedBoundary2 adapters, checked
+before erasure**. Establish them with the two specimens, then extend the same
+contract through Feature/Template/Pattern. This can be the first bounded X1
+prerequisite; it does not require replacing engineering lowerers or adding a new
+kernel capability. Full unified parsing remains shadow-mode work.
+
+## Compatibility and code-quality review
+
+No new regex call site, whole-document dispatcher, text substitution pass,
+product-side validator, geometry operation or mutable parser-state mechanism was
+introduced. Existing root/Modify ownership checks use lexer spans. The existing
+small parse cache remains; per-parse source and route metadata are immutable.
+Diagnostic severity/message mapping is consolidated in the existing adapter.
+Engineering feature identities and STEP geometry are not renamed to fix summaries.
+
+The Cadmata split-compose-chamfer fixture used an undeclared ComposeGuide frame. Unknown-frame rejection exposed it; the fixture now states Using XY explicitly, preserving its previously defaulted world plane. The seven compiler-body/published-correspondence integration cases passed after this correction. No special case for the fixture name was added to the compiler.
+
+The public schema Revolve and casing documentation contradictions were corrected.
+Historical reconciliation “resolved” rows are qualified by this report and the
+October decision register. Geometry placement F12 and unconsumed advanced fields
+are explicitly retained as unresolved, not hidden behind green test results.
+
+## Qualification evidence
+
+Commands use .NET SDK 10.0.401 and repository-local CLI assemblies, with serial
+solution builds/test lanes. Logs and detailed baseline/after JSON are ignored
+under artifacts/local/frontend-x0/. Baseline build succeeded before edits.
+
+Focused source tests cover rejection/acceptance, validation/build agreement,
+V2/V1 routing, field/marker locations, unresolved semantic sources, severity,
+route visibility, summary ownership, and STEP-reimported asymmetric bounds.
+Existing V1 routing tests retain explicit version-1 success and reject non-V1
+serialization-shaped inputs. The full Firmament suite passed 2,173 tests during
+iteration; final solution evidence is recorded below after final qualification.
+
+Final qualification results:
+
+| Check | Result |
+| --- | --- |
+| Solution Release build, -m:1 | Passed; 0 errors, 17 warnings (existing nullable/WASM import categories) |
+| Required fast Kernel.Core lane | 1,064 passed |
+| Focused X0 compiler plus existing typo-code compatibility cases | 17 passed, including the two V1 keyword-data cases |
+| Focused X0 CLI | 10 passed |
+| Cadmata compiler-body / published-correspondence integration | 7 passed |
+| Complete solution with xUnit collections serialized | 4,614 passed, 0 failed, 0 skipped across 20 test projects |
+| Ten real showcase CLI commands | All exit 0: threaded bolt, PMI, sheet metal, Templates, radial Pattern, guitar, Industrial ATLAS, warm-modern house, warehouse, factory |
+| Repeated STEP artifacts | All five repeated showcase STEP SHA-256 hashes identical (bolt, PMI, sheet metal, Template, Pattern) |
+| Repository layout / git diff --check | Passed |
+
+The exact ordinary full lane was also executed. An intermediate full run passed
+4,612 tests before the last two V1 data-keyword cases were added. On the final
+source, two ordinary full runs each had one display-budget failure: the external
+STEP slider USD test exceeded its five-second tessellation budget at 5,304 ms in
+one run; the unchanged Core display qualification test returned Partial rather
+than RefinementLimited at its five-second budget in another. Both passed isolated
+(378 ms and 186 ms respectively). No timeout was increased, no test was skipped,
+and no production display behavior was changed to obtain the controlled result.
+The default collection-parallel lane is therefore recorded as timing-sensitive,
+not represented as unconditionally green.
+
+The final controlled full invocation was:
+
+```powershell
+dotnet test Aetheris.slnx -c Release --no-build -m:1 --settings artifacts/local/frontend-x0/serial.runsettings -- RunConfiguration.MaxCpuCount=1
+```
+
+Its ignored local settings file contained:
+
+```xml
+<RunSettings>
+ <RunConfiguration><MaxCpuCount>1</MaxCpuCount></RunConfiguration>
+ <xUnit>
+ <ParallelizeAssembly>false</ParallelizeAssembly>
+ <ParallelizeTestCollections>false</ParallelizeTestCollections>
+ <MaxParallelThreads>1</MaxParallelThreads>
+ </xUnit>
+</RunSettings>
+```
+
+The repeated hashes compare two qualification runs of these changes; they are
+not a complete pre-X0/post-X0 geometry equivalence proof. Existing regression
+oracles additionally pin topology, volume, correspondence and deterministic STEP
+for their supported fixtures. No independent native Helios run, Linux run, remote
+CI result, or original twelve-part first-try retest is claimed.
+
+## Acceptance ledger
+
+| Criteria | State |
+| --- | --- |
+| 1 Audit reproduction/classification | Classified all 23 findings; source-fragment/inspection evidence is distinguished from missing original programs |
+| 2-3 Validation agreement / no invalid success | Reproduced generic cases repaired; advanced discarded intent remains open |
+| 4-5 V2 fallback / legitimate V1 | Structural fallback repaired; explicit V1 compatibility regressions retained |
+| 6-7 Closed statements / fields | Partial: canonical root/Modify and schema-backed primitives; advanced Compose/boundaries remain open |
+| 8-9 Placements / L-bracket | XZ profile-layout witness closed with world bounds; other owners not globally qualified |
+| 10-12 Diagnostic preservation / locations / JSON | Generic path improved; typed producer spans and specialized JSON migration incomplete |
+| 13 Missing semantic source message | Closed for reproduced AbsentEdge witness |
+| 14 Capability versus syntax | Generic compilation diagnostics retain owning stage and explanatory text; specialized coverage incomplete |
+| 15 Owner summaries | Tested for SelectionChamferPart; forms unprojected by generic parsing remain part of the advanced-owner gap |
+| 16 Runtime parser route | Present for generic selected routes; pre-route expansion failures have no fabricated route |
+| 17-18 No new dispatch / rewrite architecture | Met in this change |
+| 19-20 Canonical compatibility / engineering geometry | Final full regressions and representative CLI checks qualify only the recorded corpus; no universal pre/post STEP-hash claim |
+| 21 Language service / Helios | Shared compiler presentation retained and tested; independent Helios application workflow not run |
+| 22 Focused/full tests | Final results below; green tests do not override the open source-intent witnesses |
+| 23 Code-quality pass | Completed; trial blanket gate removed rather than weakening geometry tests or adding exemptions |
+| 24 Recommendation dispositions | All 24 tracked explicitly |
+
+## Executive answer
+
+**No universal acceptance claim yet. Meaningful progression.** The reproduced
+generic validation/fallback/frame/diagnostic defects are repaired and bounded
+source tests prove the improvement. CanonicalAdvanced still has concrete ignored
+intent witnesses, specialized diagnostic shapes remain inconsistent, full
+expansion provenance is unavailable, and the original twelve programs were not
+provided. X0 must remain open until consumed-source admission closes those gaps.
+No X1 AST or missing kernel capability was implemented as an unreviewed side effect.
diff --git a/fixtures/Regression/FrontendX0/README.md b/fixtures/Regression/FrontendX0/README.md
new file mode 100644
index 00000000..967330e8
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/README.md
@@ -0,0 +1,48 @@
+# Frontend X0 source witnesses
+
+These are reconstructed minimal specimens from Claude's 2026-10-13 audit, not the
+original twelve complete programs. The supplied report includes a scoreboard and
+fragments but no full source attachments. Its original text is preserved in
+`docs/development/firmament-authoring-pass-2026-10.md`.
+
+Run the real CLI with `validate <fixture> --json` and `build <fixture> --output
+artifacts/local/frontend-x0/<name>.step --json`. Negative tests additionally use
+the public in-memory engineering compiler. Output and detailed baseline/after
+records belong under ignored `artifacts/local/frontend-x0/`.
+
+| Specimen | Purpose |
+| --- | --- |
+| malformed-v2 | Failed parse cannot validate successfully or fall through to V1 |
+| unknown-model-statement | Model-level unknown Fillet statement |
+| unknown-modify-statement | Modify-level unknown Fillet statement |
+| unknown-box-field | Unknown dimension field must not disappear |
+| unsupported-xz-layout | Asymmetric six-edge L outline, 60 x 30 x 3 mm; XY must not substitute for XZ |
+| combined-fillet-hole | Parsed features rejected at the actual capability boundary |
+| unresolved-semantic-source | Selection binding must preserve AbsentEdge and its explanation |
+| edgefinish-generic-variant | Unsupported generic spelling must not validate as build-admitted |
+| through-pocket | Finite Pocket reaching through the stock must suggest the through-cut vocabulary |
+| unknown-compose-statement | **Open defect:** advanced Compose ignores nested Fillet |
+| unknown-boundary-field | **Open defect:** boundary lowering discards heigth before Compose admission |
+
+The last two remain reproduction evidence, not accepted language forms. Do not
+turn their current successful compilation into a compatibility requirement.
+
+## Twelve-part audit coverage map
+
+Original authoring success rates cannot be rerun without the original sources.
+Existing repository witnesses and the new minimal cases cover these families:
+
+| Audit part | Repository witness / limitation |
+| --- | --- |
+| 1 Plate, holes, fillet | combined-fillet-hole; canonical Features/Composition/box-counterbore-chamfer |
+| 2 L-bracket | unsupported-xz-layout; canonical ProfileComposition L-bracket regressions |
+| 3 Revolved bushing | canonical Revolve corpus; schema Mechanical owns Revolve |
+| 4 Spacer family | canonical Templates; existing Record/Template regression suite |
+| 5 Grid plate | existing FirmamentV2TemplatePatternTests and ConceptPoint3HoleTests |
+| 6 Enclosure tray | canonical Features/Pocket/rectangular-pocket; through-pocket |
+| 7 Datum assembly | canonical AssemblyInterfaces corpus |
+| 8 Spring and hook | canonical WireForm/helix; WireForm regressions |
+| 9 NEMA17 plate | existing FeatureFunctionTests and NamedSetTests; no original plate source |
+| 10 Bolt-circle flange | canonical Symmetry/radial-bolt-circle |
+| 11 Bent tube | canonical Sweep corpus |
+| 12 Slot/counterbore/chamfer | canonical Features and ProfileComposition regressions; no original block source |
diff --git a/fixtures/Regression/FrontendX0/combined-fillet-hole.firmament b/fixtures/Regression/FrontendX0/combined-fillet-hole.firmament
new file mode 100644
index 00000000..2ea33f6e
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/combined-fillet-hole.firmament
@@ -0,0 +1,8 @@
+Model CombinedFilletHole {
+ units: mm
+ Box Body { size: [40mm, 20mm, 6mm] }
+ Modify Body {
+ Hole<Shaft> Mount { on: +Z; center: Point2(0mm, 0mm); diameter: 4mm; end: ThroughAll }
+ EdgeFinish TopRound { Face: +Z; Target: Boundary; Kind: Fillet; Radius: 1mm }
+ }
+}
diff --git a/fixtures/Regression/FrontendX0/edgefinish-generic-variant.firmament b/fixtures/Regression/FrontendX0/edgefinish-generic-variant.firmament
new file mode 100644
index 00000000..f23e5a01
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/edgefinish-generic-variant.firmament
@@ -0,0 +1,27 @@
+Model SelectionChamferPart {
+ Units: mm
+ Concept Struct RectangleLayout On XY {
+ Point2 SouthWest { Position: [-10mm, -5mm] }
+ Point2 SouthEast { Position: [10mm, -5mm] }
+ Point2 NorthEast { Position: [10mm, 5mm] }
+ Point2 NorthWest { Position: [-10mm, 5mm] }
+ Line2 South { From: SouthWest; To: SouthEast }
+ Line2 East { From: SouthEast; To: NorthEast }
+ Line2 North { From: NorthEast; To: NorthWest }
+ Line2 West { From: NorthWest; To: SouthWest }
+ }
+ Profile MainPlate Using RectangleLayout { Loop Outer {
+ South As SouthEdge
+ |> East As EastEdge
+ |> North As NorthEdge
+ |> West As WestEdge
+ |> Close
+ } }
+ Struct Plate { Extrude MainPlate { Profile: MainPlate; From: -2mm; To: 0mm } }
+ Selection OuterTopBoundary {
+ Target: TopBoundary
+ Source: MainPlate.ProfileSegments([SouthEdge, EastEdge, NorthEdge, WestEdge])
+ Require: ClosedLoop
+ }
+ EdgeFinish<Chamfer> TopEdgeBreak { Target: OuterTopBoundary Distance: 1mm }
+}
diff --git a/fixtures/Regression/FrontendX0/malformed-v2.firmament b/fixtures/Regression/FrontendX0/malformed-v2.firmament
new file mode 100644
index 00000000..86f6197b
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/malformed-v2.firmament
@@ -0,0 +1,4 @@
+Model Broken {
+ units: mm
+ Box Body { size: [40mm, 20mm] }
+}
diff --git a/fixtures/Regression/FrontendX0/through-pocket.firmament b/fixtures/Regression/FrontendX0/through-pocket.firmament
new file mode 100644
index 00000000..d2a94bb8
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/through-pocket.firmament
@@ -0,0 +1,30 @@
+// Pocket is finite. Use Hole or Slot when material must be removed through-all.
+Model RectangularPocket {
+ Units: mm
+
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [50mm, 32mm] }
+ Rect2 Recess { Center: [0mm, 0mm]; Size: [24mm, 14mm] }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Stock.Bottom
+ |> Stock.Right
+ |> Stock.Top
+ |> Stock.Left
+ |> Close
+ } }
+ Profile PocketProfile Using Layout { Loop Outer {
+ Recess.Bottom
+ |> Recess.Right
+ |> Recess.Top
+ |> Recess.Left
+ |> Close
+ } }
+
+ Struct MachinedBlock {
+ Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Pocket Recess { On: Top; Profile: PocketProfile; Depth: 10mm; MinimumFloorThickness: 3mm }
+ }
+ }
+}
diff --git a/fixtures/Regression/FrontendX0/unknown-boundary-field.firmament b/fixtures/Regression/FrontendX0/unknown-boundary-field.firmament
new file mode 100644
index 00000000..4e7a0a4b
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/unknown-boundary-field.firmament
@@ -0,0 +1,30 @@
+// Pocket is finite. Use Hole or Slot when material must be removed through-all.
+Model RectangularPocket {
+ Units: mm
+
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [50mm, 32mm] }
+ Rect2 RecessGuide { Center: [0mm, 0mm]; Size: [24mm, 14mm]; heigth: 99mm }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Stock.Bottom
+ |> Stock.Right
+ |> Stock.Top
+ |> Stock.Left
+ |> Close
+ } }
+ Profile PocketProfile Using Layout { Loop Outer {
+ RecessGuide.Bottom
+ |> RecessGuide.Right
+ |> RecessGuide.Top
+ |> RecessGuide.Left
+ |> Close
+ } }
+
+ Struct MachinedBlock {
+ Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Pocket Recess { On: Top; Profile: PocketProfile; Depth: 4mm; MinimumFloorThickness: 3mm }
+ }
+ }
+}
diff --git a/fixtures/Regression/FrontendX0/unknown-box-field.firmament b/fixtures/Regression/FrontendX0/unknown-box-field.firmament
new file mode 100644
index 00000000..2462c409
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/unknown-box-field.firmament
@@ -0,0 +1,4 @@
+Model UnknownDimension {
+ units: mm
+ Box Body { size: [40mm, 20mm, 6mm]; heigth: 12mm }
+}
diff --git a/fixtures/Regression/FrontendX0/unknown-compose-statement.firmament b/fixtures/Regression/FrontendX0/unknown-compose-statement.firmament
new file mode 100644
index 00000000..052a37e2
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/unknown-compose-statement.firmament
@@ -0,0 +1,31 @@
+// Pocket is finite. Use Hole or Slot when material must be removed through-all.
+Model RectangularPocket {
+ Units: mm
+
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [50mm, 32mm] }
+ Rect2 RecessGuide { Center: [0mm, 0mm]; Size: [24mm, 14mm] }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Stock.Bottom
+ |> Stock.Right
+ |> Stock.Top
+ |> Stock.Left
+ |> Close
+ } }
+ Profile PocketProfile Using Layout { Loop Outer {
+ RecessGuide.Bottom
+ |> RecessGuide.Right
+ |> RecessGuide.Top
+ |> RecessGuide.Left
+ |> Close
+ } }
+
+ Struct MachinedBlock {
+ Compose Body {
+ Fillet LostIntent { Radius: 1mm }
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Pocket Recess { On: Top; Profile: PocketProfile; Depth: 4mm; MinimumFloorThickness: 3mm }
+ }
+ }
+}
diff --git a/fixtures/Regression/FrontendX0/unknown-model-statement.firmament b/fixtures/Regression/FrontendX0/unknown-model-statement.firmament
new file mode 100644
index 00000000..e21c628e
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/unknown-model-statement.firmament
@@ -0,0 +1,5 @@
+Model UnknownIntent {
+ units: mm
+ Box Body { size: [40mm, 20mm, 6mm] }
+ Fillet corners { radius: 1mm }
+}
diff --git a/fixtures/Regression/FrontendX0/unknown-modify-statement.firmament b/fixtures/Regression/FrontendX0/unknown-modify-statement.firmament
new file mode 100644
index 00000000..072d017a
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/unknown-modify-statement.firmament
@@ -0,0 +1,5 @@
+Model UnknownModification {
+ units: mm
+ Box Body { size: [40mm, 20mm, 6mm] }
+ Modify Body { Fillet corners { radius: 1mm } }
+}
diff --git a/fixtures/Regression/FrontendX0/unresolved-semantic-source.firmament b/fixtures/Regression/FrontendX0/unresolved-semantic-source.firmament
new file mode 100644
index 00000000..ad2dfa76
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/unresolved-semantic-source.firmament
@@ -0,0 +1,27 @@
+Model SelectionChamferPart {
+ Units: mm
+ Concept Struct RectangleLayout On XY {
+ Point2 SouthWest { Position: [-10mm, -5mm] }
+ Point2 SouthEast { Position: [10mm, -5mm] }
+ Point2 NorthEast { Position: [10mm, 5mm] }
+ Point2 NorthWest { Position: [-10mm, 5mm] }
+ Line2 South { From: SouthWest; To: SouthEast }
+ Line2 East { From: SouthEast; To: NorthEast }
+ Line2 North { From: NorthEast; To: NorthWest }
+ Line2 West { From: NorthWest; To: SouthWest }
+ }
+ Profile MainPlate Using RectangleLayout { Loop Outer {
+ South As SouthEdge
+ |> East As EastEdge
+ |> North As NorthEdge
+ |> West As WestEdge
+ |> Close
+ } }
+ Struct Plate { Extrude MainPlate { Profile: MainPlate; From: -2mm; To: 0mm } }
+ Selection OuterTopBoundary {
+ Target: TopBoundary
+ Source: MainPlate.ProfileSegments([AbsentEdge, EastEdge, NorthEdge, WestEdge])
+ Require: ClosedLoop
+ }
+ EdgeFinish TopEdgeBreak { Target: OuterTopBoundary Kind: Chamfer Distance: 1mm }
+}
diff --git a/fixtures/Regression/FrontendX0/unsupported-xz-layout.firmament b/fixtures/Regression/FrontendX0/unsupported-xz-layout.firmament
new file mode 100644
index 00000000..08ad4bad
--- /dev/null
+++ b/fixtures/Regression/FrontendX0/unsupported-xz-layout.firmament
@@ -0,0 +1,18 @@
+Concept Struct Layout On XZ {
+ Point2 A { Position: [0mm, 0mm] }
+ Point2 B { Position: [60mm, 0mm] }
+ Point2 C { Position: [60mm, 5mm] }
+ Point2 D { Position: [5mm, 5mm] }
+ Point2 E { Position: [5mm, 30mm] }
+ Point2 F { Position: [0mm, 30mm] }
+ Line2 AB { From: A; To: B }
+ Line2 BC { From: B; To: C }
+ Line2 CD { From: C; To: D }
+ Line2 DE { From: D; To: E }
+ Line2 EF { From: E; To: F }
+ Line2 FA { From: F; To: A }
+}
+Profile Outline Using Layout {
+ Loop Outer { AB |> BC |> CD |> DE |> EF |> FA |> Close }
+}
+Struct Bracket { Extrude Body { Profile: Outline; From: 0mm; To: 3mm } }
diff --git a/fixtures/Regression/ProfileComposition/valid/semantic-split-compose-chamfer.firmament b/fixtures/Regression/ProfileComposition/valid/semantic-split-compose-chamfer.firmament
index bf06386b..91704a34 100644
--- a/fixtures/Regression/ProfileComposition/valid/semantic-split-compose-chamfer.firmament
+++ b/fixtures/Regression/ProfileComposition/valid/semantic-split-compose-chamfer.firmament
@@ -1,13 +1,14 @@
Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 10mm] }
Rect2 ExtensionGuide { Center: [5mm, 0mm]; Size: [20mm, 10mm] }
-Profile BaseProfile Using ComposeGuide { Loop Outer {
+// Explicit world frame; the historical undeclared ComposeGuide defaulted to XY.
+Profile BaseProfile Using XY { Loop Outer {
BaseGuide.Bottom As South
|> BaseGuide.Right As East
|> BaseGuide.Top As North
|> BaseGuide.Left As West
|> Close
} }
-Profile ExtensionProfile Using ComposeGuide { Loop Outer {
+Profile ExtensionProfile Using XY { Loop Outer {
ExtensionGuide.Bottom As South
|> ExtensionGuide.Right As East
|> ExtensionGuide.Top As North