feat(framework): config 调试 serverOverride(全链路+游戏服连本地)

- DebugProfile 加 serverOverride:debug 抓远程配置走全链路后把连接地址覆盖为此
- staging profile 加 serverOverride=ws://127.0.0.1:3088(联调本地测试服)
- release 一律忽略 serverOverride,用远程解析结果
- 同步指南

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 20:08:59 +08:00
co-authored by Claude Opus 4.8
parent d461578d6e
commit 5132fddc4e
4 changed files with 25 additions and 5 deletions
+4 -2
View File
@@ -164,8 +164,9 @@ Profiles 取代了旧工程的 `Game_Config.Debugger`(`serverType` / `gameserv
```ts
interface DebugProfile {
name: string;
server?: string; // 显式 ws 调试服地址;给定则跳过远程抓取
server?: string; // 显式 ws 调试服地址;给定则跳过远程抓取(纯直连)
gameserver?: string; // 远程配置 txt URL(不含防缓存串)
serverOverride?: string; // debug:抓远程配置走全链路后,把连接地址覆盖为此(联调本地游戏服)
identity?: Partial<ChannelIdentity>; // 调试用渠道身份覆盖
account?: DebugAccount; // 调试用登录账号(openid 等),仅 debug 模式生效
isDebugger?: boolean; // 收发包日志开关
@@ -236,8 +237,9 @@ export const PROFILES: Record<string, DebugProfile> = {
`resolveBootstrap` 决定 `servers`(一个 `ws://` 地址数组,交给 `NetClient` 轮询)的顺序:
1. **当前 profile 有 `server`** → 直接用它,**跳过远程配置抓取**(`local`/`lab` 这类直连档位走这条)。
1. **当前 profile 有 `server`** → 直接用它,**跳过远程配置抓取**(`local`/`lab` 这类纯直连档位走这条)。
2. **否则**抓 profile 的 `gameserver` 远程配置文件,用 `getParam` 取出连接参数,`resolveServers` 组装候选列表。
- **debug 且 profile 有 `serverOverride`**:仍抓远程配置走完整链路(`rawConfig` 照常返回),但最终连接地址**覆盖为 `serverOverride`**(联调时把游戏服连到本地测试服)。release 一律忽略 `serverOverride`,用远程解析结果。
3. **不兜底**(CLAUDE.md 第二准则):profile 既无 `server` 又无 `gameserver`、远程抓取失败、或解析不出任何地址——一律抛 `ConfigFetchError` **显式暴露**,不猜默认、不降级。重试/重连归 `NetClient`,不在本层造兜底轮子。
`resolveServers` 取的连接参数键(**逐字一致**原工程,按此优先级):