perf(diag): complete trustworthy Slice A capture tooling

Correct whole-frame GPU timestamps so they bracket only the accepted render transaction and associate delayed query results with the owning CPU frame. Add route-wide frame-history summaries, fixed-camera screenshot comparison, process counters, contention traces, a pinned Arwic workload, and credential-safe launch disclosure.

The reference hardware/display contract now keeps local and RDP populations separate and defines the screenshot and re-baseline rules needed by later prepared-content gates.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-24 12:46:51 +02:00
parent bf7ec12f68
commit 3ee8ec537a
23 changed files with 1639 additions and 170 deletions

View file

@ -18,10 +18,11 @@ public sealed class ConnectedR6SoakContractTests
[Fact]
public void RouteContainsExactlyNineOrderedCheckpointBarriers()
{
string[] checkpoints = File.ReadAllLines(Path.Combine(
FindRepoRoot(),
"tools",
"connected-r6-soak.route.txt"))
string routePath = Path.Combine(
FindRepoRoot(),
"tools",
"connected-r6-soak.route.txt");
string[] checkpoints = File.ReadAllLines(routePath)
.Select(static line => line.Trim())
.Where(static line => line.StartsWith(
"checkpoint ",
@ -31,10 +32,7 @@ public sealed class ConnectedR6SoakContractTests
Assert.Equal(ExpectedCheckpointNames, checkpoints);
string[] teleports = File.ReadAllLines(Path.Combine(
FindRepoRoot(),
"tools",
"connected-r6-soak.route.txt"))
string[] teleports = File.ReadAllLines(routePath)
.Select(static line => line.Trim())
.Where(static line => line.StartsWith(
"command /teleloc ",
@ -45,6 +43,97 @@ public sealed class ConnectedR6SoakContractTests
" 1 0 0 0",
line,
StringComparison.Ordinal));
string[] screenshots = File.ReadAllLines(routePath)
.Select(static line => line.Trim())
.Where(static line => line.StartsWith(
"screenshot ",
StringComparison.Ordinal))
.Select(static line => line.Split(' ', StringSplitOptions.RemoveEmptyEntries)[1])
.ToArray();
Assert.Equal(ExpectedCheckpointNames, screenshots);
}
[Fact]
public void DenseTownRoutePinsArwicViewAndScreenshot()
{
string[] route = File.ReadAllLines(Path.Combine(
FindRepoRoot(),
"tools",
"connected-dense-town.route.txt"))
.Select(static line => line.Trim())
.Where(static line => line.Length > 0 && !line.StartsWith('#'))
.ToArray();
AssertAppearsInOrder(
string.Join('\n', route),
"command /telepoi Arwic",
"wait materialized 1 60000",
"input down MovementTurnRight",
"sleep 6000",
"input up MovementTurnRight",
"screenshot arwic-dense 10000",
"checkpoint arwic-dense");
}
[Fact]
public void PerformanceRoutesPinNoonBeforeTheirFirstTeleport()
{
foreach (string routeName in new[]
{
"connected-r6-soak.route.txt",
"connected-dense-town.route.txt",
})
{
string source = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"tools",
routeName));
int firstTeleport = source.IndexOf("command /tele", StringComparison.Ordinal);
Assert.True(firstTeleport > 0, $"{routeName} has no teleport command.");
string preTeleport = source[..firstTeleport];
Assert.Equal(
3,
CountOccurrences(
preTeleport,
"input press AcdreamCycleTimeOfDay"));
}
}
[Fact]
public void ReferenceConfigurationDefinesLocalAuthorityAndScreenshotRule()
{
string source = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"docs",
"research",
"2026-07-24-performance-reference-configuration.json"));
using System.Text.Json.JsonDocument document =
System.Text.Json.JsonDocument.Parse(source);
System.Text.Json.JsonElement root = document.RootElement;
Assert.Equal(
"performance-gate",
root.GetProperty("displayPaths")
.GetProperty("authoritativeLocal")
.GetProperty("authority")
.GetString());
Assert.Equal(
"diagnostic-only",
root.GetProperty("displayPaths")
.GetProperty("diagnosticRdp")
.GetProperty("authority")
.GetString());
Assert.Equal(
2,
root.GetProperty("screenshotComparison")
.GetProperty("channelTolerance")
.GetInt32());
Assert.Equal(
0.001,
root.GetProperty("screenshotComparison")
.GetProperty("maxDifferentPixelFraction")
.GetDouble());
}
[Fact]
@ -178,11 +267,102 @@ public sealed class ConnectedR6SoakContractTests
"EnvDisclosure = Join-Path $artifactDir 'env-disclosure.json'",
source,
StringComparison.Ordinal);
Assert.Contains(
"$sensitive = $_.Name -match '(?i)(PASS|PASSWORD|TOKEN|SECRET|KEY)'",
source,
StringComparison.Ordinal);
Assert.Contains(
"Value = if ($sensitive) { '<redacted>' } else { $_.Value }",
source,
StringComparison.Ordinal);
// ACDREAM_DUMP_MOVE_TRUTH stays SET (the exercise gate greps its
// output) — it is now disclosed, not removed.
Assert.Contains("$env:ACDREAM_DUMP_MOVE_TRUTH = '1'", source, StringComparison.Ordinal);
}
[Fact]
public void SoakExportsAndSummarizesFrameHistory()
{
string source = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"tools",
"run-connected-r6-soak.ps1"));
Assert.Contains(
"$env:ACDREAM_FRAME_HISTORY = $frameHistory",
source,
StringComparison.Ordinal);
AssertAppearsInOrder(
source,
"& dotnet $cliDll summarize-frame-history",
"$frameHistory",
"$checkpointTimeline",
"$markerLog",
"$frameSummary");
Assert.Contains("FrameHistory = $frameHistory", source, StringComparison.Ordinal);
Assert.Contains("FrameSummary = $frameSummary", source, StringComparison.Ordinal);
}
[Fact]
public void ContentionCaptureIsExplicitAndIncludesStackEvents()
{
string source = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"tools",
"run-connected-r6-soak.ps1"));
Assert.Contains("[switch]$CaptureContention", source, StringComparison.Ordinal);
Assert.Contains(
"'Microsoft-Windows-DotNETRuntime:0x4000:5'",
source,
StringComparison.Ordinal);
Assert.Contains(
"ContentionTrace = if ($CaptureContention) { $contentionTrace } else { $null }",
source,
StringComparison.Ordinal);
}
[Fact]
public void RuntimeCountersCaptureProcessWideAllocationByDefault()
{
string source = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"tools",
"run-connected-r6-soak.ps1"));
Assert.Contains("[switch]$SkipRuntimeCounters", source, StringComparison.Ordinal);
AssertAppearsInOrder(
source,
"if (-not $SkipRuntimeCounters) {",
"'--counters', 'System.Runtime'",
"'--refresh-interval', '1'",
"'--format', 'csv'",
"'--output', $runtimeCounters");
Assert.Contains(
"RuntimeCounters = if (-not $SkipRuntimeCounters) { $runtimeCounters } else { $null }",
source,
StringComparison.Ordinal);
}
[Fact]
public void DenseTownModeUsesTheDedicatedOneCheckpointRoute()
{
string source = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"tools",
"run-connected-r6-soak.ps1"));
Assert.Contains("[switch]$DenseTown", source, StringComparison.Ordinal);
AssertAppearsInOrder(
source,
"if ($DenseTown) {",
"Name = 'Arwic dense'",
"$expectedCheckpointNames = @('arwic-dense')",
"$routeFileName = 'connected-dense-town.route.txt'",
"$runName = 'connected-dense-town'");
Assert.Contains("if (-not $DenseTown) {", source, StringComparison.Ordinal);
}
private static int CountOccurrences(string source, string value)
{
int count = 0;