feat(load-index): populate battle_pass_level_info from IBattlePassService

Wire IBattlePassService.GetLevelCurveAsync into LoadController so /load/index
emits the 100-entry battle_pass_level_info dict when levels are seeded.

Also adds BattlePassRepository.ResetLevelCurveCache() to bust the process-level
static cache in tests that seed levels after earlier HTTP calls have primed it
with an empty list, and updates SVSimTestFactory.SeedGlobalsAsync + the stale
Index_surfaces_seeded_globals_after_bootstrap assertion accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-26 22:56:41 -04:00
parent 9043e20646
commit 9bec1df52f
4 changed files with 52 additions and 6 deletions

View File

@@ -46,10 +46,12 @@ public class LoadController : SVSimController
private readonly IGlobalsRepository _globalsRepository;
private readonly ICardAcquisitionService _acquisition;
private readonly IGameConfigService _config;
private readonly IBattlePassService _battlePass;
public LoadController(IViewerRepository viewerRepository, ICardRepository cardRepository,
ICollectionRepository collectionRepository, IGlobalsRepository globalsRepository,
ICardAcquisitionService acquisition, IGameConfigService config)
ICardAcquisitionService acquisition, IGameConfigService config,
IBattlePassService battlePass)
{
_viewerRepository = viewerRepository;
_cardRepository = cardRepository;
@@ -57,6 +59,7 @@ public class LoadController : SVSimController
_globalsRepository = globalsRepository;
_acquisition = acquisition;
_config = config;
_battlePass = battlePass;
}
[HttpPost("index")]
@@ -194,9 +197,8 @@ public class LoadController : SVSimController
LootBoxRegulations = new LootBoxRegulations(),
GatheringInfo = new GatheringInfo(),
IsBattlePassPeriod = rotation.IsBattlePassPeriod,
// Optional per spec (load-index.md:228). We have BattlePassLevelEntry rows seeded, but
// no per-viewer Battle Pass progression yet — emit null until that subsystem lands.
BattlePassLevelInfo = null,
BattlePassLevelInfo = (await _battlePass.GetLevelCurveAsync(CancellationToken.None))
as Dictionary<string, BattlePassLevel>,
SpecialCrystalInfos = new List<SpecialCrystalInfo>(),
AvatarRotationInfo = await BuildAvatarInfoAsync(),
MyRotationInfo = await BuildMyRotationInfoAsync(),