refactor(framework): 移除 resolveBootstrap 下游兜底,立第二准则

- CLAUDE.md 新增「第二准则:数据源权威、唯一,下游不兜底」
- bootstrap 删除 fallbackServers 选项与 ?? DEFAULT_GAMESERVER 猜默认
- 无 server/gameserver、远程失败、解析不出地址 → 一律抛 ConfigFetchError 显式暴露
- 同步 guide + 两篇 spec(删 fallback/降级措辞)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 18:59:15 +08:00
co-authored by Claude Opus 4.8
parent 39bb964a49
commit 51a4ee57ac
6 changed files with 42 additions and 29 deletions
@@ -47,18 +47,21 @@ test('debug + 原生模式:identity 来自 window.settings', async () => {
assert.equal(r.identity.marketid, 3);
});
test('debug + 远程失败 + 有 fallbackServers → 降级使用', async () => {
const r = await resolveBootstrap({ mode: 'debug', win: {}, search: '', fetcher: throwingFetcher, isNative: false, fallbackServers: ['ws://fb:1'] });
assert.deepEqual(r.servers, ['ws://fb:1']);
});
test('debug + 远程失败 + 无 fallback → 抛 ConfigFetchError', async () => {
test('远程抓取失败 → 抛 ConfigFetchError(不兜底)', async () => {
await assert.rejects(
resolveBootstrap({ mode: 'debug', win: {}, search: '', fetcher: throwingFetcher, isNative: false }),
/远程配置抓取失败/,
);
});
test('远程配置未给出可用服务器地址 → 抛错(不兜底)', async () => {
const emptyFetcher: ConfigFetcher = { fetch: async () => ({ data: {} }) };
await assert.rejects(
resolveBootstrap({ mode: 'debug', win: {}, search: '', fetcher: emptyFetcher, isNative: false }),
/未给出可用服务器/,
);
});
test('debug 结果含 mode/isDebugger', async () => {
const fetcher = fetcherReturning(REMOTE);
const r = await resolveBootstrap({ mode: 'debug', win: {}, search: '', fetcher, isNative: false });