Prove fractal pipeline composition

This commit is contained in:
Meta Vens 2026-05-18 02:45:58 +01:00
commit c856689a85
2 changed files with 62 additions and 0 deletions

View file

@ -128,3 +128,4 @@
{"timestamp":"2026-05-18T04:50:00+01:00","topic":"fractal-selected-cut-first-slice","lesson":"Projected contribution scores now compile into budgeted selected-cut rows. The first builder sorts summaries by score, clamps against estimated cost, emits fade weights, and requests children only when score crosses a threshold. This gives later residency and stochastic estimation a small deterministic target instead of mixing traversal policy into renderer code.","files":["src/Aquarium.Engine.Fractal/Lod/FractalSelectedCutBuilder.cs","tests/Aquarium.Engine.Fractal.Tests/FractalSelectedCutBuilderTests.cs","research/rendering/fractal-brush-implementation-roadmap.md"],"source":"eighth fractal implementation slice added selected-cut planning under a simple cost budget"}
{"timestamp":"2026-05-18T05:06:00+01:00","topic":"fractal-stochastic-cache-first-slice","lesson":"The contribution cache now has online estimator updates and a stochastic update scheduler. Estimator state updates mean, variance, confidence, sample count, sample age, and residency; scheduler probability keeps baseline exploration, adds pressure for visible, near-threshold, stale, uncertain, and low-confidence nodes, and remains deterministic under `IFractalRandom` for tests. This is the first bounded convergence mechanism before learned scoring is allowed anywhere near the renderer.","files":["src/Aquarium.Engine.Fractal/Lod/FractalContributionEstimator.cs","src/Aquarium.Engine.Fractal/Lod/FractalStochasticUpdateScheduler.cs","tests/Aquarium.Engine.Fractal.Tests/FractalStochasticUpdateTests.cs"],"source":"ninth fractal implementation slice added probabilistic contribution updates with deterministic mock boundaries"}
{"timestamp":"2026-05-18T05:20:00+01:00","topic":"fractal-residency-simulation-first-slice","lesson":"Selected cuts now pass through a residency planner with an `IFractalPayloadStore` mock boundary. Resident nodes render directly; missing nodes render their parent summary fallback and enqueue payload requests only when the selected cut asks for children. This keeps frame traversal nonblocking and makes SSD/GPU residency a replaceable resource policy instead of hidden renderer state.","files":["src/Aquarium.Engine.Fractal/Lod/IFractalPayloadStore.cs","src/Aquarium.Engine.Fractal/Lod/FractalResidencyPlanner.cs","tests/Aquarium.Engine.Fractal.Tests/FractalResidencyPlannerTests.cs","research/rendering/fractal-brush-implementation-roadmap.md"],"source":"tenth fractal implementation slice simulated missing/resident payload behavior before real streaming"}
{"timestamp":"2026-05-18T05:31:00+01:00","topic":"fractal-pipeline-fixture","lesson":"The first fractal architecture spine now composes end to end in a test fixture: cube tile stable key -> semantic domain/claim -> ownership tree -> conservative summary -> selected cut -> residency fallback/request -> shaped height brush compiler. Keep extending this fixture as the interview-grade proof that module boundaries are real and not prose taped to unrelated helpers.","files":["tests/Aquarium.Engine.Fractal.Tests/FractalPipelineFixtureTests.cs"],"source":"eleventh fractal implementation slice added an end-to-end composition test for the new module network"}

View file

@ -0,0 +1,61 @@
using System.Numerics;
using Aquarium.Engine.Fractal;
using Aquarium.Engine.Fractal.Brushes;
using Aquarium.Engine.Fractal.Grammar;
using Aquarium.Engine.Fractal.Lod;
namespace Aquarium.Engine.Fractal.Tests;
public sealed class FractalPipelineFixtureTests
{
[Fact]
public void CubeTileClaimPipelineProducesRenderableBudgetedBrush()
{
var tile = new CubeTileKey(CubeFace.PositiveZ, 2, 1, 1);
var domainKey = FractalStableKeyBuilder.ForCubeTile(tile, "terrain/ridges");
var rootKey = FractalStableKeyBuilder.Child(domainKey, "root");
var claimKey = FractalStableKeyBuilder.Child(rootKey, "claim/0");
var domain = new AquariumFractalDomain(domainKey, AquariumFractalDomainKind.CubeSphereTile, default, Vector4.Zero, Vector4.Zero);
var claim = new AquariumBrushClaim(
claimKey,
domainKey,
rootKey,
AquariumFractalPayloadKind.Height,
Center: new Vector2(0.25f, -0.1f),
Radii: new Vector2(0.5f, 0.2f),
RotationRadians: 0.35f,
Falloff: 3.0f,
ShapePower: 0.85f,
Amplitude: -0.4f,
Seed: 42,
Tags: "ridge");
var tree = FractalOwnershipTreeBuilder.BuildFlatUnion(domain, rootKey, [claim]);
var summaries = FractalSummaryBuilder.Build(tree);
var selectedCut = FractalSelectedCutBuilder.Build(summaries, _ => 8.0f, maxEstimatedCost: 1.0f, childRequestScore: 1.0f);
var residency = FractalResidencyPlanner.Plan(selectedCut, new EmptyPayloadStore());
var brushes = FractalHeightBrushCompiler.CompileMany(tree.Claims);
Assert.Single(tree.Nodes);
Assert.Single(summaries);
Assert.Single(selectedCut);
Assert.Single(residency.SummaryFallbackNodes);
Assert.Single(residency.RequestedNodes);
Assert.Single(brushes);
Assert.Equal(claim.Center, brushes[0].Center);
Assert.Equal(claim.Radii.X, brushes[0].Radius);
Assert.Equal(claim.Radii.Y, brushes[0].RadiusY);
}
private sealed class EmptyPayloadStore : IFractalPayloadStore
{
public bool IsResident(AquariumFractalKey nodeKey)
{
return false;
}
public void Request(AquariumFractalKey nodeKey)
{
}
}
}