Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

A4: wire stepped-hole repeated-subtract production gate

Yuechen Li962bc3570b09
diff --git a/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs b/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
index 0251fe4a..59d8bed5 100644
--- a/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
@@ -76,12 +76,12 @@ public sealed class FrepSemanticRecoveryRematerializerTests
[Fact]
- public void SteppedHole_Rematerializer_BehaviorAligned()
+ 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.False(result.Succeeded);
- Assert.Null(result.Body);
- Assert.Contains(result.Diagnostics, d => d.Contains("executor failed", StringComparison.Ordinal));
+ Assert.True(result.Succeeded);
+ Assert.NotNull(result.Body);
+ Assert.Contains(result.Diagnostics, d => d.Contains("executor succeeded", 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 09266ec5..e2c70d11 100644
--- a/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
@@ -105,14 +105,6 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
Assert.Equal(expectedDepthKind, plan.DepthKind);
Assert.Equal(expectedCapability, eval.Capability);
var exec = HoleRecoveryExecutor.Execute(plan);
- if (expectedHoleKind == HoleKind.Stepped)
- {
- Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
- Assert.Null(exec.Body);
- Assert.Contains(exec.Diagnostics, d => d.Contains("SteppedHoleExecutionDeferredPostValidator", StringComparison.Ordinal));
- return;
- }
-
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
Assert.NotNull(exec.Body);
}
@@ -129,14 +121,8 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
Assert.Equal(expectedDepthKind, plan.DepthKind);
Assert.Equal(expectedCapability, eval.Capability);
var exec = HoleRecoveryExecutor.Execute(plan);
- if (expectedHoleKind == HoleKind.Stepped)
- {
- Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
- Assert.Null(exec.Body);
- Assert.Contains(exec.Diagnostics, d => d.Contains("No STEP export attempted", StringComparison.Ordinal));
- return;
- }
-
+ Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
+ Assert.NotNull(exec.Body);
var step = Step242Exporter.ExportBody(exec.Body!);
Assert.True(step.IsSuccess);
Assert.Contains("MANIFOLD_SOLID_BREP", step.Value, StringComparison.Ordinal);
diff --git a/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs b/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
index 88bb6625..3dedd24c 100644
--- a/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
@@ -21,26 +21,50 @@ public sealed class SteppedHoleVariantAndExecutorTests
}
[Fact]
- public void SteppedHoleExecutor_CurrentPostValidatorBehavior()
+ public void SteppedHoleExecutor_CanonicalSteppedHole_ProducesBrepBody()
{
var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped())).Plan!;
var exec = HoleRecoveryExecutor.Execute(plan);
- Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
- Assert.Null(exec.Body);
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped plan validated", StringComparison.Ordinal));
+ 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("SteppedHoleExecutionDeferredPostValidator", 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));
}
[Fact]
- public void SteppedHoleStepSmoke_IfExecutionSucceeds()
+ public void SteppedHoleStepSmoke_CanonicalSteppedHole_ExportsStep()
{
var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped())).Plan!;
var exec = HoleRecoveryExecutor.Execute(plan);
- Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
+ 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.Contains(exec.Diagnostics, d => d.Contains("No STEP export attempted", StringComparison.Ordinal));
}
+ [Fact]
+ public void SteppedHole_InvalidPlanShape_RejectsBeforeBoolean()
+ {
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped()));
+ var plan = Assert.IsType<HoleRecoveryPlan>(eval.Plan);
+ var invalid = plan with { ProfileStack = [plan.ProfileStack[0], plan.ProfileStack[2]] };
+ 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.DoesNotContain(exec.Diagnostics, d => d.Contains("Stepped subtract", StringComparison.Ordinal));
+ }
+
[Fact] public void SteppedHoleVariant_DoesNotStealCounterbore() => Assert.Contains("selected-variant:CounterboreVariant", new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildCounterbore())).Evidence);
[Fact] public void SteppedHoleVariant_DoesNotStealThroughOrBlind() { Assert.Contains("selected-variant:ThroughHoleVariant", new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(new CirSubtractNode(new CirBoxNode(20,20,10), new CirCylinderNode(2,20)))).Evidence); Assert.Contains("selected-variant:BlindHoleVariant", new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(new CirSubtractNode(new CirBoxNode(20,20,10), new CirTransformNode(new CirCylinderNode(2,4), Transform3D.CreateTranslation(new Vector3D(0,0,3)))))).Evidence); }
[Fact] public void SteppedHoleVariant_RejectsNonCoaxialCylinders() => Assert.False(new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped(new Vector3D(1,0,-2)))).Admissible);
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
index b057b535..7b6f25b7 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
@@ -62,13 +62,13 @@ public static class HoleRecoveryExecutor
if (plan.HoleKind == HoleKind.Stepped && plan.DepthKind == HoleDepthKind.ThroughWithEntryRelief)
{
- diagnostics.Add("Stepped-hole plan recognized; post-validator bounded execution probe started.");
+ diagnostics.Add("Stepped-hole plan recognized; bounded repeated-subtract execution started.");
return ExecuteStepped(plan, diagnostics);
}
if (plan.HoleKind != HoleKind.Counterbore || plan.DepthKind != HoleDepthKind.ThroughWithEntryRelief)
{
- diagnostics.Add("Plan rejected: only bounded blind-hole and counterbore are supported.");
+ diagnostics.Add("Plan rejected: only bounded through/blind/counterbore/countersink/stepped plans are supported.");
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
@@ -164,7 +164,7 @@ public static class HoleRecoveryExecutor
{
if (plan.HostKind != HoleHostKind.RectangularBox || plan.Axis != HoleAxisKind.Z || plan.ProfileStack.Count != 3)
{
- diagnostics.Add("Stepped plan rejected: host/axis/profile mismatch.");
+ diagnostics.Add("Stepped plan rejected before Boolean: host must be rectangular box, axis must be Z, and profile stack count must be exactly 3.");
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
@@ -174,13 +174,13 @@ public static class HoleRecoveryExecutor
var small = plan.ProfileStack[2];
if (large.SegmentKind != HoleProfileSegmentKind.Cylindrical || medium.SegmentKind != HoleProfileSegmentKind.Cylindrical || small.SegmentKind != HoleProfileSegmentKind.Cylindrical)
{
- diagnostics.Add("Stepped plan rejected: all profile segments must be cylindrical.");
+ diagnostics.Add("Stepped plan rejected before Boolean: all profile segments must be cylindrical.");
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
if (small.RadiusStart >= medium.RadiusStart - tolerance || medium.RadiusStart >= large.RadiusStart - tolerance)
{
- diagnostics.Add("Stepped plan rejected: strict radius ordering (small < medium < large) is required.");
+ diagnostics.Add("Stepped plan rejected before Boolean: strict radius ordering (small < medium < large) is required.");
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
@@ -188,15 +188,16 @@ public static class HoleRecoveryExecutor
var mediumDepth = medium.DepthEnd - medium.DepthStart;
if (Math.Abs(small.DepthEnd - plan.ThroughLength) > tolerance || largeDepth <= tolerance || mediumDepth <= tolerance || largeDepth >= mediumDepth - tolerance || mediumDepth >= plan.ThroughLength - tolerance)
{
- diagnostics.Add("Stepped plan rejected: strict depth ordering (large < medium < through) is required.");
+ diagnostics.Add("Stepped plan rejected before Boolean: strict depth ordering (large < medium < through) is required.");
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
- diagnostics.Add("Stepped plan validated.");
+ diagnostics.Add("Stepped plan shape validated.");
+ diagnostics.Add("Stepped repeated-subtract route selected: small-through -> medium-depth -> large-shallow.");
var box = BrepPrimitives.CreateBox(plan.HostSizeX, plan.HostSizeY, plan.HostSizeZ);
if (!box.IsSuccess)
{
- diagnostics.Add("Stepped box primitive construction failed.");
+ diagnostics.Add("Stepped host box primitive construction failed.");
return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
}
@@ -205,7 +206,7 @@ public static class HoleRecoveryExecutor
var smallResult = BrepPrimitives.CreateCylinder(small.RadiusStart, throughHeight);
if (!smallResult.IsSuccess)
{
- diagnostics.Add("Stepped small through cylinder primitive construction failed.");
+ diagnostics.Add("Stepped small-through cylinder primitive construction failed.");
return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
}
@@ -214,8 +215,7 @@ public static class HoleRecoveryExecutor
if (!smallSubtract.IsSuccess || smallSubtract.Value is null)
{
diagnostics.Add("Stepped subtract small failed.");
- diagnostics.Add("SteppedHoleExecutionDeferredPostValidator: blocker-at-small-subtract");
- return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
+ return new(HoleRecoveryExecutionStatus.BooleanFailed, null, diagnostics);
}
diagnostics.Add("Stepped subtract small succeeded.");
@@ -224,7 +224,7 @@ public static class HoleRecoveryExecutor
var mediumResult = BrepPrimitives.CreateCylinder(medium.RadiusStart, mediumDepth);
if (!mediumResult.IsSuccess)
{
- diagnostics.Add("Stepped medium cylinder primitive construction failed.");
+ diagnostics.Add("Stepped medium-depth cylinder primitive construction failed.");
return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
}
@@ -233,8 +233,7 @@ public static class HoleRecoveryExecutor
if (!mediumSubtract.IsSuccess || mediumSubtract.Value is null)
{
diagnostics.Add("Stepped subtract medium failed.");
- diagnostics.Add("SteppedHoleExecutionDeferredPostValidator: blocker-at-medium-subtract");
- return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
+ return new(HoleRecoveryExecutionStatus.BooleanFailed, null, diagnostics);
}
diagnostics.Add("Stepped subtract medium succeeded.");
@@ -242,7 +241,7 @@ public static class HoleRecoveryExecutor
var largeResult = BrepPrimitives.CreateCylinder(large.RadiusStart, largeDepth);
if (!largeResult.IsSuccess)
{
- diagnostics.Add("Stepped large cylinder primitive construction failed.");
+ diagnostics.Add("Stepped large-shallow cylinder primitive construction failed.");
return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
}
@@ -251,14 +250,13 @@ public static class HoleRecoveryExecutor
if (!largeSubtract.IsSuccess || largeSubtract.Value is null)
{
diagnostics.Add("Stepped subtract large failed.");
- diagnostics.Add("SteppedHoleExecutionDeferredPostValidator: blocker-at-large-subtract");
- return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
+ return new(HoleRecoveryExecutionStatus.BooleanFailed, null, diagnostics);
}
diagnostics.Add("Stepped subtract large succeeded.");
- diagnostics.Add("Stepped execution probe succeeded; production route remains deferred until dedicated stability coverage is promoted.");
- diagnostics.Add("SteppedHoleExecutionDeferredPostValidator");
- return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
+ diagnostics.Add("Stepped repeated-subtract route succeeded.");
+ diagnostics.Add("Result BRep body produced.");
+ return new(HoleRecoveryExecutionStatus.Succeeded, largeSubtract.Value, diagnostics);
}
private static HoleRecoveryExecutionResult ExecuteBlind(HoleRecoveryPlan plan, List<string> 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
new file mode 100644
index 00000000..fe42ae9f
--- /dev/null
+++ b/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md
@@ -0,0 +1,44 @@
+# BREP-BOOLEAN-STACK-A4: stepped repeated-subtract productionization
+
+## Outcome
+Success: bounded stepped-hole recovery is now executable in production for the canonical three-level coaxial stepped shape.
+
+## A3.1 evidence used
+A3.1 architecture-lab evidence showed repeated subtract orders are viable for canonical bounded stepped stacks, while unioned-tool and generic profile-stack routes remained deferred. A4 promotes only the bounded repeated-subtract route.
+
+## Production route enabled
+`HoleRecoveryExecutor` now executes stepped plans with deterministic order:
+1. small through subtract,
+2. medium depth blind subtract,
+3. large shallow blind subtract.
+
+The route is enabled only after bounded plan-shape validation:
+- `HoleKind.Stepped` + `HoleDepthKind.ThroughWithEntryRelief`,
+- host rectangular box,
+- Z axis,
+- exactly three cylindrical profile segments,
+- strict radius order `small < medium < large`,
+- strict depth order `large < medium < through`.
+
+Unsupported shape mismatch is rejected before boolean invocation with explicit diagnostics.
+
+## Diagnostics
+Stepped diagnostics now explicitly record:
+- executor start and no STEP export attempt,
+- stepped plan shape validation,
+- route selection (`small-through -> medium-depth -> large-shallow`),
+- per-stage subtract invocation and success/failure,
+- final body production.
+
+## STEP smoke and manifold policy
+Stepped STEP smoke now runs via executor-produced body and existing `Step242Exporter.ExportBody(...)`. Expected manifold markers are asserted and `BREP_WITH_VOIDS` remains absent.
+
+## Non-goals preserved
+- No generic N-level stepped support.
+- No unioned-tool production route.
+- No direct N-level topology builder.
+- No STEP exporter behavior changes.
+- No public CLI/API expansion.
+
+## Remaining limits
+Support remains intentionally bounded to the canonical three-level coaxial Z-axis stepped-hole family.
diff --git a/docs/cir-recovery-v12-hole-family-coverage-matrix.md b/docs/cir-recovery-v12-hole-family-coverage-matrix.md
index 38d36e38..5dfa4518 100644
--- a/docs/cir-recovery-v12-hole-family-coverage-matrix.md
+++ b/docs/cir-recovery-v12-hole-family-coverage-matrix.md
@@ -19,7 +19,7 @@ This milestone adds matrix-style test coverage and diagnostics trace assertions.
- BlindHoleTop -> `BlindHoleVariant`, `HoleKind.Blind`, executable.
- BlindHoleBottom -> `BlindHoleVariant`, `HoleKind.Blind`, executable.
- Countersink -> `CountersinkVariant`, `HoleKind.Countersink`, executable.
-- SteppedHole -> `SteppedHoleVariant`, `HoleKind.Stepped`, executable.
+- SteppedHole -> `SteppedHoleVariant`, `HoleKind.Stepped`, executable (A4 repeated-subtract production route) and manifold/non-void in STEP smoke assertions.
### Unsupported/fallback rows
- BoxSphere -> no variant admits; fallback/reject path.
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 88e406e5..1e189df5 100644
--- a/docs/cir-recovery-v13-stepped-hole-variant-executor-step.md
+++ b/docs/cir-recovery-v13-stepped-hole-variant-executor-step.md
@@ -23,28 +23,17 @@ 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.
-## V13.1 blocker characterization
-Observed production failure: repeated overlapping coaxial subtracts on the canonical stepped stack produce `BooleanFailed` in current exact Boolean path.
+## A4 productionization update
+Stepped execution is now production-enabled for the bounded canonical route selected by A3.1:
-Characterization summary:
-- baseline order (`small -> medium -> large`) fails,
-- failure aligns with overlapping/coincident coaxial tool topology handling,
-- no bounded deterministic safe alternative route was promoted in this milestone,
-- unioned-tool route is explicitly deferred (not enabled in production without dedicated stability coverage).
+- deterministic order: `small -> medium -> large`,
+- bounded pre-boolean shape validation,
+- per-stage subtract diagnostics,
+- successful completion now returns `Succeeded` + produced `BrepBody`.
-## A2 execution policy update
-After A1/A1.1 validator admission fix, stepped execution is now probed in `HoleRecoveryExecutor`, but production remains deferred due to downstream subtract-stage blocker diagnostics.
+If a subtract stage fails, executor now returns `BooleanFailed` for that stage with explicit stage diagnostics.
-Execution route:
-- create host box,
-- subtract small through cylinder,
-- subtract medium depth cylinder,
-- subtract large shallow cylinder,
-- if any subtract stage fails (or probe is not yet production-hardened), return deferred unsupported status with explicit blocker diagnostics.
-
-Diagnostics now record stepped plan validation and each subtract invocation/success.
-
-STEP smoke coverage confirms exporter compatibility using existing `Step242Exporter.ExportBody(...)` behavior only.
+STEP smoke coverage now executes for stepped-hole via the recovered body and confirms manifold/non-void export markers using unchanged `Step242Exporter.ExportBody(...)` behavior.
## Non-goals
No generic N-level stack executor, no threaded-hole support, no STEP exporter changes, no public API changes.