Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Reconcile stepped route by deferring non-equivalent production execution

Yuechen Lifcbf49a32011
diff --git a/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs b/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
index 59d8bed5..e8995545 100644
--- a/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
@@ -79,9 +79,10 @@ public sealed class FrepSemanticRecoveryRematerializerTests
public void SteppedHole_Rematerializer_ProducesBrepBody()
{
var result = FrepSemanticRecoveryRematerializer.TryRecover(new CirSubtractNode(new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20,20,10), new CirCylinderNode(2,20)), new CirTransformNode(new CirCylinderNode(3,6), Transform3D.CreateTranslation(new Vector3D(0,0,-2)))), new CirTransformNode(new CirCylinderNode(4,4), Transform3D.CreateTranslation(new Vector3D(0,0,-3)))));
- Assert.True(result.Succeeded);
- Assert.NotNull(result.Body);
- Assert.Contains(result.Diagnostics, d => d.Contains("executor succeeded", StringComparison.Ordinal));
+ Assert.False(result.Succeeded);
+ Assert.Null(result.Body);
+ Assert.Contains(result.Diagnostics, d => d.Contains("executor failed", StringComparison.Ordinal));
+ Assert.Contains(result.Diagnostics, d => d.Contains("missing-stepped-entry-side-polarity", StringComparison.Ordinal));
}
private static NativeGeometryReplayLog BuildReplay(string toolKind)
=> new([
diff --git a/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs b/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
index e2c70d11..d69644bf 100644
--- a/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
@@ -105,6 +105,13 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
Assert.Equal(expectedDepthKind, plan.DepthKind);
Assert.Equal(expectedCapability, eval.Capability);
var exec = HoleRecoveryExecutor.Execute(plan);
+ if (plan.HoleKind == HoleKind.Stepped)
+ {
+ Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
+ Assert.Contains(exec.Diagnostics, d => d.Contains("missing-stepped-entry-side-polarity", StringComparison.Ordinal));
+ return;
+ }
+
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
Assert.NotNull(exec.Body);
}
@@ -121,6 +128,13 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
Assert.Equal(expectedDepthKind, plan.DepthKind);
Assert.Equal(expectedCapability, eval.Capability);
var exec = HoleRecoveryExecutor.Execute(plan);
+ if (plan.HoleKind == HoleKind.Stepped)
+ {
+ Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
+ Assert.Contains(exec.Diagnostics, d => d.Contains("missing-stepped-entry-side-polarity", StringComparison.Ordinal));
+ return;
+ }
+
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
Assert.NotNull(exec.Body);
var step = Step242Exporter.ExportBody(exec.Body!);
diff --git a/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs b/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
index 3dedd24c..d86ea49b 100644
--- a/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
@@ -25,15 +25,9 @@ public sealed class SteppedHoleVariantAndExecutorTests
{
var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped())).Plan!;
var exec = HoleRecoveryExecutor.Execute(plan);
- Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
- Assert.NotNull(exec.Body);
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped plan shape validated", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped repeated-subtract route selected", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract small invoked", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract small succeeded", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract medium succeeded", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract large succeeded", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains("Result BRep body produced", StringComparison.Ordinal));
+ Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
+ Assert.Null(exec.Body);
+ Assert.Contains(exec.Diagnostics, d => d.Contains("missing-stepped-entry-side-polarity", StringComparison.Ordinal));
}
[Fact]
@@ -41,17 +35,34 @@ public sealed class SteppedHoleVariantAndExecutorTests
{
var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped())).Plan!;
var exec = HoleRecoveryExecutor.Execute(plan);
- Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
- var step = Step242Exporter.ExportBody(exec.Body!);
- Assert.True(step.IsSuccess);
- Assert.Contains("ISO-10303-21", step.Value, StringComparison.Ordinal);
- Assert.Contains("MANIFOLD_SOLID_BREP", step.Value, StringComparison.Ordinal);
- Assert.Contains("ADVANCED_FACE", step.Value, StringComparison.Ordinal);
- Assert.Contains("CYLINDRICAL_SURFACE", step.Value, StringComparison.Ordinal);
- Assert.DoesNotContain("BREP_WITH_VOIDS", step.Value, StringComparison.Ordinal);
+ Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
+ Assert.Null(exec.Body);
+ Assert.Contains(exec.Diagnostics, d => d.Contains("missing-stepped-entry-side-polarity", StringComparison.Ordinal));
Assert.Contains(exec.Diagnostics, d => d.Contains("No STEP export attempted", StringComparison.Ordinal));
}
+ [Fact]
+ public void SteppedRouteComparison_LabAndProductionGeometryMatchOrReportMismatch()
+ {
+ var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped())).Plan!;
+ var mediumDepth = plan.ProfileStack[1].DepthEnd - plan.ProfileStack[1].DepthStart;
+ var largeDepth = plan.ProfileStack[0].DepthEnd - plan.ProfileStack[0].DepthStart;
+ var throughHeight = double.Max(plan.ThroughLength, plan.HostSizeZ);
+ var entryZ = plan.HostTranslation.Z + (plan.HostSizeZ * 0.5d);
+
+ var productionMediumCenter = entryZ + (mediumDepth * 0.5d);
+ var productionLargeCenter = entryZ + (largeDepth * 0.5d);
+ var expectedLabMediumCenter = productionMediumCenter;
+ var expectedLabLargeCenter = productionLargeCenter;
+
+ var mismatch = new List<string>();
+ if (Math.Abs(productionMediumCenter - expectedLabMediumCenter) > 1e-9) mismatch.Add("medium.centerZ");
+ if (Math.Abs(productionLargeCenter - expectedLabLargeCenter) > 1e-9) mismatch.Add("large.centerZ");
+
+ var report = $"Box={plan.HostSizeX}x{plan.HostSizeY}x{plan.HostSizeZ}@{plan.HostTranslation}; small(h={throughHeight},z=[{plan.ToolTranslation.Z - throughHeight*0.5},{plan.ToolTranslation.Z + throughHeight*0.5}]); medium(h={mediumDepth},centerZ={productionMediumCenter},z=[{productionMediumCenter-mediumDepth*0.5},{productionMediumCenter+mediumDepth*0.5}]); large(h={largeDepth},centerZ={productionLargeCenter},z=[{productionLargeCenter-largeDepth*0.5},{productionLargeCenter+largeDepth*0.5}]); order=small->medium->large; mismatch={(mismatch.Count == 0 ? "none" : string.Join(",", mismatch))}";
+ Assert.True(mismatch.Count == 0, report);
+ }
+
[Fact]
public void SteppedHole_InvalidPlanShape_RejectsBeforeBoolean()
{
@@ -61,7 +72,7 @@ public sealed class SteppedHoleVariantAndExecutorTests
var exec = HoleRecoveryExecutor.Execute(invalid);
Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
Assert.Null(exec.Body);
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped plan rejected before Boolean", StringComparison.Ordinal));
+ Assert.Contains(exec.Diagnostics, d => d.Contains("missing-stepped-entry-side-polarity", StringComparison.Ordinal));
Assert.DoesNotContain(exec.Diagnostics, d => d.Contains("Stepped subtract", StringComparison.Ordinal));
}
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
index 7b6f25b7..928484a7 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
@@ -62,8 +62,9 @@ public static class HoleRecoveryExecutor
if (plan.HoleKind == HoleKind.Stepped && plan.DepthKind == HoleDepthKind.ThroughWithEntryRelief)
{
- diagnostics.Add("Stepped-hole plan recognized; bounded repeated-subtract execution started.");
- return ExecuteStepped(plan, diagnostics);
+ diagnostics.Add("Stepped-hole plan recognized but execution deferred: plan does not encode entry-side polarity for medium/large tiers, and production route cannot be proven equivalent to FrictionLab route.");
+ diagnostics.Add("Deferred reason: missing-stepped-entry-side-polarity.");
+ return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
if (plan.HoleKind != HoleKind.Counterbore || plan.DepthKind != HoleDepthKind.ThroughWithEntryRelief)
@@ -219,7 +220,9 @@ public static class HoleRecoveryExecutor
}
diagnostics.Add("Stepped subtract small succeeded.");
- var entryFaceZ = plan.HostTranslation.Z - (plan.HostSizeZ * 0.5d);
+ var entryFaceZ = plan.HostTranslation.Z + (plan.HostSizeZ * 0.5d);
+ diagnostics.Add($"Stepped entry face resolved to top(+Z) at z={entryFaceZ:0.###}.");
+ diagnostics.Add($"Stepped route geometry: box=({plan.HostSizeX:0.###},{plan.HostSizeY:0.###},{plan.HostSizeZ:0.###})@({plan.HostTranslation.X:0.###},{plan.HostTranslation.Y:0.###},{plan.HostTranslation.Z:0.###}); small(r={small.RadiusStart:0.###},h={throughHeight:0.###},z=[{(plan.ToolTranslation.Z - (throughHeight * 0.5d)):0.###},{(plan.ToolTranslation.Z + (throughHeight * 0.5d)):0.###}]); medium(r={medium.RadiusStart:0.###},h={mediumDepth:0.###}); large(r={large.RadiusStart:0.###},h={largeDepth:0.###}).");
var mediumCenter = new Vector3D(plan.ToolTranslation.X, plan.ToolTranslation.Y, entryFaceZ + (mediumDepth * 0.5d));
var mediumResult = BrepPrimitives.CreateCylinder(medium.RadiusStart, mediumDepth);
if (!mediumResult.IsSuccess)
@@ -232,7 +235,7 @@ public static class HoleRecoveryExecutor
var mediumSubtract = BrepBoolean.Subtract(smallSubtract.Value, TranslateBody(mediumResult.Value, mediumCenter));
if (!mediumSubtract.IsSuccess || mediumSubtract.Value is null)
{
- diagnostics.Add("Stepped subtract medium failed.");
+ diagnostics.Add($"Stepped subtract medium failed at center=({mediumCenter.X:0.###},{mediumCenter.Y:0.###},{mediumCenter.Z:0.###}) z=[{(mediumCenter.Z - (mediumDepth * 0.5d)):0.###},{(mediumCenter.Z + (mediumDepth * 0.5d)):0.###}].");
return new(HoleRecoveryExecutionStatus.BooleanFailed, null, diagnostics);
}
@@ -249,7 +252,7 @@ public static class HoleRecoveryExecutor
var largeSubtract = BrepBoolean.Subtract(mediumSubtract.Value, TranslateBody(largeResult.Value, largeCenter));
if (!largeSubtract.IsSuccess || largeSubtract.Value is null)
{
- diagnostics.Add("Stepped subtract large failed.");
+ diagnostics.Add($"Stepped subtract large failed at center=({largeCenter.X:0.###},{largeCenter.Y:0.###},{largeCenter.Z:0.###}) z=[{(largeCenter.Z - (largeDepth * 0.5d)):0.###},{(largeCenter.Z + (largeDepth * 0.5d)):0.###}].");
return new(HoleRecoveryExecutionStatus.BooleanFailed, null, diagnostics);
}
diff --git a/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md b/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md
index fe42ae9f..e825ebc5 100644
--- a/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md
+++ b/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md
@@ -42,3 +42,11 @@ Stepped STEP smoke now runs via executor-produced body and existing `Step242Expo
## Remaining limits
Support remains intentionally bounded to the canonical three-level coaxial Z-axis stepped-hole family.
+
+## A4.1 reconciliation update (lab vs production)
+- **Finding:** FrictionLab repeated-subtract success was demonstrated on a lab geometry route that is not semantically equivalent to the current production `HoleRecoveryPlan` contract.
+- FrictionLab route explicitly constructs medium/large tier Z placement in tool-building code (fixed signed translation), while production stepped plan only carries depth magnitudes and no explicit entry-side polarity for each relief tier.
+- Because `SteppedHoleVariant` currently admits both entry faces (`boxMinZ` and `boxMaxZ`) and does not encode which face was used, `HoleRecoveryExecutor` cannot safely reconstruct the exact lab route from plan data alone.
+- **Decision (Outcome B):** stepped execution is restored to **deferred** in production with explicit diagnostic:
+ - `missing-stepped-entry-side-polarity`
+- Through/blind/counterbore/countersink execution paths remain unchanged.
diff --git a/docs/cir-recovery-v13-stepped-hole-variant-executor-step.md b/docs/cir-recovery-v13-stepped-hole-variant-executor-step.md
index 1e189df5..40b832ed 100644
--- a/docs/cir-recovery-v13-stepped-hole-variant-executor-step.md
+++ b/docs/cir-recovery-v13-stepped-hole-variant-executor-step.md
@@ -23,17 +23,13 @@ Counterbore remains the 2-level shape. Stepped-hole admission requires 3 levels,
- profile stack: large shallow cylinder, medium depth cylinder, small through cylinder
- expected annular transition floors and circular transition trims.
-## A4 productionization update
-Stepped execution is now production-enabled for the bounded canonical route selected by A3.1:
+## A4.1 reconciliation update
+Stepped execution is reverted to deferred in production pending plan/executor contract reconciliation:
-- deterministic order: `small -> medium -> large`,
-- bounded pre-boolean shape validation,
-- per-stage subtract diagnostics,
-- successful completion now returns `Succeeded` + produced `BrepBody`.
-
-If a subtract stage fails, executor now returns `BooleanFailed` for that stage with explicit stage diagnostics.
-
-STEP smoke coverage now executes for stepped-hole via the recovered body and confirms manifold/non-void export markers using unchanged `Step242Exporter.ExportBody(...)` behavior.
+- FrictionLab repeated-subtract success remains valid for lab-built route/tool placement.
+- Production `HoleRecoveryPlan` lacks per-tier entry-side polarity for medium/large stepped tiers.
+- Executor now returns `UnsupportedPlan` with `missing-stepped-entry-side-polarity` instead of attempting non-equivalent stepped Boolean execution.
+- STEP smoke for stepped is therefore intentionally deferred in production until that contract gap is closed.
## Non-goals
No generic N-level stack executor, no threaded-hole support, no STEP exporter changes, no public API changes.