Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add gated prismatic corpus stability test
Yuechen Li8ac6a4d98abd
diff --git a/Aetheris.CLI.Tests/PrismaticCorpusStabilityTests.cs b/Aetheris.CLI.Tests/PrismaticCorpusStabilityTests.csnew file mode 100644index 00000000..25cf2ef0--- /dev/null+++ b/Aetheris.CLI.Tests/PrismaticCorpusStabilityTests.cs@@ -0,0 +1,386 @@+using System.Security.Cryptography;+using System.Text.Json;+using Xunit.Abstractions;++namespace Aetheris.CLI.Tests;++public sealed class PrismaticCorpusStabilityTests+{+ private const string RunArtifactCorpusTestsEnvironmentVariable = "AETHERIS_RUN_ARTIFACT_CORPUS_TESTS";+ private readonly ITestOutputHelper output;++ public PrismaticCorpusStabilityTests(ITestOutputHelper output)+ {+ this.output = output;+ }++ [Fact]+ [Trait("Category", "ArtifactCorpus")]+ public void PrismaticCorpusStability_Repeated_Cli_Runs_Produce_Stable_Json_Step_Hashes_Sections_And_Map_Blocker()+ {+ if (!string.Equals(Environment.GetEnvironmentVariable(RunArtifactCorpusTestsEnvironmentVariable), "1", StringComparison.Ordinal))+ {+ output.WriteLine(+ $"Skipping gated EDGE-PRISMATIC-X6 prismatic artifact corpus stability and analyzer confirmation check. Set {RunArtifactCorpusTestsEnvironmentVariable}=1 and filter by PrismaticCorpusStability or Category=ArtifactCorpus to run it explicitly.");+ return;+ }++ output.WriteLine("edge-prismatic-x6-corpus-stability-started");++ var root = Path.Combine(Path.GetTempPath(), $"edge-prismatic-x6-corpus-stability-{Guid.NewGuid():N}");+ var firstDir = Path.Combine(root, "first");+ var secondDir = Path.Combine(root, "second");++ try+ {+ var first = GenerateAnalyzeAndSummarizeCorpus(firstDir, "first");+ var second = GenerateAnalyzeAndSummarizeCorpus(secondDir, "second");++ Assert.Equal(first.StableJsonSummaryJson, second.StableJsonSummaryJson);+ output.WriteLine("edge-prismatic-x6-json-stability-succeeded");++ Assert.Equal(first.StepSha256ByArtifactFileName, second.StepSha256ByArtifactFileName);+ output.WriteLine("edge-prismatic-x6-step-hash-stability-succeeded");++ Assert.Equal(first.StepNormalizedSummaryByArtifactFileName, second.StepNormalizedSummaryByArtifactFileName);+ output.WriteLine("edge-prismatic-x6-step-normalized-stability-succeeded");++ Assert.Equal(first.SectionAnalysisByCaseName, second.SectionAnalysisByCaseName);+ foreach (var caseName in first.SectionAnalysisByCaseName.Keys)+ {+ output.WriteLine($"edge-prismatic-x6-analyze-section-stability-succeeded:{caseName}");+ }++ Assert.Equal(first.MapAnalysisByCaseName, second.MapAnalysisByCaseName);+ foreach (var caseName in first.MapAnalysisByCaseName.Keys)+ {+ output.WriteLine($"edge-prismatic-x6-analyze-map-stability-succeeded:{caseName}");+ }+ }+ finally+ {+ if (Directory.Exists(root))+ {+ Directory.Delete(root, recursive: true);+ }+ }+ }++ private PrismaticCorpusStabilityRun GenerateAnalyzeAndSummarizeCorpus(string outputDir, string runName)+ {+ var stdout = new StringWriter();+ var stderr = new StringWriter();++ var exitCode = Aetheris.CLI.CliRunner.Run(["experimental", "prismatic-corpus", "--out-dir", outputDir, "--json"], stdout, stderr);++ Assert.Equal(0, exitCode);+ Assert.True(string.IsNullOrWhiteSpace(stderr.ToString()), stderr.ToString());+ output.WriteLine($"edge-prismatic-x6-corpus-run-completed:{runName}");++ var summaryPath = Path.Combine(outputDir, "edge-prismatic-x5-corpus.json");+ Assert.True(File.Exists(summaryPath));++ using var stdoutJson = JsonDocument.Parse(stdout.ToString());+ using var fileJson = JsonDocument.Parse(File.ReadAllText(summaryPath));+ Assert.Equal(stdoutJson.RootElement.GetProperty("milestone").GetString(), fileJson.RootElement.GetProperty("milestone").GetString());+ Assert.Equal(stdoutJson.RootElement.GetProperty("cases").GetArrayLength(), fileJson.RootElement.GetProperty("cases").GetArrayLength());++ var stableSummary = PrismaticCorpusStabilitySummary.FromJson(stdoutJson.RootElement);+ Assert.Equal("EDGE-PRISMATIC-X5", stableSummary.Milestone);+ Assert.Equal("experimental", stableSummary.Route);+ Assert.Equal("prismatic-section-transition", stableSummary.TransitionRoute);+ Assert.Equal("PrismaticSectionTransitionEmitter", stableSummary.EmitterComponentName);+ Assert.Equal("preserve-section-splits", stableSummary.SplitPolicy);+ AssertGuarantees(stableSummary.Guarantees);+ Assert.Contains("edge-prismatic-x5-no-production-route-replacement", stableSummary.Diagnostics);+ Assert.Contains("edge-prismatic-x5-no-air-edge-sweep-used", stableSummary.Diagnostics);+ Assert.Contains("edge-prismatic-x5-no-brep-bounded-chamfer-used", stableSummary.Diagnostics);+ Assert.Contains("edge-prismatic-x5-no-topology-graft-used", stableSummary.Diagnostics);+ Assert.Contains("edge-prismatic-x5-no-3d-boolean-used", stableSummary.Diagnostics);+ Assert.Contains("edge-prismatic-x5-no-coplanar-merge-used", stableSummary.Diagnostics);+ output.WriteLine("edge-prismatic-x6-no-production-route-replacement");+ output.WriteLine("edge-prismatic-x6-no-air-edge-sweep-used");+ output.WriteLine("edge-prismatic-x6-no-brep-bounded-chamfer-used");+ output.WriteLine("edge-prismatic-x6-no-topology-graft-used");+ output.WriteLine("edge-prismatic-x6-no-3d-boolean-used");+ output.WriteLine("edge-prismatic-x6-no-coplanar-merge-used");++ var expectedCases = new[]+ {+ "arcs-deferred",+ "hexagon-scaled",+ "holes-deferred",+ "invalid-self-intersecting-profile",+ "mismatched-vertex-count",+ "missing-correspondence",+ "multiple-loops-deferred",+ "non-identity-correspondence",+ "non-increasing-sections",+ "pentagon-asymmetric",+ "pentagon-scaled",+ "rectangle-inset",+ "top-edge-chamfer",+ };+ Assert.Equal(expectedCases, stableSummary.Cases.Select(c => c.CaseName).ToArray());++ var shaByArtifact = new SortedDictionary<string, string>(StringComparer.Ordinal);+ var normalizedByArtifact = new SortedDictionary<string, string>(StringComparer.Ordinal);+ foreach (var corpusCase in stableSummary.Cases.Where(c => string.Equals(c.Status, "succeeded", StringComparison.Ordinal)))+ {+ Assert.False(string.IsNullOrWhiteSpace(corpusCase.ArtifactFileName));+ var stepPath = Path.Combine(outputDir, corpusCase.ArtifactFileName!);+ Assert.True(File.Exists(stepPath), $"Expected STEP artifact '{stepPath}' to exist.");+ Assert.True(new FileInfo(stepPath).Length > 0, $"Expected STEP artifact '{stepPath}' to be non-empty.");++ var stepText = File.ReadAllText(stepPath);+ AssertStepMarkers(stepText);+ shaByArtifact.Add(corpusCase.ArtifactFileName!, Sha256(stepPath));+ normalizedByArtifact.Add(corpusCase.ArtifactFileName!, JsonSerializer.Serialize(new StepNormalizedSummary(corpusCase.Status, corpusCase.ArtifactFileName, corpusCase.TopologySummaryJson, corpusCase.StepMarkerSummaryJson)));+ }++ Assert.Equal(+ new[]+ {+ "edge-prismatic-x5-hexagon-scaled.step",+ "edge-prismatic-x5-pentagon-asymmetric.step",+ "edge-prismatic-x5-pentagon-scaled.step",+ "edge-prismatic-x5-rectangle-inset.step",+ "edge-prismatic-x5-top-edge-chamfer.step",+ },+ shaByArtifact.Keys.ToArray());++ var sectionByCase = new SortedDictionary<string, string>(StringComparer.Ordinal)+ {+ ["rectangle-inset"] = AnalyzeSection(outputDir, "rectangle-inset", "edge-prismatic-x5-rectangle-inset.step", "--xy", "0.5"),+ ["top-edge-chamfer"] = AnalyzeSection(outputDir, "top-edge-chamfer", "edge-prismatic-x5-top-edge-chamfer.step", "--xy", "5.5"),+ ["hexagon-scaled"] = AnalyzeSection(outputDir, "hexagon-scaled", "edge-prismatic-x5-hexagon-scaled.step", "--xy", "0.5"),+ };++ var mapByCase = new SortedDictionary<string, string>(StringComparer.Ordinal)+ {+ ["top-edge-chamfer"] = AnalyzeMap(outputDir, "top-edge-chamfer", "edge-prismatic-x5-top-edge-chamfer.step"),+ ["hexagon-scaled"] = AnalyzeMap(outputDir, "hexagon-scaled", "edge-prismatic-x5-hexagon-scaled.step"),+ };++ return new PrismaticCorpusStabilityRun(+ JsonSerializer.Serialize(stableSummary),+ shaByArtifact,+ normalizedByArtifact,+ sectionByCase,+ mapByCase);+ }++ private string AnalyzeSection(string outputDir, string caseName, string artifactFileName, string plane, string offset)+ {+ var stepPath = Path.Combine(outputDir, artifactFileName);+ var stdout = new StringWriter();+ var stderr = new StringWriter();+ var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", "section", stepPath, plane, "--offset", offset, "--json"], stdout, stderr);+ Assert.Equal(0, exitCode);+ Assert.True(string.IsNullOrWhiteSpace(stderr.ToString()), stderr.ToString());++ using var doc = JsonDocument.Parse(stdout.ToString());+ var summary = doc.RootElement.GetProperty("summary");+ Assert.True(summary.GetProperty("loopCount").GetInt32() > 0);+ Assert.True(summary.GetProperty("closedLoopCount").GetInt32() > 0);+ Assert.True(summary.GetProperty("lineSegmentCount").GetInt32() > 0);+ Assert.Equal(0, summary.GetProperty("unsupportedSegmentCount").GetInt32());+ output.WriteLine($"edge-prismatic-x6-analyze-section-succeeded:{caseName}");++ return JsonSerializer.Serialize(SectionProjection.FromJson(doc.RootElement));+ }++ private string AnalyzeMap(string outputDir, string caseName, string artifactFileName)+ {+ var stepPath = Path.Combine(outputDir, artifactFileName);+ var stdout = new StringWriter();+ var stderr = new StringWriter();+ var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", "map", stepPath, "--top", "--rows", "16", "--cols", "16", "--json"], stdout, stderr);+ Assert.Equal(1, exitCode);+ Assert.True(string.IsNullOrWhiteSpace(stderr.ToString()), stderr.ToString());++ using var doc = JsonDocument.Parse(stdout.ToString());+ var root = doc.RootElement;+ Assert.False(root.GetProperty("success").GetBoolean());+ Assert.Equal("analysis-failure", root.GetProperty("errorKind").GetString());+ Assert.Contains("Orthographic map v1 currently supports bodies accepted by BrepSpatialQueries.Raycast", root.GetProperty("error").GetString(), StringComparison.Ordinal);+ output.WriteLine($"edge-prismatic-x6-analyze-map-blocker-confirmed:{caseName}");++ return JsonSerializer.Serialize(MapProjection.FromJson(root));+ }++ private static void AssertGuarantees(PrismaticGuarantees guarantees)+ {+ Assert.True(guarantees.NoProductionRouteReplacement);+ Assert.True(guarantees.NoAirEdgeSweep);+ Assert.True(guarantees.NoBrepBoundedChamfer);+ Assert.True(guarantees.NoTopologyGraft);+ Assert.True(guarantees.No3DBoolean);+ Assert.True(guarantees.NoCoplanarMerge);+ }++ private static void AssertStepMarkers(string stepText)+ {+ Assert.False(string.IsNullOrWhiteSpace(stepText));+ Assert.Contains("ISO-10303-21", stepText, StringComparison.Ordinal);+ Assert.Contains("MANIFOLD_SOLID_BREP", stepText, StringComparison.Ordinal);+ Assert.Contains("ADVANCED_FACE", stepText, StringComparison.Ordinal);+ Assert.Contains("PLANE", stepText, StringComparison.Ordinal);+ Assert.DoesNotContain("CYLINDRICAL_SURFACE", stepText, StringComparison.Ordinal);+ Assert.DoesNotContain("BREP_WITH_VOIDS", stepText, StringComparison.Ordinal);+ }++ private static string Sha256(string path)+ {+ using var stream = File.OpenRead(path);+ return Convert.ToHexString(SHA256.HashData(stream));+ }++ private sealed record PrismaticCorpusStabilityRun(+ string StableJsonSummaryJson,+ SortedDictionary<string, string> StepSha256ByArtifactFileName,+ SortedDictionary<string, string> StepNormalizedSummaryByArtifactFileName,+ SortedDictionary<string, string> SectionAnalysisByCaseName,+ SortedDictionary<string, string> MapAnalysisByCaseName);++ private sealed record PrismaticCorpusStabilitySummary(+ string? CorpusVersion,+ string Milestone,+ string Route,+ string TransitionRoute,+ string EmitterComponentName,+ string SplitPolicy,+ PrismaticCorpusStabilityCaseSummary[] Cases,+ string[] Diagnostics,+ string[] Errors,+ PrismaticGuarantees Guarantees)+ {+ public static PrismaticCorpusStabilitySummary FromJson(JsonElement root)+ => new(+ ReadOptionalString(root, "corpusVersion"),+ root.GetProperty("milestone").GetString()!,+ root.GetProperty("route").GetString()!,+ root.GetProperty("transitionRoute").GetString()!,+ root.GetProperty("emitterComponentName").GetString()!,+ root.GetProperty("splitPolicy").GetString()!,+ root.GetProperty("cases")+ .EnumerateArray()+ .Select(PrismaticCorpusStabilityCaseSummary.FromJson)+ .OrderBy(c => c.CaseName, StringComparer.Ordinal)+ .ToArray(),+ ReadStringArray(root.GetProperty("diagnostics")),+ ReadStringArray(root.GetProperty("errors")),+ PrismaticGuarantees.FromJson(root.GetProperty("guarantees")));+ }++ private sealed record PrismaticCorpusStabilityCaseSummary(+ string CaseName,+ string Status,+ string? ArtifactFileName,+ string Route,+ string TransitionRoute,+ string EmitterComponentName,+ string SplitPolicy,+ string? TopologySummaryJson,+ string? StepMarkerSummaryJson,+ string[] Diagnostics,+ string[] Errors,+ PrismaticGuarantees Guarantees)+ {+ public static PrismaticCorpusStabilityCaseSummary FromJson(JsonElement element)+ => new(+ element.GetProperty("caseName").GetString()!,+ element.GetProperty("status").GetString()!,+ ReadNullableString(element.GetProperty("artifactFileName")),+ element.GetProperty("route").GetString()!,+ element.GetProperty("transitionRoute").GetString()!,+ element.GetProperty("emitterComponentName").GetString()!,+ element.GetProperty("splitPolicy").GetString()!,+ ReadNullableRawText(element.GetProperty("topologySummary")),+ ReadNullableRawText(element.GetProperty("stepMarkerSummary")),+ ReadStringArray(element.GetProperty("diagnostics")),+ ReadStringArray(element.GetProperty("errors")),+ PrismaticGuarantees.FromJson(element.GetProperty("guarantees")));+ }++ private sealed record PrismaticGuarantees(+ bool NoProductionRouteReplacement,+ bool NoAirEdgeSweep,+ bool NoBrepBoundedChamfer,+ bool NoTopologyGraft,+ bool No3DBoolean,+ bool NoCoplanarMerge)+ {+ public static PrismaticGuarantees FromJson(JsonElement element)+ => new(+ element.GetProperty("noProductionRouteReplacement").GetBoolean(),+ element.GetProperty("noAirEdgeSweep").GetBoolean(),+ element.GetProperty("noBrepBoundedChamfer").GetBoolean(),+ element.GetProperty("noTopologyGraft").GetBoolean(),+ element.GetProperty("no3DBoolean").GetBoolean(),+ element.GetProperty("noCoplanarMerge").GetBoolean());+ }++ private sealed record StepNormalizedSummary(string Status, string? ArtifactFileName, string? TopologySummaryJson, string? StepMarkerSummaryJson);++ private sealed record SectionProjection(+ string PlaneFamily,+ double Offset,+ string OffsetAxis,+ string SectionAxisU,+ string SectionAxisV,+ string BoundingBoxJson,+ int LoopCount,+ int ClosedLoopCount,+ int LineSegmentCount,+ int ArcSegmentCount,+ int UnsupportedSegmentCount,+ string? SectionBoundingBox2DJson)+ {+ public static SectionProjection FromJson(JsonElement root)+ {+ var metadata = root.GetProperty("metadata");+ var summary = root.GetProperty("summary");+ var sectionBounds = summary.GetProperty("sectionBoundingBox2D");+ return new SectionProjection(+ metadata.GetProperty("planeFamily").GetString()!,+ metadata.GetProperty("offset").GetDouble(),+ metadata.GetProperty("offsetAxis").GetString()!,+ metadata.GetProperty("sectionAxisU").GetString()!,+ metadata.GetProperty("sectionAxisV").GetString()!,+ metadata.GetProperty("boundingBox").GetRawText(),+ summary.GetProperty("loopCount").GetInt32(),+ summary.GetProperty("closedLoopCount").GetInt32(),+ summary.GetProperty("lineSegmentCount").GetInt32(),+ summary.GetProperty("arcSegmentCount").GetInt32(),+ summary.GetProperty("unsupportedSegmentCount").GetInt32(),+ sectionBounds.ValueKind == JsonValueKind.Null ? null : sectionBounds.GetRawText());+ }+ }++ private sealed record MapProjection(bool Success, string ErrorKind, string Error)+ {+ public static MapProjection FromJson(JsonElement root)+ => new(+ root.GetProperty("success").GetBoolean(),+ root.GetProperty("errorKind").GetString()!,+ root.GetProperty("error").GetString()!);+ }++ private static string[] ReadStringArray(JsonElement element)+ => element.EnumerateArray()+ .Select(x => x.GetString()!)+ .OrderBy(x => x, StringComparer.Ordinal)+ .ToArray();++ private static string? ReadNullableString(JsonElement element)+ => element.ValueKind == JsonValueKind.Null ? null : element.GetString();++ private static string? ReadOptionalString(JsonElement element, string propertyName)+ => element.TryGetProperty(propertyName, out var property) && property.ValueKind != JsonValueKind.Null+ ? property.GetString()+ : null;++ private static string? ReadNullableRawText(JsonElement element)+ => element.ValueKind == JsonValueKind.Null ? null : element.GetRawText();+}diff --git a/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.md b/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.mdindex 12e7d52b..1558c037 100644--- a/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.md+++ b/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.md@@ -285,3 +285,7 @@ The prismatic section-transition row is now **internal production-adjacent / not## EDGE-PRISMATIC-V2 status noteThe top/horizontal history-known chamfer row now has an **internal controlled route / not production-authoritative** witness for the rectangular-prism top `+X` side case. `PrismaticTopEdgeChamferPrototype` accepts controlled dimensions and chamfer distance, validates the supported selection, builds the canonical three-section stack, invokes `PrismaticSectionTransitionEmitter`, produces a closed all-planar BRep with the expected 12 vertices, 20 edges, 10 faces, 10 loops, and 40 coedges, passes STEP smoke through the existing exporter, and is now included in the EDGE-PRISMATIC-X5 corpus as `edge-prismatic-x5-top-edge-chamfer.step` with split-preserving topology asserted. No production chamfer/fillet behavior, production route replacement, current `ProfileStackExtrudeExecutor` behavior, STEP exporter/importer behavior, Boolean core behavior, AirEdgeSweep behavior, public API, triangle migration, sketch solver, clipping engine, or NURBS/freeform support changed.++## EDGE-PRISMATIC-X6 stability/analyzer evidence note++The prismatic section-transition evidence now includes an explicitly gated/manual corpus stability check: `AETHERIS_RUN_ARTIFACT_CORPUS_TESTS=1 dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "PrismaticCorpusStability"`. The gate compares repeated EDGE-PRISMATIC-X5 JSON summaries, topology summaries, STEP marker summaries, raw STEP SHA256 hashes, normalized STEP summaries, and invalid/deferred diagnostics for rectangle inset, top-edge chamfer, scaled pentagon, scaled hexagon, asymmetric pentagon, and JSON-only invalid/deferred cases. It also confirms deterministic `analyze section` geometry summaries for selected successful artifacts and records the current `analyze map` primitive-raycast limitation as analyzer integration evidence to address later. This improves repeatability evidence for the split-preserving prismatic lane but does not upgrade any chamfer/fillet row to production support and does not change production chamfer/fillet behavior, ProfileStack behavior, STEP exporter/importer behavior, Boolean core behavior, AirEdgeSweep behavior, coplanar merge policy, triangle migration, sketch solver, clipping engine, or NURBS/freeform support.diff --git a/docs/edge-prismatic-x4-coplanar-split-merge-policy-audit.md b/docs/edge-prismatic-x4-coplanar-split-merge-policy-audit.mdindex a8cf012c..ad594e54 100644--- a/docs/edge-prismatic-x4-coplanar-split-merge-policy-audit.md+++ b/docs/edge-prismatic-x4-coplanar-split-merge-policy-audit.md@@ -167,10 +167,11 @@ Future tests for a merge mode should:Recommended next milestones are:-1. **EDGE-PRISMATIC-X5**: prismatic artifact/corpus route using split-preserving output.-2. **EDGE-PRISMATIC-X6**: optional coplanar merge proof lab, only after the split-preserving corpus exists.-3. **EDGE-PRISMATIC-V3**: controlled Firmament/CLI route if the split-preserving corpus is stable.-4. Or return to chamfer/fillet work after X4 if the prismatic audit trail is sufficient for current planning.+1. **EDGE-PRISMATIC-X5**: completed as the prismatic artifact/corpus route using split-preserving output.+2. **EDGE-PRISMATIC-X6**: completed as the gated/manual corpus stability and analyzer confirmation check for the split-preserving corpus.+3. **EDGE-PRISMATIC-X7**: optional coplanar merge proof lab, only after the split-preserving corpus remains stable and analyzer limitations are explicitly classified.+4. **EDGE-PRISMATIC-V3**: controlled Firmament/CLI route if the split-preserving corpus and route-admission evidence are stable enough.+5. Or return to chamfer/fillet work if the prismatic audit trail is sufficient for current planning.## 13. Non-goals@@ -192,6 +193,10 @@ This milestone does not include:- triangle migration retry;- sketch solver, clipping engine, NURBS, or freeform support.-## 11. EDGE-PRISMATIC-X5 corpus evidence note+## 14. EDGE-PRISMATIC-X5 corpus evidence noteEDGE-PRISMATIC-X5 adds a split-preserving artifact corpus for the prismatic section-transition lane. The corpus writes deterministic STEP artifacts for rectangle inset, top `+X` edge chamfer, scaled pentagon, scaled hexagon, and asymmetric pentagon cases, plus JSON-only invalid/deferred diagnostics. Its topology assertions intentionally use the X4 policy: section-boundary split faces are preserved by default, and coplanar merging remains a future optional post-emission optimization only.++## 15. EDGE-PRISMATIC-X6 split-preserving stability evidence note++EDGE-PRISMATIC-X6 adds gated artifact stability and analyzer confirmation evidence for the split-preserving output policy recorded here. The manual `PrismaticCorpusStability` test runs the X5 corpus twice, compares stable JSON/topology/marker/diagnostic projections, compares raw STEP SHA256 hashes plus normalized STEP summaries for successful artifacts, and confirms deterministic `analyze section` output for selected rectangle, top-edge chamfer, and hexagon artifacts. It also invokes `analyze map` and documents the current primitive-raycast limitation as a bounded analyzer integration blocker rather than introducing a coplanar merge or production-route change. This strengthens the default split-preserving contract; it does not add merged mode, mutate topology, change exporter/importer behavior, or replace any production chamfer/fillet route.diff --git a/docs/frictionlab/edge-prismatic-x5-section-transition-artifact-corpus.md b/docs/frictionlab/edge-prismatic-x5-section-transition-artifact-corpus.mdindex 5a6f1c93..2e930984 100644--- a/docs/frictionlab/edge-prismatic-x5-section-transition-artifact-corpus.md+++ b/docs/frictionlab/edge-prismatic-x5-section-transition-artifact-corpus.md@@ -220,3 +220,7 @@ Alternative future milestones remain valid after X6:- **EDGE-PRISMATIC-X7 optional coplanar merge proof lab**, if a gated simplification lane is desired.- Return to chamfer/fillet production-route work after the corpus is stable and route admission criteria are explicit.++## 14. EDGE-PRISMATIC-X6 gated stability/analyzer note++EDGE-PRISMATIC-X6 adds an explicitly gated/manual stability and analyzer confirmation check for this X5 corpus. See `docs/frictionlab/edge-prismatic-x6-corpus-stability-and-analyzer-confirmation.md` for the `Category=ArtifactCorpus` trait, `AETHERIS_RUN_ARTIFACT_CORPUS_TESTS=1` guard, `PrismaticCorpusStability` filter, repeated-run JSON/STEP hash/normalized-summary comparisons, `analyze section` confirmation, and current `analyze map` primitive-raycast integration blocker. The X6 gate is not part of normal unit-test execution unless explicitly requested, and it does not change production chamfer/fillet behavior, production route authority, ProfileStack behavior, STEP exporter/importer behavior, Boolean core behavior, AirEdgeSweep behavior, or coplanar merge policy.diff --git a/docs/frictionlab/edge-prismatic-x6-corpus-stability-and-analyzer-confirmation.md b/docs/frictionlab/edge-prismatic-x6-corpus-stability-and-analyzer-confirmation.mdnew file mode 100644index 00000000..37bb717c--- /dev/null+++ b/docs/frictionlab/edge-prismatic-x6-corpus-stability-and-analyzer-confirmation.md@@ -0,0 +1,225 @@+# EDGE-PRISMATIC-X6 corpus stability and analyzer confirmation++## 1. Purpose and scope++EDGE-PRISMATIC-X6 adds an explicitly gated/manual stability check for the EDGE-PRISMATIC-X5 split-preserving prismatic artifact corpus. The gate exists to answer two repeatability questions before any broader production-route discussion resumes:++1. Does the corpus produce the same stable JSON/topology/marker/diagnostic projection across repeated runs?+2. Can existing CLI analyzer commands consume selected successful STEP artifacts in a bounded, deterministic way?++The check is intentionally test-only and lab-only. It does not change production chamfer/fillet behavior, production route selection, `ProfileStackExtrudeExecutor`, STEP exporter/importer behavior, Boolean core behavior, AirEdgeSweep behavior, `BrepBoundedChamfer`, coplanar merge policy, triangle migration, sketch solving, clipping, or NURBS/freeform support.++## 2. Relationship to EDGE-PRISMATIC-X5++EDGE-PRISMATIC-X5 introduced:++```bash+aetheris experimental prismatic-corpus --out-dir <dir> [--json]+```++That command writes split-preserving prismatic STEP artifacts and an `edge-prismatic-x5-corpus.json` summary. X6 does not replace or broaden the X5 route. Instead, X6 repeatedly invokes the existing X5 route in temporary directories and compares stable projections from each run.++Manual corpus generation remains:++```bash+dotnet run --project Aetheris.CLI --framework net10.0 -- experimental prismatic-corpus --out-dir "$tmp/edge-prismatic-x5" --json+```++## 3. Gating mechanism++The X6 stability/analyzer test lives in `Aetheris.CLI.Tests` and is explicitly gated by all of the following:++- xUnit trait/category: `Category=ArtifactCorpus`+- test-name filter target: `PrismaticCorpusStability`+- environment guard: `AETHERIS_RUN_ARTIFACT_CORPUS_TESTS=1`++Without the environment variable, the test returns successfully after writing a clear no-op message. The heavy corpus generation and analyzer body only runs when the environment variable is set.++Exact command for the no-op gate check:++```bash+dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "PrismaticCorpusStability"+```++Exact command for the explicit stability/analyzer run:++```bash+AETHERIS_RUN_ARTIFACT_CORPUS_TESTS=1 dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "PrismaticCorpusStability"+```++The broader artifact-corpus category can also be run explicitly with:++```bash+AETHERIS_RUN_ARTIFACT_CORPUS_TESTS=1 dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "Category=ArtifactCorpus"+```++## 4. Corpus cases compared++The stable projection includes all X5 corpus rows:++Successful STEP-producing cases:++- `rectangle-inset`+- `top-edge-chamfer`+- `pentagon-scaled`+- `hexagon-scaled`+- `pentagon-asymmetric`++JSON-only rejected/deferred cases:++- `mismatched-vertex-count`+- `non-increasing-sections`+- `invalid-self-intersecting-profile`+- `holes-deferred`+- `arcs-deferred`+- `multiple-loops-deferred`+- `missing-correspondence`+- `non-identity-correspondence`++## 5. JSON fields compared++The stability projection intentionally removes run-local paths such as output directory and artifact path, then compares these stable fields:++- milestone (`EDGE-PRISMATIC-X5`)+- corpus version, if/when the corpus summary emits one+- route (`experimental`)+- transition route (`prismatic-section-transition`)+- emitter component name (`PrismaticSectionTransitionEmitter`)+- split policy (`preserve-section-splits`)+- sorted case names+- case statuses+- artifact filenames+- per-case route/emitter/split-policy fields+- topology summary JSON for successful cases+- STEP marker summary JSON for successful cases+- per-case diagnostics and errors+- top-level diagnostics and errors+- guarantee booleans:+ - no production route replacement+ - no AirEdgeSweep+ - no BrepBoundedChamfer+ - no topology graft/body mutation+ - no 3D Boolean+ - no coplanar merge++The test also writes X6-scoped diagnostics to test output, including repeated-run completion, JSON stability success, STEP hash stability success, normalized STEP stability success, analyzer section stability success, analyzer map stability comparison success, and the no-production/no-legacy-route guarantee confirmations.++## 6. STEP comparison mode++Current X5 STEP artifacts are deterministic for the selected corpus rows, so X6 compares raw SHA256 hashes for every successful artifact file:++- `edge-prismatic-x5-rectangle-inset.step`+- `edge-prismatic-x5-top-edge-chamfer.step`+- `edge-prismatic-x5-pentagon-scaled.step`+- `edge-prismatic-x5-hexagon-scaled.step`+- `edge-prismatic-x5-pentagon-asymmetric.step`++X6 also compares a normalized STEP-adjacent summary for each successful artifact: case status, artifact filename, topology summary, and marker summary. The normalized comparison remains useful if a future exporter change introduces benign run-specific text instability, but this milestone does **not** change the STEP exporter to chase hash stability.++## 7. Analyzer commands used++X6 runs existing analyzer commands against selected generated STEP artifacts. The test calls the in-process CLI runner, equivalent to these manual commands:++```bash+dotnet run --project Aetheris.CLI --framework net10.0 -- analyze section <artifact.step> --xy --offset 0.5 --json+```++for:++- `edge-prismatic-x5-rectangle-inset.step`+- `edge-prismatic-x5-hexagon-scaled.step`++and:++```bash+dotnet run --project Aetheris.CLI --framework net10.0 -- analyze section <edge-prismatic-x5-top-edge-chamfer.step> --xy --offset 5.5 --json+```++for the top-edge chamfer transition interval.++The map analyzer is invoked with:++```bash+dotnet run --project Aetheris.CLI --framework net10.0 -- analyze map <artifact.step> --top --rows 16 --cols 16 --json+```++for:++- `edge-prismatic-x5-top-edge-chamfer.step`+- `edge-prismatic-x5-hexagon-scaled.step`++## 8. Analyzer assertions and current map limitation++`analyze section` succeeds for the selected prismatic artifacts. X6 compares a path-free projection containing:++- plane family;+- offset;+- offset axis;+- section axes;+- 3D bounding box;+- loop count;+- closed-loop count;+- line/arc/unsupported segment counts;+- section 2D bounding box.++The section assertions require non-empty closed line-loop geometry and zero unsupported section segments, then compare the stable projection across both corpus runs.++`analyze map` is also invoked, but current orthographic map analysis cannot raycast these imported/generated prismatic BReps. The stable JSON failure is treated as a bounded analyzer integration blocker rather than a corpus failure. The compared projection records the deterministic failure kind/message:++- `success = false`+- `errorKind = analysis-failure`+- message beginning with `Orthographic map v1 currently supports bodies accepted by BrepSpatialQueries.Raycast`++This documents that richer map support for non-primitive imported/generated prismatic bodies is a future analyzer milestone. X6 does not broaden production geometry, Boolean, STEP, or raycast behavior to make the map pass.++## 9. Why this does not run by default++The test writes real artifact directories, hashes STEP files, and runs analyzer commands. It is intended for manual milestone validation and future diff investigations, not for normal unit-test latency. The default/no-env behavior is therefore a no-op pass with a clear diagnostic message.++## 10. Non-goals++EDGE-PRISMATIC-X6 does not add or change:++- production chamfer/fillet behavior;+- production route replacement;+- default production routing;+- current `ProfileStackExtrudeExecutor` behavior;+- STEP exporter/importer behavior;+- Boolean core behavior;+- AirEdgeSweep behavior;+- `BrepBoundedChamfer` behavior;+- topology graft/body mutation;+- 3D Boolean fallback;+- coplanar merge mode;+- arbitrary edge selection;+- triangle migration;+- sketch solver or clipping engine behavior;+- NURBS/freeform support.++## 11. Tests run for this milestone++Focused X6 validation:++```bash+dotnet run --project Aetheris.CLI --framework net10.0 -- --help+dotnet run --project Aetheris.CLI --framework net10.0 -- experimental prismatic-corpus --out-dir "$tmp/edge-prismatic-x5" --json+dotnet run --project Aetheris.CLI --framework net10.0 -- analyze section "$tmp/edge-prismatic-x5/edge-prismatic-x5-rectangle-inset.step" --xy --offset 0.5 --json+dotnet run --project Aetheris.CLI --framework net10.0 -- analyze section "$tmp/edge-prismatic-x5/edge-prismatic-x5-top-edge-chamfer.step" --xy --offset 5.5 --json+dotnet run --project Aetheris.CLI --framework net10.0 -- analyze map "$tmp/edge-prismatic-x5/edge-prismatic-x5-top-edge-chamfer.step" --top --rows 16 --cols 16 --json+dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "PrismaticCorpusStability"+AETHERIS_RUN_ARTIFACT_CORPUS_TESTS=1 dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "PrismaticCorpusStability"+dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "Prismatic|AirChamfer|Experimental|Lab|Step|CliBaseline|Export|Corpus"+dotnet test Aetheris.FrictionLab.Tests/Aetheris.FrictionLab.Tests.csproj -c Release -f net10.0 --filter "PrismaticSectionTransition|PrismaticTopEdgeChamfer|ProfileStackChamfer|ProfileChamfer|ProfileStack|LineArcProfileExtrude|Profile2D|AirChamfer|EdgeSweep|CIRLab"+dotnet test Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj --filter "Chamfer|Fillet|Corner|BrepPrimitives|BrepExtrude|Step242|Primitive|Extrude|Boolean|SafeComposition"+dotnet test Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj --filter "Chamfer|Fillet|Corner|ProfileStack|LineArcProfileExtrude|FirmamentPrimitive|FirmamentStepExporter|SemanticRecovery|FrepMaterializer|Rematerialize"+```++## 12. Next recommended milestone++Recommended next milestone: **EDGE-PRISMATIC-X7 analyzer map support audit for generated/imported prismatic BReps**. The bounded blocker isolated by X6 is that `analyze section` can confirm non-empty deterministic sections for the prismatic STEP artifacts, while `analyze map` currently reports the known primitive-raycast limitation. X7 should decide whether to extend analyzer/raycast support in a lab route or keep map confirmation deferred until a broader analyzer architecture milestone.++Optional later milestones remain:++- optional coplanar merge proof lab, still gated and still not a default route;+- controlled production-adjacent route admission only after stability, analyzer, recognition, and fallback authority evidence are sufficient;+- return to chamfer/fillet production-route hardening without changing the split-preserving prismatic contract.