fix(A.5 T4-T6): bootstrap guard + dead enum + test cleanups
Code review on commits 7bcabab/fb6b61e/326b698 flagged 2 Important + 4 Minor issues. Apply all fixes: Important: - Two-tier RecenterTo + MarkResidentFromBootstrap now throw InvalidOperationException on misuse — calling RecenterTo before the bootstrap silently emitted the entire window as fresh loads (no demotes/unloads since _tierResidence was empty), a correctness hazard that produced no exception. Calling MarkResidentFromBootstrap twice silently dropped accumulated tier state. Both now crash loudly via a _bootstrapped flag. - Dropped TierResidence.None from the enum — never assigned, never checked; absence from the dictionary already encodes "not resident." Minor: - Renamed test: RecenterTo_FirstTick_* → ComputeFirstTickDiff_FirstTick_* (the test calls ComputeFirstTickDiff, not RecenterTo). - Strengthened RecenterTo_PlayerWalks_NullToFar_* with assertions for ToPromote.Count==3 (the x=102 column promoting Far→Near) and ToUnload.Empty (everything within hysteresis). - Replaced System.Math.Abs with Math.Abs in new code to match the file's existing `using System;` convention. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
326b698161
commit
1658882439
2 changed files with 40 additions and 10 deletions
|
|
@ -22,7 +22,7 @@ public class StreamingRegionTwoTierTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void RecenterTo_FirstTick_SplitsLoadIntoNearAndFar()
|
||||
public void ComputeFirstTickDiff_FirstTick_SplitsLoadIntoNearAndFar()
|
||||
{
|
||||
// near=1, far=3 → near window is 3×3=9, far window is 7×7-3×3=40 LBs.
|
||||
var region = new StreamingRegion(centerX: 100, centerY: 100, nearRadius: 1, farRadius: 3);
|
||||
|
|
@ -52,6 +52,13 @@ public class StreamingRegionTwoTierTests
|
|||
Assert.Contains(id, diff.ToLoadFar);
|
||||
}
|
||||
Assert.Empty(diff.ToLoadNear);
|
||||
// The 3 LBs at x=102, y in {99,100,101} were Far from old center
|
||||
// (distance 2) and are now Near from new center (distance ≤1).
|
||||
// They should land in ToPromote.
|
||||
Assert.Equal(3, diff.ToPromote.Count);
|
||||
// All resident LBs from the old window are within hysteresis of
|
||||
// the new center (max distance 4 ≤ FarRadius+2=5), so nothing unloads.
|
||||
Assert.Empty(diff.ToUnload);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue