Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add AIR region side-hole yield contract trace
Yuechen Li5b58114adc90
diff --git a/Aetheris.CLI.Tests/AirTraceCommandTests.cs b/Aetheris.CLI.Tests/AirTraceCommandTests.csindex 1ade5308..01e87eec 100644--- a/Aetheris.CLI.Tests/AirTraceCommandTests.cs+++ b/Aetheris.CLI.Tests/AirTraceCommandTests.cs@@ -305,18 +305,20 @@ public sealed class AirTraceCommandTests}[Fact]- public void TraceSideHoleFaceAttachedRegion_DefaultText()+ public void TraceSideHoleRegion_YieldContract_DefaultText(){var (exitCode, output, error) = Run("trace", "--fixture", RegionFixture("valid/side-hole-face-attached-region.valid.firmfixture"));Assert.Equal(0, exitCode); Assert.True(string.IsNullOrWhiteSpace(error));Assert.Contains("Regions", output); Assert.Contains("FaceAttachedRegion", output);Assert.Contains("Subtractive", output); Assert.Contains("YieldSubtractiveVolume", output);Assert.Contains("YieldsCutVolume", output); Assert.Contains("Integration: Deferred", output);+ Assert.Contains("Region yield", output); Assert.Contains("SideHole", output); Assert.Contains("Circle", output);+ Assert.Contains("radius=1", output); Assert.Contains("+X", output); Assert.Contains("through inward", output); Assert.Contains("ThroughCut", output);Assert.Contains("no Boolean", output); Assert.Contains("no BRep emission", output);}[Fact]- public void TraceSideHoleFaceAttachedRegion_Json()+ public void TraceSideHoleRegion_YieldContract_Json(){var (exitCode, output, _) = Run("trace", "--fixture", RegionFixture("valid/side-hole-face-attached-region.valid.firmfixture"), "--json");Assert.Equal(0, exitCode);@@ -333,13 +335,27 @@ public sealed class AirTraceCommandTestsAssert.Equal("YieldSubtractiveVolume", side.GetProperty("yieldKind").GetString());Assert.Equal("YieldsCutVolume", side.GetProperty("boundaryContractKind").GetString());Assert.Equal("Deferred", side.GetProperty("integrationStatus").GetString());+ var yield = side.GetProperty("yield");+ Assert.Equal("SideHole", yield.GetProperty("featureKind").GetString());+ Assert.Equal("YieldSubtractiveVolume", yield.GetProperty("yieldKind").GetString());+ Assert.Equal("Subtractive", yield.GetProperty("effectKind").GetString());+ Assert.Equal("+X", yield.GetProperty("attachment").GetProperty("faceSelector").GetString());+ Assert.Equal("Circle", yield.GetProperty("profile").GetProperty("profileKind").GetString());+ Assert.Equal(1, yield.GetProperty("profile").GetProperty("radius").GetDouble());+ Assert.Equal("FaceNormal", yield.GetProperty("direction").GetProperty("directionKind").GetString());+ Assert.Equal("Inward", yield.GetProperty("direction").GetProperty("sense").GetString());+ Assert.True(yield.GetProperty("direction").GetProperty("isThrough").GetBoolean());+ Assert.Equal("ThroughCut", yield.GetProperty("boundaryIntent").GetProperty("boundaryKind").GetString());+ Assert.True(yield.GetProperty("affectedScope").GetProperty("parentBodyOnly").GetBoolean());+ Assert.True(yield.GetProperty("affectedScope").GetProperty("escapesOnlyThroughYield").GetBoolean());+ Assert.Equal("Deferred", yield.GetProperty("integrationStatus").GetString());Assert.False(root.GetProperty("emission").GetProperty("succeeded").GetBoolean());Assert.False(root.GetProperty("stepSmoke").GetProperty("succeeded").GetBoolean());Assert.Equal("none", root.GetProperty("brepPlan").GetProperty("planKind").GetString());}[Fact]- public void TraceImplicitParentMutationRegion_Rejected()+ public void TraceImplicitParentMutationRegion_RejectedWithYieldContractReason(){var (exitCode, output, _) = Run("trace", "--fixture", RegionFixture("invalid/implicit-parent-mutation.invalid.firmfixture"), "--json");Assert.Equal(0, exitCode);@@ -348,11 +364,15 @@ public sealed class AirTraceCommandTestsAssert.True(root.GetProperty("fixture").GetProperty("expectationSatisfied").GetBoolean());Assert.Equal("region-rejected", root.GetProperty("actualStageReached").GetString());Assert.Contains("implicit parent mutation rejected", root.GetProperty("recommendation").GetString());+ var diagnostics = root.GetProperty("diagnostics").EnumerateArray().Select(x => x.GetString()).ToArray();+ Assert.Contains("air-region-x2-implicit-parent-mutation-rejected", diagnostics);+ Assert.Contains("air-region-x2-missing-explicit-yield-rejected", diagnostics);+ Assert.Contains("air-region-x2-boundary-contract-required", diagnostics);Assert.False(root.GetProperty("emission").GetProperty("succeeded").GetBoolean());}[Fact]- public void TraceRegionFixtures_DeterministicJson()+ public void RegionYieldSummaries_AreDeterministic(){var valid = RegionFixture("valid/side-hole-face-attached-region.valid.firmfixture");var invalid = RegionFixture("invalid/implicit-parent-mutation.invalid.firmfixture");@@ -360,6 +380,43 @@ public sealed class AirTraceCommandTestsAssert.Equal(Run("trace", "--fixture", invalid, "--json").Stdout, Run("trace", "--fixture", invalid, "--json").Stdout);}+ [Fact]+ public void TraceSideHoleRegion_EnforcesLocality_NoGeometryOrBoolean()+ {+ var (exitCode, output, _) = Run("trace", "--fixture", RegionFixture("valid/side-hole-face-attached-region.valid.firmfixture"), "--json");+ Assert.Equal(0, exitCode);+ using var doc = JsonDocument.Parse(output); var root = doc.RootElement;+ Assert.False(root.GetProperty("emission").GetProperty("succeeded").GetBoolean());+ Assert.False(root.GetProperty("stepSmoke").GetProperty("succeeded").GetBoolean());+ Assert.Equal("none", root.GetProperty("brepPlan").GetProperty("planKind").GetString());+ Assert.Equal("not-requested", root.GetProperty("cirMirror").GetProperty("status").GetString());+ var guarantees = root.GetProperty("guarantees").EnumerateArray().Select(x => x.GetString()).ToArray();+ Assert.Contains("no Boolean", guarantees);+ Assert.Contains("escapes only through explicit yield", guarantees);+ Assert.Contains("no BRep emission", guarantees);+ }++ [Fact]+ public void TraceParserBackedBox_RootRegionStillWorks()+ {+ var (exitCode, output, _) = Run("trace", "--fixture", PrimitiveFixture("valid/box.valid.firmfixture"), "--json");+ Assert.Equal(0, exitCode);+ using var doc = JsonDocument.Parse(output); var root = doc.RootElement;+ Assert.Equal("emitted-brep", root.GetProperty("actualStageReached").GetString());+ var regions = root.GetProperty("regions");+ Assert.Equal(1, regions.GetProperty("regionCount").GetInt32());+ Assert.DoesNotContain("SideHole", output, StringComparison.Ordinal);+ }++ [Fact]+ public void ExistingMetadataDrivenChamferFixtures_StillWork()+ {+ Assert.Equal(0, Run("trace", "--fixture", Fixture("valid/top-face-loop-chamfer.valid.firmfixture"), "--json").ExitCode);+ Assert.Equal(0, Run("trace", "--fixture", Fixture("invalid/arbitrary-graph-chamfer.invalid.firmfixture"), "--json").ExitCode);+ Assert.Equal(0, Run("trace", "--fixture", Fixture("invalid/non-uniform-loop-chamfer.invalid.firmfixture"), "--json").ExitCode);+ Assert.Equal(0, Run("trace", "--fixture", Fixture("invalid/loop-fillet-deferred.invalid.firmfixture"), "--json").ExitCode);+ }+private static string Fixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Chamfer", relative));private static string PrimitiveFixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Primitive", relative));private static string RegionFixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Region", relative));diff --git a/Aetheris.CLI/AirTrace.cs b/Aetheris.CLI/AirTrace.csindex 0c8d737f..37a25a59 100644--- a/Aetheris.CLI/AirTrace.cs+++ b/Aetheris.CLI/AirTrace.cs@@ -195,8 +195,8 @@ internal static class AirTraceReportBuildervar actualStage = "region-integration-deferred";var expectationSatisfied = fixture.Expectation == "valid" && (string.IsNullOrWhiteSpace(fixture.ExpectedStage) || fixture.ExpectedStage == actualStage);var fxDiagnostics = Stable([.. fixture.Diagnostics, .. regions.Diagnostics, "air-region-x1-firmfixture-case-mapped", expectationSatisfied ? "air-region-x1-expectation-satisfied" : "air-region-x1-expectation-not-satisfied"]).ToArray();- return new("AIR-REGION-X1", "trace", "lowering", "firmfixture", fixture.CaseName, expectationSatisfied, "FaceAttachedRegion side-hole yield is valid but parent integration is deferred; no geometry emitted.",- new("RegionFixture", "none", "none", "none", "metadata-driven-region-contract", fixture.CaseName, fixture.CaseName, "AIR-REGION-X1"),+ return new("AIR-REGION-X2", "trace", "lowering", "firmfixture", fixture.CaseName, expectationSatisfied, "FaceAttachedRegion side-hole yield contract is valid but parent integration is deferred; no geometry emitted.",+ new("RegionFixture", "none", "none", "none", "metadata-driven-region-contract", fixture.CaseName, fixture.CaseName, "AIR-REGION-X2"),new("none", null, false, "region integration deferred; no route selection invoked", "none", "none", []),new("none", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "none", "none", null, []),new("none", false, "no geometry emitted for trace-only region fixture"),@@ -299,6 +299,24 @@ internal static class AirTraceTextRendererif (region.ParentRegionId is not null) b.AppendLine($" Parent: {region.ParentRegionId}");b.AppendLine($" Effect: {region.EffectKind}"); b.AppendLine($" Yield: {region.YieldKind}"); b.AppendLine($" Boundary: {region.BoundaryContractKind}");b.AppendLine($" Frame: {FrameLabel(region.LocalFrame)}"); b.AppendLine($" Integration: {region.IntegrationStatus}");+ if (region.Yield is not null)+ {+ var y = region.Yield;+ b.AppendLine(" Region yield");+ b.AppendLine($" Yield: {y.YieldKind}");+ b.AppendLine($" Feature: {y.FeatureKind}");+ b.AppendLine($" Attachment: {y.Attachment.AttachmentKind} {y.Attachment.FaceSelector}");+ b.AppendLine($" Profile: {y.Profile.ProfileKind}(radius={y.Profile.Radius:g}, center=({y.Profile.Center.X:g},{y.Profile.Center.Y:g}))");+ b.AppendLine($" Direction: {(y.Direction.IsThrough ? "through" : y.Direction.Depth)} {y.Direction.Sense.ToLowerInvariant()} along face normal");+ b.AppendLine($" Boundary: {y.BoundaryIntent.BoundaryKind}");+ b.AppendLine($" Entry: circular entry loop on {y.Attachment.FaceSelector} face");+ b.AppendLine($" Exit: opposite-side exit {y.BoundaryIntent.ExitBoundary.ToLowerInvariant()}");+ b.AppendLine(" Rim: circular rim intent");+ b.AppendLine($" Affected scope: {(y.AffectedScope.ParentBodyOnly ? "parent body only" : "parent scope")}, local feature scope");+ b.AppendLine($" Integration: {y.IntegrationStatus}");+ b.AppendLine(" Guarantees:");+ foreach (var guarantee in y.Guarantees) b.AppendLine($" - {guarantee}");+ }foreach (var loss in region.KnownLosses) b.AppendLine($" Reason: {loss}");foreach (var guarantee in region.Guarantees) b.AppendLine($" Guarantee: {guarantee}");}diff --git a/Aetheris.Kernel.Core/Air/AirRegions.cs b/Aetheris.Kernel.Core/Air/AirRegions.csindex 7d211788..fc7f70f3 100644--- a/Aetheris.Kernel.Core/Air/AirRegions.cs+++ b/Aetheris.Kernel.Core/Air/AirRegions.cs@@ -9,6 +9,14 @@ internal enum AirLocalFrameHandedness { RightHanded, LeftHanded, Unknown }internal enum AirRegionIntegrationStatus { NotRequired, Deferred, Rejected, Admitted, Unsupported }internal sealed record AirVectorSummary(double X, double Y, double Z);+internal sealed record AirPoint2Summary(double X, double Y);++internal sealed record AirRegionYieldSummary(string YieldId, AirRegionYieldKind YieldKind, string FeatureKind, AirRegionEffectKind EffectKind, string LocalFrameId, string ParentRegionId, AirRegionAttachmentSummary Attachment, AirRegionProfileSummary Profile, AirRegionDirectionSummary Direction, AirRegionAffectedScopeSummary AffectedScope, AirRegionBoundaryIntentSummary BoundaryIntent, AirRegionIntegrationStatus IntegrationStatus, IReadOnlyList<string> Diagnostics, IReadOnlyList<string> KnownLosses, IReadOnlyList<string> Guarantees);+internal sealed record AirRegionAttachmentSummary(string AttachmentKind, string ParentRegionId, string ParentBody, string FaceSelector, string FaceRole, string LocalFrameId, IReadOnlyList<string> AttachmentDiagnostics);+internal sealed record AirRegionProfileSummary(string ProfileKind, AirPoint2Summary Center, double Radius, string? LoopKind, string? ProfileFrame);+internal sealed record AirRegionDirectionSummary(string DirectionKind, string Axis, string Sense, bool IsThrough, string Depth, IReadOnlyList<string> Diagnostics);+internal sealed record AirRegionAffectedScopeSummary(string ScopeKind, bool ParentBodyOnly, string AffectedFaceSelector, bool MayAffectSiblings, bool EscapesOnlyThroughYield, IReadOnlyList<string> Diagnostics);+internal sealed record AirRegionBoundaryIntentSummary(string BoundaryKind, string EntryBoundary, string ExitBoundary, string RimIntent, string PatchIntent, IReadOnlyList<string> Diagnostics);internal sealed record AirLocalFrameSummary(string FrameId,@@ -38,7 +46,8 @@ internal sealed record AirRegionSummary(string Provenance,IReadOnlyList<string> Diagnostics,IReadOnlyList<string> KnownLosses,- IReadOnlyList<string> Guarantees);+ IReadOnlyList<string> Guarantees,+ AirRegionYieldSummary? Yield = null);internal sealed record AirRegionTraceSummary(IReadOnlyList<AirRegionSummary> Regions,@@ -71,19 +80,32 @@ internal static class AirRegionTraceFactory"deferred:no-geometry-integration","region-integration-deferred","AIR-REGION-X1 metadata-driven fixture",- ["air-region-x1-face-attached-region-created", "air-region-x1-region-effect-declared", "air-region-x1-region-yield-declared", "air-region-x1-boundary-contract-declared", "air-region-x1-parent-integration-deferred"],- ["side-hole geometry integration not implemented"],- ["no implicit parent mutation", "no Boolean", "no BRep emission", "no production route replacement", "trace-only"]);- return Summary([root, side], ["air-region-x1-region-trace-created", "air-region-x1-no-implicit-parent-mutation", "air-region-x1-no-boolean", "air-region-x1-no-brep-emission", "air-region-x1-no-production-route-replacement", "air-region-x1-trace-only"], ["no Boolean", "no geometry", "no BRep emission", "no STEP smoke", "no production route replacement"]);+ ["air-region-x1-face-attached-region-created", "air-region-x1-region-effect-declared", "air-region-x1-region-yield-declared", "air-region-x1-boundary-contract-declared", "air-region-x1-parent-integration-deferred", "air-region-x2-yield-contract-created", "air-region-x2-side-hole-yield-created", "air-region-x2-face-attachment-recorded", "air-region-x2-local-profile-recorded", "air-region-x2-circle-profile-recorded", "air-region-x2-through-direction-recorded", "air-region-x2-affected-scope-recorded", "air-region-x2-boundary-intent-recorded", "air-region-x2-entry-loop-intent-recorded", "air-region-x2-exit-boundary-deferred", "air-region-x2-region-locality-enforced", "air-region-x2-explicit-yield-only", "air-region-x2-parent-integration-deferred", "air-region-x2-no-implicit-parent-mutation", "air-region-x2-no-boolean", "air-region-x2-no-brep-emission", "air-region-x2-no-step-smoke", "air-region-x2-no-cir-mirror", "air-region-x2-trace-only"],+ ["side-hole geometry integration not implemented", "concrete through depth deferred", "opposite-side exit boundary deferred"],+ ["escapes only through explicit yield", "no implicit parent mutation", "no Boolean", "no BRep emission", "no production route replacement", "trace-only"],+ SideHoleYield(root.RegionId));+ return Summary([root, side], ["air-region-x1-region-trace-created", "air-region-x1-no-implicit-parent-mutation", "air-region-x1-no-boolean", "air-region-x1-no-brep-emission", "air-region-x1-no-production-route-replacement", "air-region-x1-trace-only", "air-region-x2-yield-contract-created", "air-region-x2-side-hole-yield-created", "air-region-x2-region-locality-enforced", "air-region-x2-explicit-yield-only", "air-region-x2-parent-integration-deferred", "air-region-x2-no-boolean", "air-region-x2-no-brep-emission", "air-region-x2-no-step-smoke", "air-region-x2-no-cir-mirror", "air-region-x2-trace-only"], ["escapes only through explicit yield", "no Boolean", "no geometry", "no BRep emission", "no STEP smoke", "no production route replacement"]);}public static AirRegionTraceSummary ForImplicitParentMutationRejected(){var root = RootRegion("region-created");- var bad = new AirRegionSummary("region:implicit-parent-mutation", AirRegionKind.FaceAttachedRegion, root.RegionId, AirRegionEffectKind.Subtractive, AirRegionYieldKind.None, AirRegionBoundaryContractKind.RejectedOrDeferred, new AirLocalFrameSummary("frame:implicit-parent-mutation", AirLocalFrameKind.FaceAttached, new(5, 0, 0), new(0, 1, 0), new(0, 0, 1), new(1, 0, 0), AirLocalFrameHandedness.RightHanded, "box.face(\"+X\")", "+X", "+Z", true, ["air-region-x1-face-attached-frame-created"]), AirRegionIntegrationStatus.Rejected, "rejected:implicit-parent-mutation", "region-rejected", "AIR-REGION-X1 metadata-driven fixture", ["air-region-x1-implicit-parent-mutation-rejected"], ["implicit parent mutation rejected"], ["no geometry", "no BRep emission", "no Boolean"]);- return Summary([root, bad], ["air-region-x1-region-trace-created", "air-region-x1-implicit-parent-mutation-rejected", "air-region-x1-no-brep-emission", "air-region-x1-no-boolean"], ["no Boolean", "no geometry", "no BRep emission"]);+ var bad = new AirRegionSummary("region:implicit-parent-mutation", AirRegionKind.FaceAttachedRegion, root.RegionId, AirRegionEffectKind.Subtractive, AirRegionYieldKind.None, AirRegionBoundaryContractKind.RejectedOrDeferred, new AirLocalFrameSummary("frame:implicit-parent-mutation", AirLocalFrameKind.FaceAttached, new(5, 0, 0), new(0, 1, 0), new(0, 0, 1), new(1, 0, 0), AirLocalFrameHandedness.RightHanded, "box.face(\"+X\")", "+X", "+Z", true, ["air-region-x1-face-attached-frame-created"]), AirRegionIntegrationStatus.Rejected, "rejected:implicit-parent-mutation", "region-rejected", "AIR-REGION-X1 metadata-driven fixture", ["air-region-x1-implicit-parent-mutation-rejected", "air-region-x2-implicit-parent-mutation-rejected", "air-region-x2-missing-explicit-yield-rejected", "air-region-x2-boundary-contract-required"], ["implicit parent mutation rejected", "missing explicit yield", "boundary contract required"], ["no geometry", "no BRep emission", "no Boolean"]);+ return Summary([root, bad], ["air-region-x1-region-trace-created", "air-region-x1-implicit-parent-mutation-rejected", "air-region-x1-no-brep-emission", "air-region-x1-no-boolean", "air-region-x2-implicit-parent-mutation-rejected", "air-region-x2-missing-explicit-yield-rejected", "air-region-x2-boundary-contract-required"], ["no Boolean", "no geometry", "no BRep emission"]);}+ private static AirRegionYieldSummary SideHoleYield(string parentRegionId) => new(+ "yield:side-hole:+x:subtractive-volume", AirRegionYieldKind.YieldSubtractiveVolume, "SideHole", AirRegionEffectKind.Subtractive, "frame:side-hole:+x", parentRegionId,+ new("Face", parentRegionId, "parser-backed/root box fixture", "+X", "SideFace", "frame:side-hole:+x", ["air-region-x2-face-attachment-recorded"]),+ new("Circle", new(0, 0), 1, "CircularEntryLoop", "frame:side-hole:+x/profile"),+ new("FaceNormal", "LocalZ", "Inward", true, "Through", ["air-region-x2-through-direction-recorded"]),+ new("ParentBodyLocalFeature", true, "+X", false, true, ["air-region-x2-affected-scope-recorded", "air-region-x2-explicit-yield-only"]),+ new("ThroughCut", "CircularEntryLoop", "Deferred", "CircularRimIntent", "Deferred", ["air-region-x2-boundary-intent-recorded", "air-region-x2-entry-loop-intent-recorded", "air-region-x2-exit-boundary-deferred"]),+ AirRegionIntegrationStatus.Deferred,+ ["air-region-x2-yield-contract-created", "air-region-x2-side-hole-yield-created", "air-region-x2-region-locality-enforced"],+ ["concrete through depth deferred", "opposite-side exit boundary deferred", "side-hole geometry integration not implemented"],+ ["escapes only through explicit yield", "parent body local feature scope", "no implicit parent mutation", "no Boolean", "no BRep emission"]);+private static AirRegionSummary RootRegion(string stageReached) => new("region:root", AirRegionKind.RootRegion, null, AirRegionEffectKind.PureConstruction, AirRegionYieldKind.YieldBody, AirRegionBoundaryContractKind.YieldsBody, new AirLocalFrameSummary("frame:world-root", AirLocalFrameKind.WorldRoot, new(0, 0, 0), new(1, 0, 0), new(0, 1, 0), new(0, 0, 1), AirLocalFrameHandedness.RightHanded, null, null, null, true, ["air-region-x1-world-root-frame-created"]), AirRegionIntegrationStatus.NotRequired, "root-body", stageReached, "AIR-REGION-X1", ["air-region-x1-root-region-created"], [], ["root region is a trace-only summary"]);private static AirRegionTraceSummary Summary(IReadOnlyList<AirRegionSummary> regions, IReadOnlyList<string> diagnostics, IReadOnlyList<string> guarantees) => new(regions, "region:root", regions.Count, regions.Any(r => r.ParentRegionId is not null), diagnostics.Order(StringComparer.Ordinal).ToArray(), guarantees.Order(StringComparer.Ordinal).ToArray());}diff --git a/docs/air-a0-aetheris-v2-compiler-ir-constitution.md b/docs/air-a0-aetheris-v2-compiler-ir-constitution.mdindex afea151e..e614cc39 100644--- a/docs/air-a0-aetheris-v2-compiler-ir-constitution.md+++ b/docs/air-a0-aetheris-v2-compiler-ir-constitution.md@@ -788,3 +788,7 @@ AIR-X11 establishes the first parser-backed Constructive AIR to existing emissio## AIR-REGION-X1 status noteAIR-REGION-X1 adds a trace-only AIR Region skeleton: parser-backed box fixtures report a `RootRegion`, region fixtures can report metadata-driven `FaceAttachedRegion` yields with deferred integration, and no Boolean, geometry emission, production route replacement, grammar expansion, BRepPlan semantics, or CIR behavior is changed. See `docs/air-region-x1-region-model-skeleton-trace-fixtures.md`.++## AIR-REGION-X2 constitution note++AIR-REGION-X2 reinforces that AIR Region yields carry construction intent across scoped boundaries. The side-hole `FaceAttachedRegion` yield is explicit, local, and deferred, allowing later lowering to choose an integration route without treating Boolean subtraction as the region model.diff --git a/docs/air-a1-air-regions-scoped-feature-lowering-audit.md b/docs/air-a1-air-regions-scoped-feature-lowering-audit.mdindex b6dba3b0..006a0242 100644--- a/docs/air-a1-air-regions-scoped-feature-lowering-audit.md+++ b/docs/air-a1-air-regions-scoped-feature-lowering-audit.md@@ -628,3 +628,7 @@ AIR-A1 explicitly does not include:## AIR-REGION-X1 status noteAIR-REGION-X1 adds a trace-only AIR Region skeleton: parser-backed box fixtures report a `RootRegion`, region fixtures can report metadata-driven `FaceAttachedRegion` yields with deferred integration, and no Boolean, geometry emission, production route replacement, grammar expansion, BRepPlan semantics, or CIR behavior is changed. See `docs/air-region-x1-region-model-skeleton-trace-fixtures.md`.++## AIR-REGION-X2 status note++AIR-REGION-X2 implements a trace-only side-hole yield boundary contract for the metadata-driven `FaceAttachedRegion` fixture. The contract records `SideHole` feature intent, face attachment, circular profile radius, through/inward direction, parent-body-local affected scope, through-cut boundary intent, deferred exit boundary, and explicit-yield-only locality guarantees. Parent integration remains deferred and no production geometry, Boolean, BRepPlan, CIR, STEP, or grammar behavior changes.diff --git a/docs/air-region-x1-region-model-skeleton-trace-fixtures.md b/docs/air-region-x1-region-model-skeleton-trace-fixtures.mdindex d7a94a6d..3edda5f6 100644--- a/docs/air-region-x1-region-model-skeleton-trace-fixtures.md+++ b/docs/air-region-x1-region-model-skeleton-trace-fixtures.md@@ -41,3 +41,7 @@ Focused CLI tests cover root-region box reporting, side-hole text and JSON, impl## Recommended next milestoneAIR-REGION-X2 — Side-hole FaceAttachedRegion mock yield refinement and boundary contract. The implementation showed that trace contracts are now visible, but the next blocker is sharpening yield/boundary metadata before any BRepPlan or CIR analysis is attempted.++## AIR-REGION-X2 note++AIR-REGION-X2 extends the X1 side-hole `FaceAttachedRegion` trace with a structured yield contract. The region still reports `YieldSubtractiveVolume`, `YieldsCutVolume`, and `Deferred` integration, but the emitted trace now includes feature kind, attachment, profile, direction, affected scope, boundary intent, diagnostics, known losses, and locality guarantees. This remains metadata-driven and trace-only: no side-hole geometry, Boolean, BRepPlan, CIR, STEP smoke, or production route replacement is introduced.diff --git a/docs/air-region-x2-side-hole-yield-boundary-contract.md b/docs/air-region-x2-side-hole-yield-boundary-contract.mdnew file mode 100644index 00000000..789c81a7--- /dev/null+++ b/docs/air-region-x2-side-hole-yield-boundary-contract.md@@ -0,0 +1,81 @@+# AIR-REGION-X2 — Side-hole yield boundary contract++## Purpose and scope++AIR-REGION-X2 refines the trace-only side-hole `FaceAttachedRegion` so its yielded value carries construction intent instead of only saying that a subtractive volume exists. The change is still a trace contract: it does not implement side-hole geometry, invoke Boolean, emit BRep, add BRepPlan integration, mirror to CIR, or expand Firmament grammar.++## Relationship to AIR-A1 and AIR-REGION-X1++AIR-A1 defines AIR Regions as scoped construction islands whose effects escape only through explicit yields. AIR-REGION-X1 added the minimal region trace model and metadata-driven fixtures. X2 keeps the same fixture route and deferred integration, but adds a structured yield summary for the side-hole contract.++## Why yield contracts enforce locality++A parent body should not observe arbitrary internal mutation from a nested region. The parent sees a typed yield with an explicit affected scope. For the side-hole fixture this means: a face-attached local frame constructs a circular through-hole intent, and the only escaping effect is a `YieldSubtractiveVolume` contract whose integration remains deferred.++## Fixture path++The side-hole fixture is `fixtures/Firmament/Region/valid/side-hole-face-attached-region.valid.firmfixture`.++## Yield contract fields++The JSON trace stores the contract under each region's `yield` field when a region has an escaping yield:++- `attachment`: face attachment, parent region/body, face selector, face role, local frame, attachment diagnostics.+- `profile`: profile kind, local center, radius, loop kind, and profile frame.+- `direction`: direction kind, axis, sense, through flag, depth, diagnostics.+- `affectedScope`: parent-body-local feature scope, affected face selector, sibling impact flag, and explicit-yield-only flag.+- `boundaryIntent`: through-cut boundary, entry loop intent, deferred exit boundary, rim intent, patch intent, diagnostics.+- `integrationStatus`: remains `Deferred` for the side-hole fixture.++## Locality guarantees++X2 records these guarantees for the side-hole yield:++- escapes only through explicit yield;+- parent body local feature scope;+- no implicit parent mutation;+- no Boolean;+- no BRep emission.++## Side-hole contract++First-scope side-hole values are symbolic and deterministic:++- attachment face: `+X`;+- profile: `Circle`, center `(0,0)`, radius `1` in the local face/profile frame;+- direction: through/inward along the face normal (`FaceNormal`, `LocalZ`, `Inward`, `IsThrough=true`, `Depth=Through`);+- boundary: `ThroughCut`;+- entry: circular entry loop on the `+X` face;+- exit: opposite-side exit boundary deferred;+- rim: circular rim intent;+- affected scope: parent body only, local feature scope;+- integration: deferred.++## Invalid implicit parent mutation fixture++`fixtures/Firmament/Region/invalid/implicit-parent-mutation.invalid.firmfixture` still rejects direct parent mutation. X2 preserves the X1 rejection and adds diagnostics for missing explicit yield and missing boundary contract.++## Trace output examples++Text output includes a `Region yield` block with `Feature: SideHole`, `Profile: Circle(radius=1, center=(0,0))`, `Direction: through inward along face normal`, `Boundary: ThroughCut`, affected scope, deferred integration, and guarantees.++JSON output includes stable fields under `regions.regions[].yield`, including `featureKind`, `yieldKind`, `attachment`, `profile`, `direction`, `affectedScope`, `boundaryIntent`, and `integrationStatus`.++## Non-goals++- no side-hole geometry;+- no Boolean;+- no BRepPlan integration;+- no CIR mirror;+- no production route replacement;+- no grammar expansion;+- no STEP smoke for side-hole;+- no BRep topology changes.++## Tests run++The implementation was validated with CLI help, side-hole text and JSON traces, implicit-parent-mutation JSON trace, parser-backed box trace, focused CLI tests, and the requested filtered .NET test commands.++## Recommended next milestone++Recommended: **AIR-REGION-X3 — Region BRepPlan boundary contract for side-hole, no integration**. X2 now carries enough attachment/profile/direction/boundary/scope intent to define an analysis-only BRepPlan boundary contract without committing to Boolean integration or production side-hole geometry.diff --git a/docs/air-x6-aetheris-trace-lowering-report-cli.md b/docs/air-x6-aetheris-trace-lowering-report-cli.mdindex d9c43a6d..f0e027c8 100644--- a/docs/air-x6-aetheris-trace-lowering-report-cli.md+++ b/docs/air-x6-aetheris-trace-lowering-report-cli.md@@ -167,3 +167,7 @@ For parser-backed Firmament box fixtures, `aetheris trace --fixture` may include## AIR-REGION-X1 status noteAIR-REGION-X1 adds a trace-only AIR Region skeleton: parser-backed box fixtures report a `RootRegion`, region fixtures can report metadata-driven `FaceAttachedRegion` yields with deferred integration, and no Boolean, geometry emission, production route replacement, grammar expansion, BRepPlan semantics, or CIR behavior is changed. See `docs/air-region-x1-region-model-skeleton-trace-fixtures.md`.++## AIR-REGION-X2 region yield contract trace note++For the side-hole region fixture, `aetheris trace` now renders a `Region yield` block in text and a structured `regions.regions[].yield` object in JSON. The fields are stable trace summaries for attachment, profile, direction, affected scope, boundary intent, integration status, diagnostics, known losses, and guarantees. The side-hole route remains trace-only and deferred.diff --git a/docs/air-x7-firmament-fixture-trace-corpus.md b/docs/air-x7-firmament-fixture-trace-corpus.mdindex 33834c24..44a31093 100644--- a/docs/air-x7-firmament-fixture-trace-corpus.md+++ b/docs/air-x7-firmament-fixture-trace-corpus.md@@ -122,3 +122,7 @@ The parser-backed primitive box fixture advances to existing profile extrusion e## AIR-REGION-X1 status noteAIR-REGION-X1 adds a trace-only AIR Region skeleton: parser-backed box fixtures report a `RootRegion`, region fixtures can report metadata-driven `FaceAttachedRegion` yields with deferred integration, and no Boolean, geometry emission, production route replacement, grammar expansion, BRepPlan semantics, or CIR behavior is changed. See `docs/air-region-x1-region-model-skeleton-trace-fixtures.md`.++## AIR-REGION-X2 side-hole fixture note++The region fixture corpus now uses `fixtures/Firmament/Region/valid/side-hole-face-attached-region.valid.firmfixture` to validate a side-hole `FaceAttachedRegion` yield contract. Metadata records the expected side-hole feature, circle profile, radius, attachment face, direction, boundary kind, and affected scope without requiring production Firmament grammar support.diff --git a/fixtures/Firmament/Region/invalid/implicit-parent-mutation.invalid.firmfixture b/fixtures/Firmament/Region/invalid/implicit-parent-mutation.invalid.firmfixtureindex 607e474e..6b8d4be7 100644--- a/fixtures/Firmament/Region/invalid/implicit-parent-mutation.invalid.firmfixture+++ b/fixtures/Firmament/Region/invalid/implicit-parent-mutation.invalid.firmfixture@@ -2,6 +2,8 @@// expected: invalid// expected-stage: region-rejected// expected-reason: implicit-parent-mutation-rejected+// expected-diagnostic: air-region-x2-missing-explicit-yield-rejected+// expected-diagnostic: air-region-x2-boundary-contract-required// description: Region fixture that attempts parent mutation without explicit yield.solid box = Box(width: 10, depth: 8, height: 6);diff --git a/fixtures/Firmament/Region/valid/side-hole-face-attached-region.valid.firmfixture b/fixtures/Firmament/Region/valid/side-hole-face-attached-region.valid.firmfixtureindex 0b042aed..360658e4 100644--- a/fixtures/Firmament/Region/valid/side-hole-face-attached-region.valid.firmfixture+++ b/fixtures/Firmament/Region/valid/side-hole-face-attached-region.valid.firmfixture@@ -6,6 +6,13 @@// expected-yield: YieldSubtractiveVolume// expected-boundary: YieldsCutVolume// expected-integration: Deferred+// expected-yield-feature: SideHole+// expected-profile: Circle+// expected-radius: 1+// expected-attachment-face: +X+// expected-direction: through-inward+// expected-boundary-kind: ThroughCut+// expected-affected-scope: ParentBodyLocalFeature// description: Trace-only face-attached side-hole region fixture; integration deferred.solid box = Box(width: 10, depth: 8, height: 6);