fix general constraint failure log parity
This commit is contained in:
@@ -908,6 +908,7 @@ export const createReservedTurnHandler = async (options: {
|
||||
const result = evaluateConstraints(constraints, constraintCtx, view);
|
||||
if (result.kind !== 'allow') {
|
||||
const failedDefinition = definition;
|
||||
const failedActionArgs = actionArgs;
|
||||
definition = fallbackDefinition;
|
||||
actionArgs = definition.parseArgs({}) ?? {};
|
||||
actionKey = definition.key;
|
||||
@@ -916,7 +917,7 @@ export const createReservedTurnHandler = async (options: {
|
||||
blockedReason = reason;
|
||||
const meta = result.kind === 'deny' ? { constraintName: result.constraintName } : undefined;
|
||||
const failureText =
|
||||
failedDefinition.formatConstraintFailure?.(reason, constraintCtx, actionArgs, view) ??
|
||||
failedDefinition.formatConstraintFailure?.(reason, constraintCtx, failedActionArgs, view) ??
|
||||
`${reason} ${failedDefinition.name} 실패.`;
|
||||
logs.push(createActionLog(failureText, meta));
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ const remainCityTrust = (): Constraint => ({
|
||||
test: (ctx, view) => {
|
||||
const city = ctx.cityId !== undefined ? (view.get({ kind: 'city', id: ctx.cityId }) as City | null) : null;
|
||||
if (!city) return { kind: 'deny', reason: '도시 정보가 없습니다.' };
|
||||
return readTrust(city) >= 100 ? { kind: 'deny', reason: '민심이 충분합니다.' } : { kind: 'allow' };
|
||||
return readTrust(city) >= 100
|
||||
? { kind: 'deny', reason: '주민 선정은 충분합니다.' }
|
||||
: { kind: 'allow' };
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -3754,6 +3754,9 @@ integration('general command full-constraint fallback matrix', () => {
|
||||
ignoredPathPatterns: ignoredLifecyclePaths,
|
||||
})
|
||||
).toEqual([]);
|
||||
expect(semanticLogSignatures(core.after.logs)).toEqual(
|
||||
semanticLogSignatures(addedReferenceLogs(reference.before, reference.after.logs))
|
||||
);
|
||||
},
|
||||
120_000
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user