fix(config): resolve remote hierarchy in memory for every profile

This commit is contained in:
2026-09-05 21:21:24 +08:00
parent 62328b6fd6
commit 053302c5df
27 changed files with 286 additions and 143 deletions
@@ -14,7 +14,7 @@ class MapStorage implements LocalStoragePort {
function resolve(search = '?profile=local') {
return resolveLocalStartup({ mode: 'debug', hostKind: 'h5', win: {}, search,
fetcher: { async fetch(): Promise<never> { throw new Error('forbidden fetch'); } } });
fetcher: { async fetch() { return { player_server_tcp: 'remote.example:3088' }; } } });
}
function sourcesFor(context: Awaited<ReturnType<typeof resolve>>, storage: LocalStoragePort,
@@ -1,3 +1,4 @@
import { remoteFixture } from '../fixtures/remote-config.ts';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { test } from 'node:test';
@@ -13,7 +14,7 @@ import { FakeTransport } from '../helpers/fake-transport.ts';
const CONFIG: RuntimeConfig = {
mode: 'debug', isDebugger: true,
identity: { agentid: 'A', channelid: 'C', gameid: '41', version: 1, marketid: 4 },
source: 'direct', servers: ['ws://agent'], gameserver: null, rawConfig: null,
source: 'remote', servers: ['ws://agent'], gameserver: 'https://fixture/config', ...remoteFixture(),
};
const ACCOUNT = { openid: 'o', nickname: 'n', avatar: 'a', sex: 0, province: '', city: '', unionid: 'u' };
const LOGIN = {
@@ -137,7 +137,7 @@ test('real modern vertical replay preserves wire contracts, room ordering and te
configRequests.push({ url: String(url), init });
return new Response(JSON.stringify({
urlserver: 'wrong-root.example:1',
data: { urlserver: ['agent.example:3088', 'backup.example:3088'] },
player_server_tcp: ['agent.example:3088', 'backup.example:3088'],
}), { status: 200 });
}),
}),