Pin every ACE teleloc to an explicit starting quaternion and distinguish stable-workload owner growth from legitimate authoritative population, visibility, and cache-retirement changes. Preserve the original process residency and frame-cost limits while making canonical deltas actionable. Co-authored-by: Codex <codex@openai.com>
156 lines
5.1 KiB
C#
156 lines
5.1 KiB
C#
namespace AcDream.App.Tests.Diagnostics;
|
|
|
|
public sealed class ConnectedR6SoakContractTests
|
|
{
|
|
private static readonly string[] ExpectedCheckpointNames =
|
|
[
|
|
"caul-baseline",
|
|
"sawato-baseline",
|
|
"rynthid",
|
|
"aerlinthe",
|
|
"sawato-return",
|
|
"holtburg",
|
|
"caul-return",
|
|
"sawato-plateau",
|
|
"caul-plateau",
|
|
];
|
|
|
|
[Fact]
|
|
public void RouteContainsExactlyNineOrderedCheckpointBarriers()
|
|
{
|
|
string[] checkpoints = File.ReadAllLines(Path.Combine(
|
|
FindRepoRoot(),
|
|
"tools",
|
|
"connected-r6-soak.route.txt"))
|
|
.Select(static line => line.Trim())
|
|
.Where(static line => line.StartsWith(
|
|
"checkpoint ",
|
|
StringComparison.Ordinal))
|
|
.Select(static line => line["checkpoint ".Length..])
|
|
.ToArray();
|
|
|
|
Assert.Equal(ExpectedCheckpointNames, checkpoints);
|
|
|
|
string[] teleports = File.ReadAllLines(Path.Combine(
|
|
FindRepoRoot(),
|
|
"tools",
|
|
"connected-r6-soak.route.txt"))
|
|
.Select(static line => line.Trim())
|
|
.Where(static line => line.StartsWith(
|
|
"command /teleloc ",
|
|
StringComparison.Ordinal))
|
|
.ToArray();
|
|
Assert.Equal(9, teleports.Length);
|
|
Assert.All(teleports, static line => Assert.EndsWith(
|
|
" 1 0 0 0",
|
|
line,
|
|
StringComparison.Ordinal));
|
|
}
|
|
|
|
[Fact]
|
|
public void GateConsumesCanonicalTimelineWithoutWeakeningResidencyFormulas()
|
|
{
|
|
string source = File.ReadAllText(Path.Combine(
|
|
FindRepoRoot(),
|
|
"tools",
|
|
"run-connected-r6-soak.ps1"));
|
|
|
|
AssertAppearsInOrder(
|
|
source,
|
|
"$expectedCheckpointNames = @(",
|
|
"'caul-baseline'",
|
|
"'sawato-baseline'",
|
|
"'rynthid'",
|
|
"'aerlinthe'",
|
|
"'sawato-return'",
|
|
"'holtburg'",
|
|
"'caul-return'",
|
|
"'sawato-plateau'",
|
|
"'caul-plateau'");
|
|
AssertAppearsInOrder(
|
|
source,
|
|
"$canonicalCheckpoints = @(Read-CanonicalCheckpoints)",
|
|
"Add-CanonicalCheckpointFailures $process",
|
|
"Add-RelativeGateFailures");
|
|
Assert.Contains("CanonicalCheckpoints = @($canonicalCheckpoints)", source);
|
|
Assert.Contains("CheckpointTimeline = $checkpointTimeline", source);
|
|
Assert.Contains(
|
|
"Join-Path $artifactDir \"checkpoint-$expectedName.json\"",
|
|
source,
|
|
StringComparison.Ordinal);
|
|
Assert.Contains(
|
|
"missing render-world synchronization fields",
|
|
source,
|
|
StringComparison.Ordinal);
|
|
Assert.Contains(
|
|
"canonical cache '$field' grew",
|
|
source,
|
|
StringComparison.Ordinal);
|
|
Assert.Contains(
|
|
"if ($workloadChanged) { $warnings.Add($message) }",
|
|
source,
|
|
StringComparison.Ordinal);
|
|
|
|
string[] zeroFields =
|
|
[
|
|
"pendingLiveTeardowns",
|
|
"pendingLandblockRetirements",
|
|
"stagedMeshUploads",
|
|
"stagedMeshBytes",
|
|
"compositeWarmupPending",
|
|
];
|
|
foreach (string field in zeroFields)
|
|
Assert.Contains($"'{field}'", source, StringComparison.Ordinal);
|
|
|
|
Assert.Equal(1, CountOccurrences(
|
|
source,
|
|
"$privateLimit = [Math]::Max(192.0, $pair.First.PrivateMiB * 0.20)"));
|
|
Assert.Equal(1, CountOccurrences(
|
|
source,
|
|
"$workingLimit = [Math]::Max(192.0, $pair.First.WorkingSetMiB * 0.20)"));
|
|
Assert.Equal(1, CountOccurrences(
|
|
source,
|
|
"$updateLimit = $pair.First.UpdateP95Ms * 1.5 + 0.5"));
|
|
Assert.Equal(1, CountOccurrences(
|
|
source,
|
|
"$allocLimit = $pair.First.AllocP50Kb * 1.5 + 16.0"));
|
|
}
|
|
|
|
private static int CountOccurrences(string source, string value)
|
|
{
|
|
int count = 0;
|
|
int cursor = 0;
|
|
while ((cursor = source.IndexOf(value, cursor, StringComparison.Ordinal)) >= 0)
|
|
{
|
|
count++;
|
|
cursor += value.Length;
|
|
}
|
|
|
|
return count;
|
|
}
|
|
|
|
private static void AssertAppearsInOrder(string source, params string[] values)
|
|
{
|
|
int cursor = -1;
|
|
foreach (string value in values)
|
|
{
|
|
int next = source.IndexOf(value, cursor + 1, StringComparison.Ordinal);
|
|
Assert.True(next >= 0, $"Missing expected source fragment: {value}");
|
|
Assert.True(next > cursor, $"Out-of-order source fragment: {value}");
|
|
cursor = next;
|
|
}
|
|
}
|
|
|
|
private static string FindRepoRoot()
|
|
{
|
|
DirectoryInfo? directory = new(AppContext.BaseDirectory);
|
|
while (directory is not null)
|
|
{
|
|
if (File.Exists(Path.Combine(directory.FullName, "AcDream.slnx")))
|
|
return directory.FullName;
|
|
directory = directory.Parent;
|
|
}
|
|
|
|
throw new DirectoryNotFoundException("Could not find AcDream.slnx.");
|
|
}
|
|
}
|