From 25708317792005b8d2216da3edff7bba78d1213c Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Thu, 10 Sep 2026 19:33:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20AGC=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=90=91=E5=AF=BC=E6=8C=81=E4=B9=85=E5=8C=96=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=9C=A8=20Windows=20=E4=B8=8A=E7=A8=B3=E5=AE=9A=E8=B6=85?= =?UTF-8?q?=E6=97=B6=EF=BC=9A=E8=AF=BB=E8=B7=AF=E5=BE=84=E8=A1=A5=E4=B8=8A?= =?UTF-8?q?=20ACL=20=E6=A1=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - agentSwarmTestEntry.test.ts:readGameCreatorWizardConfigState 的三处调用补传 persistenceOptions,读路径不再拉起真实 powershell.exe 去加固私有 DACL。 - agentSwarmTestEntry.test.ts:在 persistenceOptions 定义处补注释,说明读路径同样会加固、读写都要带桩,避免后续再漏。 - 失败形态:单跑该文件稳定 1 failed | 124 passed,报错为 Test timed out in 5000ms,不是 expected / actual 断言不符。 - 根因:该用例只校验配置分层优先级(local 覆盖 primary → 向导写入后剥离 local 的 llm → GUI 后写 primary 获胜),但三处读路径都没传桩;每次 readGameCreatorWizardConfigState 会加固目录、主配置、本地配置各一次,三处读累计 9 次 powershell.exe 子进程。逐段实测 5474.9ms / 5494.9ms,正好压过 vitest 默认 5000ms。 - 基线定性:8f96b05f6 上同一用例同样失败(连续两次 1 failed | 124 passed,同样报 5000ms 超时),且该用例与 game-creator-config-wizard.mjs、agent-swarm-test-chat.mjs 在本批前后逐字节一致(blob 相同),故不是本批引入的回归。 - 未放宽任何断言:补桩后该用例 5500ms → 39ms,本文件 13.6s → 8.7s,断言与断言语义均未改动。 --- .../tests/agentSwarmTestEntry.test.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts b/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts index f0152b2ec..99418c563 100644 --- a/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts +++ b/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts @@ -584,6 +584,9 @@ describe('terminal configuration wizard persistence', () => { it('moves the default LLM to primary config and lets later GUI saves win', async () => { await withTemporaryRoot(async (root) => { + // 读写都要带上这个桩:读路径同样会加固私有目录与配置文件, + // 在 Windows 上每次加固都要拉起一个 powershell.exe(约 0.6 秒), + // 本用例只校验配置分层优先级,不该为无关的 DACL 子进程耗掉超时预算。 const persistenceOptions = process.platform === 'win32' ? { secureWindowsPath: async () => {} } @@ -601,7 +604,10 @@ describe('terminal configuration wizard persistence', () => { '{"llm":{"model":"stale-local","stream":true},"agentLlm":{"planner":{"model":"planner"}}}\n', ); - const state = await readGameCreatorWizardConfigState(configDir); + const state = await readGameCreatorWizardConfigState( + configDir, + persistenceOptions, + ); expect(state.configPath).toBe(primaryPath); expect(state.effectiveConfig.llm.model).toBe('stale-local'); const wizardConfig = buildGameCreatorWizardConfig(state.writeConfig, { @@ -619,7 +625,10 @@ describe('terminal configuration wizard persistence', () => { const sanitizedLocal = JSON.parse(await readFile(localPath, 'utf8')); expect(sanitizedLocal.llm).toBeUndefined(); expect(sanitizedLocal.agentLlm.planner.model).toBe('planner'); - const afterWizard = await readGameCreatorWizardConfigState(configDir); + const afterWizard = await readGameCreatorWizardConfigState( + configDir, + persistenceOptions, + ); expect(afterWizard.effectiveConfig.llm).toMatchObject({ apiKey: 'wizard-key', model: 'wizard-model', @@ -638,7 +647,10 @@ describe('terminal configuration wizard persistence', () => { guiConfig, persistenceOptions, ); - const afterGui = await readGameCreatorWizardConfigState(configDir); + const afterGui = await readGameCreatorWizardConfigState( + configDir, + persistenceOptions, + ); expect(afterGui.effectiveConfig.llm.apiKey).toBe('gui-key'); expect(afterGui.effectiveConfig.llm.model).toBe('gui-model'); });