"""Validate database contracts used by the asynchronous native creation path.""" from pathlib import Path import re root=Path(__file__).resolve().parents[2] registration=(root/'src/server/database/Database/Implementation/LoginDatabase.cpp').read_text() for name in ('LOGIN_INS_ACCOUNT','LOGIN_REP_REALM_CHARACTERS'): match=re.search(r'PrepareStatement\('+name+r',\s*"([^"]+)",\s*(\w+)\)',registration) assert match and match[2] in ('CONNECTION_ASYNC','CONNECTION_BOTH'),name+' unavailable on async connection' factory=(root/'src/server/game/World/ClientlessCharacterFactory.cpp').read_text().split('void ClientlessCharacterFactory::CreateAsync(')[1] assert 'x.AccountID=a.id' in factory and 'x.SecurityLevel' in factory assert 'x.gmlevel' not in factory and 'x.id=a.id' not in factory assert '.m_future.get(' not in factory and '.wait(' not in factory assert 'FactorySaves->AddCallback' in factory and 'if(!ok)' in factory assert factory.index('if(!ok)')Update(diff)' in world print('Async creation DB contracts: prepared connection masks, native security column names, no future waits, successful-save cache publication and world-update-only loader hook passed')