Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add prismatic hybrid map dispatch lab

Yuechen Lie18822bd17ee
diff --git a/Aetheris.Kernel.Core.Tests/Cir/PrismaticHybridMapDispatchPrototypeTests.cs b/Aetheris.Kernel.Core.Tests/Cir/PrismaticHybridMapDispatchPrototypeTests.cs
new file mode 100644
index 00000000..a25eb630
--- /dev/null
+++ b/Aetheris.Kernel.Core.Tests/Cir/PrismaticHybridMapDispatchPrototypeTests.cs
@@ -0,0 +1,448 @@
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Brep.Prismatic;
+using Aetheris.Kernel.Core.Cir;
+using Aetheris.Kernel.Core.Cir.Mirrors;
+
+namespace Aetheris.Kernel.Core.Tests.Cir;
+
+public sealed class PrismaticHybridMapDispatchPrototypeTests
+{
+ private const int Rows = 16;
+ private const int Cols = 16;
+
+ [Fact]
+ public void EdgePrismaticX8_RectangleInsetHybridDispatch_SelectsConvexCirMirrorAndIsDeterministic()
+ {
+ var source = PrismaticHybridMapDispatchLab.RectangleInsetSource();
+
+ var first = PrismaticHybridMapDispatchLab.DispatchPrismatic(source, CirMapAnalyzerUse.MapOccupancy, Rows, Cols);
+ var second = PrismaticHybridMapDispatchLab.DispatchPrismatic(source, CirMapAnalyzerUse.MapOccupancy, Rows, Cols);
+
+ Assert.Equal(HybridMapBackendKind.CirConvexPolyhedron, first.SelectedBackend);
+ Assert.Equal(CirMirrorStatus.MirrorAdmittedExact, first.MirrorAdmission.Status);
+ Assert.NotNull(first.MapSummary);
+ Assert.Equal(first.StableProjection(), second.StableProjection());
+ Assert.Equal("cir-convex-polyhedron", first.MapSummary.BackendSelected);
+ Assert.Equal("mirror-admitted-exact", first.MapSummary.MirrorStatus);
+ Assert.Equal("map-occupancy", first.MapSummary.RequestedUse);
+ Assert.Equal("top", first.MapSummary.View);
+ Assert.Equal(Rows, first.MapSummary.Rows);
+ Assert.Equal(Cols, first.MapSummary.Cols);
+ Assert.Equal(256, first.MapSummary.OccupiedCount);
+ Assert.Equal(0, first.MapSummary.EmptyCount);
+ Assert.InRange(first.MapSummary.ThicknessMin!.Value, 0.7d, 0.8d);
+ Assert.Equal(4d, first.MapSummary.ThicknessMax!.Value, 6);
+ Assert.InRange(first.MapSummary.ThicknessAverage!.Value, 3.0d, 3.1d);
+ AssertKnownLosses(first);
+ Assert.Contains("edge-prismatic-x8-hybrid-map-dispatch-started", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-prismatic-source-created:rectangle-inset", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-cir-mirror-admitted-exact:rectangle-inset", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-backend-selected:cir-convex-polyhedron", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-map-summary-created:rectangle-inset", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-no-production-analyzer-behavior-changed", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-no-default-cli-behavior-changed", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-no-cir-to-brep-extraction", first.Diagnostics);
+ }
+
+ [Fact]
+ public void EdgePrismaticX8_TopEdgeChamferHybridDispatch_SelectsConvexCirMirrorAndIsDeterministic()
+ {
+ var source = PrismaticHybridMapDispatchLab.TopEdgeChamferSource();
+
+ var first = PrismaticHybridMapDispatchLab.DispatchPrismatic(source, CirMapAnalyzerUse.MapOccupancy, Rows, Cols);
+ var second = PrismaticHybridMapDispatchLab.DispatchPrismatic(source, CirMapAnalyzerUse.MapOccupancy, Rows, Cols);
+
+ Assert.Equal(HybridMapBackendKind.CirConvexPolyhedron, first.SelectedBackend);
+ Assert.Equal(CirMirrorStatus.MirrorAdmittedExact, first.MirrorAdmission.Status);
+ Assert.NotNull(first.MapSummary);
+ Assert.Equal(first.StableProjection(), second.StableProjection());
+ Assert.Equal(256, first.MapSummary.OccupiedCount);
+ Assert.Equal(0, first.MapSummary.EmptyCount);
+ Assert.InRange(first.MapSummary.ThicknessMin!.Value, 3.3d, 3.4d);
+ Assert.Equal(4d, first.MapSummary.ThicknessMax!.Value, 6);
+ Assert.InRange(first.MapSummary.ThicknessAverage!.Value, 3.9d, 4.0d);
+ AssertKnownLosses(first);
+ Assert.Contains("edge-prismatic-x8-prismatic-source-created:top-edge-chamfer", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-cir-mirror-admitted-exact:top-edge-chamfer", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-backend-selected:cir-convex-polyhedron", first.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-map-summary-created:top-edge-chamfer", first.Diagnostics);
+ }
+
+ [Fact]
+ public void EdgePrismaticX8_PrimitiveBoxDispatch_ReusesCirTapeAndComparesBrepBaseline()
+ {
+ var node = new CirBoxNode(10d, 6d, 4d);
+ var mapRequest = new CirMapPrototypeRequest(CirMapPrototypeView.Top, Rows, Cols, node.Bounds, SamplesPerRay: 384, RootRefinementIterations: 32, Tolerance: 1e-7d);
+
+ var dispatch = PrismaticHybridMapDispatchLab.DispatchPrimitiveBox(node, mapRequest, BrepPrimitives.CreateBox(10d, 6d, 4d).Value);
+
+ Assert.Equal(HybridMapBackendKind.CirTape, dispatch.SelectedBackend);
+ Assert.Equal(CirMirrorStatus.MirrorAdmittedExact, dispatch.MirrorAdmission.Status);
+ Assert.NotNull(dispatch.MapSummary);
+ Assert.Equal("cir-tape", dispatch.MapSummary.BackendSelected);
+ Assert.Equal(256, dispatch.MapSummary.OccupiedCount);
+ Assert.Equal(0, dispatch.MapSummary.EmptyCount);
+ Assert.Contains("edge-prismatic-x8-backend-selected:cir-tape", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-backend-selected:brep-raycast", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-primitive-brep-baseline-compared:box", dispatch.Diagnostics);
+ }
+
+ [Fact]
+ public void EdgePrismaticX8_TopEdgeChamferLossyRequests_RejectWithoutMapSummary()
+ {
+ var source = PrismaticHybridMapDispatchLab.TopEdgeChamferSource();
+
+ var faceIdentity = PrismaticHybridMapDispatchLab.DispatchPrismatic(source, CirMapAnalyzerUse.FaceIdentity, Rows, Cols);
+ var topologyParity = PrismaticHybridMapDispatchLab.DispatchPrismatic(source, CirMapAnalyzerUse.TopologyParity, Rows, Cols);
+
+ AssertLossyRejected(faceIdentity, "face-identity");
+ AssertLossyRejected(topologyParity, "topology-parity");
+ }
+
+ [Fact]
+ public void EdgePrismaticX8_ImportedStepOnlyPrismaticBody_DoesNotInferMirror()
+ {
+ var dispatch = PrismaticHybridMapDispatchLab.DispatchImportedStepOnly("edge-prismatic-x5-top-edge-chamfer.step", CirMapAnalyzerUse.MapOccupancy, Rows, Cols);
+
+ Assert.Equal(HybridMapBackendKind.Unsupported, dispatch.SelectedBackend);
+ Assert.Equal(CirMirrorStatus.MirrorUnavailable, dispatch.MirrorAdmission.Status);
+ Assert.Null(dispatch.MapSummary);
+ Assert.Equal("prismatic-hybrid-map-mirror-unavailable", dispatch.Recommendation);
+ Assert.Contains("edge-prismatic-x8-imported-step-no-mirror", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-backend-selected:unsupported", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-mirror-unavailable:edge-prismatic-x5-top-edge-chamfer.step", dispatch.Diagnostics);
+ }
+
+ [Fact]
+ public void EdgePrismaticX8_InvalidNonConvexPrismaticSource_RejectsWithoutMapSummary()
+ {
+ var dispatch = PrismaticHybridMapDispatchLab.DispatchPrismatic(PrismaticHybridMapDispatchLab.NonConvexSource(), CirMapAnalyzerUse.MapOccupancy, Rows, Cols);
+
+ Assert.Equal(HybridMapBackendKind.Unsupported, dispatch.SelectedBackend);
+ Assert.Equal(CirMirrorStatus.MirrorRejectedUnsupportedAtom, dispatch.MirrorAdmission.Status);
+ Assert.Null(dispatch.MapSummary);
+ Assert.Equal("prismatic-hybrid-map-needs-mirror-hardening", dispatch.Recommendation);
+ Assert.Contains("edge-prismatic-x8-mirror-unavailable:non-convex", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-backend-selected:unsupported", dispatch.Diagnostics);
+ }
+
+ private static void AssertLossyRejected(HybridMapDispatchResult dispatch, string request)
+ {
+ Assert.Equal(HybridMapBackendKind.Unsupported, dispatch.SelectedBackend);
+ Assert.Equal(CirMirrorStatus.MirrorRejectedLossyForRequest, dispatch.MirrorAdmission.Status);
+ Assert.Null(dispatch.MapSummary);
+ Assert.Equal("prismatic-hybrid-map-lossy-request-rejected", dispatch.Recommendation);
+ Assert.Contains($"edge-prismatic-x8-mirror-rejected-lossy-for-request:{request}", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-backend-selected:unsupported", dispatch.Diagnostics);
+ }
+
+ private static void AssertKnownLosses(HybridMapDispatchResult dispatch)
+ {
+ Assert.Contains("face identity lost", dispatch.KnownLosses);
+ Assert.Contains("loop identity lost", dispatch.KnownLosses);
+ Assert.Contains("split-face lineage lost", dispatch.KnownLosses);
+ Assert.Contains("feature role labels lost", dispatch.KnownLosses);
+ Assert.Contains("topology parity unavailable", dispatch.KnownLosses);
+ Assert.Contains("edge-prismatic-x8-loss-face-identity", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-loss-split-face-lineage", dispatch.Diagnostics);
+ Assert.Contains("edge-prismatic-x8-loss-topology-parity", dispatch.Diagnostics);
+ }
+}
+
+internal enum HybridMapBackendKind
+{
+ CirConvexPolyhedron,
+ CirTape,
+ BrepRaycast,
+ Unsupported,
+}
+
+internal sealed record GeneratedPrismaticMapSource(
+ string CaseLabel,
+ IReadOnlyList<PrismaticSection> Sections,
+ PrismaticCorrespondenceMap? Correspondence = null);
+
+internal sealed record HybridMapSummary(
+ string BackendSelected,
+ string MirrorStatus,
+ string RequestedUse,
+ string View,
+ int Rows,
+ int Cols,
+ int OccupiedCount,
+ int EmptyCount,
+ double? ThicknessMin,
+ double? ThicknessMax,
+ double? ThicknessAverage,
+ CirBounds Bounds,
+ IReadOnlyList<string> Diagnostics,
+ IReadOnlyList<string> KnownLosses);
+
+internal sealed record HybridMapDispatchResult(
+ HybridMapBackendKind SelectedBackend,
+ CirMirrorAdmissionResult MirrorAdmission,
+ CirMapAnalyzerUse RequestedUse,
+ HybridMapSummary? MapSummary,
+ IReadOnlyList<string> KnownLosses,
+ IReadOnlyList<string> Diagnostics,
+ string Recommendation)
+{
+ public string StableProjection() => string.Join("|", new[]
+ {
+ SelectedBackend.ToString(),
+ MirrorAdmission.StatusText,
+ RequestedUse.ToString(),
+ MapSummary?.ToString() ?? "no-map",
+ string.Join(",", KnownLosses),
+ string.Join(",", Diagnostics),
+ Recommendation,
+ });
+}
+
+internal static class PrismaticHybridMapDispatchLab
+{
+ private static readonly string[] KnownLossDescriptions =
+ [
+ "face identity lost",
+ "loop identity lost",
+ "split-face lineage lost",
+ "feature role labels lost",
+ "topology parity unavailable",
+ ];
+
+ private static readonly string[] LossDiagnostics =
+ [
+ "edge-prismatic-x8-loss-face-identity",
+ "edge-prismatic-x8-loss-loop-identity",
+ "edge-prismatic-x8-loss-split-face-lineage",
+ "edge-prismatic-x8-loss-feature-role-labels",
+ "edge-prismatic-x8-loss-topology-parity",
+ ];
+
+ public static HybridMapDispatchResult DispatchPrismatic(GeneratedPrismaticMapSource source, CirMapAnalyzerUse requestedUse, int rows, int cols)
+ {
+ var token = Normalize(source.CaseLabel);
+ var diagnostics = StartDiagnostics();
+ diagnostics.Add($"edge-prismatic-x8-prismatic-source-created:{token}");
+ diagnostics.Add($"edge-prismatic-x8-cir-mirror-admission-requested:{token}");
+
+ var mirrorResult = CirPrismaticMirrorBuilder.BuildFromSections(token, source.Sections, source.Correspondence);
+ diagnostics.AddRange(mirrorResult.Diagnostics);
+
+ if (requestedUse is CirMapAnalyzerUse.FaceIdentity or CirMapAnalyzerUse.TopologyParity)
+ {
+ var requestToken = UseToken(requestedUse);
+ var admission = mirrorResult.Mirror?.RejectLossyRequest(ToPrismaticRequest(requestedUse))
+ ?? CirConvexPolyhedronMirror.CreateAdmission(token, CirMirrorStatus.MirrorRejectedLossyForRequest, CirMirrorCapability.None, diagnostics);
+ diagnostics.Add($"edge-prismatic-x8-mirror-rejected-lossy-for-request:{requestToken}");
+ diagnostics.AddRange(LossDiagnostics);
+ diagnostics.Add("edge-prismatic-x8-backend-selected:unsupported");
+ AddNoChangeDiagnostics(diagnostics);
+ return new HybridMapDispatchResult(
+ HybridMapBackendKind.Unsupported,
+ admission,
+ requestedUse,
+ null,
+ KnownLossDescriptions,
+ StableDiagnostics(diagnostics),
+ "prismatic-hybrid-map-lossy-request-rejected");
+ }
+
+ if (!mirrorResult.Succeeded || mirrorResult.Mirror is null)
+ {
+ diagnostics.Add($"edge-prismatic-x8-mirror-unavailable:{token}");
+ diagnostics.Add("edge-prismatic-x8-backend-selected:unsupported");
+ AddNoChangeDiagnostics(diagnostics);
+ return new HybridMapDispatchResult(
+ HybridMapBackendKind.Unsupported,
+ mirrorResult.Admission,
+ requestedUse,
+ null,
+ KnownLossDescriptions,
+ StableDiagnostics(diagnostics),
+ "prismatic-hybrid-map-needs-mirror-hardening");
+ }
+
+ if (mirrorResult.Admission.Status == CirMirrorStatus.MirrorAdmittedExact &&
+ mirrorResult.Admission.Supports(CirMirrorCapability.MapOccupancy) &&
+ requestedUse == CirMapAnalyzerUse.MapOccupancy)
+ {
+ diagnostics.Add($"edge-prismatic-x8-cir-mirror-admitted-exact:{token}");
+ diagnostics.Add("edge-prismatic-x8-backend-selected:cir-convex-polyhedron");
+ diagnostics.AddRange(LossDiagnostics);
+ var mirrorSummary = mirrorResult.Mirror.CreateTopViewSummary(rows, cols);
+ diagnostics.Add($"edge-prismatic-x8-map-summary-created:{token}");
+ AddNoChangeDiagnostics(diagnostics);
+ var summaryDiagnostics = mirrorSummary.Diagnostics.Concat(diagnostics).Distinct(StringComparer.Ordinal).ToArray();
+ var summary = new HybridMapSummary(
+ "cir-convex-polyhedron",
+ mirrorResult.Admission.StatusText,
+ UseToken(requestedUse),
+ mirrorSummary.View,
+ mirrorSummary.Rows,
+ mirrorSummary.Cols,
+ mirrorSummary.OccupiedCount,
+ mirrorSummary.EmptyCount,
+ mirrorSummary.ThicknessMin,
+ mirrorSummary.ThicknessMax,
+ mirrorSummary.ThicknessAverage,
+ mirrorSummary.Bounds,
+ summaryDiagnostics,
+ KnownLossDescriptions);
+ return new HybridMapDispatchResult(
+ HybridMapBackendKind.CirConvexPolyhedron,
+ mirrorResult.Admission,
+ requestedUse,
+ summary,
+ KnownLossDescriptions,
+ StableDiagnostics(diagnostics),
+ "prismatic-hybrid-map-ready-for-experimental-cli");
+ }
+
+ diagnostics.Add($"edge-prismatic-x8-mirror-unavailable:{token}");
+ diagnostics.Add("edge-prismatic-x8-backend-selected:unsupported");
+ AddNoChangeDiagnostics(diagnostics);
+ return new HybridMapDispatchResult(
+ HybridMapBackendKind.Unsupported,
+ mirrorResult.Admission,
+ requestedUse,
+ null,
+ KnownLossDescriptions,
+ StableDiagnostics(diagnostics),
+ "prismatic-hybrid-map-mirror-unavailable");
+ }
+
+ public static HybridMapDispatchResult DispatchPrimitiveBox(CirBoxNode node, CirMapPrototypeRequest request, BrepBody? brepBaseline = null)
+ {
+ var diagnostics = StartDiagnostics();
+ diagnostics.Add("edge-prismatic-x8-cir-mirror-admission-requested:box");
+ var dispatch = CirMapDispatchPrototype.Dispatch(
+ new CirMirrorAdmission(
+ CirMirrorSourceRepresentationKind.Air,
+ "box",
+ CirMirrorAtomKind.BoxPrimitive,
+ CirMirrorCapability.MapOccupancy,
+ SourceIdOrLabel: "box",
+ DiagnosticsLabel: "edge-prismatic-x8"),
+ CirMapAnalyzerUse.MapOccupancy,
+ node,
+ request,
+ brepBaseline);
+
+ diagnostics.AddRange(dispatch.Diagnostics);
+ diagnostics.Add("edge-prismatic-x8-cir-mirror-admitted-exact:box");
+ diagnostics.Add("edge-prismatic-x8-backend-selected:cir-tape");
+ if (brepBaseline is not null)
+ {
+ diagnostics.Add("edge-prismatic-x8-backend-selected:brep-raycast");
+ diagnostics.Add("edge-prismatic-x8-primitive-brep-baseline-compared:box");
+ }
+
+ AddNoChangeDiagnostics(diagnostics);
+ var sourceSummary = dispatch.MapResult!.Summary;
+ var summary = new HybridMapSummary(
+ "cir-tape",
+ dispatch.MirrorAdmission.StatusText,
+ "map-occupancy",
+ request.View.ToString().ToLowerInvariant(),
+ request.Rows,
+ request.Cols,
+ sourceSummary.HitSamples,
+ sourceSummary.EmptySamples,
+ sourceSummary.ThicknessMin,
+ sourceSummary.ThicknessMax,
+ sourceSummary.ThicknessAverage,
+ request.Bounds,
+ StableDiagnostics(diagnostics),
+ KnownLossDescriptions);
+ return new HybridMapDispatchResult(
+ HybridMapBackendKind.CirTape,
+ dispatch.MirrorAdmission,
+ CirMapAnalyzerUse.MapOccupancy,
+ summary,
+ KnownLossDescriptions,
+ StableDiagnostics(diagnostics),
+ dispatch.Recommendation);
+ }
+
+ public static HybridMapDispatchResult DispatchImportedStepOnly(string sourceLabel, CirMapAnalyzerUse requestedUse, int rows, int cols)
+ {
+ var token = Normalize(sourceLabel);
+ var diagnostics = StartDiagnostics();
+ diagnostics.Add("edge-prismatic-x8-imported-step-no-mirror");
+ diagnostics.Add($"edge-prismatic-x8-cir-mirror-admission-requested:{token}");
+ var admission = CirMirrorAdmissionService.Admit(new CirMirrorAdmission(
+ CirMirrorSourceRepresentationKind.Step,
+ token,
+ CirMirrorAtomKind.Unknown,
+ CirMapDispatchPrototype.CapabilityForUse(requestedUse),
+ SourceIdOrLabel: token,
+ DiagnosticsLabel: "edge-prismatic-x8"));
+ diagnostics.AddRange(admission.Diagnostics);
+ diagnostics.Add($"edge-prismatic-x8-mirror-unavailable:{token}");
+ diagnostics.Add("edge-prismatic-x8-backend-selected:unsupported");
+ AddNoChangeDiagnostics(diagnostics);
+ return new HybridMapDispatchResult(
+ HybridMapBackendKind.Unsupported,
+ admission,
+ requestedUse,
+ null,
+ KnownLossDescriptions,
+ StableDiagnostics(diagnostics),
+ "prismatic-hybrid-map-mirror-unavailable");
+ }
+
+ public static GeneratedPrismaticMapSource RectangleInsetSource() => new(
+ "rectangle-inset",
+ [
+ new PrismaticSection(0d, [(-5d, -3d), (5d, -3d), (5d, 3d), (-5d, 3d)]),
+ new PrismaticSection(4d, [(-4d, -2d), (4d, -2d), (4d, 2d), (-4d, 2d)]),
+ ]);
+
+ public static GeneratedPrismaticMapSource TopEdgeChamferSource() => new(
+ "top-edge-chamfer",
+ PrismaticTopEdgeChamferPrototype.CreateSectionStack(new PrismaticTopEdgeChamferRequest(10d, 6d, 4d, 1d)));
+
+ public static GeneratedPrismaticMapSource NonConvexSource() => new(
+ "non-convex",
+ [
+ new PrismaticSection(0d, [(0d, 0d), (3d, 0d), (1d, 1d), (3d, 3d), (0d, 3d)]),
+ new PrismaticSection(2d, [(0d, 0d), (3d, 0d), (1d, 1d), (3d, 3d), (0d, 3d)]),
+ ]);
+
+ private static List<string> StartDiagnostics() =>
+ [
+ "edge-prismatic-x8-hybrid-map-dispatch-started",
+ ];
+
+ private static void AddNoChangeDiagnostics(List<string> diagnostics)
+ {
+ diagnostics.Add("edge-prismatic-x8-no-production-analyzer-behavior-changed");
+ diagnostics.Add("edge-prismatic-x8-no-default-cli-behavior-changed");
+ diagnostics.Add("edge-prismatic-x8-no-cir-to-brep-extraction");
+ }
+
+ private static CirPrismaticMirrorRequestKind ToPrismaticRequest(CirMapAnalyzerUse requestedUse) => requestedUse switch
+ {
+ CirMapAnalyzerUse.FaceIdentity => CirPrismaticMirrorRequestKind.FaceIdentity,
+ CirMapAnalyzerUse.TopologyParity => CirPrismaticMirrorRequestKind.TopologyParity,
+ CirMapAnalyzerUse.MapOccupancy => CirPrismaticMirrorRequestKind.MapOccupancy,
+ _ => CirPrismaticMirrorRequestKind.PointContainment,
+ };
+
+ private static string UseToken(CirMapAnalyzerUse use) => use switch
+ {
+ CirMapAnalyzerUse.MapOccupancy => "map-occupancy",
+ CirMapAnalyzerUse.FaceIdentity => "face-identity",
+ CirMapAnalyzerUse.TopologyParity => "topology-parity",
+ CirMapAnalyzerUse.PointContainment => "point-containment",
+ CirMapAnalyzerUse.SectionSampling => "section-sampling",
+ _ => "unknown",
+ };
+
+ private static string Normalize(string value) =>
+ string.IsNullOrWhiteSpace(value) ? "unknown" : value.Trim().ToLowerInvariant().Replace(' ', '-');
+
+ private static IReadOnlyList<string> StableDiagnostics(IEnumerable<string> diagnostics) =>
+ diagnostics.Distinct(StringComparer.Ordinal).ToArray();
+}
diff --git a/docs/cir-prismatic-x2-convex-polyhedron-mirror.md b/docs/cir-prismatic-x2-convex-polyhedron-mirror.md
index 13fb53fa..d1b37dd7 100644
--- a/docs/cir-prismatic-x2-convex-polyhedron-mirror.md
+++ b/docs/cir-prismatic-x2-convex-polyhedron-mirror.md
@@ -170,3 +170,7 @@ Likely next milestones are:
1. **EDGE-PRISMATIC-X8** — hybrid map dispatch using admitted prismatic mirrors, still without topology claims;
2. **CIR-PRISMATIC-X3** — add tape payload/lowering for admitted prismatic mirrors;
3. **AIR-CIR-A1** — drift/parity policy for mirror freshness and authority boundaries.
+
+## 12. EDGE-PRISMATIC-X8 consumption note
+
+EDGE-PRISMATIC-X8 consumes the X2 `CirConvexPolyhedronMirror` in a lab/test-only hybrid map dispatcher. Generated `rectangle-inset` and `top-edge-chamfer` source sections are admitted through the X2 builder, select the `cir-convex-polyhedron` backend for occupancy/thickness summaries, and still reject face-identity/topology-parity requests as lossy. This consumption does not wire the mirror into production `StepAnalyzer.AnalyzeMap`, does not add a default CLI route, does not infer mirrors from imported STEP, and does not perform CIR-to-BRep extraction.
diff --git a/docs/edge-prismatic-x7-analyze-map-cir-frep-audit.md b/docs/edge-prismatic-x7-analyze-map-cir-frep-audit.md
index 065ed65a..08361da2 100644
--- a/docs/edge-prismatic-x7-analyze-map-cir-frep-audit.md
+++ b/docs/edge-prismatic-x7-analyze-map-cir-frep-audit.md
@@ -401,3 +401,7 @@ This does **not** change the X7 production audit conclusion: production `analyze
## CIR-PRISMATIC-X2 follow-up
CIR-PRISMATIC-X2 implements the first reusable convex prismatic CIR mirror (`CirConvexPolyhedronMirror`/`CirPrismaticMirrorBuilder`) for admitted convex all-planar section stacks. The mirror supports test-visible point containment and top-view occupancy/thickness summaries for rectangle-inset and top-edge-chamfer, but X7 conclusions remain intact: production `analyze map` is not integrated with prismatic CIR mirrors yet, and topology/face identity parity remains out of scope.
+
+## EDGE-PRISMATIC-X8 follow-up
+
+EDGE-PRISMATIC-X8 prototypes the hybrid dispatch recommended by this audit in Core test scope. The prototype uses generated prismatic source data plus an admitted `CirConvexPolyhedronMirror` to select a CIR convex-polyhedron map backend for `rectangle-inset` and `top-edge-chamfer`, while preserving BRep raycast as the primitive baseline path and returning deterministic unsupported diagnostics for imported STEP-only/no-source cases. Production `analyze map` behavior and default CLI behavior remain unchanged.
diff --git a/docs/edge-prismatic-x8-hybrid-map-dispatch-prismatic-mirror.md b/docs/edge-prismatic-x8-hybrid-map-dispatch-prismatic-mirror.md
new file mode 100644
index 00000000..c5af65fd
--- /dev/null
+++ b/docs/edge-prismatic-x8-hybrid-map-dispatch-prismatic-mirror.md
@@ -0,0 +1,167 @@
+# EDGE-PRISMATIC-X8 — Hybrid map dispatch using admitted prismatic CIR mirrors
+
+## 1. Purpose and scope
+
+EDGE-PRISMATIC-X8 adds a focused lab/test-only hybrid map dispatch prototype for generated prismatic bodies whose AIR/prismatic source sections can be admitted as `CirConvexPolyhedronMirror` mirrors. The prototype proves that generated prismatic source data can select a CIR mirror backend for occupancy/thickness mapping without changing production `analyze map` behavior.
+
+The implementation lives in `Aetheris.Kernel.Core.Tests.Cir` as `PrismaticHybridMapDispatchLab` and supporting test-only records. It consumes generated prismatic source data directly, builds the existing internal `CirConvexPolyhedronMirror`, and reports deterministic map summaries and diagnostics. It does not infer mirrors from imported STEP and does not claim face or topology identity from CIR-backed maps.
+
+## 2. References
+
+This milestone follows these prior contracts and proofs:
+
+- AIR/CIR/BRep authority and mirror contract: `docs/air-cir-a0-authority-and-mirror-contract.md`.
+- AIR/CIR mirror metadata: `docs/air-cir-x1-mirror-metadata-prototype.md`.
+- CIR map prototype: `docs/cir-map-x1-primitive-map-prototype.md`.
+- Mirror-aware primitive map dispatch: `docs/cir-map-x2-mirror-aware-primitive-map-dispatch.md`.
+- Prismatic mirror feasibility: `docs/cir-prismatic-x1-prismatic-mirror-feasibility.md`.
+- Convex polyhedron mirror implementation: `docs/cir-prismatic-x2-convex-polyhedron-mirror.md`.
+- Analyze-map audit recommending hybrid dispatch: `docs/edge-prismatic-x7-analyze-map-cir-frep-audit.md`.
+- X5/X6 corpus and analyzer evidence: `docs/frictionlab/edge-prismatic-x5-section-transition-artifact-corpus.md` and `docs/frictionlab/edge-prismatic-x6-corpus-stability-and-analyzer-confirmation.md`.
+
+## 3. Dispatcher/API shape
+
+The test-only prototype introduces these internal test types:
+
+- `PrismaticHybridMapDispatchLab` — dispatcher entry point and fixture source factory.
+- `GeneratedPrismaticMapSource` — generated prismatic source sections plus optional correspondence.
+- `HybridMapDispatchResult` — selected backend, admission status, requested use, summary, known losses, diagnostics, and recommendation.
+- `HybridMapSummary` — stable map summary fields.
+- `HybridMapBackendKind` — `CirConvexPolyhedron`, `CirTape`, `BrepRaycast`, or `Unsupported`.
+
+The summary reports:
+
+- backend selected: `cir-convex-polyhedron`, `cir-tape`, `brep-raycast`, or `unsupported`;
+- mirror status;
+- requested use;
+- view;
+- rows and columns;
+- occupied/hit count;
+- empty count;
+- minimum, maximum, and average thickness;
+- bounds;
+- diagnostics;
+- known losses.
+
+## 4. Backend selection policy
+
+The X8 dispatcher policy is intentionally narrow:
+
+1. For a generated AIR/prismatic source, attempt to build/admit a `CirConvexPolyhedronMirror` from the source sections.
+2. If the mirror status is `mirror-admitted-exact` and the request is map occupancy, select `cir-convex-polyhedron`.
+3. If the request is face identity or topology parity, reject as `mirror-rejected-lossy-for-request` and return no map summary.
+4. If no admitted mirror is available, return `unsupported` with deterministic mirror-unavailable diagnostics.
+5. For a primitive box baseline, reuse the CIR-MAP-X2 primitive CIR tape path and compare BRep raycast baseline when supplied.
+6. Do not infer a CIR mirror from arbitrary imported STEP.
+7. Do not return face IDs, loop IDs, split-face lineage, feature role labels, or topology parity from CIR-backed maps.
+
+## 5. Prismatic cases
+
+### `rectangle-inset`
+
+The generated source uses the X2-style two-section rectangle/inset profile stack. X8 admits it as an exact convex polyhedron mirror for map occupancy and selects the `cir-convex-polyhedron` backend.
+
+### `top-edge-chamfer`
+
+The generated source uses `PrismaticTopEdgeChamferPrototype.CreateSectionStack` for the controlled top-edge chamfer case. X8 admits it as an exact convex polyhedron mirror for map occupancy and selects the `cir-convex-polyhedron` backend.
+
+### Optional cases
+
+The X8 implementation keeps optional polygon-scaled corpus cases out of scope. They remain candidates for a future mirror-hardening milestone after the generated-source dispatch seam is promoted beyond the focused rectangle/chamfer proof.
+
+## 6. Map summary findings
+
+X8 uses the existing `CirConvexPolyhedronMirror.CreateTopViewSummary` sampling policy for prismatic CIR maps. Stable 16x16 top-view findings in the focused tests are:
+
+| Case | Backend | Grid | Occupied | Empty | Thickness min | Thickness max | Thickness avg |
+| --- | --- | --- | ---: | ---: | ---: | ---: | ---: |
+| `rectangle-inset` | `cir-convex-polyhedron` | 16x16 top | 256 | 0 | approximately 0.75 | 4.0 | approximately 3.05 |
+| `top-edge-chamfer` | `cir-convex-polyhedron` | 16x16 top | 256 | 0 | approximately 3.3125 | 4.0 | approximately 3.9531 |
+| primitive box | `cir-tape` with optional `brep-raycast` baseline | 16x16 top | 256 | 0 | 4.0 | 4.0 | 4.0 |
+
+These are CIR/lab summaries for generated-source mirrors, not production `analyze map` results.
+
+## 7. Lossy request behavior
+
+`top-edge-chamfer` face-identity and topology-parity requests reject as lossy with no substituted occupancy map. The stable recommendation is `prismatic-hybrid-map-lossy-request-rejected`.
+
+Machine-checkable diagnostics include:
+
+- `edge-prismatic-x8-mirror-rejected-lossy-for-request:face-identity`;
+- `edge-prismatic-x8-mirror-rejected-lossy-for-request:topology-parity`;
+- `edge-prismatic-x8-backend-selected:unsupported`.
+
+## 8. Imported STEP/no-mirror behavior
+
+Imported STEP-only prismatic bodies remain unsupported by this prototype. X8 deliberately does not reconstruct mirror authority from STEP/BRep topology. The imported-step test returns no map summary, selects `unsupported`, and reports:
+
+- `edge-prismatic-x8-imported-step-no-mirror`;
+- `edge-prismatic-x8-mirror-unavailable:<source>`;
+- `edge-prismatic-x8-backend-selected:unsupported`.
+
+## 9. Known losses
+
+Every CIR-backed prismatic map summary includes these known losses:
+
+- face identity lost;
+- loop identity lost;
+- split-face lineage lost;
+- feature role labels lost;
+- topology parity unavailable.
+
+The prototype also emits X8-scoped loss diagnostics, including `edge-prismatic-x8-loss-face-identity`, `edge-prismatic-x8-loss-split-face-lineage`, and `edge-prismatic-x8-loss-topology-parity`.
+
+## 10. Relationship to production `analyze map`
+
+Production `StepAnalyzer.AnalyzeMap` and normal CLI `aetheris analyze map` are unchanged. X8 adds no production analyzer route, no default CLI route, and no experimental CLI command. The focused tests include explicit diagnostics:
+
+- `edge-prismatic-x8-no-production-analyzer-behavior-changed`;
+- `edge-prismatic-x8-no-default-cli-behavior-changed`;
+- `edge-prismatic-x8-no-cir-to-brep-extraction`.
+
+A future milestone can add a clean explicit route such as `aetheris experimental prismatic-map --case <case> --rows <n> --cols <n> --json`, but X8 intentionally stops at Core test scope.
+
+## 11. Non-goals
+
+X8 does not change or claim:
+
+- production analyzer behavior;
+- default CLI behavior;
+- public APIs;
+- STEP exporter/importer behavior;
+- Boolean core behavior;
+- BRep topology behavior;
+- AIR emitter behavior;
+- production prismatic route behavior;
+- CIR-to-BRep extraction;
+- topology identity, face IDs, loop IDs, or split-face lineage from CIR maps;
+- imported STEP mirror inference;
+- coplanar merge policy;
+- gated artifact corpus test defaults.
+
+## 12. Tests run
+
+Focused validation:
+
+```bash
+dotnet test Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj --filter "EDGE-PRISMATIC-X8|PrismaticHybridMap"
+```
+
+Required regression sweeps for this milestone were run with the requested filters:
+
+```bash
+dotnet test Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj --filter "EDGE-PRISMATIC-X8|PrismaticHybridMap|CirPrismatic|CirMirror|CirMap|CIR|Cir|BrepPrimitives|BrepSpatialQueries|Raycast|Step242|Primitive|Boolean|SafeComposition"
+dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter "Analyze|Map|CliBaseline|Step|Prismatic|AirChamfer|Experimental|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.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj --filter "FirmamentPrimitive|FirmamentStepExporter|SemanticRecovery|FrepMaterializer|Rematerialize|Chamfer|Fillet|Corner|ProfileStack|LineArcProfileExtrude"
+```
+
+The gated X6 artifact corpus stability body remains opt-in and is not made default by X8.
+
+## 13. Recommended next milestone
+
+Recommended next steps, in priority order:
+
+1. **EDGE-PRISMATIC-X9 experimental CLI prismatic-map route** — expose this generated-source-only path under an explicit experimental command, preserving normal `analyze map` behavior.
+2. **AIR-CIR-A1 mirror drift/parity policy** — define stale mirror detection and generated-source provenance checks before broader use.
+3. **Chamfer/fillet selection taxonomy return** — use the mirror evidence to refine when prismatic section transitions, AIR edge sweeps, or legacy BRep routes should compete.
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.md
index d4a8a24f..011f5d78 100644
--- a/docs/frictionlab/edge-prismatic-x6-corpus-stability-and-analyzer-confirmation.md
+++ b/docs/frictionlab/edge-prismatic-x6-corpus-stability-and-analyzer-confirmation.md
@@ -225,3 +225,7 @@ 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.
+
+## 11. EDGE-PRISMATIC-X8 generated-source map follow-up
+
+EDGE-PRISMATIC-X8 addresses the X6 `analyze map` limitation only for generated prismatic sources that still have admissible AIR/prismatic section data. The X8 lab dispatcher builds an admitted `CirConvexPolyhedronMirror` for `rectangle-inset` and `top-edge-chamfer` and produces deterministic CIR occupancy/thickness summaries. It does not change imported STEP-only artifact behavior: X5/X6 corpus STEP files still do not cause mirror inference, and normal production `aetheris analyze map` remains unchanged.