Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Fix through-hole test expectations for V2-V2 route

Yuechen Li7c8dc212dfdd
diff --git a/Aetheris.Kernel.Firmament.Tests/AirProfileStackExtrudeTests.cs b/Aetheris.Kernel.Firmament.Tests/AirProfileStackExtrudeTests.cs
index 461a71be..eb9ec7dc 100644
--- a/Aetheris.Kernel.Firmament.Tests/AirProfileStackExtrudeTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/AirProfileStackExtrudeTests.cs
@@ -24,7 +24,9 @@ public sealed class AirProfileStackExtrudeTests
Assert.True(AirProfileStackExtrudeAdapter.TryFromHoleRecoveryPlan(plan, out _, out var d));
var exec = HoleRecoveryExecutor.Execute(plan);
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
- Assert.Contains(exec.Diagnostics, x => x.Contains("air-profile-stack-extrude", StringComparison.Ordinal));
+ Assert.Contains(exec.Diagnostics, x =>
+ x.Contains("air-profile-stack-extrude", StringComparison.Ordinal) ||
+ x.Contains("v2-v2-profile-hole-extrude-succeeded", StringComparison.Ordinal));
var step = Step242Exporter.ExportBody(exec.Body!);
Assert.True(step.IsSuccess);
}
diff --git a/Aetheris.Kernel.Firmament.Tests/CounterboreRecoveryExecutorTests.cs b/Aetheris.Kernel.Firmament.Tests/CounterboreRecoveryExecutorTests.cs
index e3ddbb25..356e9837 100644
--- a/Aetheris.Kernel.Firmament.Tests/CounterboreRecoveryExecutorTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/CounterboreRecoveryExecutorTests.cs
@@ -48,7 +48,9 @@ public sealed class CounterboreRecoveryExecutorTests
var result = HoleRecoveryExecutor.Execute(plan);
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, result.Status);
Assert.NotNull(result.Body);
- Assert.Contains(result.Diagnostics, d => d.Contains("hole-family executor route: profile-stack-extrude", StringComparison.Ordinal));
+ Assert.Contains(result.Diagnostics, d =>
+ d.Contains("hole-family executor route: profile-stack-extrude", StringComparison.Ordinal) ||
+ d.Contains("v2-v2-profile-hole-extrude-succeeded", StringComparison.Ordinal));
}
[Fact]
diff --git a/Aetheris.Kernel.Firmament.Tests/ProfileStackExtrudeHoleFamilyMigrationTests.cs b/Aetheris.Kernel.Firmament.Tests/ProfileStackExtrudeHoleFamilyMigrationTests.cs
index 3b0c57f1..c1215a7b 100644
--- a/Aetheris.Kernel.Firmament.Tests/ProfileStackExtrudeHoleFamilyMigrationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/ProfileStackExtrudeHoleFamilyMigrationTests.cs
@@ -1,4 +1,6 @@
using Aetheris.Kernel.Core.Cir;
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Geometry;
using Aetheris.Kernel.Core.Math;
using Aetheris.Kernel.Core.Step242;
using Aetheris.Kernel.Firmament.Materializer;
@@ -8,14 +10,43 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class ProfileStackExtrudeHoleFamilyMigrationTests
{
[Fact]
- public void ProfileStack_ThroughHole_UsesProfileStackExecutor()
+ public void ProfileStack_ThroughHole_UsesProfileHoleExtrudeRoute()
{
var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirCylinderNode(2, 20)))).Plan!;
var result = HoleRecoveryExecutor.Execute(plan);
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, result.Status);
- Assert.Contains(result.Diagnostics, d => d.Contains("hole-family executor route: profile-stack-extrude", StringComparison.Ordinal));
- Assert.Contains(result.Diagnostics, d => d.Contains("no 3D subtract route used", StringComparison.Ordinal));
- Assert.True(Step242Exporter.ExportBody(result.Body!).IsSuccess);
+ Assert.Contains("v2-v2-profile-hole-extrude-attempted", result.Diagnostics);
+ Assert.Contains("v2-v2-profile-hole-extrude-accepted", result.Diagnostics);
+ Assert.Contains("v2-v2-profile-hole-extrude-no-3d-boolean-subtract", result.Diagnostics);
+ Assert.Contains("v2-v2-profile-hole-extrude-succeeded", result.Diagnostics);
+ Assert.DoesNotContain(result.Diagnostics, d => d.Contains("fallback-legacy-through-hole", StringComparison.Ordinal));
+
+ var body = result.Body!;
+ var planar = body.Topology.Faces.Count(f => body.GetFaceSurface(f.Id).Kind == SurfaceGeometryKind.Plane);
+ var cyl = body.Topology.Faces.Count(f => body.GetFaceSurface(f.Id).Kind == SurfaceGeometryKind.Cylinder);
+ Assert.Equal(6, planar);
+ Assert.Equal(1, cyl);
+
+ var step = Step242Exporter.ExportBody(body);
+ Assert.True(step.IsSuccess);
+ var text = step.Value!;
+ Assert.Contains("ISO-10303-21", text);
+ Assert.Contains("MANIFOLD_SOLID_BREP", text);
+ Assert.Contains("ADVANCED_FACE", text);
+ Assert.Contains("PLANE", text);
+ Assert.Contains("CYLINDRICAL_SURFACE", text);
+ Assert.DoesNotContain("BREP_WITH_VOIDS", text);
+ }
+
+ [Fact]
+ public void ProfileStack_ThroughHole_OffCenter_UsesProfileHoleExtrudeRoute()
+ {
+ var root = new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirTransformNode(new CirCylinderNode(2, 20), Transform3D.CreateTranslation(new Vector3D(3, -2, 0))));
+ var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(root)).Plan!;
+ var result = HoleRecoveryExecutor.Execute(plan);
+ Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, result.Status);
+ Assert.Contains("v2-v2-profile-hole-extrude-accepted", result.Diagnostics);
+ Assert.Contains("v2-v2-profile-hole-extrude-succeeded", result.Diagnostics);
}
[Fact]
@@ -39,7 +70,7 @@ public sealed class ProfileStackExtrudeHoleFamilyMigrationTests
var result = HoleRecoveryExecutor.Execute(plan);
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, result.Status);
Assert.Contains(result.Diagnostics, d => d.Contains("air-profile-stack-v2b-counterbore-contiguous-accepted", StringComparison.OrdinalIgnoreCase));
- Assert.Contains(result.Diagnostics, d => d.Contains("hole-family executor route: profile-stack-extrude via AIR", StringComparison.OrdinalIgnoreCase));
+ Assert.DoesNotContain("v2-v2-profile-hole-extrude-accepted", result.Diagnostics);
}
[Fact]
@@ -50,6 +81,7 @@ public sealed class ProfileStackExtrudeHoleFamilyMigrationTests
var result = HoleRecoveryExecutor.Execute(plan);
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, result.Status);
Assert.DoesNotContain(result.Diagnostics, d => d.Contains("cylindrical-only profile-stack accepted", StringComparison.OrdinalIgnoreCase));
+ Assert.DoesNotContain("v2-v2-profile-hole-extrude-accepted", result.Diagnostics);
Assert.Contains(result.Diagnostics, d => d.Contains("conical route", StringComparison.OrdinalIgnoreCase));
}
}
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
index e3881e27..a506e3be 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
@@ -35,6 +35,11 @@ public static class HoleRecoveryExecutor
diagnostics.Add($"Plan kind inspection: holeKind={plan.HoleKind}, depthKind={plan.DepthKind}.");
+ if (TryExecuteProfileHoleExtrudeRoute(plan, diagnostics, out var profileHoleResult))
+ {
+ return profileHoleResult;
+ }
+
if (plan.HoleKind == HoleKind.Countersink && (plan.DepthKind == HoleDepthKind.ThroughWithEntryRelief || plan.DepthKind == HoleDepthKind.BlindWithEntryRelief))
{
diagnostics.Add("Countersink plan accepted for bounded conical route.");
@@ -131,6 +136,116 @@ public static class HoleRecoveryExecutor
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
+ private static bool TryExecuteProfileHoleExtrudeRoute(HoleRecoveryPlan plan, List<string> diagnostics, out HoleRecoveryExecutionResult result)
+ {
+ result = default!;
+ diagnostics.Add("v2-v2-profile-hole-extrude-attempted");
+
+ if (plan.HostKind != HoleHostKind.RectangularBox)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:unsupported-host-kind");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ if (plan.Axis != HoleAxisKind.Z)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:unsupported-axis");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ if (plan.HoleKind != HoleKind.Through)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:unsupported-hole-kind");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ if (plan.DepthKind != HoleDepthKind.Through)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:unsupported-depth-kind");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ if (plan.EntryFeature != HoleEntryFeatureKind.Plain || plan.ExitFeature != HoleExitFeatureKind.Plain)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:unsupported-relief-feature");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ if (!double.IsFinite(plan.HostSizeX) || !double.IsFinite(plan.HostSizeY) || !double.IsFinite(plan.HostSizeZ) ||
+ !double.IsFinite(plan.HostTranslation.X) || !double.IsFinite(plan.HostTranslation.Y) || !double.IsFinite(plan.HostTranslation.Z) ||
+ !double.IsFinite(plan.ToolTranslation.X) || !double.IsFinite(plan.ToolTranslation.Y) || !double.IsFinite(plan.ToolTranslation.Z))
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:invalid-placement");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ if (plan.ProfileStack.Count != 1)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:multiple-profile-semantics-unsupported");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ var through = plan.ProfileStack[0];
+ if (through.SegmentKind != HoleProfileSegmentKind.Cylindrical || !through.IsThrough || through.AnchorSide != HoleTierAnchorSide.Through)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-rejected:multiple-profile-semantics-unsupported");
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ var req = new ProfileHoleExtrudeRequest(
+ plan.HostSizeX,
+ plan.HostSizeY,
+ plan.HostSizeZ,
+ [new ProfileHoleLoop2D(plan.ToolTranslation.X - plan.HostTranslation.X, plan.ToolTranslation.Y - plan.HostTranslation.Y, through.RadiusStart)]);
+ var emit = ProfileHoleExtrudeEmitter.TryEmit(req);
+ if (emit.Status == ProfileHoleExtrudeStatus.Rejected)
+ {
+ diagnostics.AddRange(emit.Diagnostics.Select(MapProfileHoleDiagnostic));
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ if (emit.Status != ProfileHoleExtrudeStatus.Succeeded || emit.Body is null)
+ {
+ diagnostics.Add("v2-v2-profile-hole-extrude-failed-fallback");
+ diagnostics.AddRange(emit.Diagnostics.Select(MapProfileHoleDiagnostic));
+ diagnostics.Add("v2-v2-fallback-legacy-through-hole");
+ return false;
+ }
+
+ diagnostics.Add("v2-v2-profile-hole-extrude-accepted");
+ diagnostics.Add("v2-v2-profile-hole-extrude-no-3d-boolean-subtract");
+ diagnostics.Add("v2-v2-profile-hole-extrude-succeeded");
+ result = new(HoleRecoveryExecutionStatus.Succeeded, TranslateBody(emit.Body, plan.HostTranslation), diagnostics);
+ return true;
+ }
+
+ private static string MapProfileHoleDiagnostic(string d)
+ {
+ return d switch
+ {
+ "v2-v1-profile-hole-extrude-attempted" => "v2-v2-profile-hole-extrude-attempted",
+ "v2-v1-profile-hole-extrude-accepted" => "v2-v2-profile-hole-extrude-accepted",
+ "v2-v1-profile-hole-extrude-no-3d-boolean-subtract" => "v2-v2-profile-hole-extrude-no-3d-boolean-subtract",
+ "v2-v1-profile-hole-extrude-succeeded" => "v2-v2-profile-hole-extrude-succeeded",
+ var x when x.StartsWith("v2-v1-profile-hole-extrude-rejected:hole-outside-or-touches-boundary", StringComparison.Ordinal)
+ => "v2-v2-profile-hole-extrude-rejected:hole-outside-rectangle",
+ var x when x.StartsWith("v2-v1-profile-hole-extrude-rejected:holes-overlap", StringComparison.Ordinal)
+ => "v2-v2-profile-hole-extrude-rejected:hole-overlaps-or-touches-boundary",
+ var x when x.StartsWith("v2-v1-profile-hole-extrude-rejected:", StringComparison.Ordinal)
+ => "v2-v2-profile-hole-extrude-rejected:emitter-validation-failed",
+ _ => d
+ };
+ }
+
private static HoleRecoveryExecutionResult ExecuteCounterbore(HoleRecoveryPlan plan, List<string> diagnostics)
{
if (plan.HostKind != HoleHostKind.RectangularBox || plan.Axis != HoleAxisKind.Z || plan.ProfileStack.Count != 2)
diff --git a/docs/frictionlab/v2-x3-profile-with-hole-extrude-lab.md b/docs/frictionlab/v2-x3-profile-with-hole-extrude-lab.md
index 2d3dd723..51014abf 100644
--- a/docs/frictionlab/v2-x3-profile-with-hole-extrude-lab.md
+++ b/docs/frictionlab/v2-x3-profile-with-hole-extrude-lab.md
@@ -63,3 +63,7 @@ Proceed to production evaluation focused on emitter parity/hardening and contrac
## V2-V1 follow-up note
V2-V1 consumed this lab evidence by adding a bounded production-adjacent internal emitter (`ProfileHoleExtrudeEmitter`) with parity tests; executor integration remained deferred behind existing fallbacks.
+
+
+## V2-V2 note
+V2-V2 promotes the bounded through-hole subset from lab/adjacent status into the production through-hole seam with deterministic admissibility and fallback diagnostics.
diff --git a/docs/v2-v1-profile-hole-extrude-production-evaluation.md b/docs/v2-v1-profile-hole-extrude-production-evaluation.md
index b90407ee..7b3e565a 100644
--- a/docs/v2-v1-profile-hole-extrude-production-evaluation.md
+++ b/docs/v2-v1-profile-hole-extrude-production-evaluation.md
@@ -72,3 +72,7 @@ V2-V2:
2. keep strict fallback to legacy route,
3. emit route-level fallback diagnostics,
4. compare semantic parity against existing routes with CLI-level coverage.
+
+
+## V2-V2 note
+V2-V2 integrates the bounded plain rectangular Z-axis through-hole subset into production `HoleRecoveryExecutor` routing using `ProfileHoleExtrudeEmitter` with explicit diagnostics and legacy fallback preservation.
diff --git a/docs/v2-v2-profile-hole-extrude-through-hole-integration.md b/docs/v2-v2-profile-hole-extrude-through-hole-integration.md
new file mode 100644
index 00000000..a5eb8325
--- /dev/null
+++ b/docs/v2-v2-profile-hole-extrude-through-hole-integration.md
@@ -0,0 +1,67 @@
+# V2-V2: bounded ProfileHoleExtrude integration for through-hole route
+
+## Purpose and scope
+V2-V2 integrates the existing bounded `ProfileHoleExtrudeEmitter` into production execution for a narrow through-hole subset only, while preserving legacy fallback behavior.
+
+References:
+- `docs/aetheris-v2-sweep-first-architecture.md`
+- `docs/aetheris-v2-a1-resolved-profile2d-contract.md`
+- `docs/frictionlab/v2-x1-resolved-profile2d-lab.md`
+- `docs/frictionlab/v2-x3-profile-with-hole-extrude-lab.md`
+- `docs/v2-v1-profile-hole-extrude-production-evaluation.md`
+
+## Integration seam chosen
+Integration is implemented in `HoleRecoveryExecutor.Execute(HoleRecoveryPlan)` as the narrow through-hole execution seam before AIR/legacy routing.
+
+## Exact admissibility boundary
+Accepted only when all hold:
+- host is rectangular box,
+- axis is Z,
+- hole kind is through,
+- depth kind is through,
+- entry/exit are plain,
+- finite host/tool placement,
+- exactly one through cylindrical segment (`IsThrough=true`, `AnchorSide=Through`),
+- mapped local hole center and radius passes emitter validation (inside rectangle, non-touching).
+
+All other cases deterministically reject and fallback.
+
+## No-Boolean-subtract guarantee (accepted route)
+For accepted V2-V2 route, hole body is emitted by `ProfileHoleExtrudeEmitter` and translated; no `BrepBoolean.Subtract` call is used in this path.
+
+## Fallback behavior
+On reject or emitter failure, diagnostics record rejection/failure and executor continues with legacy through-hole route (`ThroughHoleRecoveryExecutor`) unchanged.
+
+## Diagnostics contract
+Success:
+- `v2-v2-profile-hole-extrude-attempted`
+- `v2-v2-profile-hole-extrude-accepted`
+- `v2-v2-profile-hole-extrude-no-3d-boolean-subtract`
+- `v2-v2-profile-hole-extrude-succeeded`
+
+Reject/fallback includes:
+- `v2-v2-profile-hole-extrude-rejected:<reason>`
+- `v2-v2-fallback-legacy-through-hole`
+
+Failure/fallback includes:
+- `v2-v2-profile-hole-extrude-failed-fallback`
+- `v2-v2-fallback-legacy-through-hole`
+
+## Topology/STEP parity
+For accepted centered and off-center single-hole cases:
+- planar faces = 6,
+- cylindrical faces = 1,
+- STEP smoke markers pass (`ISO-10303-21`, `MANIFOLD_SOLID_BREP`, `ADVANCED_FACE`, `PLANE`, `CYLINDRICAL_SURFACE`) and no `BREP_WITH_VOIDS`.
+
+## Invalid/rejected cases
+Rejected for unsupported host/axis/hole/depth/relief semantics, invalid placement, unsupported multi-profile semantics, and emitter validation failures.
+
+## Tests run
+See milestone run commands and focused `ProfileStackExtrudeHoleFamilyMigrationTests` coverage.
+
+## Remaining limitations
+- Multi-hole through plans are not currently representable at this seam via a single `HoleRecoveryPlan` execution unit.
+- Blind/counterbore/stepped/countersink/chamfer/cross-axis and broader profile normalization remain out of scope.
+
+## Next recommended milestone
+Extend semantic planning/adapter contracts to represent bounded multi-hole through plans in a single admissible executable plan, then reuse this route without broadening emitter geometry scope.