Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add Firmament pre-M0 corpus manifest and fixture harness
Yuechen Li56b60e19dae5
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusHarness.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusHarness.csnew file mode 100644index 00000000..fce6d1e4--- /dev/null+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusHarness.cs@@ -0,0 +1,87 @@+using System.Text;+using System.Text.Json;+using Aetheris.Kernel.Core.Diagnostics;++namespace Aetheris.Kernel.Firmament.Tests;++internal static class FirmamentCorpusHarness+{+ public static FirmamentCorpusManifest LoadManifest(string relativePath)+ {+ var fullPath = Path.Combine(RepoRoot(), relativePath.Replace('/', Path.DirectorySeparatorChar));+ var json = File.ReadAllText(fullPath, Encoding.UTF8);+ var manifest = JsonSerializer.Deserialize<FirmamentCorpusManifest>(json, new JsonSerializerOptions(JsonSerializerDefaults.Web));+ if (manifest is null)+ {+ throw new InvalidOperationException($"Unable to deserialize manifest: {relativePath}");+ }++ return manifest;+ }++ public static string ResolveFixtureFullPath(string fixturePath)+ {+ ArgumentException.ThrowIfNullOrWhiteSpace(fixturePath);+ return Path.Combine(RepoRoot(), fixturePath.Replace('/', Path.DirectorySeparatorChar));+ }++ public static string ReadFixtureText(string fixturePath)+ {+ var fullPath = ResolveFixtureFullPath(fixturePath);+ return NormalizeLf(File.ReadAllText(fullPath, Encoding.UTF8));+ }++ public static string NormalizeLf(string value) => value.Replace("\r\n", "\n", StringComparison.Ordinal).Replace("\r", "\n", StringComparison.Ordinal);++ public static string RepoRoot()+ {+ var directory = new DirectoryInfo(AppContext.BaseDirectory);+ while (directory is not null)+ {+ if (File.Exists(Path.Combine(directory.FullName, "Aetheris.slnx")))+ {+ return directory.FullName;+ }++ directory = directory.Parent;+ }++ throw new InvalidOperationException("Unable to locate repository root.");+ }++ public static KernelDiagnostic CompileFirstDiagnostic(string fixtureText)+ {+ var compiler = new FirmamentCompiler();+ var request = new FirmamentCompileRequest(new FirmamentSourceDocument(fixtureText));+ var result = compiler.Compile(request);+ Assert.False(result.Compilation.IsSuccess);+ return Assert.Single(result.Compilation.Diagnostics);+ }+}++internal sealed class FirmamentCorpusManifest+{+ public string Version { get; init; } = string.Empty;++ public IReadOnlyList<FirmamentCorpusEntry> Entries { get; init; } = Array.Empty<FirmamentCorpusEntry>();+}++internal sealed class FirmamentCorpusEntry+{+ public string Id { get; init; } = string.Empty;++ public string Name { get; init; } = string.Empty;++ public string FixturePath { get; init; } = string.Empty;++ public string ExpectedOutcome { get; init; } = string.Empty;++ public FirmamentExpectedDiagnostic? ExpectedDiagnostic { get; init; }+}++internal sealed class FirmamentExpectedDiagnostic+{+ public string Source { get; init; } = string.Empty;++ public string Code { get; init; } = string.Empty;+}diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.csnew file mode 100644index 00000000..a0a351bf--- /dev/null+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentCorpusScaffoldTests.cs@@ -0,0 +1,58 @@+using Aetheris.Kernel.Core.Diagnostics;++namespace Aetheris.Kernel.Firmament.Tests;++public sealed class FirmamentCorpusScaffoldTests+{+ private const string ManifestPath = "testdata/firmament/manifests/pre-m0.corpus.json";++ [Fact]+ public void Manifest_Exists_And_CanBeLoaded()+ {+ var fullPath = Path.Combine(FirmamentCorpusHarness.RepoRoot(), ManifestPath.Replace('/', Path.DirectorySeparatorChar));+ Assert.True(File.Exists(fullPath), $"Missing manifest: {ManifestPath}");++ var manifest = FirmamentCorpusHarness.LoadManifest(ManifestPath);+ Assert.Equal("1", manifest.Version);+ Assert.NotEmpty(manifest.Entries);+ }++ [Fact]+ public void Manifest_ListedFixtures_Exist_And_AreReadableDeterministically()+ {+ var manifest = FirmamentCorpusHarness.LoadManifest(ManifestPath);++ foreach (var entry in manifest.Entries)+ {+ var fullPath = FirmamentCorpusHarness.ResolveFixtureFullPath(entry.FixturePath);+ Assert.True(File.Exists(fullPath), $"Missing fixture: {entry.FixturePath}");++ var first = FirmamentCorpusHarness.ReadFixtureText(entry.FixturePath);+ var second = FirmamentCorpusHarness.ReadFixtureText(entry.FixturePath);++ Assert.Equal(first, second);+ Assert.False(string.IsNullOrWhiteSpace(first));+ }+ }++ [Fact]+ public void CuratedCases_InvokeStubCompiler_WithExpectedCoarseOutcome()+ {+ var manifest = FirmamentCorpusHarness.LoadManifest(ManifestPath);++ foreach (var entry in manifest.Entries.OrderBy(e => e.Id, StringComparer.Ordinal))+ {+ Assert.Equal("stubNotImplemented", entry.ExpectedOutcome);++ var fixtureText = FirmamentCorpusHarness.ReadFixtureText(entry.FixturePath);+ var diagnostic = FirmamentCorpusHarness.CompileFirstDiagnostic(fixtureText);++ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ if (entry.ExpectedDiagnostic is not null)+ {+ Assert.Equal(entry.ExpectedDiagnostic.Source, diagnostic.Source);+ Assert.Equal(entry.ExpectedDiagnostic.Code, diagnostic.Code.ToString());+ }+ }+ }+}diff --git a/Aetheris.Kernel.Firmament.Tests/README.md b/Aetheris.Kernel.Firmament.Tests/README.mdindex cccdbbc0..f341c85d 100644--- a/Aetheris.Kernel.Firmament.Tests/README.md+++ b/Aetheris.Kernel.Firmament.Tests/README.md@@ -8,3 +8,8 @@ Pre-M0 scaffold test areas:- Integration/No parser, validator, selector, or lowering behavior is implemented yet.+++Corpus scaffold:+- `testdata/firmament/manifests/pre-m0.corpus.json` defines tiny curated cases.+- `testdata/firmament/fixtures/*.firmament` are pre-M0 placeholder fixtures only.diff --git a/Aetheris.Kernel.Firmament/README.md b/Aetheris.Kernel.Firmament/README.mdindex 0ebdc263..b11a6f88 100644--- a/Aetheris.Kernel.Firmament/README.md+++ b/Aetheris.Kernel.Firmament/README.md@@ -9,7 +9,8 @@ Implemented scaffolding:- Firmament diagnostic taxonomy placeholders and code-family conventions- source location contract placeholders (`FirmamentSourcePosition`, `FirmamentSourceSpan`)- deterministic compiler facade stub (`FirmamentCompiler`) that reports not implemented+- tiny pre-M0 curated corpus scaffold (`testdata/firmament/`) with a manifest and placeholder `.firmament` fixtures consumed by tests-Not implemented yet: parser, semantic validation, selectors, lowering, or STEP behavior.+Not implemented yet: parser, semantic validation, selectors, lowering, or STEP behavior. The corpus scaffold is infrastructure-only and will be expanded by future parser/validator/lowering work.The top-level lanes (`Connectors`, `ParsedModel`, `Lanes`, `Mapping`, `Diagnostics`) are intentionally separated to guide future implementation work.diff --git a/testdata/firmament/fixtures/invalid-placeholder.firmament b/testdata/firmament/fixtures/invalid-placeholder.firmamentnew file mode 100644index 00000000..602c9abb--- /dev/null+++ b/testdata/firmament/fixtures/invalid-placeholder.firmament@@ -0,0 +1,2 @@+# intentionally invalid pre-M0 placeholder+this is not real firmament syntax ###diff --git a/testdata/firmament/fixtures/minimal-placeholder.firmament b/testdata/firmament/fixtures/minimal-placeholder.firmamentnew file mode 100644index 00000000..f51bd0f7--- /dev/null+++ b/testdata/firmament/fixtures/minimal-placeholder.firmament@@ -0,0 +1,2 @@+# pre-M0 placeholder fixture+module demo {}diff --git a/testdata/firmament/manifests/pre-m0.corpus.json b/testdata/firmament/manifests/pre-m0.corpus.jsonnew file mode 100644index 00000000..a57e043d--- /dev/null+++ b/testdata/firmament/manifests/pre-m0.corpus.json@@ -0,0 +1,25 @@+{+ "version": "1",+ "entries": [+ {+ "id": "fixture-minimal-source-exists",+ "name": "Minimal placeholder source fixture exists",+ "fixturePath": "testdata/firmament/fixtures/minimal-placeholder.firmament",+ "expectedOutcome": "stubNotImplemented",+ "expectedDiagnostic": {+ "source": "firmament",+ "code": "NotImplemented"+ }+ },+ {+ "id": "fixture-invalid-placeholder-source",+ "name": "Invalid placeholder source still routes through compiler stub",+ "fixturePath": "testdata/firmament/fixtures/invalid-placeholder.firmament",+ "expectedOutcome": "stubNotImplemented",+ "expectedDiagnostic": {+ "source": "firmament",+ "code": "NotImplemented"+ }+ }+ ]+}