test(upserver): 归档存档迁移与玩法闭环回归工具
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using game;
|
||||
if(!GContext.Ready)return "GContext not ready; "+KVGameplayLoopSetup.State();
|
||||
var u=GContext.container.Resolve<IUserService>();
|
||||
var p=GContext.container.Resolve<PlayerData>();
|
||||
var g=GContext.container.Resolve<GuideDataCenter>();
|
||||
var cfg=GContext.container.Resolve<IConfig>();
|
||||
var e=GContext.container.Resolve<FishingEventData>();
|
||||
GuideSaveData potion;g.GuideSaveDataDic.TryGetValue("EventPotion01",out potion);
|
||||
return new {loggedIn=u.IsLogin, account=u.CustomId, internalId=u.InternalId,backend=cfg.Get<string>("SaveBackend",""),api=cfg.Get<string>(GConstant.K_Event_API_URL,""),level=p.lv,gold=p.gold,energy=p.Energy,guideGroup=g.curGroupDefine==null?null:g.curGroupDefine.groupName.ToString(),guideNode=g.curDefine!=null,guideSavePointer=g.curSaveData!=null,potionEvent=e.GetEvent(4,5),potionSaved=potion==null?"missing":potion.groupName+"|"+potion.guideSubIndex+"|"+potion.isFinish,state=KVGameplayLoopSetup.State()}.ToString();
|
||||
@@ -0,0 +1,18 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using game;
|
||||
using LitJson;
|
||||
if(!GContext.Ready || GContext.container==null) return "Bootstrap pending; "+KVGameplayLoopSetup.State();
|
||||
var u=GContext.container.Resolve<IUserService>();
|
||||
if(!u.IsLogin) return "Login pending; "+KVGameplayLoopSetup.State();
|
||||
var p=GContext.container.Resolve<PlayerData>();
|
||||
var f=GContext.container.Resolve<PlayerFishData>();
|
||||
var guide=GContext.container.Resolve<GuideDataCenter>();
|
||||
var source=SimpleJSON.JSON.Parse(System.IO.File.ReadAllText("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/backups/20260928T092418Z/101.json"))["data"];
|
||||
var mismatches=new System.Collections.Generic.List<string>();
|
||||
foreach(var key in source.Keys)if(!string.Equals(PlayFabMgr.Instance.GetLocalData(key),source[key].Value,System.StringComparison.Ordinal))mismatches.Add(key);
|
||||
var rawMap=JsonMapper.ToObject<System.Collections.Generic.Dictionary<string,string>>(PlayFabMgr.Instance.GetLocalData("Map_5_102"));
|
||||
var saved=guide.GuideSaveDataDic["EventPotion01"];
|
||||
var api=GContext.container.Resolve<ICustomServerMgr>().ApiBaseUri.ToString();
|
||||
bool valuesPass=u.CustomId=="101" && api=="http://s101.local:18080/" && (ulong)p.gold==36552317UL && (int)p.Energy==7300 && p.GetEnergyRM()==7236 && rawMap["10231"]=="6|9.23|54|5|False" && System.Math.Abs(f.GetDataMaxWeight(10231)-9.23f)<0.001f && f.GetDataLevel(10231)==6 && saved.guideSubIndex==4 && !saved.isFinish && guide.curDefine==null && guide.curGroupDefine==null && guide.curSaveData==null;
|
||||
return JsonMapper.ToJson(new {valuesPass,account=u.CustomId,internalId=u.InternalId,api,gold=(ulong)p.gold,energy=(int)p.Energy,energyRM=p.GetEnergyRM(),core=p.PlayerDataDic["newData"],fishId=10231,fishRaw=rawMap["10231"],liveMaxWeight=f.GetDataMaxWeight(10231),liveLevel=f.GetDataLevel(10231),liveNewFish=f.GetDataNewFish(10231),guide=saved.groupName+"|"+saved.guideSubIndex+"|"+saved.isFinish,comparedKeys=source.Count,mismatches,state=KVGameplayLoopSetup.State()});
|
||||
@@ -0,0 +1,4 @@
|
||||
var consume=await KVGameplayLoopSetup.RunValidationAsync("fishing-consume");
|
||||
var guides=await KVGameLoadValidation.RunAsync("M09-M10-M12");
|
||||
var full=await KVGameLoadValidation.RunAsync("B2-20");
|
||||
return "consume="+consume+"\nguides="+guides+"\nfull="+full;
|
||||
@@ -0,0 +1 @@
|
||||
return KVGameplayLoopSetup.InspectPFBackup("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/pf-source-backups/20260924T041802Z/101.json");
|
||||
@@ -0,0 +1,4 @@
|
||||
if(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling || UnityEditor.EditorApplication.isUpdating) throw new System.InvalidOperationException("Idle required");
|
||||
if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/permit.json")) throw new System.InvalidOperationException("Active permit exists");
|
||||
using(var p=System.Diagnostics.Process.GetCurrentProcess()){var id=p.Id+"_"+p.StartTime.ToUniversalTime().Ticks;if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/run-control/"+id+".claimed") || System.IO.Directory.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/runs/"+id))throw new System.InvalidOperationException("Process already used");}
|
||||
return KVGameplayLoopSetup.PrepareFishingRewardPermit("101","C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/backups/20260928T091527Z/101.json",new string[]{"AquariumEventDataNewKey","BattlePassRecordTask","BombGameCount","BuffDataList","BuyData","ChainPackDataNew","DeferredRewardStashService","epbdk","epdk","Event1v1BattleSlapData","EventBingo","EventBoostPackData","EventBossFightData","EventCubeMeltData","EventLuckGameRecord","EventLuckMagicPlayfabData","EventLuckyTowerData","EventOfferDevourFishData","EventPackData","EventPartnerStatueData","EventTransitionTokenDic","FishHuntGameCount","FishingChallengeData","FixedTimeShopDic","GeneralEventPackData","GuideSaveDataNew","IsOpenAppraise","IsOpenClubRed","LastPaymentTime","Leadboard_LastContinent","LuckyTaskADKey","Map_5_101","Map_5_102","MiniBPKeyNew","MMTest","MonthlySignEvent","NewPlayerDataDic","NewRodList","OfferChainsChestData","OfferDiscoPartyManager","OfferStoryChain","OfferSweepPackData","Pack1A1Data","Pack1A2Data","PiggyBankPackData","RodData","RodLevelData","SeasonStampData","ShopPackBuyCount","SoloDataKey","TargetBuffDataList","TransitionData","TriggerPackDataList","VIPAdPackData","WelcomeBack"});
|
||||
@@ -0,0 +1,4 @@
|
||||
if(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling || UnityEditor.EditorApplication.isUpdating) throw new System.InvalidOperationException("Idle required");
|
||||
if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/permit.json")) throw new System.InvalidOperationException("Active permit exists");
|
||||
using(var p=System.Diagnostics.Process.GetCurrentProcess()){var id=p.Id+"_"+p.StartTime.ToUniversalTime().Ticks;if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/run-control/"+id+".claimed") || System.IO.Directory.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/runs/"+id))throw new System.InvalidOperationException("Process already used");}
|
||||
return KVGameplayLoopSetup.PreparePermit("101","C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/backups/20260928T092418Z/101.json",new string[]{"AquariumEventDataNewKey","BattlePassRecordTask","BombGameCount","BuffDataList","BuyData","ChainPackDataNew","DeferredRewardStashService","epbdk","epdk","Event1v1BattleSlapData","EventBingo","EventBoostPackData","EventBossFightData","EventCubeMeltData","EventLuckGameRecord","EventLuckMagicPlayfabData","EventLuckyTowerData","EventOfferDevourFishData","EventPackData","EventPartnerStatueData","EventTransitionTokenDic","FishHuntGameCount","FishingChallengeData","FixedTimeShopDic","GeneralEventPackData","GuideSaveDataNew","IsOpenAppraise","IsOpenClubRed","LastPaymentTime","Leadboard_LastContinent","LuckyTaskADKey","Map_5_101","Map_5_102","MiniBPKeyNew","MMTest","MonthlySignEvent","NewPlayerDataDic","NewRodList","OfferChainsChestData","OfferDiscoPartyManager","OfferStoryChain","OfferSweepPackData","Pack1A1Data","Pack1A2Data","PiggyBankPackData","RodData","RodLevelData","SeasonStampData","ShopPackBuyCount","SoloDataKey","TargetBuffDataList","TransitionData","TriggerPackDataList","VIPAdPackData","WelcomeBack"});
|
||||
@@ -0,0 +1,4 @@
|
||||
if(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling || UnityEditor.EditorApplication.isUpdating) throw new System.InvalidOperationException("Idle required");
|
||||
if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/permit.json")) throw new System.InvalidOperationException("Active permit exists");
|
||||
using(var p=System.Diagnostics.Process.GetCurrentProcess()){var id=p.Id+"_"+p.StartTime.ToUniversalTime().Ticks;if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/run-control/"+id+".claimed") || System.IO.Directory.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/runs/"+id))throw new System.InvalidOperationException("Process already used");}
|
||||
return KVGameplayLoopSetup.PrepareFishingRewardPermit("101","C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/backups/20260928T081406Z/101.json",new string[]{"AquariumEventDataNewKey","BattlePassRecordTask","BombGameCount","BuffDataList","BuyData","ChainPackDataNew","DeferredRewardStashService","epbdk","epdk","Event1v1BattleSlapData","EventBingo","EventBoostPackData","EventBossFightData","EventCubeMeltData","EventLuckGameRecord","EventLuckMagicPlayfabData","EventLuckyTowerData","EventOfferDevourFishData","EventPackData","EventPartnerStatueData","EventTransitionTokenDic","FishHuntGameCount","FishingChallengeData","FixedTimeShopDic","GeneralEventPackData","GuideSaveDataNew","IsOpenAppraise","IsOpenClubRed","LastPaymentTime","Leadboard_LastContinent","LuckyTaskADKey","Map_5_101","Map_5_102","MiniBPKeyNew","MMTest","MonthlySignEvent","NewPlayerDataDic","NewRodList","OfferChainsChestData","OfferDiscoPartyManager","OfferStoryChain","OfferSweepPackData","Pack1A1Data","Pack1A2Data","PiggyBankPackData","RodData","RodLevelData","SeasonStampData","ShopPackBuyCount","SoloDataKey","TargetBuffDataList","TransitionData","TriggerPackDataList","VIPAdPackData","WelcomeBack"});
|
||||
@@ -0,0 +1,4 @@
|
||||
if(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling || UnityEditor.EditorApplication.isUpdating) throw new System.InvalidOperationException("Idle required");
|
||||
if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/permit.json")) throw new System.InvalidOperationException("Active permit exists");
|
||||
using(var p=System.Diagnostics.Process.GetCurrentProcess()){var id=p.Id+"_"+p.StartTime.ToUniversalTime().Ticks;if(System.IO.File.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/run-control/"+id+".claimed") || System.IO.Directory.Exists("C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/runs/"+id))throw new System.InvalidOperationException("Process already used");}
|
||||
return KVGameplayLoopSetup.PrepareFishingRewardPermit("101","C:/projects/ft/CodexOutput/upserver/KVGameplayLoopTests/backups/20260928T075611Z/101.json",new string[]{"AquariumEventDataNewKey","BattlePassRecordTask","BombGameCount","BuffDataList","BuyData","ChainPackDataNew","DeferredRewardStashService","epbdk","epdk","Event1v1BattleSlapData","EventBingo","EventBoostPackData","EventBossFightData","EventCubeMeltData","EventLuckGameRecord","EventLuckMagicPlayfabData","EventLuckyTowerData","EventOfferDevourFishData","EventPackData","EventPartnerStatueData","EventTransitionTokenDic","FishHuntGameCount","FishingChallengeData","FixedTimeShopDic","GeneralEventPackData","GuideSaveDataNew","IsOpenAppraise","IsOpenClubRed","LastPaymentTime","Leadboard_LastContinent","LuckyTaskADKey","Map_5_101","Map_5_102","MiniBPKeyNew","MMTest","MonthlySignEvent","NewPlayerDataDic","NewRodList","OfferChainsChestData","OfferDiscoPartyManager","OfferStoryChain","OfferSweepPackData","Pack1A1Data","Pack1A2Data","PiggyBankPackData","RodData","RodLevelData","SeasonStampData","ShopPackBuyCount","SoloDataKey","TargetBuffDataList","TransitionData","TriggerPackDataList","VIPAdPackData","WelcomeBack"});
|
||||
@@ -0,0 +1,30 @@
|
||||
$ErrorActionPreference='Stop'
|
||||
$root='C:/projects/ft/CodexOutput/upserver'
|
||||
$rounds=@('20260928T091527Z','20260928T092018Z','20260928T092245Z','20260928T092418Z','20260928T092948Z')
|
||||
function Compare-Values($before,$after){
|
||||
$names=[Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal)
|
||||
foreach($p in $before.PSObject.Properties){[void]$names.Add($p.Name)}
|
||||
foreach($p in $after.PSObject.Properties){[void]$names.Add($p.Name)}
|
||||
$differences=@(foreach($key in $names){
|
||||
$a=$before.PSObject.Properties[$key];$b=$after.PSObject.Properties[$key]
|
||||
if($null -eq $a -or $null -eq $b -or ![string]::Equals([string]$a.Value,[string]$b.Value,[StringComparison]::Ordinal)){$key}
|
||||
})
|
||||
[ordered]@{beforeKeys=@($before.PSObject.Properties).Count;afterKeys=@($after.PSObject.Properties).Count;differentKeys=$differences;ordinalEqual=$differences.Count -eq 0}
|
||||
}
|
||||
$comparison=@()
|
||||
foreach($account in @('101','102')){
|
||||
$data=@($rounds|ForEach-Object {(Get-Content -LiteralPath "$root/KVGameplayLoopTests/backups/$_/$account.json" -Raw|ConvertFrom-Json).data})
|
||||
for($i=1;$i -lt $rounds.Count;$i++){$comparison+=[ordered]@{account=$account;before=$rounds[$i-1];after=$rounds[$i];comparison=(Compare-Values $data[$i-1] $data[$i])}}
|
||||
}
|
||||
$runFacts=@()
|
||||
foreach($prefix in @('55088','130200')){
|
||||
$run=Get-ChildItem "$root/KVGameplayLoopTests/runs" -Directory -Filter ($prefix+'_*')
|
||||
$events=@(Get-Content ($run.FullName+'/events.jsonl')|ForEach-Object {$_|ConvertFrom-Json})
|
||||
$state=Get-Content (Get-ChildItem ($run.FullName+'/cache') -Recurse -Filter state.json).FullName -Raw|ConvertFrom-Json
|
||||
$final=(Get-Content "$root/KVGameplayLoopTests/backups/20260928T092948Z/101.json" -Raw|ConvertFrom-Json).data
|
||||
$runFacts+=[ordered]@{run=$run.Name;pending=@($state.pending).Count;activeBatch=$state.activeBatch;unknownBatch=$state.unknownBatch;cacheVsFinal=(Compare-Values $state.baseline $final);counts=@($events|Group-Object kind|ForEach-Object {[ordered]@{kind=$_.Name;count=$_.Count}});closed=($events|Where-Object kind -eq 'closed').at}
|
||||
}
|
||||
$result=[ordered]@{createdUtc=[DateTime]::UtcNow.ToString('o');comparisons=$comparison;runs=$runFacts;activePermit=Test-Path "$root/KVGameplayLoopTests/permit.json";claims=@(Get-ChildItem "$root/KVGameplayLoopTests/run-control" -Filter '*.claimed'|ForEach-Object Name);scope='Ordinal comparison of local captured data; event counts are application records, not HTTP request totals'}
|
||||
$result|ConvertTo-Json -Depth 12|Set-Content "$root/Gameplay101Validation/guide-final-reconciliation.json" -Encoding utf8
|
||||
$result.comparisons|ConvertTo-Json -Depth 7
|
||||
$result.runs|ConvertTo-Json -Depth 7
|
||||
Reference in New Issue
Block a user