Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add CIR-F10 planar payload derivation scaffold with blocker diagnostics

Yuechen Li0969a8e45902
diff --git a/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
index 15edaa6f..470a22b3 100644
--- a/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
@@ -130,4 +130,40 @@ public sealed class SurfacePatchDescriptorScaffoldTests
Assert.False(result.Success);
Assert.Contains(result.Diagnostics, d => d.Contains("supports only rectangular untrimmed", StringComparison.OrdinalIgnoreCase));
}
+
+ [Fact]
+ public void PlanarPayloadBuilder_RejectsNonPlanarSource()
+ {
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", Transform3D.Identity, "cir:sphere", nameof(CirSphereNode), 0, FacePatchOrientationRole.Forward);
+ var success = PlanarPatchPayloadBuilder.TryBuildRectanglePayload(source, out _, out var diagnostic);
+ Assert.False(success);
+ Assert.Contains("not planar", diagnostic, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public void PlanarPayloadBuilder_RejectsDescriptorWithoutRectangleGeometry()
+ {
+ var extraction = SourceSurfaceExtractor.Extract(new CirBoxNode(10, 6, 4));
+ var top = Assert.Single(extraction.Descriptors.Where(d => d.ParameterPayloadReference == "top"));
+
+ var success = PlanarPatchPayloadBuilder.TryBuildRectanglePayload(top, out _, out var diagnostic);
+ Assert.False(success);
+ Assert.Contains("does not encode bounded rectangle corners", diagnostic, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public void PlanarSurfaceMaterializer_FromRealDescriptor_RespectsReadinessGate()
+ {
+ var extraction = SourceSurfaceExtractor.Extract(new CirBoxNode(10, 6, 4));
+ var top = Assert.Single(extraction.Descriptors.Where(d => d.ParameterPayloadReference == "top"));
+ var ready = PlanarPatchPayloadBuilder.TryBuildRectanglePayload(top, out var payload, out var payloadDiagnostic);
+ Assert.False(ready);
+ Assert.Contains("rejected", payloadDiagnostic, StringComparison.OrdinalIgnoreCase);
+
+ var patch = new FacePatchDescriptor(top with { ParameterPayloadReference = payload }, [], [], FacePatchOrientationRole.Forward, "outer", []);
+ var readiness = new MaterializationReadinessReport(true, EmissionReadiness.Deferred, [EmissionBlockingReason.TopologyPlanning], [], 1, 1, 0, 0, 0, 0, 0, [], false);
+ var result = new PlanarSurfaceMaterializer().Emit(patch, readiness);
+ Assert.False(result.Success);
+ Assert.Contains(result.Diagnostics, d => d.Contains("no readiness, no emission", StringComparison.OrdinalIgnoreCase));
+ }
}
diff --git a/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs b/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
index dafb5933..87fff820 100644
--- a/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
+++ b/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
@@ -233,6 +233,35 @@ internal sealed class PlanarSurfaceMaterializer : ISurfaceFamilyMaterializer
}
}
+internal static class PlanarPatchPayloadBuilder
+{
+ internal static bool TryBuildRectanglePayload(SourceSurfaceDescriptor source, out string? payload, out string diagnostic)
+ {
+ payload = null;
+ if (source.Family != SurfacePatchFamily.Planar)
+ {
+ diagnostic = $"payload-derivation-rejected: source family '{source.Family}' is not planar.";
+ return false;
+ }
+
+ if (string.IsNullOrWhiteSpace(source.ParameterPayloadReference))
+ {
+ diagnostic = "payload-derivation-rejected: source descriptor missing rectangle geometry payload reference.";
+ return false;
+ }
+
+ if (source.ParameterPayloadReference.StartsWith("rect3d:", StringComparison.Ordinal))
+ {
+ payload = source.ParameterPayloadReference;
+ diagnostic = "payload-derivation-succeeded: source descriptor already provides bounded rect3d payload.";
+ return true;
+ }
+
+ diagnostic = $"payload-derivation-rejected: planar source payload '{source.ParameterPayloadReference}' does not encode bounded rectangle corners; descriptor needs explicit rectangle geometry.";
+ return false;
+ }
+}
+
internal sealed record SurfaceMaterializationResult(
bool Success,
BrepBody? Body,
diff --git a/docs/cir-f10-real-planar-source-emission.md b/docs/cir-f10-real-planar-source-emission.md
new file mode 100644
index 00000000..100d0b48
--- /dev/null
+++ b/docs/cir-f10-real-planar-source-emission.md
@@ -0,0 +1,54 @@
+# CIR-F10: real dry-run planar evidence integration (bounded scaffold)
+
+## Outcome
+
+**Outcome B — meaningful progression.**
+
+The F8/F8.10 real source-surface pipeline is now wired to a bounded planar payload derivation helper, but current `SourceSurfaceDescriptor` content does not include explicit rectangle corner/dimension geometry for box faces (it carries role tokens such as `top`, `bottom`, etc.).
+
+Because of the readiness rule (**no readiness, no emission**) and anti-fabrication requirement, CIR-F10 does **not** synthesize rectangle geometry from incomplete descriptor payload.
+
+## What was integrated
+
+- Added `PlanarPatchPayloadBuilder.TryBuildRectanglePayload(SourceSurfaceDescriptor, out string? payload, out string diagnostic)`.
+- Builder accepts existing bounded payload (`rect3d:...`) and returns success.
+- Builder rejects real F8 extractor role payloads (`top`, `bottom`, etc.) with a precise blocker diagnostic.
+- Added focused tests against real `SourceSurfaceExtractor.Extract(new CirBoxNode(...))` descriptors and readiness-gated emission refusal.
+
+## Supported behavior in this milestone
+
+- Synthetic F9 `rect3d:` path remains supported and unchanged.
+- Real extracted planar descriptors can now be evaluated by an explicit conversion helper, with clear rejection diagnostics when rectangle geometry is missing.
+
+## Rejection behavior
+
+The helper/materializer now distinguishes:
+
+- non-planar source family,
+- missing payload reference,
+- planar payload that is not bounded rectangle geometry (`rect3d:`),
+- readiness gate rejection (`NotApplicable`/`Deferred`/`Unsupported`).
+
+## Why this is not full box/shell materialization
+
+CIR-F10 intentionally remains bounded:
+
+- no full box face-set assembly,
+- no shell stitching,
+- no trim-loop solving,
+- no non-planar family emission,
+- no STEP/export changes,
+- no generated topology naming.
+
+## Exact blocker for Outcome A
+
+To emit from a real extracted box face without synthetic payloads, `SourceSurfaceDescriptor` (or adjacent dry-run evidence object) needs exact bounded planar geometry for at least one untrimmed face, e.g. one of:
+
+- four world-space face corners, or
+- local rectangle extents + frame axes + transform.
+
+Current descriptor payload role strings (`top`, `bottom`, `left`, ...) are insufficient to derive exact bounded corners safely.
+
+## Recommended next step
+
+Extend the source-surface evidence contract for box planar faces with deterministic bounded geometry fields (corners or equivalent local frame/extents) so the payload builder can produce `rect3d:` without inference/fabrication.