Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add Firmament pre-M0 compile boundary and diagnostic scaffolding
Yuechen Li671bcac4d074
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.csnew file mode 100644index 00000000..c54de9db--- /dev/null+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs@@ -0,0 +1,64 @@+using Aetheris.Kernel.Firmament.Diagnostics;++namespace Aetheris.Kernel.Firmament.Tests;++public sealed class FirmamentScaffoldTests+{+ [Fact]+ public void CompileBoundaryContracts_CanBeConstructed()+ {+ var document = new FirmamentSourceDocument("", SourceName: "empty.firmament", LanguageVersion: "0");+ var request = new FirmamentCompileRequest(document);+ var result = new FirmamentCompileResult(+ Aetheris.Kernel.Core.Results.KernelResult<FirmamentCompilationArtifact>.Failure());++ Assert.Same(document, request.Document);+ Assert.False(result.Compilation.IsSuccess);+ }++ [Fact]+ public void CompilerStub_ReturnsDeterministicNotImplementedFailure()+ {+ var compiler = new FirmamentCompiler();+ var request = new FirmamentCompileRequest(new FirmamentSourceDocument(string.Empty));++ var first = compiler.Compile(request);+ var second = compiler.Compile(request);++ Assert.False(first.Compilation.IsSuccess);+ Assert.False(second.Compilation.IsSuccess);++ var firstDiagnostic = Assert.Single(first.Compilation.Diagnostics);+ var secondDiagnostic = Assert.Single(second.Compilation.Diagnostics);++ Assert.Equal(firstDiagnostic.Code, secondDiagnostic.Code);+ Assert.Equal(firstDiagnostic.Severity, secondDiagnostic.Severity);+ Assert.Equal(firstDiagnostic.Message, secondDiagnostic.Message);+ Assert.Equal(firstDiagnostic.Source, secondDiagnostic.Source);+ }++ [Fact]+ public void DiagnosticTaxonomyIdentifiers_AreStableAndNonEmpty()+ {+ Assert.Equal("firmament", FirmamentDiagnosticConventions.Source);+ Assert.StartsWith("FIRM-PARSE", FirmamentDiagnosticCodes.ParsePlaceholder.Value);+ Assert.StartsWith("FIRM-STRUCT", FirmamentDiagnosticCodes.StructurePlaceholder.Value);+ Assert.StartsWith("FIRM-REF", FirmamentDiagnosticCodes.ReferencePlaceholder.Value);+ Assert.StartsWith("FIRM-SEL", FirmamentDiagnosticCodes.SelectorPlaceholder.Value);+ Assert.StartsWith("FIRM-SCHEMA", FirmamentDiagnosticCodes.SchemaPlaceholder.Value);+ Assert.StartsWith("FIRM-LOWER", FirmamentDiagnosticCodes.LoweringPlaceholder.Value);+ }++ [Fact]+ public void SourceLocationContracts_ExposeExpectedStructure()+ {+ var start = new FirmamentSourcePosition(1, 1);+ var end = new FirmamentSourcePosition(1, 5);+ var span = new FirmamentSourceSpan(start, end);++ Assert.Equal(1, span.Start.Line);+ Assert.Equal(1, span.Start.Column);+ Assert.Equal(1, span.End.Line);+ Assert.Equal(5, span.End.Column);+ }+}diff --git a/Aetheris.Kernel.Firmament.Tests/SmokeTests.cs b/Aetheris.Kernel.Firmament.Tests/SmokeTests.csdeleted file mode 100644index b7ff845b..00000000--- a/Aetheris.Kernel.Firmament.Tests/SmokeTests.cs+++ /dev/null@@ -1,7 +0,0 @@-namespace Aetheris.Kernel.Firmament.Tests;--public sealed class SmokeTests-{- [Fact]- public void TestProjectIsWired() => Assert.True(true);-}diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCode.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCode.csnew file mode 100644index 00000000..3cdd37ab--- /dev/null+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCode.cs@@ -0,0 +1,6 @@+namespace Aetheris.Kernel.Firmament.Diagnostics;++public readonly record struct FirmamentDiagnosticCode(string Value)+{+ public override string ToString() => Value;+}diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.csnew file mode 100644index 00000000..1e46b98d--- /dev/null+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs@@ -0,0 +1,11 @@+namespace Aetheris.Kernel.Firmament.Diagnostics;++public static class FirmamentDiagnosticCodes+{+ public static readonly FirmamentDiagnosticCode ParsePlaceholder = new($"{FirmamentDiagnosticConventions.ParsePrefix}-0001");+ public static readonly FirmamentDiagnosticCode StructurePlaceholder = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0001");+ public static readonly FirmamentDiagnosticCode ReferencePlaceholder = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0001");+ public static readonly FirmamentDiagnosticCode SelectorPlaceholder = new($"{FirmamentDiagnosticConventions.SelectorPrefix}-0001");+ public static readonly FirmamentDiagnosticCode SchemaPlaceholder = new($"{FirmamentDiagnosticConventions.SchemaPrefix}-0001");+ public static readonly FirmamentDiagnosticCode LoweringPlaceholder = new($"{FirmamentDiagnosticConventions.LoweringPrefix}-0001");+}diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticConventions.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticConventions.csnew file mode 100644index 00000000..203c3bd7--- /dev/null+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticConventions.cs@@ -0,0 +1,13 @@+namespace Aetheris.Kernel.Firmament.Diagnostics;++public static class FirmamentDiagnosticConventions+{+ public const string Source = "firmament";++ public const string ParsePrefix = "FIRM-PARSE";+ public const string StructurePrefix = "FIRM-STRUCT";+ public const string ReferencePrefix = "FIRM-REF";+ public const string SelectorPrefix = "FIRM-SEL";+ public const string SchemaPrefix = "FIRM-SCHEMA";+ public const string LoweringPrefix = "FIRM-LOWER";+}diff --git a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.csnew file mode 100644index 00000000..2edd2964--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs@@ -0,0 +1,3 @@+namespace Aetheris.Kernel.Firmament;++public sealed record FirmamentCompilationArtifact(string ArtifactKind = "pre-m0-placeholder");diff --git a/Aetheris.Kernel.Firmament/FirmamentCompileRequest.cs b/Aetheris.Kernel.Firmament/FirmamentCompileRequest.csnew file mode 100644index 00000000..4a2d82f4--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentCompileRequest.cs@@ -0,0 +1,3 @@+namespace Aetheris.Kernel.Firmament;++public sealed record FirmamentCompileRequest(FirmamentSourceDocument Document);diff --git a/Aetheris.Kernel.Firmament/FirmamentCompileResult.cs b/Aetheris.Kernel.Firmament/FirmamentCompileResult.csnew file mode 100644index 00000000..815f320e--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentCompileResult.cs@@ -0,0 +1,5 @@+using Aetheris.Kernel.Core.Results;++namespace Aetheris.Kernel.Firmament;++public sealed record FirmamentCompileResult(KernelResult<FirmamentCompilationArtifact> Compilation);diff --git a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs b/Aetheris.Kernel.Firmament/FirmamentCompiler.csnew file mode 100644index 00000000..a858ed2d--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs@@ -0,0 +1,22 @@+using Aetheris.Kernel.Core.Diagnostics;+using Aetheris.Kernel.Core.Results;+using Aetheris.Kernel.Firmament.Diagnostics;++namespace Aetheris.Kernel.Firmament;++public sealed class FirmamentCompiler+{+ public FirmamentCompileResult Compile(FirmamentCompileRequest request)+ {+ ArgumentNullException.ThrowIfNull(request);++ var diagnostic = new KernelDiagnostic(+ KernelDiagnosticCode.NotImplemented,+ KernelDiagnosticSeverity.Error,+ "Firmament compilation is not implemented yet (pre-M0 scaffold).",+ Source: FirmamentDiagnosticConventions.Source);++ return new FirmamentCompileResult(+ KernelResult<FirmamentCompilationArtifact>.Failure([diagnostic]));+ }+}diff --git a/Aetheris.Kernel.Firmament/FirmamentSourceDocument.cs b/Aetheris.Kernel.Firmament/FirmamentSourceDocument.csnew file mode 100644index 00000000..78c12b4b--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentSourceDocument.cs@@ -0,0 +1,7 @@+namespace Aetheris.Kernel.Firmament;++public sealed record FirmamentSourceDocument(+ string SourceText,+ string? SourceName = null,+ string SourceFamily = "firmament",+ string? LanguageVersion = null);diff --git a/Aetheris.Kernel.Firmament/FirmamentSourceLocation.cs b/Aetheris.Kernel.Firmament/FirmamentSourceLocation.csnew file mode 100644index 00000000..046940cf--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentSourceLocation.cs@@ -0,0 +1,37 @@+namespace Aetheris.Kernel.Firmament;++public readonly record struct FirmamentSourcePosition+{+ public FirmamentSourcePosition(int line, int column)+ {+ if (line < 1)+ {+ throw new ArgumentOutOfRangeException(nameof(line), "Line must be 1 or greater.");+ }++ if (column < 1)+ {+ throw new ArgumentOutOfRangeException(nameof(column), "Column must be 1 or greater.");+ }++ Line = line;+ Column = column;+ }++ public int Line { get; }++ public int Column { get; }+}++public readonly record struct FirmamentSourceSpan+{+ public FirmamentSourceSpan(FirmamentSourcePosition start, FirmamentSourcePosition end)+ {+ Start = start;+ End = end;+ }++ public FirmamentSourcePosition Start { get; }++ public FirmamentSourcePosition End { get; }+}diff --git a/Aetheris.Kernel.Firmament/README.md b/Aetheris.Kernel.Firmament/README.mdindex b1eed565..0ebdc263 100644--- a/Aetheris.Kernel.Firmament/README.md+++ b/Aetheris.Kernel.Firmament/README.md@@ -2,6 +2,14 @@This project is the future home of Firmament in Aetheris.-Current status: pre-M0 scaffold only. No parser, lowering, or validator behavior exists yet.+Current status: pre-M0 scaffold only.++Implemented scaffolding:+- compile boundary contracts (`FirmamentSourceDocument`, `FirmamentCompileRequest`, `FirmamentCompileResult`)+- Firmament diagnostic taxonomy placeholders and code-family conventions+- source location contract placeholders (`FirmamentSourcePosition`, `FirmamentSourceSpan`)+- deterministic compiler facade stub (`FirmamentCompiler`) that reports not implemented++Not implemented yet: parser, semantic validation, selectors, lowering, or STEP behavior.The top-level lanes (`Connectors`, `ParsedModel`, `Lanes`, `Mapping`, `Diagnostics`) are intentionally separated to guide future implementation work.