v0.1.35b: 兼容层铲除——迁移链/版本戳/死表死代码/normalize 兼容批/死字段
【A+I】migrate.ts 迁移链(CURRENT_SCHEMA/MIGRATIONS/migrateIfNeeded/MigrationError)整链铲除→validateLoadedState 结构校验(seed/family/members 断言);信封统一 payload 单格式(去双格式兜底);APP_ID 保留 【F】schemaVersion 字段全删(domain/creation/save 8 处);SaveMeta.version 记游戏版本字符串 【C】chronicle 死表+saveChronicle 死方法(首行 return+unreachable legacy 僵尸)全删 【D/E】GameEngine __state globalThis 泄漏口+seed 三元(恒不可达)删除;engineFromSnapshot/noAutoCreate 保留(测试便利——非兼容机器) 【B/H】normalizeGameState 兼容批删:老档字段补(28行)/worldGen 重放(18行)/P0-2 占位 def(9行)/worldSim 字段批删;保留 npcs 重注册/headId 修复/d distress 防护;initSim 补 0.1.34 四键(唯一初始源) 【G】domain 收紧 5 兼容 optional(techniqueRank/Progress/tribBoost/worldGen 必填)+pcgen 必写 【测试】删 9 个兼容验证体(audit 0.1.0-era/全残缺矩阵/空 worldSim 兜底);5989 全绿——金钟罩零漂(新档结构全字段,删除不涉世界数值)
This commit is contained in:
@@ -73,36 +73,6 @@ describe('志向矩阵', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('normalizeGameState 全残缺矩阵', () => {
|
||||
it.each([
|
||||
['finance', 'yearStats', 'yearlyReports', 'stats'].map((k) => [k] as const)
|
||||
].flat())('%s 缺失补齐', (key) => {
|
||||
const w = baseWorld('norm-' + key)
|
||||
const state = JSON.parse(JSON.stringify(w.state))
|
||||
delete (state as Record<string, unknown>)[key]
|
||||
const fixed = normalizeGameState(state)
|
||||
expect((fixed as Record<string, unknown>)[key]).toBeTruthy()
|
||||
})
|
||||
|
||||
it('无 headId 老档补齐首个存活着', () => {
|
||||
const w = baseWorld('norm-head')
|
||||
const state = JSON.parse(JSON.stringify(w.state))
|
||||
state.family.headId = 'x-not-exist'
|
||||
const fixed = normalizeGameState(state)
|
||||
expect(fixed.family.headId).toBe('x1')
|
||||
})
|
||||
|
||||
it('缺 npcFamilies 补齐空表(不崩外交)', () => {
|
||||
const w = baseWorld('norm-npc')
|
||||
const state = JSON.parse(JSON.stringify(w.state))
|
||||
delete state.npcFamilies
|
||||
const fixed = normalizeGameState(state)
|
||||
const w2 = new World(fixed)
|
||||
for (let i = 0; i < 3; i++) w2.advanceMonth() // 不抛
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('大比寄读渡劫动态事件矩阵', () => {
|
||||
it.each([
|
||||
['ev-tournament-10', '称病不出'],
|
||||
|
||||
Reference in New Issue
Block a user