#!/usr/bin/env python3 """Static architecture checks; NOT a compilation or live integration test.""" from pathlib import Path import re root=Path(__file__).resolve().parents[2] server=root/'SHiNE-server' net=server/'shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON' ws=server/'src/main/java/server/ws' registry=(net/'JsonHandlerRegistry.java').read_text() original=(root/'old-frame-v1/SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/JsonHandlerRegistry.java').read_text() active=re.findall(r'add\(handlers,types,"(\w+)"',registry) old=set(re.findall(r'^\s*Map.entry\("(\w+)"',original,re.M)) blocked=set(re.findall(r'// (\w+): deliberately unavailable',registry)) assert len(active)==len(set(active)) assert old-set(active)==blocked assert len(old)==90 assert not (ws/'CoreWsEntry.java').exists() assert not (net/'CoreWsRouteRegistry.java').exists() assert 'ChannelNamesStateBootstrapper' not in registry and 'new Net_AddBlock_Handler(' not in registry assert '"AddBlock",CoreWsHandlers.AddRequest.class' in registry assert '"SetChannelReadState",CoreChannelReadWsHandler.Request.class' in registry assert 'SetCoreChannelReadState' not in active and 'AddCloseFriend' not in active entry=(ws/'WsServer.java').read_text() assert entry.count('new Server(')==1 and 'JsonHandlerRegistry.create(' in entry for name in ['DmFileApiConfigurator','PublicFileApiConfigurator','DebugApiConfigurator']: assert name+'.register(context)' in entry assert 'new SolanaRpcGateway()' in entry and 'new BlockchainWsEndpoint(routes)' in entry assert 'ArweaveBlockSyncScheduler' not in entry and 'ArweaveBlockPublisherScheduler.startOrLog' not in entry assert 'SHINE_CORE_STAGING_DISPOSABLE' in entry and 'CoreStagingRuntime.open(' in entry assert '127.0.0.1' in entry assert 'LegacyRoutes' not in (net/'JsonInboundProcessor.java').read_text() assert 'public BlockchainWsEndpoint()' not in (ws/'BlockchainWsEndpoint.java').read_text() assert not re.search(r'\bcoreRoutes\b', (ws/'BlockchainWsEndpoint.java').read_text()), 'stale reference to removed runtime field' print(f'Static unified runtime checks PASS: {len(active)} active, {len(blocked)} explicitly unavailable; no parallel entry or registry; HTTP configurators retained')