test(compare): trace deterministic monthly seed progression

This commit is contained in:
2026-08-03 18:57:01 +00:00
parent 3b2fd1082f
commit f16a6b6880
23 changed files with 1274 additions and 213 deletions
+17 -2
View File
@@ -15,11 +15,24 @@ function calcTournamentTerm(int $turnTerm): int{
function processTournament()
{
if (
getenv('REF_DETERMINISTIC_INSTALL_ENABLED') === '1'
&& getenv('REF_DETERMINISTIC_TOURNAMENT_MODE') === 'hold'
) {
// Legacy tournament matches mix PHP rand(), shuffle(), and MariaDB
// ORDER BY RAND(), so they are outside the hidden/monthly seed stream.
// Hold the real-time subsystem during monthly world-state comparison.
return;
}
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time', 'turnterm', 'last_tournament_betting_id']);
$now = new \DateTime();
// The comparison harness supplies a fixed clock through TimeUtil. Keep the
// production clock unchanged while preventing tournament catch-up from
// escaping that deterministic month boundary.
$now = TimeUtil::nowDateTime();
$offset = $now->getTimestamp() - (new \DateTime($admin['tnmt_time']))->getTimestamp();
//수동일땐 무시
@@ -286,7 +299,9 @@ function startTournament($type)
$unit = calcTournamentTerm($turnTerm);
$gameStor->tnmt_auto = true;
$gameStor->tnmt_time = (new \DateTimeImmutable())->add(new \DateInterval("PT{$unit}M"))->format('Y-m-d H:i:s');
$gameStor->tnmt_time = TimeUtil::nowDateTimeImmutable()
->add(new \DateInterval("PT{$unit}M"))
->format('Y-m-d H:i:s');
$gameStor->tournament = 1;
$gameStor->tnmt_type = $type;
$gameStor->last_tournament_betting_id = 0;