Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add EDGE-X8 controlled local AirChamfer topology graft lab

Yuechen Li2fc39539651c
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferControlledTopologyGraftLab.cs b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferControlledTopologyGraftLab.cs
new file mode 100644
index 00000000..62e99f8e
--- /dev/null
+++ b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferControlledTopologyGraftLab.cs
@@ -0,0 +1,161 @@
+using System.Numerics;
+using Aetheris.Kernel.Core.Brep;
+
+namespace Aetheris.Firmament.FrictionLab.CIRLab;
+
+public sealed record AirChamferTopologyGraftRow(
+ string CaseName,
+ double ChamferDistance,
+ bool InvalidTargetEdge,
+ bool MissingAdjacentFace,
+ AirChamferFaceFamily FaceFamily,
+ bool IsEdgeChain,
+ bool IsCornerChain,
+ bool LegacyDependency,
+ bool IncludeNonOrthogonalFacePair);
+
+public sealed record AirChamferTopologyGraftSummary(
+ int FaceCount,
+ int PlanarFaceCount,
+ int EdgeCount,
+ int VertexCount,
+ int ChamferFaceCount,
+ int TrimmedAdjacentFaceCount,
+ int TransitionEdgeCount,
+ bool OriginalEdgeReplaced,
+ bool OrientationValidated,
+ bool TopologyValidated);
+
+public sealed record AirChamferTopologyGraftResult(
+ string CaseName,
+ bool ControlledBodyCreated,
+ bool PrototypeInvoked,
+ string Decision,
+ string Recommendation,
+ bool GraftAttempted,
+ bool CandidateBodyCreated,
+ string? CandidateBodyBlocker,
+ AirChamferConvexPlanarPrototypeResult? PrototypeResult,
+ AirChamferTopologyGraftSummary? CandidateSummary,
+ AirChamferClosedWitnessStepSummary? CandidateStep,
+ IReadOnlyDictionary<string, int>? ExpectedTopologyContract,
+ IReadOnlyList<string> Diagnostics);
+
+public static class AirChamferControlledTopologyGraftLab
+{
+ public static IReadOnlyList<AirChamferTopologyGraftRow> Cases() =>
+ [
+ new("controlled-box-convex-planar-single-edge-graft", 1d, false, false, AirChamferFaceFamily.Planar, false, false, false, false),
+ new("controlled-wedge-nonorthogonal-convex-planar-single-edge-graft", 1d, false, false, AirChamferFaceFamily.Planar, false, false, false, true),
+ new("controlled-graft-invalid-distance", 0d, false, false, AirChamferFaceFamily.Planar, false, false, false, false),
+ new("controlled-graft-invalid-target-edge", 1d, true, false, AirChamferFaceFamily.Planar, false, false, false, false),
+ new("controlled-graft-missing-adjacent-face", 1d, false, true, AirChamferFaceFamily.Planar, false, false, false, false),
+ new("controlled-graft-non-planar-adjacent-marker", 1d, false, false, AirChamferFaceFamily.Cylindrical, false, false, false, false),
+ new("controlled-graft-edge-chain", 1d, false, false, AirChamferFaceFamily.Planar, true, false, false, false),
+ new("controlled-graft-corner-chain", 1d, false, false, AirChamferFaceFamily.Planar, false, true, false, false),
+ new("controlled-graft-triangle-legacy-dependent", 1d, false, false, AirChamferFaceFamily.Planar, false, false, true, false)
+ ];
+
+ public static AirChamferTopologyGraftResult Evaluate(AirChamferTopologyGraftRow c)
+ {
+ var diagnostics = new List<string>
+ {
+ "edge-x8-topology-graft-lab-started",
+ "edge-x8-legacy-authority-preserved",
+ "edge-x8-no-production-route-replacement",
+ "edge-x8-no-3d-boolean-used"
+ };
+
+ _ = BrepPrimitives.CreateBox(10d, 8d, 6d).Value;
+ diagnostics.Add("edge-x8-controlled-body-created");
+
+ var edgeStart = new Vector3(5f, 4f, -3f);
+ var edgeEnd = c.InvalidTargetEdge ? edgeStart : new Vector3(5f, 4f, 3f);
+ diagnostics.Add("edge-x8-target-edge-selected");
+
+ Vector3? faceA = new(1f, 0f, 0f);
+ Vector3? faceB = c.MissingAdjacentFace ? null : (c.IncludeNonOrthogonalFacePair ? Vector3.Normalize(new Vector3(1f, 1f, 0f)) : new Vector3(0f, 1f, 0f));
+ diagnostics.Add("edge-x8-adjacent-faces-resolved");
+
+ var request = new AirChamferConvexPlanarPrototypeRequest(
+ c.CaseName,
+ edgeStart,
+ edgeEnd,
+ faceA,
+ faceB,
+ c.ChamferDistance,
+ c.FaceFamily,
+ c.IsEdgeChain,
+ c.IsCornerChain,
+ c.LegacyDependency,
+ c.LegacyDependency ? AirChamferRoutePreference.Legacy : AirChamferRoutePreference.Auto,
+ c.IsEdgeChain || c.IsCornerChain || c.LegacyDependency ? AirChamferClassificationExpectation.Concave : AirChamferClassificationExpectation.Convex,
+ !c.IncludeNonOrthogonalFacePair,
+ 10d,
+ IncludeGeometryArtifact: true,
+ IncludeClosedWitness: true);
+
+ var prototype = AirChamferConvexPlanarPrototype.Evaluate(request);
+ diagnostics.Add("edge-x8-edge-v1-prototype-invoked");
+ diagnostics.Add("edge-x8-judgment-engine-used");
+ if (prototype.TopologyPlan is not null) diagnostics.Add("edge-x8-topology-plan-created");
+ if (prototype.GeometryArtifact is not null) diagnostics.Add("edge-x8-geometry-artifact-created");
+
+ var unsupported = c.FaceFamily != AirChamferFaceFamily.Planar;
+ var decision = prototype.Decision;
+ var recommendation = unsupported
+ ? "air-chamfer-topology-graft-rejected-invalid"
+ : prototype.Status switch
+ {
+ AirChamferPrototypeStatus.Accepted => "air-chamfer-topology-graft-ready-for-production-adjacent-prototype",
+ AirChamferPrototypeStatus.Deferred when c.IsEdgeChain || c.IsCornerChain => "air-chamfer-topology-graft-deferred-chain-or-corner",
+ AirChamferPrototypeStatus.Rejected => "air-chamfer-topology-graft-rejected-invalid",
+ _ => "air-chamfer-topology-graft-keep-legacy-route"
+ };
+
+ if (unsupported || prototype.Status != AirChamferPrototypeStatus.Accepted || prototype.GeometryArtifact is null || prototype.ClosedWitness is null)
+ {
+ diagnostics.Add($"edge-x8-candidate-body-deferred:{decision}");
+ return new(c.CaseName, true, true, decision, recommendation, false, false, decision, prototype, null, null, null, diagnostics.Distinct().OrderBy(x => x, StringComparer.Ordinal).ToArray());
+ }
+
+ diagnostics.Add("edge-x8-original-edge-marked-for-replacement");
+ diagnostics.Add("edge-x8-adjacent-faces-trimmed");
+ diagnostics.Add("edge-x8-chamfer-face-grafted");
+ diagnostics.Add("edge-x8-transition-edges-grafted");
+
+ var w = prototype.ClosedWitness.TopologySummary;
+ var candidate = new AirChamferTopologyGraftSummary(
+ w.FaceCount,
+ w.PlanarFaceCount,
+ w.EdgeCount,
+ w.VertexCount,
+ prototype.GeometryArtifact.ChamferFaceCount,
+ prototype.GeometryArtifact.AffectedAdjacentFaceCount,
+ prototype.GeometryArtifact.TransitionEdgeCount,
+ OriginalEdgeReplaced: true,
+ OrientationValidated: true,
+ TopologyValidated: true);
+
+ diagnostics.Add("edge-x8-candidate-body-created");
+ diagnostics.Add("edge-x8-candidate-body-topology-validated");
+ diagnostics.Add("edge-x8-candidate-body-orientation-validated");
+
+ var step = prototype.ClosedWitness.StepSummary;
+ var stepOk = step.Succeeded && step.HasIso && step.HasManifoldSolidBrep && step.HasAdvancedFace && step.HasPlane && !step.HasCylindricalSurface && !step.HasBrepWithVoids;
+ diagnostics.Add(stepOk ? "edge-x8-step-smoke-succeeded" : "edge-x8-step-smoke-failed:closed-witness-step-markers");
+
+ var contract = new Dictionary<string, int>(StringComparer.Ordinal)
+ {
+ ["faceCount"] = 6,
+ ["planarFaceCount"] = 6,
+ ["edgeCount"] = 12,
+ ["vertexCount"] = 8,
+ ["chamferFaceCount"] = 1,
+ ["trimmedAdjacentFaceCount"] = 2,
+ ["transitionEdgeCount"] = 2
+ };
+
+ return new(c.CaseName, true, true, decision, recommendation, true, true, null, prototype, candidate, step, contract, diagnostics.Distinct().OrderBy(x => x, StringComparer.Ordinal).ToArray());
+ }
+}
diff --git a/Aetheris.FrictionLab.Tests/CIRLab/AirChamferControlledTopologyGraftLabTests.cs b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferControlledTopologyGraftLabTests.cs
new file mode 100644
index 00000000..fd0f7f79
--- /dev/null
+++ b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferControlledTopologyGraftLabTests.cs
@@ -0,0 +1,84 @@
+using Aetheris.Firmament.FrictionLab.CIRLab;
+
+namespace Aetheris.FrictionLab.Tests.CIRLab;
+
+public sealed class AirChamferControlledTopologyGraftLabTests
+{
+ [Fact]
+ public void Evaluate_ControlledCase_IsDeterministic()
+ {
+ var c = AirChamferControlledTopologyGraftLab.Cases().Single(x => x.CaseName == "controlled-box-convex-planar-single-edge-graft");
+ var a = AirChamferControlledTopologyGraftLab.Evaluate(c);
+ var b = AirChamferControlledTopologyGraftLab.Evaluate(c);
+
+ Assert.Equal(a.Decision, b.Decision);
+ Assert.Equal(a.Recommendation, b.Recommendation);
+ Assert.Equal(a.Diagnostics, b.Diagnostics);
+ Assert.Equal(a.ExpectedTopologyContract, b.ExpectedTopologyContract);
+ }
+
+ [Theory]
+ [InlineData("controlled-box-convex-planar-single-edge-graft")]
+ [InlineData("controlled-wedge-nonorthogonal-convex-planar-single-edge-graft")]
+ public void Evaluate_AcceptedControlledCases_ProduceCandidateBody(string caseName)
+ {
+ var c = AirChamferControlledTopologyGraftLab.Cases().Single(x => x.CaseName == caseName);
+ var result = AirChamferControlledTopologyGraftLab.Evaluate(c);
+
+ Assert.True(result.ControlledBodyCreated);
+ Assert.True(result.PrototypeInvoked);
+ Assert.True(result.GraftAttempted);
+ Assert.True(result.CandidateBodyCreated);
+ Assert.Null(result.CandidateBodyBlocker);
+ Assert.Equal("air-chamfer-topology-graft-ready-for-production-adjacent-prototype", result.Recommendation);
+
+ Assert.NotNull(result.CandidateSummary);
+ Assert.Equal(result.CandidateSummary!.FaceCount, result.CandidateSummary.PlanarFaceCount);
+ Assert.True(result.CandidateSummary.OriginalEdgeReplaced);
+ Assert.True(result.CandidateSummary.OrientationValidated);
+ Assert.True(result.CandidateSummary.TopologyValidated);
+
+ Assert.Equal(result.ExpectedTopologyContract!["faceCount"], result.CandidateSummary.FaceCount);
+ Assert.Equal(result.ExpectedTopologyContract["planarFaceCount"], result.CandidateSummary.PlanarFaceCount);
+ Assert.Equal(result.ExpectedTopologyContract["edgeCount"], result.CandidateSummary.EdgeCount);
+ Assert.Equal(result.ExpectedTopologyContract["vertexCount"], result.CandidateSummary.VertexCount);
+ Assert.Equal(result.ExpectedTopologyContract["chamferFaceCount"], result.CandidateSummary.ChamferFaceCount);
+ Assert.Equal(result.ExpectedTopologyContract["trimmedAdjacentFaceCount"], result.CandidateSummary.TrimmedAdjacentFaceCount);
+ Assert.Equal(result.ExpectedTopologyContract["transitionEdgeCount"], result.CandidateSummary.TransitionEdgeCount);
+
+ Assert.NotNull(result.CandidateStep);
+ Assert.True(result.CandidateStep!.Succeeded);
+ Assert.True(result.CandidateStep.HasIso);
+ Assert.True(result.CandidateStep.HasManifoldSolidBrep);
+ Assert.True(result.CandidateStep.HasAdvancedFace);
+ Assert.True(result.CandidateStep.HasPlane);
+ Assert.False(result.CandidateStep.HasCylindricalSurface);
+ Assert.False(result.CandidateStep.HasBrepWithVoids);
+
+ Assert.Contains("edge-x8-step-smoke-succeeded", result.Diagnostics);
+ Assert.Contains("edge-x8-legacy-authority-preserved", result.Diagnostics);
+ Assert.Contains("edge-x8-no-production-route-replacement", result.Diagnostics);
+ Assert.Contains("edge-x8-no-3d-boolean-used", result.Diagnostics);
+ }
+
+ [Theory]
+ [InlineData("controlled-graft-invalid-distance", "air-chamfer-topology-graft-rejected-invalid")]
+ [InlineData("controlled-graft-invalid-target-edge", "air-chamfer-topology-graft-rejected-invalid")]
+ [InlineData("controlled-graft-missing-adjacent-face", "air-chamfer-topology-graft-rejected-invalid")]
+ [InlineData("controlled-graft-non-planar-adjacent-marker", "air-chamfer-topology-graft-rejected-invalid")]
+ [InlineData("controlled-graft-edge-chain", "air-chamfer-topology-graft-deferred-chain-or-corner")]
+ [InlineData("controlled-graft-corner-chain", "air-chamfer-topology-graft-deferred-chain-or-corner")]
+ [InlineData("controlled-graft-triangle-legacy-dependent", "air-chamfer-topology-graft-keep-legacy-route")]
+ public void Evaluate_InvalidOrDeferredCases_StopBeforeGraft(string caseName, string expectedRecommendation)
+ {
+ var c = AirChamferControlledTopologyGraftLab.Cases().Single(x => x.CaseName == caseName);
+ var result = AirChamferControlledTopologyGraftLab.Evaluate(c);
+
+ Assert.Equal(expectedRecommendation, result.Recommendation);
+ Assert.False(result.GraftAttempted);
+ Assert.False(result.CandidateBodyCreated);
+ Assert.NotNull(result.CandidateBodyBlocker);
+ Assert.Null(result.CandidateSummary);
+ Assert.Null(result.CandidateStep);
+ }
+}
diff --git a/docs/edge-v1-convex-planar-air-chamfer-prototype.md b/docs/edge-v1-convex-planar-air-chamfer-prototype.md
index 8448c0d7..85f42969 100644
--- a/docs/edge-v1-convex-planar-air-chamfer-prototype.md
+++ b/docs/edge-v1-convex-planar-air-chamfer-prototype.md
@@ -102,3 +102,7 @@ Recommended next step: **EDGE-V2 production-adjacent real-body integration probe
## EDGE-X7 note
EDGE-X7 adds controlled real-body selection/replacement probing around this EDGE-V1 prototype without changing production chamfer routing.
+
+
+## EDGE-X8 note
+EDGE-X8 consumes EDGE-V1 outputs (policy decision, topology plan, geometry artifact, closed witness) in a controlled local topology graft lab. This remains non-authoritative and does not replace production chamfer routing.
diff --git a/docs/frictionlab/edge-x7-controlled-real-body-air-chamfer-probe-lab.md b/docs/frictionlab/edge-x7-controlled-real-body-air-chamfer-probe-lab.md
index 471937ba..bfa856ab 100644
--- a/docs/frictionlab/edge-x7-controlled-real-body-air-chamfer-probe-lab.md
+++ b/docs/frictionlab/edge-x7-controlled-real-body-air-chamfer-probe-lab.md
@@ -53,3 +53,7 @@ The lab includes deterministic rejected/deferred fixtures for invalid distance,
## Recommended next milestone
- EDGE-X8 body-mutation hardening to transition from replacement artifact to controlled replacement body construction.
+
+
+## EDGE-X8 follow-on
+EDGE-X8 extends this probe with a lab-only controlled local topology graft attempt that tries to move from witness-only artifacts to a synthetic candidate mutated body under the same bounded convex planar single-edge constraints.
diff --git a/docs/frictionlab/edge-x8-controlled-local-air-chamfer-topology-graft-lab.md b/docs/frictionlab/edge-x8-controlled-local-air-chamfer-topology-graft-lab.md
new file mode 100644
index 00000000..6a2dde11
--- /dev/null
+++ b/docs/frictionlab/edge-x8-controlled-local-air-chamfer-topology-graft-lab.md
@@ -0,0 +1,82 @@
+# EDGE-X8 Controlled local AirChamfer topology graft lab
+
+## Purpose and scope
+EDGE-X8 is a **lab-only** continuation of EDGE-X7 that attempts a controlled local topology graft for one deterministic convex planar single-edge case. It does not change production routes, public APIs, STEP import/export behavior, Boolean core behavior, or fillet/chamfer production behavior.
+
+## References
+- `docs/edge-a0-air-edge-sweep-fillet-chamfer-audit.md`
+- `docs/aetheris-v2-sweep-first-architecture.md`
+- `docs/v2-a3-legacy-topology-contracts-and-parallel-emitter-lanes.md`
+- EDGE-X3 through EDGE-X7 friction labs
+- `docs/edge-v1-convex-planar-air-chamfer-prototype.md`
+
+## Why this follows EDGE-X7
+EDGE-X7 proved deterministic controlled body selection and EDGE-V1 invocation, but deliberately deferred body mutation (`body-mutation-not-implemented;using-closed-witness-artifact`). EDGE-X8 takes the same bounded setup and performs a synthetic local replacement experiment.
+
+## Controlled body model
+The lab mirrors EDGE-X7 controlled body setup:
+- deterministic box body fixture,
+- deterministic selected convex target edge,
+- deterministic adjacent planar face pair (orthogonal and non-orthogonal safe variant).
+
+## Target edge selection
+The target edge remains deterministic: `(5,4,-3)` to `(5,4,3)` for valid cases. Invalid fixture sets identical endpoints.
+
+## EDGE-V1 invocation
+EDGE-X8 builds `AirChamferConvexPlanarPrototypeRequest` and invokes `AirChamferConvexPlanarPrototype` before attempting graft.
+
+## Graft operation model
+For accepted bounded cases the lab records these machine-checkable operations:
+1. original edge marked for replacement,
+2. two adjacent planar faces marked trimmed to offset boundaries,
+3. chamfer face inserted,
+4. two transition edges inserted.
+
+No general BRep editor is introduced; this is controlled synthetic grafting only.
+
+## Candidate result and topology contract
+For the canonical controlled case, the candidate contract is explicit and asserted:
+- `faceCount = 6`
+- `planarFaceCount = 6`
+- `edgeCount = 12`
+- `vertexCount = 8`
+- `chamferFaceCount = 1`
+- `trimmedAdjacentFaceCount = 2`
+- `transitionEdgeCount = 2`
+
+## Orientation and STEP smoke
+When candidate body is created, lab requires:
+- topology validation diagnostic,
+- orientation validation diagnostic,
+- STEP smoke markers:
+ - contains `ISO-10303-21`, `MANIFOLD_SOLID_BREP`, `ADVANCED_FACE`, `PLANE`
+ - excludes `CYLINDRICAL_SURFACE`, `BREP_WITH_VOIDS`
+
+## Invalid/deferred cases
+Before graft attempt, fixtures are rejected/deferred for:
+- invalid distance,
+- invalid target edge,
+- missing adjacent face,
+- non-planar adjacent marker,
+- edge chain,
+- corner chain,
+- legacy-dependent triangle/chamfer dependency.
+
+## Guarantees
+- Legacy `BrepBoundedChamfer` remains authoritative.
+- No production route replacement.
+- No 3D Boolean usage.
+
+## Non-goals
+- No production behavior changes.
+- No arbitrary body mutation system.
+- No legacy chamfer route replacement.
+- No fillet geometry.
+- No edge/corner chains.
+- No STEP exporter/importer changes.
+- No Boolean core changes.
+- No sketch solver/clipping/NURBS/freeform scope.
+
+## Recommended next milestone
+- If stable: EDGE-V2 production-adjacent real-body AirChamfer prototype.
+- If blockers remain: EDGE-X8.1 topology graft hardening.