Replace per-switch network simulation with aggregate per-DC statistical model
Balance Check / balance-simulation (push) Successful in 48s
Balance Check / multi-run-balance (push) Successful in 1m24s
CI / build-and-push (push) Successful in 43s

Eliminates the 22K-object switchRegistry that caused O(n×m) scans 4x per tick.
Network health is now tracked as aggregate counts per tier (totalByTier/healthyByTier)
with RepairBatch timers, cutting late-game tick cost from ~50ms to ~0.3ms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 20:06:40 -04:00
parent 57a81be769
commit 19f652b43a
4 changed files with 181 additions and 365 deletions
@@ -8,10 +8,10 @@ import type { DeepPartial } from './createTestState';
function emptyDCNetwork(): DCNetworkSummary {
return {
switchIds: [],
networkRackCount: 0,
totalByTier: {},
healthyByTier: {},
repairBatches: [],
networkRackCount: 0,
racksDisconnected: 0,
racksDegraded: 0,
averageBandwidth: 1,
@@ -20,11 +20,11 @@ function emptyDCNetwork(): DCNetworkSummary {
}
function emptyCampusNetwork(): CampusNetworkSummary {
return { switchIds: [], totalT4: 0, healthyT4: 0, crossDCBandwidth: 1 };
return { totalT4: 0, healthyT4: 0, crossDCBandwidth: 1 };
}
function emptyClusterNetwork(): ClusterNetworkSummary {
return { switchIds: [], totalT5: 0, healthyT5: 0, crossCampusBandwidth: 1 };
return { totalT5: 0, healthyT5: 0, crossCampusBandwidth: 1 };
}
export function createTestDataCenter(overrides?: DeepPartial<DataCenter>): DataCenter {