Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add artifact verification and fix B-rep volume handling
Yuechen Lic341d487d693
diff --git a/Aetheris.CLI.Tests/CadAssistantInspectionTests.cs b/Aetheris.CLI.Tests/CadAssistantInspectionTests.csnew file mode 100644index 00000000..0ebd3c61--- /dev/null+++ b/Aetheris.CLI.Tests/CadAssistantInspectionTests.cs@@ -0,0 +1,22 @@+namespace Aetheris.CLI.Tests;++public sealed class CadAssistantInspectionTests+{+ [Fact]+ public void ExplicitMissingExecutable_IsReportedAsUnavailableWithoutFallback()+ {+ var artifact = Path.Combine(Path.GetTempPath(), "aetheris-cad-inspection-" + Guid.NewGuid().ToString("N") + ".step");+ File.WriteAllText(artifact, "ISO-10303-21;");+ try+ {+ var result = Aetheris.CLI.CadAssistantInspection.Inspect(+ artifact,+ new Aetheris.CLI.CadAssistantInspectionOptions(artifact + ".missing.exe", TimeSpan.FromMilliseconds(10), Path.GetTempPath()));++ Assert.Equal(Aetheris.CLI.CadAssistantInspectionStatus.Unavailable, result.Status);+ Assert.Null(result.ResolvedExecutablePath);+ Assert.NotEmpty(result.ArtifactSha256);+ }+ finally { File.Delete(artifact); }+ }+}diff --git a/Aetheris.CLI/ArtifactVerificationModels.cs b/Aetheris.CLI/ArtifactVerificationModels.csnew file mode 100644index 00000000..213897f1--- /dev/null+++ b/Aetheris.CLI/ArtifactVerificationModels.cs@@ -0,0 +1,25 @@+using Aetheris.Kernel.Core.Brep.Verification;++namespace Aetheris.CLI;++/// <summary>+/// Preserves independent evidence layers. A false or pending layer is never+/// collapsed into an undifferentiated pass/fail value.+/// </summary>+public sealed record ArtifactIdentity(string Path, string Sha256, string EvidenceDirectory);+public sealed record ArtifactProducerEvidence(string Status, string Note);+public sealed record ArtifactStepReimportEvidence(string Status, AnalyzeResult? Analysis, string? Error = null);+public sealed record ArtifactMassComparisonEvidence(+ double ExpectedVolume,+ double ObservedVolume,+ double Delta,+ double RelativeDelta,+ bool WithinReportedErrorBound);+public sealed record ArtifactVerificationResult(+ ArtifactIdentity Artifact,+ ArtifactProducerEvidence ProducerEvidence,+ BrepMassPropertiesResult? BrepMassProperties,+ ArtifactMassComparisonEvidence? MassComparison,+ ArtifactStepReimportEvidence StepReimport,+ object CadAssistant,+ string OverallAdmission);diff --git a/Aetheris.CLI/CadAssistantInspection.cs b/Aetheris.CLI/CadAssistantInspection.csnew file mode 100644index 00000000..9db52ad8--- /dev/null+++ b/Aetheris.CLI/CadAssistantInspection.cs@@ -0,0 +1,226 @@+using System.Diagnostics;+using System.IO.Compression;+using System.Runtime.InteropServices;+using System.Security.Cryptography;++namespace Aetheris.CLI;++public enum CadAssistantInspectionStatus+{+ Unavailable,+ LaunchFailed,+ ImportFailed,+ TimedOut,+ Displayed,+ DisplayedWithWarnings,+ InspectionCompleted,+}++public sealed record CadAssistantInspectionOptions(string? ExecutablePath, TimeSpan Timeout, string EvidenceDirectory);++public sealed record CadAssistantInspectionResult(+ CadAssistantInspectionStatus Status,+ string? ResolvedExecutablePath,+ string ArtifactPath,+ string ArtifactSha256,+ IReadOnlyList<string> LaunchArguments,+ DateTimeOffset StartedAt,+ DateTimeOffset EndedAt,+ int? ImportProgress,+ string? DisplayStatus,+ bool WindowResponsive,+ long StableForMilliseconds,+ IReadOnlyList<string> Screenshots,+ IReadOnlyList<string> Diagnostics);++/// <summary>+/// Bounded external-display harness. CAD Assistant has no stable public import+/// completion API, so the harness records the raw process/window observations+/// and refuses to infer visual geometry correctness from them.+/// </summary>+public static class CadAssistantInspection+{+ public static CadAssistantInspectionResult Inspect(string stepPath, CadAssistantInspectionOptions options)+ {+ var artifactPath = Path.GetFullPath(stepPath);+ var hash = Convert.ToHexString(SHA256.HashData(File.ReadAllBytes(artifactPath))).ToLowerInvariant();+ var started = DateTimeOffset.UtcNow;+ var executable = ResolveExecutable(options.ExecutablePath);+ if (executable is null)+ return Result(CadAssistantInspectionStatus.Unavailable, null, artifactPath, hash, started, null, false, 0, [], ["CAD Assistant was not found. Set --cad-assistant-path or AETHERIS_CAD_ASSISTANT_PATH."]);++ Directory.CreateDirectory(options.EvidenceDirectory);+ using var process = new Process { StartInfo = new ProcessStartInfo(executable, Quote(artifactPath)) { UseShellExecute = true } };+ try+ {+ if (!process.Start())+ return Result(CadAssistantInspectionStatus.LaunchFailed, executable, artifactPath, hash, started, null, false, 0, [], ["Process.Start returned false."]);+ }+ catch (Exception ex)+ {+ return Result(CadAssistantInspectionStatus.LaunchFailed, executable, artifactPath, hash, started, null, false, 0, [], [ex.Message]);+ }++ var deadline = DateTimeOffset.UtcNow + options.Timeout;+ var stableSince = DateTimeOffset.UtcNow;+ IntPtr lastWindow = IntPtr.Zero;+ while (DateTimeOffset.UtcNow < deadline)+ {+ process.Refresh();+ if (process.HasExited)+ return Result(CadAssistantInspectionStatus.ImportFailed, executable, artifactPath, hash, started, process, false, 0, [], [$"CAD Assistant exited with code {process.ExitCode} before a display-ready window was observed."]);+ var handle = process.MainWindowHandle;+ if (handle != IntPtr.Zero && process.Responding)+ {+ if (handle != lastWindow) { lastWindow = handle; stableSince = DateTimeOffset.UtcNow; }+ var stable = DateTimeOffset.UtcNow - stableSince;+ if (stable >= TimeSpan.FromSeconds(2))+ {+ var screenshots = CaptureEvidence(handle, options.EvidenceDirectory);+ var notes = screenshots.Count == 2+ ? new[] { "A responsive CAD Assistant window remained stable for two seconds. Import-progress and display-status controls are not exposed through a stable automation API, so this is a display observation with warnings, not a visual geometry pass." }+ : new[] { "A responsive CAD Assistant window was observed, but native screenshot capture failed. This is not a clean display admission." };+ TryCloseOwnedProcess(process);+ return Result(screenshots.Count == 2 ? CadAssistantInspectionStatus.DisplayedWithWarnings : CadAssistantInspectionStatus.DisplayedWithWarnings, executable, artifactPath, hash, started, process, true, (long)stable.TotalMilliseconds, screenshots, notes);+ }+ }+ Thread.Sleep(100);+ }+ TryCloseOwnedProcess(process);+ return Result(CadAssistantInspectionStatus.TimedOut, executable, artifactPath, hash, started, process, false, 0, [], $"No stable responsive CAD Assistant window was observed within {options.Timeout}.");+ }++ public static string? ResolveExecutable(string? explicitPath)+ {+ if (!string.IsNullOrWhiteSpace(explicitPath))+ {+ return File.Exists(explicitPath) ? explicitPath : null;+ }+ var candidates = new[]+ {+ Environment.GetEnvironmentVariable("AETHERIS_CAD_ASSISTANT_PATH"),+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "CAD Assistant", "CAD Assistant.exe"),+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "CAD Assistant", "CAD Assistant.exe"),+ };+ return candidates.FirstOrDefault(path => !string.IsNullOrWhiteSpace(path) && File.Exists(path));+ }++ private static CadAssistantInspectionResult Result(CadAssistantInspectionStatus status, string? executable, string artifact, string hash, DateTimeOffset started, Process? process, bool responsive, long stable, IReadOnlyList<string> screenshots, params string[] diagnostics)+ => new(status, executable, artifact, hash, executable is null ? [] : [artifact], started, DateTimeOffset.UtcNow, null, null, responsive, stable, screenshots, diagnostics);++ private static string Quote(string value) => $"\"{value.Replace("\"", "\\\"")}\"";++ private static void TryCloseOwnedProcess(Process process)+ {+ try { if (!process.HasExited && process.MainWindowHandle != IntPtr.Zero) process.CloseMainWindow(); }+ catch { /* best-effort only; never touch a process the harness did not start. */ }+ }++ private static IReadOnlyList<string> CaptureEvidence(IntPtr window, string evidenceDirectory)+ {+ // Native capture avoids taking a dependency on System.Drawing in the cross-platform CLI.+ // A second capture is a bounded secondary observation; no input is synthesized because+ // CAD Assistant does not offer a stable public camera automation contract.+ var first = Path.Combine(evidenceDirectory, "cad-assistant-isometric.png");+ var second = Path.Combine(evidenceDirectory, "cad-assistant-secondary.png");+ return CaptureWindowPng(window, first) && CaptureWindowPng(window, second) ? [first, second] : [];+ }++ private static bool CaptureWindowPng(IntPtr window, string destination)+ {+ if (!OperatingSystem.IsWindows() || !GetWindowRect(window, out var rect)) return false;+ var width = rect.Right - rect.Left;+ var height = rect.Bottom - rect.Top;+ if (width <= 0 || height <= 0) return false;+ var source = GetWindowDC(window);+ var memory = CreateCompatibleDC(source);+ var bitmap = CreateCompatibleBitmap(source, width, height);+ var previous = IntPtr.Zero;+ try+ {+ if (source == IntPtr.Zero || memory == IntPtr.Zero || bitmap == IntPtr.Zero) return false;+ previous = SelectObject(memory, bitmap);+ if (!BitBlt(memory, 0, 0, width, height, source, 0, 0, 0x00CC0020)) return false;+ var info = new BitmapInfo { Header = new BitmapInfoHeader { Size = Marshal.SizeOf<BitmapInfoHeader>(), Width = width, Height = -height, Planes = 1, BitCount = 32, Compression = 0 } };+ var stride = width * 4;+ var pixels = new byte[stride * height];+ if (GetDIBits(memory, bitmap, 0, (uint)height, pixels, ref info, 0) == 0) return false;+ WritePng(destination, width, height, pixels, stride);+ return true;+ }+ catch { return false; }+ finally+ {+ if (previous != IntPtr.Zero) SelectObject(memory, previous);+ if (bitmap != IntPtr.Zero) DeleteObject(bitmap);+ if (memory != IntPtr.Zero) DeleteDC(memory);+ if (source != IntPtr.Zero) ReleaseDC(window, source);+ }+ }++ private static void WritePng(string path, int width, int height, byte[] bgra, int stride)+ {+ using var file = File.Create(path);+ file.Write([137, 80, 78, 71, 13, 10, 26, 10]);+ WriteChunk(file, "IHDR", BuildHeader(width, height));+ var scanlines = new byte[height * ((width * 4) + 1)];+ for (var y = 0; y < height; y++)+ {+ var target = y * ((width * 4) + 1) + 1;+ for (var x = 0; x < width; x++)+ {+ var source = y * stride + x * 4;+ scanlines[target + x * 4] = bgra[source + 2];+ scanlines[target + x * 4 + 1] = bgra[source + 1];+ scanlines[target + x * 4 + 2] = bgra[source];+ scanlines[target + x * 4 + 3] = bgra[source + 3];+ }+ }+ using var compressed = new MemoryStream();+ using (var zlib = new ZLibStream(compressed, CompressionLevel.SmallestSize, leaveOpen: true)) zlib.Write(scanlines);+ WriteChunk(file, "IDAT", compressed.ToArray());+ WriteChunk(file, "IEND", []);+ }++ private static byte[] BuildHeader(int width, int height)+ {+ var data = new byte[13];+ WriteBigEndian(data, 0, width); WriteBigEndian(data, 4, height);+ data[8] = 8; data[9] = 6;+ return data;+ }++ private static void WriteChunk(Stream stream, string name, byte[] data)+ {+ var type = System.Text.Encoding.ASCII.GetBytes(name);+ var length = new byte[4]; WriteBigEndian(length, 0, data.Length); stream.Write(length); stream.Write(type); stream.Write(data);+ var checksumInput = type.Concat(data).ToArray();+ var crc = new byte[4]; WriteBigEndian(crc, 0, unchecked((int)Crc32(checksumInput))); stream.Write(crc);+ }++ private static void WriteBigEndian(byte[] target, int offset, int value)+ {+ target[offset] = (byte)(value >> 24); target[offset + 1] = (byte)(value >> 16); target[offset + 2] = (byte)(value >> 8); target[offset + 3] = (byte)value;+ }++ private static uint Crc32(byte[] bytes)+ {+ var crc = 0xffffffffu;+ foreach (var b in bytes) { crc ^= b; for (var bit = 0; bit < 8; bit++) crc = (crc >> 1) ^ ((crc & 1) == 0 ? 0u : 0xedb88320u); }+ return ~crc;+ }++ [StructLayout(LayoutKind.Sequential)] private struct Rect { public int Left, Top, Right, Bottom; }+ [StructLayout(LayoutKind.Sequential)] private struct BitmapInfoHeader { public int Size, Width, Height; public short Planes, BitCount; public int Compression, SizeImage, XPelsPerMeter, YPelsPerMeter, ClrUsed, ClrImportant; }+ [StructLayout(LayoutKind.Sequential)] private struct BitmapInfo { public BitmapInfoHeader Header; public uint Colors; }+ [DllImport("user32.dll")] private static extern bool GetWindowRect(IntPtr hWnd, out Rect rect);+ [DllImport("user32.dll")] private static extern IntPtr GetWindowDC(IntPtr hWnd);+ [DllImport("user32.dll")] private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDc);+ [DllImport("gdi32.dll")] private static extern IntPtr CreateCompatibleDC(IntPtr hDc);+ [DllImport("gdi32.dll")] private static extern bool DeleteDC(IntPtr hDc);+ [DllImport("gdi32.dll")] private static extern IntPtr CreateCompatibleBitmap(IntPtr hDc, int width, int height);+ [DllImport("gdi32.dll")] private static extern IntPtr SelectObject(IntPtr hDc, IntPtr hObject);+ [DllImport("gdi32.dll")] private static extern bool DeleteObject(IntPtr hObject);+ [DllImport("gdi32.dll")] private static extern bool BitBlt(IntPtr destination, int x, int y, int width, int height, IntPtr source, int sourceX, int sourceY, uint rasterOperation);+ [DllImport("gdi32.dll")] private static extern int GetDIBits(IntPtr hDc, IntPtr bitmap, uint startScan, uint scanLines, byte[] bits, ref BitmapInfo info, uint usage);+}diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.csindex c72f1940..a311c95a 100644--- a/Aetheris.CLI/CliRunner.cs+++ b/Aetheris.CLI/CliRunner.cs@@ -1,6 +1,9 @@+using System.Security.Cryptography;using System.Text.Json;using System.Text.Json.Serialization;using Aetheris.Forge.Abstractions.FirmamentInterop;+using Aetheris.Kernel.Core.Brep.Verification;+using Aetheris.Kernel.Core.Step242;using Aetheris.Kernel.Firmament;using Aetheris.Kernel.Firmament.Assembly;using Aetheris.Kernel.Firmament.FirmamentV2;@@ -108,7 +111,7 @@ public static class CliRunnerstring? Error,string? Classification = null,int? RigidRootCount = null);- private const string TopLevelUsage = "Usage: aetheris <build|validate|analyze|match|trace|canon|asm|experimental> <path> [options]";+ private const string TopLevelUsage = "Usage: aetheris <build|validate|analyze|verify|match|trace|canon|asm|experimental> <path> [options]";private const string BuildUsage = "Usage: aetheris build <file.firmament> [--out <path>] [--json]";private const string ValidateUsage = "Usage: aetheris validate <file.firmament|file.firmfixture> [--forge-pack <path>] [--json]";private const string AnalyzeUsage = "Usage: aetheris analyze <file.step> [--face <id>] [--edge <id>] [--vertex <id>] [--json]";@@ -116,6 +119,7 @@ public static class CliRunnerprivate const string AnalyzeSectionUsage = "Usage: aetheris analyze section <file.step> (--xy|--xz|--yz) --offset <value> --json";private const string AnalyzeVolumeUsage = "Usage: aetheris analyze volume <file.step> [--approximate --resolution <N>] [--json]";private const string AnalyzeCompareUsage = "Usage: aetheris analyze compare <reference.step> <candidate.step> [--approximate-volume --resolution <N>] [--json]";+ private const string VerifyUsage = "Usage: aetheris verify <artifact.step> [--expected-volume <value>] [--cad-assistant] [--cad-assistant-path <path>] [--timeout <seconds>] [--evidence-dir <path>] [--require-external] [--json]";private const string MatchUsage = "Usage: aetheris match <file.step> <concept.firmament> [--linear-tolerance <mm>] [--angular-tolerance <deg>] [--json]";private const string TraceUsage = "Usage: aetheris trace (--case <name>|--fixture <path>) [--out-dir <dir>] [--json]";private const string CanonUsage = "Usage: aetheris canon <file.step> --out <canonical.step> [--mode deterministic|production] [--json]";@@ -167,6 +171,7 @@ public static class CliRunner"build" => RunBuild(args.Skip(1).ToArray(), stdout, stderr),"validate" => RunValidate(args.Skip(1).ToArray(), stdout, stderr),"analyze" => RunAnalyze(args.Skip(1).ToArray(), stdout, stderr),+ "verify" => RunVerify(args.Skip(1).ToArray(), stdout, stderr),"match" => RunMatch(args.Skip(1).ToArray(), stdout, stderr),"trace" => RunTrace(args.Skip(1).ToArray(), stdout, stderr),"canon" => RunCanon(args.Skip(1).ToArray(), stdout, stderr),@@ -182,6 +187,91 @@ public static class CliRunner}}+ private static int RunVerify(string[] args, TextWriter stdout, TextWriter stderr)+ {+ if (args.Length == 0 || IsHelpFlag(args[0])) { WriteVerifyHelp(stdout); return args.Length == 0 ? 1 : 0; }+ var stepPath = args[0];+ var json = false;+ var requestCadAssistant = false;+ var requireExternal = false;+ double? expectedVolume = null;+ string? cadPath = null;+ string? evidenceRoot = null;+ var timeout = TimeSpan.FromSeconds(30);+ for (var i = 1; i < args.Length; i++)+ {+ switch (args[i])+ {+ case "--cad-assistant": requestCadAssistant = true; break;+ case "--cad-assistant-path" when i + 1 < args.Length: cadPath = args[++i]; requestCadAssistant = true; break;+ case "--timeout" when i + 1 < args.Length && double.TryParse(args[++i], out var seconds) && seconds > 0d: timeout = TimeSpan.FromSeconds(seconds); break;+ case "--evidence-dir" when i + 1 < args.Length: evidenceRoot = args[++i]; break;+ case "--expected-volume" when i + 1 < args.Length && double.TryParse(args[++i], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var expected) && expected >= 0d: expectedVolume = expected; break;+ case "--require-external": requireExternal = true; requestCadAssistant = true; break;+ case "--json": json = true; break;+ default: stderr.WriteLine($"Unknown verify option '{args[i]}'."); stderr.WriteLine(VerifyUsage); return 1;+ }+ }+ if (!File.Exists(stepPath)) { stderr.WriteLine($"STEP artifact '{stepPath}' does not exist."); return 1; }+ var fullPath = Path.GetFullPath(stepPath);+ var hash = Convert.ToHexString(SHA256.HashData(File.ReadAllBytes(fullPath))).ToLowerInvariant();+ var fixtureName = Path.GetFileNameWithoutExtension(fullPath);+ var evidenceDir = Path.GetFullPath(evidenceRoot ?? Path.Combine("artifacts", "verification", fixtureName, hash));+ Directory.CreateDirectory(evidenceDir);+ File.Copy(fullPath, Path.Combine(evidenceDir, "model.step"), overwrite: true);++ object report;+ CadAssistantInspectionResult? external = null;+ BrepMassPropertiesResult? massProperties = null;+ AnalyzeResult? reimportAnalysis = null;+ try+ {+ var import = Step242Importer.ImportBody(File.ReadAllText(fullPath));+ if (!import.IsSuccess) throw new InvalidOperationException(string.Join("; ", import.Diagnostics.Select(d => d.Message)));+ massProperties = BrepMassProperties.Evaluate(import.Value);+ reimportAnalysis = StepAnalyzer.AnalyzeImportedBody(import.Value, fullPath);+ if (requestCadAssistant)+ {+ external = CadAssistantInspection.Inspect(fullPath, new CadAssistantInspectionOptions(cadPath, timeout, evidenceDir));+ }+ var overall = massProperties.Status == BrepMassPropertiesStatus.Unavailable+ ? "BRepRejected"+ : external?.Status == CadAssistantInspectionStatus.Unavailable+ ? "ExternalInspectionPending"+ : external is null ? "ExternalInspectionPending"+ : external.Status is CadAssistantInspectionStatus.Displayed or CadAssistantInspectionStatus.InspectionCompleted ? "ExternallyDisplayed"+ : massProperties.Status != BrepMassPropertiesStatus.Unavailable ? "BRepVerified" : "Rejected";+ ArtifactMassComparisonEvidence? comparison = null;+ if (expectedVolume.HasValue && massProperties.Status != BrepMassPropertiesStatus.Unavailable)+ {+ var delta = massProperties.AbsoluteVolume - expectedVolume.Value;+ var relative = expectedVolume.Value > 1e-12d ? delta / expectedVolume.Value : delta;+ comparison = new ArtifactMassComparisonEvidence(expectedVolume.Value, massProperties.AbsoluteVolume, delta, relative, Math.Abs(delta) <= (massProperties.ErrorBound ?? 0d));+ }+ report = new ArtifactVerificationResult(+ new ArtifactIdentity(fullPath, hash, evidenceDir),+ new ArtifactProducerEvidence("ArtifactOnly", "verify consumes an existing STEP artifact; compiler preflight evidence is not reconstructed."),+ massProperties,+ comparison,+ new ArtifactStepReimportEvidence("Valid", reimportAnalysis),+ (object?)external ?? new { status = "NotRequested", availability = "Unknown" },+ overall);+ }+ catch (Exception ex)+ {+ report = new { artifact = new { path = fullPath, sha256 = hash, evidenceDirectory = evidenceDir }, overallAdmission = "Rejected", error = ex.Message };+ }+ var reportPath = Path.Combine(evidenceDir, "verification-report.json");+ File.WriteAllText(reportPath, JsonSerializer.Serialize(report, JsonOptions));+ if (massProperties is not null) File.WriteAllText(Path.Combine(evidenceDir, "mass-properties.json"), JsonSerializer.Serialize(massProperties, JsonOptions));+ if (reimportAnalysis is not null) File.WriteAllText(Path.Combine(evidenceDir, "aetheris-analyze.json"), JsonSerializer.Serialize(reimportAnalysis, JsonOptions));+ if (external is not null) File.WriteAllText(Path.Combine(evidenceDir, "cad-assistant-inspection.json"), JsonSerializer.Serialize(external, JsonOptions));+ File.WriteAllText(Path.Combine(evidenceDir, "verification-summary.md"), $"# Artifact verification\n\n- Artifact: `{fullPath}`\n- SHA-256: `{hash}`\n- Report: `verification-report.json`\n- External inspection: `{external?.Status.ToString() ?? "NotRequested"}`\n");+ if (json) stdout.WriteLine(JsonSerializer.Serialize(report, JsonOptions));+ else stdout.WriteLine($"Verification report: {reportPath}");+ return requireExternal && external?.Status == CadAssistantInspectionStatus.Unavailable ? 2 : 0;+ }+private static int RunMatch(string[] args, TextWriter stdout, TextWriter stderr){if (args.Length == 0 || IsHelpFlag(args[0]))@@ -2310,6 +2400,7 @@ public static class CliRunnerstdout.WriteLine(" build Build a .firmament source file into STEP.");stdout.WriteLine(" validate Validate Firmament V2 manufacturing intent and emit report JSON.");stdout.WriteLine(" analyze Analyze STEP topology, geometry, map, and sections.");+ stdout.WriteLine(" verify Reimport STEP and emit independent B-rep/external-display evidence.");stdout.WriteLine(" match Match a compile-time Concept Struct against observed STEP geometry.");stdout.WriteLine(" trace Trace built-in AIR lowering cases through route, BRepPlan, STEP smoke, and CIR mirror.");stdout.WriteLine(" canon Import and re-export STEP/AP242 as canonical STEP.");@@ -2337,6 +2428,7 @@ public static class CliRunnerstdout.WriteLine(" aetheris analyze map model.step --top --rows 40 --cols 60 --json");stdout.WriteLine(" aetheris analyze section model.step --xy --offset 2.5 --json");stdout.WriteLine(" aetheris analyze volume model.step --json");+ stdout.WriteLine(" aetheris verify model.step --json");stdout.WriteLine();stdout.WriteLine("Run 'aetheris <command> --help' for command-specific usage.");}@@ -2493,6 +2585,23 @@ public static class CliRunnerstdout.WriteLine(" aetheris analyze volume part.step --approximate --resolution 64 --json");}+ private static void WriteVerifyHelp(TextWriter stdout)+ {+ stdout.WriteLine(VerifyUsage);+ stdout.WriteLine();+ stdout.WriteLine("Reimport a STEP artifact, evaluate independent B-rep mass properties, and optionally run bounded external CAD display inspection.");+ stdout.WriteLine("The report is hash-tied to artifacts/verification/<fixture>/<sha256>/ by default.");+ stdout.WriteLine();+ stdout.WriteLine("Options:");+ stdout.WriteLine(" --expected-volume <value> Compare independent measured volume with external analytic evidence; never used by the evaluator.");+ stdout.WriteLine(" --cad-assistant Launch configured CAD Assistant for external display observation.");+ stdout.WriteLine(" --cad-assistant-path <path> Explicit CAD Assistant executable; otherwise AETHERIS_CAD_ASSISTANT_PATH and two standard install paths are checked.");+ stdout.WriteLine(" --timeout <seconds> External inspection timeout (default 30).");+ stdout.WriteLine(" --evidence-dir <path> Override hash-tied evidence directory.");+ stdout.WriteLine(" --require-external Return exit 2 when CAD Assistant is unavailable.");+ stdout.WriteLine(" --json Emit the unified report on stdout.");+ }+private static void WriteCanonHelp(TextWriter stdout){stdout.WriteLine("Canonicalize part-like STEP/AP242 through Aetheris import/export.");diff --git a/Aetheris.CLI/StepAnalyzer.cs b/Aetheris.CLI/StepAnalyzer.csindex 4931f81b..859e1bb3 100644--- a/Aetheris.CLI/StepAnalyzer.cs+++ b/Aetheris.CLI/StepAnalyzer.cs@@ -574,10 +574,13 @@ public sealed record VolumeAnalysisResult(return false;}- var loopOrientationSign = loopSignedArea >= 0d ? 1d : -1d;foreach (var triangle in triangles){- faceSignedVolume += loopOrientationSign * SignedTetraVolume(triangle.A, triangle.B, triangle.C);+ // TriangulateLoopOnPlane already emits winding relative to the+ // face plane. Applying the loop's projected-area sign a second+ // time inverted valid Box faces and was the source of the four+ // generic Box/derivation/PMI volume failures.+ faceSignedVolume += SignedTetraVolume(triangle.A, triangle.B, triangle.C);}}diff --git a/Aetheris.Kernel.Core.Tests/Brep/BrepMassPropertiesTests.cs b/Aetheris.Kernel.Core.Tests/Brep/BrepMassPropertiesTests.csnew file mode 100644index 00000000..ee87e200--- /dev/null+++ b/Aetheris.Kernel.Core.Tests/Brep/BrepMassPropertiesTests.cs@@ -0,0 +1,104 @@+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Brep.Queries;+using Aetheris.Kernel.Core.Brep.Tessellation;+using Aetheris.Kernel.Core.Brep.Verification;+using Aetheris.Kernel.Core.Geometry.Surfaces;+using Aetheris.Kernel.Core.Step242;++namespace Aetheris.Kernel.Core.Tests.Brep;++public sealed class BrepMassPropertiesTests+{+ [Theory]+ [InlineData("cylinder")]+ [InlineData("sphere")]+ [InlineData("torus")]+ public void AnalyticSurfaceFamilies_AreIntegratedFromFinalBrep(string kind)+ {+ var source = kind switch+ {+ "cylinder" => BrepPrimitives.CreateCylinder(2d, 5d).Value,+ "sphere" => BrepPrimitives.CreateSphere(2d).Value,+ "torus" => BrepPrimitives.CreateTorus(5d, 1d).Value,+ _ => throw new ArgumentOutOfRangeException(nameof(kind))+ };++ var step = Step242Exporter.ExportBody(source);+ var body = Assert.IsType<BrepBody>(Step242Importer.ImportBody(step.Value).Value);+ var result = BrepMassProperties.Evaluate(body, new BrepMassPropertiesOptions(1e-4d, double.Pi / 96d, 0.1d));++ Assert.True(result.Status != BrepMassPropertiesStatus.Unavailable, string.Join(" | ", result.Diagnostics));+ Assert.True(result.AbsoluteVolume > 0d);+ Assert.Contains(result.FaceContributions, item => item.SurfaceKind is not null);+ }++ [Fact]+ public void ClosedBox_UsesIndependentTessellatedBoundaryIntegral()+ {+ var body = Assert.IsType<BrepBody>(BrepPrimitives.CreateBox(10d, 6d, 4d).Value);++ var result = BrepMassProperties.Evaluate(body, new BrepMassPropertiesOptions(1e-5d, double.Pi / 96d, 1e-8d));++ Assert.True(result.Status != BrepMassPropertiesStatus.Unavailable, string.Join(" | ", result.Diagnostics));+ Assert.True(result.IsEnclosed);+ Assert.Equal(240d, result.AbsoluteVolume, 6);+ Assert.NotNull(result.Centroid);+ Assert.Equal(0d, result.Centroid!.Value.X, 6);+ Assert.Equal(0d, result.Centroid!.Value.Y, 6);+ Assert.Equal(0d, result.Centroid!.Value.Z, 6);+ Assert.Equal(6, result.FaceContributions.Count);+ }++ [Fact]+ public void HollowFrustum_FullCircularConeTrimsProduceCompleteIndependentEvidence()+ {+ var realization = ThinWalledBodyBRepPlanner.CreateFrustum(32d, 43d, 90d, 2d).Value;+ var body = realization.Body;+ var options = DisplayTessellationOptions.Create(double.Pi / 48d, 1e-4d, 12, 512).Value;++ var first = BrepDisplayTessellator.Tessellate(body, options).Value;+ var second = BrepDisplayTessellator.Tessellate(body, options).Value;+ var coneFaces = body.Topology.Faces+ .Where(face => body.TryGetFaceSurfaceGeometry(face.Id, out var surface) && surface?.Cone is not null)+ .OrderBy(face => face.Id.Value)+ .ToArray();++ Assert.Equal(2, coneFaces.Length);+ Assert.True(body.Bindings.GetFaceBinding(coneFaces[0].Id).SameSense);+ Assert.False(body.Bindings.GetFaceBinding(coneFaces[1].Id).SameSense);+ foreach (var face in coneFaces)+ {+ var patch = Assert.Single(first.FacePatches, candidate => candidate.FaceId == face.Id);+ var again = Assert.Single(second.FacePatches, candidate => candidate.FaceId == face.Id);+ Assert.True(body.TryGetFaceSurfaceGeometry(face.Id, out var faceSurface));+ var cone = faceSurface!.Cone!.Value;+ Assert.NotEmpty(patch.TriangleIndices);+ Assert.Equal(patch.TriangleIndices.Count, again.TriangleIndices.Count);+ Assert.Equal(patch.Positions.Count, again.Positions.Count);+ Assert.All(patch.Positions, point => AssertConeResidual(cone, point));+ Assert.True((patch.Positions[0] - patch.Positions[^1]).Length > 1e-3d); // distinct generator rings+ }++ var result = BrepMassProperties.Evaluate(body);+ Assert.Equal(BrepMassPropertiesStatus.NumericalWithBound, result.Status);+ Assert.True(result.IsEnclosed && result.IsOrientationConsistent);+ Assert.Equal(5, result.FaceContributions.Count);+ Assert.All(result.FaceContributions.Where(item => item.SurfaceKind?.ToString() == "Cone"), item => Assert.True(item.TriangleCount > 0));+ Assert.InRange(result.AbsoluteVolume, 47274.67209734925d - result.ErrorBound!.Value, 47274.67209734925d + result.ErrorBound.Value);+ Assert.InRange(result.Centroid!.Value.Z, 0d, 90d);++ var reimported = Step242Importer.ImportBody(Step242Exporter.ExportBody(body).Value).Value;+ var imported = BrepMassProperties.Evaluate(reimported);+ Assert.True(imported.Status != BrepMassPropertiesStatus.Unavailable, string.Join(" | ", imported.Diagnostics));+ Assert.All(imported.FaceContributions.Where(item => item.SurfaceKind?.ToString() == "Cone"), item => Assert.True(item.TriangleCount > 0));+ }++ private static void AssertConeResidual(ConeSurface cone, Aetheris.Kernel.Core.Math.Point3D point)+ {+ var offset = point - cone.Apex;+ var axial = offset.Dot(cone.Axis.ToVector());+ var radial = (offset - (cone.Axis.ToVector() * axial)).Length;+ Assert.InRange(System.Math.Abs(radial - (axial * System.Math.Tan(cone.SemiAngleRadians))), 0d, 1e-8d);+ Assert.True(axial > 0d);+ }+}diff --git a/Aetheris.Kernel.Core/Brep/RoundedBoxTopologyPlan.cs b/Aetheris.Kernel.Core/Brep/RoundedBoxTopologyPlan.csindex e104ed62..308ebc26 100644--- a/Aetheris.Kernel.Core/Brep/RoundedBoxTopologyPlan.cs+++ b/Aetheris.Kernel.Core/Brep/RoundedBoxTopologyPlan.cs@@ -172,7 +172,11 @@ public static class RoundedBoxBRepPlanner{if (i % 2 == 0) return SurfaceGeometry.FromCylinder(new CylinderSurface(CornerCenter(i, ProfilePoints(a, c, r, 0), r, z), PlusZ, r, PlusX));var p = new Point3D(start.X, start.Y, z); var tangent = Direction3D.Create(new Vector3D(end.X - start.X, end.Y - start.Y, 0));- var outward = Direction3D.Create(tangent.ToVector().Cross(PlusZ.ToVector()));+ // The profile runs clockwise when viewed from +Z, so +Z × tangent is+ // the material-outward planar normal. The previous tangent × +Z+ // convention inverted each straight wall and made its signed boundary+ // contribution cancel the caps/corner cylinders.+ var outward = Direction3D.Create(PlusZ.ToVector().Cross(tangent.ToVector()));return SurfaceGeometry.FromPlane(new PlaneSurface(p, outward, PlusZ));}diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.csindex b6534f57..a7a2ed26 100644--- a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs+++ b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs@@ -604,6 +604,11 @@ public static class BrepDisplayTessellatorprivate static KernelResult<DisplayFaceMeshPatch> TessellateConeFace(BrepBody body, FaceId faceId, ConeSurface cone, DisplayTessellationOptions options, DisplayTessellationExecutionBudget? executionBudget = null){var loopIds = body.GetLoopIds(faceId);+ if (TryResolveFullPeriodicConeBetweenCircularTrimLoops(body, faceId, loopIds, cone, options, out var fullFrustumPatch, out var fullFrustumDiagnostics))+ {+ return KernelResult<DisplayFaceMeshPatch>.Success(fullFrustumPatch, fullFrustumDiagnostics);+ }+if (loopIds.Count > 0){var uvLoopsResult = TryBuildPeriodicTrimmedSurfaceUvLoops(body, faceId, loopIds, point => TryProjectPointToConeUv(cone, point), options, executionBudget, SurfaceGeometryKind.Cone);@@ -639,6 +644,107 @@ public static class BrepDisplayTessellatorreturn TessellateLegacyConeFace(body, faceId, cone, options);}+ /// <summary>+ /// Resolves the deliberately narrow full-frustum cone family used by hollow frusta:+ /// two separate closed circular trim loops are the lower and upper generator bounds,+ /// not an outer loop plus a hole. The generic UV trim path represents each full+ /// circle as a periodic ring; treating the second ring as a hole cancels the entire+ /// periodic domain and used to yield zero triangles for both material cone faces.+ /// </summary>+ private static bool TryResolveFullPeriodicConeBetweenCircularTrimLoops(+ BrepBody body,+ FaceId faceId,+ IReadOnlyList<LoopId> loopIds,+ ConeSurface cone,+ DisplayTessellationOptions options,+ out DisplayFaceMeshPatch patch,+ out IReadOnlyList<KernelDiagnostic> diagnostics)+ {+ patch = default!;+ diagnostics = [];+ if (loopIds.Count != 2)+ {+ return false;+ }++ var trimLevels = new List<(double Axial, double Radius)>();+ var tolerance = System.Math.Max(1e-6d, options.ChordTolerance * 1e-3d);+ var axis = cone.Axis.ToVector();+ foreach (var loopId in loopIds.OrderBy(id => id.Value))+ {+ var coedgeIds = body.GetCoedgeIds(loopId);+ if (coedgeIds.Count != 1)+ {+ return false;+ }++ var coedge = body.Topology.GetCoedge(coedgeIds[0]);+ var edge = body.Topology.GetEdge(coedge.EdgeId);+ if (edge.StartVertexId != edge.EndVertexId+ || !body.Bindings.TryGetEdgeBinding(coedge.EdgeId, out var edgeBinding)+ || edgeBinding.TrimInterval is not { } trim+ || System.Math.Abs((trim.End - trim.Start) - (2d * double.Pi)) > 1e-5d+ || body.GetEdgeCurve(coedge.EdgeId).Circle3 is not { } circle)+ {+ return false;+ }++ // A full circular trim must be coaxial with the support and lie on its+ // equation. Sampling four quadrants makes the authority explicit: these+ // levels come from BRep trim topology, never fixture dimensions.+ if (System.Math.Abs(circle.Normal.ToVector().Dot(axis)) < (1d - 1e-6d))+ {+ return false;+ }++ var centerOffset = circle.Center - cone.Apex;+ var axial = centerOffset.Dot(axis);+ var axisResidual = (centerOffset - (axis * axial)).Length;+ var expectedRadius = axial * double.Tan(cone.SemiAngleRadians);+ var supportTolerance = System.Math.Max(tolerance, System.Math.Max(circle.Radius, expectedRadius) * 1e-6d);+ if (axial <= supportTolerance+ || axisResidual > supportTolerance+ || System.Math.Abs(circle.Radius - expectedRadius) > supportTolerance)+ {+ return false;+ }++ for (var sample = 0; sample < 4; sample++)+ {+ var point = circle.Evaluate(sample * (double.Pi / 2d));+ if (TryProjectPointToConeUv(cone, point) is null)+ {+ return false;+ }+ }++ trimLevels.Add((axial, circle.Radius));+ }++ var ordered = trimLevels.OrderBy(level => level.Axial).ToArray();+ if (ordered[1].Axial - ordered[0].Axial <= tolerance)+ {+ return false;+ }++ var angularSegments = CalculateSegmentCount(2d * double.Pi, ordered.Max(level => level.Radius), options);+ var axialSegments = CalculateAxialSegments(ordered[0].Axial, ordered[1].Axial, options);+ patch = CreatePeriodicGridPatch(+ faceId,+ angularSegments,+ axialSegments,+ (u, v) => cone.Evaluate(u, v),+ (u, _) => cone.Normal(u).ToVector(),+ ordered[0].Axial,+ ordered[1].Axial);+ diagnostics = [new KernelDiagnostic(+ KernelDiagnosticCode.Unknown,+ KernelDiagnosticSeverity.Info,+ $"Face {faceId.Value} tessellated as a topology-derived full-period cone strip: angularSegments={angularSegments}, generatorSegments={axialSegments}, trimAxial=[{ordered[0].Axial:R},{ordered[1].Axial:R}].",+ "Viewer.Cone.FullPeriodicCircularTrims")];+ return true;+ }+private static KernelResult<DisplayFaceMeshPatch> TessellateLegacyCylinderFace(BrepBody body, FaceId faceId, CylinderSurface cylinder, DisplayTessellationOptions options){@@ -3349,7 +3455,7 @@ public static class BrepDisplayTessellatorAppendUniquePoint(flattened, segmentEnd);break;case CurveGeometryKind.Circle3:- var arcPointsResult = SampleCircleArc(body, coedge, isTraversalSwapped, curve.Circle3!.Value, segmentStart, segmentEnd, plane, faceId);+ var arcPointsResult = SampleCircleArc(body, coedge, isTraversalSwapped, curve.Circle3!.Value, segmentStart, segmentEnd, plane, faceId, options);if (!arcPointsResult.IsSuccess){return KernelResult<IReadOnlyList<Point3D>>.Failure(arcPointsResult.Diagnostics);@@ -3410,7 +3516,8 @@ public static class BrepDisplayTessellatorPoint3D start,Point3D end,PlaneSurface plane,- FaceId faceId)+ FaceId faceId,+ DisplayTessellationOptions options){var effectiveIsReversed = coedge.IsReversed ^ traversalSwapped;if (body.Bindings.TryGetEdgeBinding(coedge.EdgeId, out var binding)@@ -3421,7 +3528,8 @@ public static class BrepDisplayTessellatoreffectiveIsReversed ? !binding.OrientedEdgeSense : binding.OrientedEdgeSense,out var sampledPoints,out var isClosed,- out var usedShorterArcFallback))+ out var usedShorterArcFallback,+ options)){var points = new List<Point3D>(sampledPoints.Count - 1);for (var i = 1; i < sampledPoints.Count; i++)@@ -3451,7 +3559,7 @@ public static class BrepDisplayTessellator}var (startAngle, delta) = deltaResult.Value;- var samples = CurveSampler.SampleCircleArc(circle, startAngle, delta);+ var samples = CurveSampler.SampleCircleArc(circle, startAngle, delta, options);var pointsFallback = new List<Point3D>(samples.Count - 1);for (var i = 1; i < samples.Count; i++){diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/CurveSampler.cs b/Aetheris.Kernel.Core/Brep/Tessellation/CurveSampler.csindex 6f848250..efd6e0a7 100644--- a/Aetheris.Kernel.Core/Brep/Tessellation/CurveSampler.cs+++ b/Aetheris.Kernel.Core/Brep/Tessellation/CurveSampler.cs@@ -13,9 +13,9 @@ internal static class CurveSamplerpublic static IReadOnlyList<Point3D> SampleLine(Line3Curve line, ParameterInterval interval)=> [line.Evaluate(interval.Start), line.Evaluate(interval.End)];- public static IReadOnlyList<Point3D> SampleCircleArc(Circle3Curve circle, double startAngle, double delta)+ public static IReadOnlyList<Point3D> SampleCircleArc(Circle3Curve circle, double startAngle, double delta, DisplayTessellationOptions? options = null){- var segmentCount = ResolveCircleSegmentCount(delta);+ var segmentCount = ResolveCircleSegmentCount(delta, circle.Radius, options);var points = new List<Point3D>(segmentCount + 1);for (var i = 0; i <= segmentCount; i++){@@ -52,7 +52,8 @@ internal static class CurveSamplerbool orientedEdgeSense,out IReadOnlyList<Point3D> points,out bool isClosed,- out bool usedShorterArcFallback)+ out bool usedShorterArcFallback,+ DisplayTessellationOptions? options = null){const double endpointTolerance = 1e-6d;const double fullCircleEpsilon = 1e-6d;@@ -115,7 +116,7 @@ internal static class CurveSamplerdelta = sign * System.Math.Clamp(double.Abs(delta), minDelta, maxDelta);}- var sampled = SampleCircleArc(circle, thetaStart, delta).ToArray();+ var sampled = SampleCircleArc(circle, thetaStart, delta, options).ToArray();sampled[0] = startProjected;sampled[^1] = endProjected;points = sampled;@@ -141,7 +142,7 @@ internal static class CurveSamplerreturn normalized;}- private static int ResolveCircleSegmentCount(double delta)+ private static int ResolveCircleSegmentCount(double delta, double radius, DisplayTessellationOptions? options){var absoluteDelta = double.Abs(delta);if (absoluteDelta <= 1e-12d)@@ -149,7 +150,20 @@ internal static class CurveSamplerreturn MinimumCircleSegments;}- var segments = (int)double.Ceiling(absoluteDelta / AngularStepRadians);- return System.Math.Clamp(segments, MinimumCircleSegments, MaximumCircleSegments);+ if (options is null)+ {+ var displaySegments = (int)double.Ceiling(absoluteDelta / AngularStepRadians);+ return System.Math.Clamp(displaySegments, MinimumCircleSegments, MaximumCircleSegments);+ }++ var angular = (int)double.Ceiling(absoluteDelta / options.AngularToleranceRadians);+ var chord = 0;+ if (radius > options.ChordTolerance)+ {+ var halfStep = double.Acos(System.Math.Clamp(1d - (options.ChordTolerance / radius), -1d, 1d));+ chord = halfStep > 0d ? (int)double.Ceiling(absoluteDelta / (2d * halfStep)) : 0;+ }++ return System.Math.Clamp(System.Math.Max(options.MinimumSegments, System.Math.Max(angular, chord)), options.MinimumSegments, options.MaximumSegments);}}diff --git a/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.cs b/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.csindex 81ae9577..aa19f5cf 100644--- a/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.cs+++ b/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.cs@@ -122,7 +122,10 @@ public static class ThinWalledBodyBRepPlannerfor (var i = 0; i < 8; i++) { outerVertical[i] = AddLine(v[0, i], v[1, i], points, b, g, bindings); innerVertical[i] = AddLine(v[2, i], v[3, i], points, b, g, bindings); rim[i] = AddLine(v[1, i], v[3, i], points, b, g, bindings); }var faces = new List<FaceId>();var outerBottom = AddFace(b, [Reverse(Row(edges, 0))]); BindPlane(outerBottom, new Point3D(0, 0, 0), MinusZ, g, bindings); faces.Add(outerBottom);- var innerBottom = AddFace(b, [Forward(Row(edges, 2))]); BindPlane(innerBottom, new Point3D(0, 0, t), PlusZ, g, bindings, false); faces.Add(innerBottom);+ // The inner material boundary faces into the cavity (+Z). Keep the+ // planar support and SameSense canonical rather than encoding the same+ // orientation as (-Z, false), because STEP import normalizes planes.+ var innerBottom = AddFace(b, [Forward(Row(edges, 2))]); BindPlane(innerBottom, new Point3D(0, 0, t), PlusZ, g, bindings); faces.Add(innerBottom);for (var i = 0; i < 8; i++) { var face = AddFace(b, [[new(edges[0, i], false), new(outerVertical[(i + 1) % 8], false), new(edges[1, i], true), new(outerVertical[i], true)]]); BindSurface(face, SideSurface(i, outer, radius, 0d), g, bindings); faces.Add(face); }for (var i = 0; i < 8; i++) { var face = AddFace(b, [[new(edges[2, i], false), new(innerVertical[(i + 1) % 8], false), new(edges[3, i], true), new(innerVertical[i], true)]]); BindSurface(face, SideSurface(i, inner, radius - t, t), g, bindings, false); faces.Add(face); }for (var i = 0; i < 8; i++) { var face = AddFace(b, [[new(edges[1, i], false), new(rim[(i + 1) % 8], false), new(edges[3, i], true), new(rim[i], true)]]); BindPlane(face, new Point3D(0, 0, height), PlusZ, g, bindings); faces.Add(face); }@@ -143,7 +146,8 @@ public static class ThinWalledBodyBRepPlannerBindSurface(outerCone, SurfaceGeometry.FromCone(outerSupport), g, bindings);BindSurface(innerCone, SurfaceGeometry.FromCone(innerSupport), g, bindings, false);BindPlane(outerBottom, new Point3D(0, 0, 0), MinusZ, g, bindings);- BindPlane(innerBottomFace, new Point3D(0, 0, t), PlusZ, g, bindings, false);+ // Canonical material-facing inner bottom; see rounded-box counterpart.+ BindPlane(innerBottomFace, new Point3D(0, 0, t), PlusZ, g, bindings);BindPlane(rim, new Point3D(0, 0, h), PlusZ, g, bindings);var shell = b.AddShell([outerCone, innerCone, outerBottom, innerBottomFace, rim]); b.AddBody([shell]); return new BrepBody(b.Model, g, bindings, points);}@@ -168,7 +172,7 @@ public static class ThinWalledBodyBRepPlannerprivate static EdgeId AddCircle(VertexId vertex, double radius, double z, TopologyBuilder b, BrepGeometryStore g, BrepBindingModel bindings) { var edge = b.AddEdge(vertex, vertex); AddCurve(edge, CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, z), PlusZ, radius, PlusX)), 0, 2d * double.Pi, g, bindings); return edge; }private static EdgeId AddLine(VertexId start, VertexId end, IReadOnlyDictionary<VertexId, Point3D> points, TopologyBuilder b, BrepGeometryStore g, BrepBindingModel bindings) { var edge=b.AddEdge(start,end); var a=points[start]; var q=points[end]; AddCurve(edge,CurveGeometry.FromLine(new Line3Curve(a,Direction3D.Create(q-a))),0,(q-a).Length,g,bindings); return edge; }private static Point3D CornerCenter(int i, (double X, double Y)[] p, double z) => i switch { 0 => new(p[i].X,p[(i+1)%8].Y,z), 2 => new(p[(i+1)%8].X,p[i].Y,z), 4 => new(p[i].X,p[(i+1)%8].Y,z), _ => new(p[(i+1)%8].X,p[i].Y,z) };- private static SurfaceGeometry SideSurface(int i, (double X, double Y)[] profile, double radius, double z) { if (i % 2 == 0) return SurfaceGeometry.FromCylinder(new CylinderSurface(CornerCenter(i, profile, z), PlusZ, radius, PlusX)); var a=new Point3D(profile[i].X,profile[i].Y,z); var q=new Point3D(profile[(i+1)%8].X,profile[(i+1)%8].Y,z); var tangent=Direction3D.Create(q-a); return SurfaceGeometry.FromPlane(new PlaneSurface(a,Direction3D.Create(tangent.ToVector().Cross(PlusZ.ToVector())),PlusZ)); }+ private static SurfaceGeometry SideSurface(int i, (double X, double Y)[] profile, double radius, double z) { if (i % 2 == 0) return SurfaceGeometry.FromCylinder(new CylinderSurface(CornerCenter(i, profile, z), PlusZ, radius, PlusX)); var a=new Point3D(profile[i].X,profile[i].Y,z); var q=new Point3D(profile[(i+1)%8].X,profile[(i+1)%8].Y,z); var tangent=Direction3D.Create(q-a); return SurfaceGeometry.FromPlane(new PlaneSurface(a,Direction3D.Create(PlusZ.ToVector().Cross(tangent.ToVector())),PlusZ)); }private static void AddCurve(EdgeId edge, CurveGeometry curve, double start, double end, BrepGeometryStore g, BrepBindingModel bindings) { var id=new CurveGeometryId(g.Curves.Count()+1); g.AddCurve(id,curve); bindings.AddEdgeBinding(new EdgeGeometryBinding(edge,id,new ParameterInterval(start,end))); }private static void BindSurface(FaceId face, SurfaceGeometry surface, BrepGeometryStore g, BrepBindingModel bindings, bool sameSense=true) { var id=new SurfaceGeometryId(g.Surfaces.Count()+1); g.AddSurface(id,surface); bindings.AddFaceBinding(new FaceGeometryBinding(face,id,sameSense)); }private static void BindPlane(FaceId face, Point3D origin, Direction3D normal, BrepGeometryStore g, BrepBindingModel bindings, bool sameSense=true) => BindSurface(face, SurfaceGeometry.FromPlane(new PlaneSurface(origin,normal,PlusX)),g,bindings,sameSense);diff --git a/Aetheris.Kernel.Core/Brep/Verification/BrepMassProperties.cs b/Aetheris.Kernel.Core/Brep/Verification/BrepMassProperties.csnew file mode 100644index 00000000..c40916e3--- /dev/null+++ b/Aetheris.Kernel.Core/Brep/Verification/BrepMassProperties.cs@@ -0,0 +1,286 @@+using Aetheris.Kernel.Core.Brep.Tessellation;+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Math;+using Aetheris.Kernel.Core.Topology;++namespace Aetheris.Kernel.Core.Brep.Verification;++/// <summary>+/// The confidence assigned to a mass-property result. The verifier deliberately+/// never promotes a tessellated result to an exact result.+/// </summary>+public enum BrepMassPropertiesStatus+{+ Unavailable,+ NumericalWithBound,+ NumericalConverged,+}++public sealed record BrepMassPropertiesOptions(+ double LinearTolerance,+ double AngularToleranceRadians,+ double ConvergenceTolerance,+ int MinimumSegments = 12,+ int MaximumSegments = 512)+{+ public static BrepMassPropertiesOptions Default { get; } = new(1e-4d, double.Pi / 48d, 1e-5d);+}++public sealed record BrepMassPropertiesFaceContribution(+ FaceId FaceId,+ SurfaceGeometryKind? SurfaceKind,+ double SignedVolume,+ double SurfaceArea,+ int TriangleCount,+ bool FaceSenseAvailable,+ bool FaceSameSense,+ bool TriangleOrientationCoherent);++public sealed record BrepMassPropertiesTopologyDiagnostics(+ bool IsSingleBody,+ bool IsEnclosed,+ bool IsOrientationConsistent,+ int ConnectedShellCount,+ IReadOnlyList<string> Messages);++public sealed record BrepMassPropertiesResult(+ BrepMassPropertiesStatus Status,+ double SignedVolume,+ double AbsoluteVolume,+ double SurfaceArea,+ Point3D? Centroid,+ bool IsEnclosed,+ bool IsOrientationConsistent,+ IReadOnlyList<BrepMassPropertiesFaceContribution> FaceContributions,+ string EvaluationMethod,+ double? ErrorBound,+ BrepMassPropertiesOptions Tolerance,+ BrepMassPropertiesTopologyDiagnostics Topology,+ IReadOnlyList<string> Diagnostics);++/// <summary>+/// Independent B-rep mass-property evaluator. It only consumes materialized+/// topology, bindings, and analytic surfaces. Every supported face is+/// deterministically tessellated at two resolutions; oriented triangles are+/// integrated as tetrahedra against the origin (divergence theorem). The+/// difference between the two resolutions is reported as a numerical bound.+/// </summary>+public static class BrepMassProperties+{+ public static BrepMassPropertiesResult Evaluate(BrepBody body, BrepMassPropertiesOptions? options = null)+ {+ ArgumentNullException.ThrowIfNull(body);+ var effective = options ?? BrepMassPropertiesOptions.Default;+ var topology = ValidateTopology(body);+ if (!topology.IsEnclosed)+ {+ return Unavailable(effective, topology, "Mass properties require a closed, orientable material boundary.");+ }++ var coarse = EvaluateAtResolution(body, effective, refinement: 1);+ if (coarse.Error is not null)+ {+ return Unavailable(effective, topology, coarse.Error);+ }++ var refined = EvaluateAtResolution(body, effective, refinement: 2);+ if (refined.Error is not null)+ {+ return Unavailable(effective, topology, refined.Error);+ }++ var signed = refined.SignedVolume;+ var orientationConsistent = topology.IsOrientationConsistent && System.Math.Abs(signed) > effective.LinearTolerance * effective.LinearTolerance * effective.LinearTolerance;+ var sign = signed < 0d ? -1d : 1d;+ Point3D? centroid = System.Math.Abs(signed) > 1e-18d+ ? new Point3D(refined.CentroidNumerator.X / signed, refined.CentroidNumerator.Y / signed, refined.CentroidNumerator.Z / signed)+ : null;+ var coarseCentroid = CentroidOf(coarse);+ var refinedCentroid = CentroidOf(refined);+ var centroidDelta = coarseCentroid is null || refinedCentroid is null+ ? double.PositiveInfinity+ : (refinedCentroid.Value - coarseCentroid.Value).Length;+ var refinementDelta = System.Math.Max(System.Math.Abs(refined.SignedVolume - coarse.SignedVolume), System.Math.Abs(refined.SurfaceArea - coarse.SurfaceArea));+ // A refinement delta alone misses systematic chord error when a surface+ // reaches the deterministic segment cap. A normal displacement no+ // greater than the requested chord tolerance changes enclosed volume+ // by at most area × displacement; the factor four conservatively covers+ // the two sampled resolutions and bounded trim seams.+ var error = System.Math.Max(refinementDelta, refined.SurfaceArea * effective.LinearTolerance * 4d);+ var actualRefinement = refined.Contributions.Zip(coarse.Contributions, (fine, rough) => fine.TriangleCount > rough.TriangleCount).Any(increased => increased);+ var converged = actualRefinement && refinementDelta <= effective.ConvergenceTolerance && centroidDelta <= effective.ConvergenceTolerance;+ var diagnostics = new List<string>(topology.Messages)+ {+ "Verification triangulation is not authoritative geometry.",+ "Volume is the oriented sum of tetrahedra (0,a,b,c); centroid is its signed first moment divided by signed volume.",+ $"coarseVolume={coarse.SignedVolume:G17}; refinedVolume={refined.SignedVolume:G17}; refinementDelta={refinementDelta:G17}; centroidDelta={centroidDelta:G17}; actualRefinement={actualRefinement}; conservativeErrorBound={error:G17}."+ };+ if (!orientationConsistent) diagnostics.Add("Face senses or signed enclosure orientation are inconsistent; absolute volume remains a magnitude only.");++ return new BrepMassPropertiesResult(+ converged ? BrepMassPropertiesStatus.NumericalConverged : BrepMassPropertiesStatus.NumericalWithBound,+ signed,+ System.Math.Abs(signed),+ refined.SurfaceArea,+ centroid,+ topology.IsEnclosed,+ orientationConsistent,+ refined.Contributions,+ "DeterministicTrimmedFaceTriangulationBoundaryIntegral",+ error,+ effective,+ topology with { IsOrientationConsistent = orientationConsistent },+ diagnostics);+ }++ private static BrepMassPropertiesResult Unavailable(BrepMassPropertiesOptions options, BrepMassPropertiesTopologyDiagnostics topology, string reason)+ => new(BrepMassPropertiesStatus.Unavailable, 0d, 0d, 0d, null, topology.IsEnclosed, topology.IsOrientationConsistent, [], "DeterministicTrimmedFaceTriangulationBoundaryIntegral", null, options, topology, topology.Messages.Append(reason).ToArray());++ private static Evaluation EvaluateAtResolution(BrepBody body, BrepMassPropertiesOptions options, int refinement)+ {+ // Reserve the upper half of the declared deterministic segment budget for+ // the refined pass. This avoids a false "converged" result when both+ // passes immediately hit the same cap.+ var maximumSegments = System.Math.Max(options.MinimumSegments * refinement, options.MaximumSegments / (3 - refinement));+ var displayOptions = DisplayTessellationOptions.Create(+ options.AngularToleranceRadians / refinement,+ options.LinearTolerance / refinement,+ options.MinimumSegments * refinement,+ maximumSegments);+ if (!displayOptions.IsSuccess) return new(0d, 0d, Vector3D.Zero, [], string.Join("; ", displayOptions.Diagnostics.Select(d => d.Message)));+ var mesh = BrepDisplayTessellator.Tessellate(body, displayOptions.Value);+ if (!mesh.IsSuccess) return new(0d, 0d, Vector3D.Zero, [], string.Join("; ", mesh.Diagnostics.Select(d => d.Message)));++ var missingFaces = body.Topology.Faces+ .Where(face => !mesh.Value.FacePatches.Any(patch => patch.FaceId == face.Id && patch.TriangleIndices.Count >= 3))+ .Select(face => face.Id.Value)+ .OrderBy(id => id)+ .ToArray();+ if (missingFaces.Length > 0)+ return new(0d, 0d, Vector3D.Zero, [], $"Verification tessellation produced no triangles for face(s) {string.Join(",", missingFaces)}; mass properties are unavailable rather than partial.");++ var volume = 0d;+ var area = 0d;+ var moment = Vector3D.Zero;+ var contributions = new List<BrepMassPropertiesFaceContribution>();+ foreach (var patch in mesh.Value.FacePatches.OrderBy(p => p.FaceId.Value))+ {+ var faceVolume = 0d;+ var faceArea = 0d;+ var coherent = true;+ var senseAvailable = body.Bindings.TryGetFaceBinding(patch.FaceId, out var binding);+ if (!senseAvailable) return new(0d, 0d, Vector3D.Zero, [], $"Face {patch.FaceId.Value} has no face-sense binding.");+ for (var i = 0; i < patch.TriangleIndices.Count; i += 3)+ {+ var a = patch.Positions[patch.TriangleIndices[i]];+ var b = patch.Positions[patch.TriangleIndices[i + 1]];+ var c = patch.Positions[patch.TriangleIndices[i + 2]];+ var cross = (b - a).Cross(c - a);+ // STEP import normalizes planar ADVANCED_FACE same_sense by+ // reversing the decoded PlaneSurface itself. Applying the binding+ // flag a second time would invert an equivalent imported plane;+ // canonical producer plans therefore use material-facing plane+ // supports. Curved grid patches retain native parameter normals and+ // require their explicit SameSense binding here.+ var normal = patch.Normals[patch.TriangleIndices[i]] + patch.Normals[patch.TriangleIndices[i + 1]] + patch.Normals[patch.TriangleIndices[i + 2]];+ var isPlanar = body.TryGetFaceSurfaceGeometry(patch.FaceId, out var surfaceForSense) && surfaceForSense?.Kind == SurfaceGeometryKind.Plane;+ if (!isPlanar && !binding.SameSense) normal = -normal;+ if (cross.Dot(normal) < 0d)+ {+ (b, c) = (c, b);+ cross = -cross;+ }+ coherent &= cross.Dot(normal) >= -1e-12d;+ var triangleArea = 0.5d * System.Math.Sqrt(cross.Dot(cross));+ var av = new Vector3D(a.X, a.Y, a.Z);+ var bv = new Vector3D(b.X, b.Y, b.Z);+ var cv = new Vector3D(c.X, c.Y, c.Z);+ var tetraVolume = av.Dot(bv.Cross(cv)) / 6d;+ faceArea += triangleArea;+ faceVolume += tetraVolume;+ moment += (av + bv + cv) * (tetraVolume / 4d);+ }+ volume += faceVolume;+ area += faceArea;+ body.TryGetFaceSurfaceGeometry(patch.FaceId, out var surface);+ contributions.Add(new(patch.FaceId, surface?.Kind, faceVolume, faceArea, patch.TriangleIndices.Count / 3, senseAvailable, binding.SameSense, coherent));+ }+ return new(volume, area, moment, contributions, null);+ }++ private static BrepMassPropertiesTopologyDiagnostics ValidateTopology(BrepBody body)+ {+ var messages = new List<string>();+ var bodies = body.Topology.Bodies.ToArray();+ var singleBody = bodies.Length == 1;+ if (!singleBody) messages.Add($"Expected exactly one body; found {bodies.Length}.");+ var edgeUses = new Dictionary<EdgeId, List<(FaceId Face, bool Reversed)>>();+ var connectedShells = 0;+ var loopsClosed = true;+ var senses = true;+ foreach (var shell in body.Topology.Shells)+ {+ var graph = shell.FaceIds.ToDictionary(f => f, _ => new HashSet<FaceId>());+ foreach (var faceId in shell.FaceIds)+ {+ senses &= body.Bindings.TryGetFaceBinding(faceId, out _);+ if (!body.Topology.TryGetFace(faceId, out var face) || face is null) { loopsClosed = false; messages.Add($"Shell {shell.Id.Value} references missing face {faceId.Value}."); continue; }+ foreach (var loopId in face.LoopIds)+ {+ if (!body.Topology.TryGetLoop(loopId, out var loop) || loop is null || loop.CoedgeIds.Count == 0) { loopsClosed = false; messages.Add($"Face {faceId.Value} has missing or empty loop {loopId.Value}."); continue; }+ for (var i = 0; i < loop.CoedgeIds.Count; i++)+ {+ if (!body.Topology.TryGetCoedge(loop.CoedgeIds[i], out var coedge) || coedge is null || !body.Topology.TryGetEdge(coedge.EdgeId, out var edge) || edge is null) { loopsClosed = false; messages.Add($"Loop {loopId.Value} references missing coedge or edge."); continue; }+ var expectedNext = loop.CoedgeIds[(i + 1) % loop.CoedgeIds.Count];+ if (coedge.NextCoedgeId != expectedNext) { loopsClosed = false; messages.Add($"Loop {loopId.Value} next-link is not cyclic."); }+ var end = coedge.IsReversed ? edge.StartVertexId : edge.EndVertexId;+ var next = body.Topology.GetCoedge(expectedNext);+ var nextEdge = body.Topology.GetEdge(next.EdgeId);+ var start = next.IsReversed ? nextEdge.EndVertexId : nextEdge.StartVertexId;+ if (!VerticesCoincident(body, end, start)) { loopsClosed = false; messages.Add($"Loop {loopId.Value} has disconnected coedges at {coedge.Id.Value}."); }+ if (!edgeUses.TryGetValue(edge.Id, out var uses)) edgeUses[edge.Id] = uses = [];+ uses.Add((faceId, coedge.IsReversed));+ }+ }+ }+ foreach (var uses in edgeUses.Values.Where(u => u.Count == 2 && graph.ContainsKey(u[0].Face) && graph.ContainsKey(u[1].Face)))+ {+ graph[uses[0].Face].Add(uses[1].Face); graph[uses[1].Face].Add(uses[0].Face);+ }+ if (graph.Count > 0)+ {+ var visited = new HashSet<FaceId>(); var stack = new Stack<FaceId>(); stack.Push(graph.Keys.First());+ while (stack.Count > 0) { var current = stack.Pop(); if (!visited.Add(current)) continue; foreach (var next in graph[current]) stack.Push(next); }+ if (visited.Count == graph.Count) connectedShells++; else messages.Add($"Shell {shell.Id.Value} is disconnected.");+ }+ }+ var closedParametricSurface = edgeUses.Count == 0+ && body.Topology.Faces.Any()+ && body.Topology.Faces.All(face => face.LoopIds.Count == 0+ && body.TryGetFaceSurfaceGeometry(face.Id, out var surface)+ && surface?.Kind == SurfaceGeometryKind.Sphere);+ var manifold = (edgeUses.Count > 0 && edgeUses.All(pair => pair.Value.Count == 2)) || closedParametricSurface;+ foreach (var (edge, uses) in edgeUses.Where(p => p.Value.Count != 2)) messages.Add($"Edge {edge.Value} has {uses.Count} uses; expected 2 for a closed manifold boundary.");+ if (!senses) messages.Add("At least one face has no face-sense binding.");+ var allShellsConnected = connectedShells == body.Topology.Shells.Count();+ var enclosed = singleBody && loopsClosed && senses && manifold && allShellsConnected;+ return new(singleBody, enclosed, loopsClosed && senses, connectedShells, messages);+ }++ private sealed record Evaluation(double SignedVolume, double SurfaceArea, Vector3D CentroidNumerator, IReadOnlyList<BrepMassPropertiesFaceContribution> Contributions, string? Error);++ private static Point3D? CentroidOf(Evaluation evaluation)+ => System.Math.Abs(evaluation.SignedVolume) > 1e-18d+ ? new Point3D(+ evaluation.CentroidNumerator.X / evaluation.SignedVolume,+ evaluation.CentroidNumerator.Y / evaluation.SignedVolume,+ evaluation.CentroidNumerator.Z / evaluation.SignedVolume)+ : null;++ private static bool VerticesCoincident(BrepBody body, VertexId left, VertexId right)+ {+ if (left == right) return true;+ if (!body.TryGetVertexPoint(left, out var a) || !body.TryGetVertexPoint(right, out var b)) return false;+ return (a - b).Length <= 1e-6d;+ }+}diff --git a/docs/verification/aetheris-verification-m8.md b/docs/verification/aetheris-verification-m8.mdnew file mode 100644index 00000000..7f6a7651--- /dev/null+++ b/docs/verification/aetheris-verification-m8.md@@ -0,0 +1,37 @@+# AETHERIS-VERIFICATION-M8++> Aetheris does not call an artifact correct merely because it exported, reimported, or looked plausible in one viewer. Construction, topology, serialization, and external display are separate verification layers.++`aetheris verify model.step` is the artifact-level verifier. It writes a hash-tied report under `artifacts/verification/<fixture>/<step-sha256>/` by default, including a copied STEP artifact and `verification-report.json`.++## Independent B-rep mass properties++The evaluator consumes a materialized `BrepBody`, never fixture expected-volume values, AIR, CIR, or `StepAnalyzer`'s legacy planar signed-shell routine. It first gates the body on one body, closed cyclic loops, two uses per edge (with the closed parametric-sphere exception), connected shells, face bindings, and coincident geometric endpoints where the kernel represents periodic seam vertices separately.++Supported materialized surface families are planes, cylinders, cones, spheres, and tori. The evaluator refines its verification mesh twice. At each resolution it corrects each curved triangle to the face's bound `SameSense`, sums triangle area, and integrates oriented tetrahedra `(0,a,b,c)`. Thus `V = sum dot(a, cross(b,c))/6`; the first moment is each tetrahedron's signed volume times `(a+b+c)/4`. The centroid is that first moment divided by signed volume.++The surface mesh is verification-only and never becomes authoritative geometry. Results are `NumericalConverged`, `NumericalWithBound`, or `Unavailable`; no tessellated value is called exact. The reported bound is the larger of the coarse/refined delta and `4 × sampled-area × chord-tolerance`, which remains conservative when deterministic segment caps leave chord error. The coarse pass receives half the declared segment cap and the refined pass receives the full cap, so a capped pair cannot be reported converged without an actual triangle-count increase. Face-level signed-volume, area, triangle-count, surface-family, and orientation evidence are preserved.++## M8B bounded trimmed-cone repair++`Frustum<Hollow>` has two separate single-coedge, closed circular loops on each conical face. The generic periodic UV trim processor correctly projects each loop to a full angular ring, but then interprets the second ring as a hole. In a periodic domain those two full rings cancel the fill mask, producing zero triangles. This was a trim-role error, not a cone equation, apex, or material orientation error.++The admitted repair is intentionally narrow. For exactly two closed, full-period `Circle3` trim edges on a cone, it verifies coaxial circle normals, center-on-axis residual, radius against `v × tan(semiAngle)`, four support samples per circle, non-apex levels, and a nondegenerate generator interval. The ordered trim levels come from actual face topology and edge geometry. It then evaluates the kernel convention `S(u,v) = Apex + v Axis + v tan(alpha) (cos(u) X + sin(u) Y)` on a deterministic structured strip with periodic `u in [0, 2π]`; the seam rings coincide numerically. The grid is oriented to the support normal, while the mass evaluator applies the binding's `SameSense` once for curved faces. Thus the outer cone uses `SameSense=true` and the inner cone uses `false` while sharing the same geometric convention.++The direct and STEP-reimported `Frustum<Hollow>` both now have five participating faces. At the declared maximum 512 angular/generator segments per cone, the refined artifact result is volume `47273.485526 mm³`, area `47817.126229 mm²`, centroid approximately `(0,0,41.687779) mm`, and a conservative bound `19.126850 mm³`. Its analytic witness is `47274.672097 mm³`; delta `-1.186572 mm³` is within the bound. Cone patches contain 524,288 triangles each, have machine-evaluation support residuals (the focused test requires `<= 1e-8 mm`), and have opposite material-facing senses.++The older CLI `analyze volume` planar signed-shell path remains a separate, exact planar-only route and is not used by `verify`. Its four historical Box/derivation/PMI failures were caused by applying projected-loop orientation after the planar triangulator had already oriented the triangles; the duplicate sign inverted valid faces. That second sign is removed and the affected regression filter now passes. New curved or general verification callers should use `verify` / `BrepMassProperties`.++## External CAD Assistant observation++`aetheris verify model.step --cad-assistant` resolves CAD Assistant in this order: `--cad-assistant-path`, `AETHERIS_CAD_ASSISTANT_PATH`, then two documented Program Files locations. It launches only the resolved executable with the one requested artifact, observes a fresh owned process, waits for a stable responsive main window, captures native PNG evidence where a visible Windows desktop permits it, then requests a clean close only for that owned process.++The report records executable path, artifact SHA-256, start/end times, arguments, timeout outcome, responsive-window observation, stability time, raw unavailable progress/display fields, screenshot paths, and diagnostics. It deliberately records `DisplayedWithWarnings` rather than a clean visual pass because CAD Assistant does not expose a stable import-progress/display-ready automation contract here. No visual geometric correctness is inferred from process or screenshot success. A secondary screenshot is an observation only; camera rotation is not synthesized without a stable public automation control.++Statuses are explicit: `Unavailable`, `LaunchFailed`, `ImportFailed`, `TimedOut`, `Displayed`, `DisplayedWithWarnings`, and `InspectionCompleted`. Normal CI does not request CAD Assistant; `--require-external` makes unavailability return exit code 2 for opt-in external jobs.++## Admission++The JSON report keeps producer evidence, independent B-rep evidence, STEP reimport analysis, external observation, and an overall admission separately. Artifact-only verification cannot reconstruct compiler preflight evidence, so it reports that honestly. CAD Assistant unavailability is `ExternalInspectionPending`, not a failure or a full pass.++The 2026-08-04 canonical run recorded all ten artifacts as topology-enclosed, orientation-consistent, `NumericalWithBound`, and STEP-reimport valid. Their exact hashes and external states are in `m8-regression-manifest.json`; CAD Assistant discovery returned `Unavailable` for each, so the correct overall state is `ExternalInspectionPending`, not visual admission. Current limitations are deliberately bounded: manifest orchestration remains shell-driven, compiler-originated producer evidence aggregation is artifact-only, CAD Assistant semantic status/control automation is unavailable, and arbitrary conic holes/partial angular trims remain unsupported. The next geometry milestone should add only the next bounded primitive family after external CAD availability is established.diff --git a/docs/verification/m8-regression-manifest.json b/docs/verification/m8-regression-manifest.jsonnew file mode 100644index 00000000..ec6c54cf--- /dev/null+++ b/docs/verification/m8-regression-manifest.json@@ -0,0 +1,17 @@+{+ "schema": "aetheris-verification-m8/v1",+ "executedAt": "2026-08-04",+ "note": "Semantic M8 admission inventory. Each artifact was passed through aetheris verify with CAD Assistant discovery enabled; hash-tied reports are generated artifacts and are ignored by Git.",+ "fixtures": [+ { "name": "Box", "buildSource": "fixtures/FirmamentV2/Primitive/valid/pipeline-v2-box-step-verified.valid.firmfixture", "expectedVolume": 480, "required": ["Producer", "BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "1b9816763bbb51e94f188e4a493c6f63975be6652c807d9c737a8f423495c7a7", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "LocalizedChamfer", "artifact": "artifacts/m2-localized-chamfer.step", "required": ["BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "de3c2e490a6b9826e28908cda5476a6ba7a887f302480ff409ae7a1f56c64779", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "LocalizedFillet", "artifact": "artifacts/m2-localized-fillet.step", "required": ["BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "669fb2d6cf9d91a958de906381429f629595c024a9c47745e9b80487e164fb4d", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "TwoEdgeChamferJunction", "artifact": "artifacts/air-chamfer-corner-policy-a0/legacy-two-edge-convex-junction.step", "required": ["BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "de14995b4b99dec293de2d7a3cce9d2e8083580cf3f6a0dccc619165c1759d0f", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "TwoEdgeFilletJunction", "artifact": "artifacts/air-fillet-junction-m4a-canonical.step", "required": ["BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "e2cf4d60a5a6ca99ab045cfca5fabaa7ef933e7dd55866d8433f5fd49a429aea", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "TrihedralFillet", "artifact": "artifacts/air-fillet-trihedral-canonical.step", "required": ["BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "9d1db6a9cb6698b7a30934f600ba2cb7379436291c7c564a565bed3ea867719e", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "RoundedBox", "buildSource": "testdata/firmament/verification/m8-rounded-box-primitive.firmament", "expectedVolume": 78901.23859659494, "required": ["Producer", "BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "8410bc81704ebc6556725bd6ac3337ab4c8a502a5d488aa8d816fbe281236ce4", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "RoundedBoxTopFillet", "buildSource": "testdata/firmament/examples/rounded_box_top_fillet.firmament", "expectedVolume": 170251.7394201211, "required": ["Producer", "BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "9547802507985a0c7b0f2e7cfc5cc7ceb365ce0b406cf2da9a154ad8b76ad7ff", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "RoundedBoxHollow", "buildSource": "testdata/firmament/air-thinwall-m7/rounded-enclosure.firmament", "expectedVolume": 35369.84037290877, "required": ["Producer", "BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "233354ea648a12960110a426de6d94c9060539a8b9fe49bf657f1f486a52f5d8", "brepStatus": "NumericalWithBound", "external": "Unavailable" } },+ { "name": "FrustumHollow", "buildSource": "testdata/firmament/air-thinwall-m7/frustum-cup.firmament", "expectedVolume": 47274.67209734925, "required": ["Producer", "BRep", "StepReimport", "ExternalDisplay"], "evidence": { "sha256": "ccc99b129c16767cda87bdacec764a2d10ebd12b7ab279edb840df083801372f", "brepStatus": "NumericalWithBound", "external": "Unavailable" } }+ ]+}diff --git a/testdata/firmament/verification/m8-rounded-box-primitive.firmament b/testdata/firmament/verification/m8-rounded-box-primitive.firmamentnew file mode 100644index 00000000..b387567e--- /dev/null+++ b/testdata/firmament/verification/m8-rounded-box-primitive.firmament@@ -0,0 +1,6 @@+Struct M8RoundedBoxPrimitive {+ RoundedBox Body {+ Size: [80mm, 50mm, 20mm]+ CornerRadius: 8mm+ }+}