feat: add STEP-093 runtime validation tooling

This commit is contained in:
tei
2026-09-24 14:39:39 +09:00
parent 8a5d88008c
commit b3ec8edc87
20 changed files with 765 additions and 24 deletions

View File

@@ -57,6 +57,7 @@ ParticleFastPathGateInput fastPathInput() {
.stillImageRequest = false,
.continuousMode = true,
.debugDisabled = true,
.unsupportedContinuousLayer = false,
.supportedScene = true,
.annotationMutation = false,
};
@@ -124,6 +125,46 @@ TEST(RetainedUnderlayCache, BuildReuseAndInvalidation) {
EXPECT_EQ(cache.getLastInvalidationReason(), "camera-or-boundary");
}
TEST(RetainedUnderlayCache, RuntimeValidationDiagnosticsExposeRangeResourcesAndFastPath) {
RetainedUnderlayRuntimeState state;
ASSERT_TRUE(state.setContinuousLayerRange("weather", "particle"));
const auto config = state.continuousLayerRangeConfig();
state.recordRangeResolution(
{.configured = true,
.valid = true,
.startLayerId = "weather",
.endLayerId = "particle",
.startIndex = 2,
.endIndex = 3,
.configRevision = config.revision,
.reason = "explicit-range"},
true,
true);
state.recordRangeCacheState(false, RetainedRangeCacheState::Reuse);
state.recordRangeInvalidationReason(false, RetainedUnderlayReason::Viewport);
state.recordRangeTextureCreate(false);
state.recordRangeCompositeCreate(false);
state.recordRangeResourceRelease(false);
state.recordFastPathEligibility(true);
state.recordFastPathDecision(true, ParticleFastPathMissReason::None);
state.recordFullCpuFrame();
const auto snapshot = state.snapshot();
EXPECT_TRUE(snapshot.rangeValid);
EXPECT_EQ(snapshot.continuousBegin, 2);
EXPECT_EQ(snapshot.continuousEndExclusive, 4);
EXPECT_EQ(snapshot.bottomCacheState, "reuse");
EXPECT_EQ(snapshot.bottomLastInvalidationReason, "viewport");
EXPECT_EQ(snapshot.bottomTextureCreate, 1u);
EXPECT_EQ(snapshot.bottomCompositeCreate, 1u);
EXPECT_EQ(snapshot.bottomResourceRelease, 1u);
EXPECT_TRUE(snapshot.fastPathEligible);
EXPECT_FALSE(snapshot.fastPathActive);
EXPECT_EQ(snapshot.fastPathHit, 1u);
EXPECT_EQ(snapshot.fastPathMiss, 0u);
EXPECT_EQ(snapshot.fullCpuFrame, 1u);
}
TEST(RetainedUnderlayRevision, MonotonicAcrossCameraViewportStyleAndSourceChanges) {
RetainedUnderlayRevisionTracker tracker;
RetainedUnderlayCache cache;
@@ -556,6 +597,10 @@ TEST(ParticleFastPath, PendingStillAndUnsupportedPathsReject) {
input = fastPathInput();
input.supportedScene = false;
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::UnsupportedScene);
input = fastPathInput();
input.unsupportedContinuousLayer = true;
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::UnsupportedContinuousLayer);
}
TEST(ParticleFastPath, FullFrameCanRestabilizeCandidate) {