Fix Fill Capacity exceeding DC slot limit due to double-counted failed racks
CI / build-and-push (push) Successful in 38s
CI / build-and-push (push) Successful in 38s
computeRacksFailed was incremented on production failure and never decremented when repaired racks came back online, while repair cohorts also tracked the same racks. This caused usedSlots to inflate past the DC capacity over time. Fix: derive computeRacksFailed from repair cohorts each tick instead of maintaining it as a running counter. Include repair cohorts in pipeline slot accounting so all racks are counted exactly once. Also fixes power limit in fillDCToCapacity to only count online racks (pipeline racks don't draw power). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -195,7 +195,6 @@ export function processInfrastructure(state: GameState): InfraTickResult {
|
||||
}
|
||||
|
||||
let computeRacksOnline = dc.computeRacksOnline;
|
||||
let computeRacksFailed = dc.computeRacksFailed;
|
||||
let dcRepairCosts = 0;
|
||||
|
||||
// Process retrofit
|
||||
@@ -349,7 +348,6 @@ export function processInfrastructure(state: GameState): InfraTickResult {
|
||||
const prodFailures = binomialSample(computeRacksOnline, effectiveRate);
|
||||
if (prodFailures > 0) {
|
||||
computeRacksOnline -= prodFailures;
|
||||
computeRacksFailed += prodFailures;
|
||||
const repairCost = sku.baseCost * sku.repairCostFraction * prodFailures;
|
||||
dcRepairCosts += repairCost;
|
||||
|
||||
@@ -400,12 +398,15 @@ export function processInfrastructure(state: GameState): InfraTickResult {
|
||||
// Compute aggregates for this DC
|
||||
const location = LOCATION_CONFIGS[cluster.locationId];
|
||||
const tierConfig = DC_TIER_CONFIGS[dc.tier];
|
||||
const totalRacksInDc = computeRacksOnline + computeRacksFailed;
|
||||
const netSlots = networkSlotsRequired(computeRacksOnline);
|
||||
const pipelineRacks = updatedCohorts
|
||||
.filter(c => c.stage !== 'decommission' && c.stage !== 'repair')
|
||||
.filter(c => c.stage !== 'decommission')
|
||||
.reduce((sum, c) => sum + c.count, 0);
|
||||
const usedSlots = totalRacksInDc + netSlots + pipelineRacks;
|
||||
const computeRacksFailed = updatedCohorts
|
||||
.filter(c => c.stage === 'repair')
|
||||
.reduce((sum, c) => sum + c.count, 0);
|
||||
const totalRacksInDc = computeRacksOnline + pipelineRacks;
|
||||
const netSlots = networkSlotsRequired(computeRacksOnline + pipelineRacks);
|
||||
const usedSlots = computeRacksOnline + pipelineRacks + netSlots;
|
||||
|
||||
let usedPowerKW = 0;
|
||||
let dcFlops = 0;
|
||||
|
||||
Reference in New Issue
Block a user