diff --git a/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs b/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs index 0c5fca4..768b6b0 100644 --- a/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs +++ b/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs @@ -629,6 +629,7 @@ public static class AquariumFieldEvidenceValidator } var claimKeys = new HashSet(StringComparer.Ordinal); + var claimsByKey = new Dictionary(StringComparer.Ordinal); var resourceKeys = new HashSet(StringComparer.Ordinal); foreach (var resource in frame.Resources) { @@ -688,6 +689,7 @@ public static class AquariumFieldEvidenceValidator } claimKeys.Add(claim.ClaimKey); + claimsByKey[claim.ClaimKey] = claim; } foreach (var candidate in frame.Candidates) @@ -751,10 +753,22 @@ public static class AquariumFieldEvidenceValidator continue; } - if (!claimKeys.Contains(lowering.ClaimKey)) + if (!claimsByKey.TryGetValue(lowering.ClaimKey, out var claim)) { issues.Add(Error(lowering.LoweringKey, $"Tube spline lowering references unknown claim '{lowering.ClaimKey}'.")); } + else + { + if (claim.Encoding != AquariumFieldEncoding.Tube) + { + issues.Add(Error(lowering.LoweringKey, $"Tube spline lowering claim '{lowering.ClaimKey}' is encoded as {claim.Encoding}, not Tube.")); + } + + if (!string.Equals(claim.PayloadHandle, lowering.ResourceKey, StringComparison.Ordinal)) + { + issues.Add(Error(lowering.LoweringKey, $"Tube spline lowering resource '{lowering.ResourceKey}' does not match claim payload '{claim.PayloadHandle}'.")); + } + } if (!resourceKeys.Contains(lowering.ResourceKey)) { diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 7f7539a..fae04fd 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -247,3 +247,4 @@ {"lesson":"TubeField now uses the first explicit pipeline-private generated mesh render lane. The compute path still owns the minimal D3D12TubeFieldVertex/index/indirect argument layout, but render now binds those buffers through a named D3D12PipelinePrivateGeneratedMesh before applying TubeField material root bindings and ExecuteIndirect. This implements the chosen generated-mesh option without creating a public imported-mesh renderer or forcing splines through PositionNormalUvColor. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:49:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"user chose pipeline-private generated mesh draw path for spline migration","topic":"pipeline-private-generated-mesh-rendering"} {"lesson":"The generated-mesh DrawIndexed indirect ABI is no longer TubeField-owned. D3D12Renderer now creates a generic generatedMeshDrawCommandSignature with the standard five-uint D3D12 DrawIndexedArguments stride; TubeField still owns its compute-emitted argument buffer, but the command signature is reusable for future pipeline-private generated mesh lowerings. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:52:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"continued pipeline-private generated mesh migration","topic":"generated-mesh-indirect-draw-abi"} {"lesson":"TubeField generated mesh dispatch now obeys AquariumFieldLoweringPlan selection authority. D3D12Renderer builds the planned TubeField claim set from backend packets and only expands matching TubeSplineLowerings; unplanned lowerings are counted in debug status instead of rendered. This prevents explicit lowering metadata from bypassing validation/planning. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:55:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"continued migration after generated mesh draw ABI","topic":"tubefield-planned-packet-authority"} +{"lesson":"TubeSpline lowering metadata is now bound to claim/resource authority at validation time. AquariumFieldEvidenceValidator rejects a TubeSpline lowering if its claim is not Tube-encoded or if the lowering resource differs from the claim payload resource. This keeps the planned-packet render gate from being the first place split authority is detected. Fensalir build, Aquarium.Engine.Tests (25 tests), and headless reload passed.","timestamp":"2026-05-26T22:58:00+01:00","files":["src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs","tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs","state/map.yaml"],"source":"continued TubeField generated mesh authority tightening","topic":"tubespline-lowering-validation"} diff --git a/state/map.yaml b/state/map.yaml index 3919205..23952ad 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -126,7 +126,9 @@ next_actions: draw ABI while owning their own producer buffers and materials. TubeField dispatch now obeys selected packet authority: only lowerings whose claim has a planned TubeField backend packet are expanded, and unplanned lowerings are - counted instead of rendered. + counted instead of rendered. Validation also rejects TubeSpline lowering + metadata whose claim is not Tube-encoded or whose resource does not match + the claim payload, so split authority is caught before render dispatch. - Move any remaining client-only Epiphany state found here back to `E:\Projects\Aquarium-Engine`. - Keep Mimir app/adapters out of this repo; Fensalir may expose generic sensor-fusion contracts only. - Package contracts/host deliberately before replacing sibling source references in client repos. diff --git a/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs b/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs index ae37c23..9c7ef0b 100644 --- a/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs +++ b/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs @@ -194,6 +194,57 @@ public sealed class FieldEvidenceContractTests Assert.Contains(report.Issues, issue => issue.Key == "mimir:resource:native-ring:asio-ch0"); } + [Fact] + public void ValidatorRejectsTubeSplineLoweringClaimEncodingMismatch() + { + var frame = BuildValidTubeEvidenceFrame(); + frame = new AquariumFieldEvidenceFrame + { + Resources = frame.Resources, + Domains = frame.Domains, + Claims = [frame.Claims[0] with { Encoding = AquariumFieldEncoding.Mesh }], + Candidates = frame.Candidates, + BackendPackets = frame.BackendPackets, + TubeSplineLowerings = frame.TubeSplineLowerings, + AccumulationWindowSeconds = frame.AccumulationWindowSeconds, + PresentationDelaySeconds = frame.PresentationDelaySeconds, + }; + + var report = AquariumFieldEvidenceValidator.Validate(frame); + + Assert.True(report.HasErrors); + Assert.Contains(report.Issues, issue => issue.Key == "tube-spline:mimir:spectrum:asio-ch0:42"); + } + + [Fact] + public void ValidatorRejectsTubeSplineLoweringResourceMismatch() + { + var frame = BuildValidTubeEvidenceFrame(); + frame = new AquariumFieldEvidenceFrame + { + Resources = + [ + frame.Resources[0], + frame.Resources[0] with { ResourceKey = "mimir:resource:native-ring:asio-ch1" }, + ], + Domains = frame.Domains, + Claims = frame.Claims, + Candidates = frame.Candidates, + BackendPackets = frame.BackendPackets, + TubeSplineLowerings = + [ + frame.TubeSplineLowerings[0] with { ResourceKey = "mimir:resource:native-ring:asio-ch1" }, + ], + AccumulationWindowSeconds = frame.AccumulationWindowSeconds, + PresentationDelaySeconds = frame.PresentationDelaySeconds, + }; + + var report = AquariumFieldEvidenceValidator.Validate(frame); + + Assert.True(report.HasErrors); + Assert.Contains(report.Issues, issue => issue.Key == "tube-spline:mimir:spectrum:asio-ch0:42"); + } + [Fact] public void NormalizerBuildsPendingLoweringRequestsWithoutChoosingBackend() {