From 0aaf08e3112601a6e311e00442542505e0362a54 Mon Sep 17 00:00:00 2001 From: hided62 Date: Mon, 27 Jul 2026 10:28:18 +0000 Subject: [PATCH] fix legacy invalid turn argument logs --- .../src/turn/reservedTurnHandler.ts | 5 +-- .../test/reservedTurnExecution.test.ts | 2 +- ...urnCommandNationMatrix.integration.test.ts | 32 +++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/app/game-engine/src/turn/reservedTurnHandler.ts b/app/game-engine/src/turn/reservedTurnHandler.ts index 7fe186f..3514d32 100644 --- a/app/game-engine/src/turn/reservedTurnHandler.ts +++ b/app/game-engine/src/turn/reservedTurnHandler.ts @@ -884,12 +884,13 @@ export const createReservedTurnHandler = async (options: { let blockedReason: string | undefined = undefined; if (parsedArgs === null) { + const failureText = `인자가 올바르지 않습니다. ${resolvedDefinition.name} 실패.`; definition = fallbackDefinition; actionArgs = definition.parseArgs({}) ?? {}; actionKey = definition.key; usedFallback = true; - blockedReason = '예약된 명령을 실행하지 못했습니다.'; - logs.push(createActionLog('예약된 명령을 실행하지 못했습니다.')); + blockedReason = failureText; + logs.push(createActionLog(failureText)); } const actionConstraintEnv = { diff --git a/app/game-engine/test/reservedTurnExecution.test.ts b/app/game-engine/test/reservedTurnExecution.test.ts index 62bd001..fff9e83 100644 --- a/app/game-engine/test/reservedTurnExecution.test.ts +++ b/app/game-engine/test/reservedTurnExecution.test.ts @@ -456,7 +456,7 @@ describe('Reserved Turn Execution Integration', () => { const dirty = world.consumeDirtyState(); expect(world.getGeneralById(1)!.cityId).toBe(1); - expect(dirty.logs.some((log) => log.text.includes('예약된 명령을 실행하지 못했습니다.'))).toBe(true); + expect(dirty.logs.some((log) => log.text.includes('인자가 올바르지 않습니다. 이동 실패.'))).toBe(true); expect(dirty.logs.some((log) => log.text.includes('아무것도 실행하지 않았습니다.'))).toBe(true); }); diff --git a/tools/integration-tests/test/turnCommandNationMatrix.integration.test.ts b/tools/integration-tests/test/turnCommandNationMatrix.integration.test.ts index 4aee58d..26b705e 100644 --- a/tools/integration-tests/test/turnCommandNationMatrix.integration.test.ts +++ b/tools/integration-tests/test/turnCommandNationMatrix.integration.test.ts @@ -2695,6 +2695,38 @@ integration('nation command resource balance and target boundaries', () => { ); }); +integration('nation command missing argument object parity', () => { + it.each(['che_포상', 'che_몰수'] as const)( + '%s falls back with the legacy invalid-argument log and no RNG', + async (action) => { + const request = buildRequest(action); + const reference = runReferenceTurnCommandTraceRequest( + workspaceRoot!, + request as unknown as Record + ); + const core = await runCoreTurnCommandTrace(request, reference.before); + + expect(reference.execution.outcome).toMatchObject({ completed: false }); + expect(core.execution.outcome).toMatchObject({ + requestedAction: action, + actionKey: '휴식', + usedFallback: true, + }); + expect(reference.rng).toEqual([]); + expect(core.rng).toEqual(reference.rng); + expect( + compareTurnSnapshotDeltas(reference.before, reference.after, core.before, core.after, { + ignoredPathPatterns: ignoredLifecyclePaths, + }) + ).toEqual([]); + expect(semanticLogSignatures(nationCommandLogs(core.after.logs))).toEqual( + semanticLogSignatures(addedReferenceLogs(reference.before, reference.after.logs)) + ); + }, + 120_000 + ); +}); + integration('nation seizure NPC public message parity', () => { it('matches the legacy fixed-seed RNG and public message side effect', async () => { const request = buildRequest(