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);
|
const result = evaluateConstraints(constraints, constraintCtx, view);
|
||||||
if (result.kind !== 'allow') {
|
if (result.kind !== 'allow') {
|
||||||
const failedDefinition = definition;
|
const failedDefinition = definition;
|
||||||
|
const failedActionArgs = actionArgs;
|
||||||
definition = fallbackDefinition;
|
definition = fallbackDefinition;
|
||||||
actionArgs = definition.parseArgs({}) ?? {};
|
actionArgs = definition.parseArgs({}) ?? {};
|
||||||
actionKey = definition.key;
|
actionKey = definition.key;
|
||||||
@@ -916,7 +917,7 @@ export const createReservedTurnHandler = async (options: {
|
|||||||
blockedReason = reason;
|
blockedReason = reason;
|
||||||
const meta = result.kind === 'deny' ? { constraintName: result.constraintName } : undefined;
|
const meta = result.kind === 'deny' ? { constraintName: result.constraintName } : undefined;
|
||||||
const failureText =
|
const failureText =
|
||||||
failedDefinition.formatConstraintFailure?.(reason, constraintCtx, actionArgs, view) ??
|
failedDefinition.formatConstraintFailure?.(reason, constraintCtx, failedActionArgs, view) ??
|
||||||
`${reason} ${failedDefinition.name} 실패.`;
|
`${reason} ${failedDefinition.name} 실패.`;
|
||||||
logs.push(createActionLog(failureText, meta));
|
logs.push(createActionLog(failureText, meta));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,9 @@ const remainCityTrust = (): Constraint => ({
|
|||||||
test: (ctx, view) => {
|
test: (ctx, view) => {
|
||||||
const city = ctx.cityId !== undefined ? (view.get({ kind: 'city', id: ctx.cityId }) as City | null) : null;
|
const city = ctx.cityId !== undefined ? (view.get({ kind: 'city', id: ctx.cityId }) as City | null) : null;
|
||||||
if (!city) return { kind: 'deny', reason: '도시 정보가 없습니다.' };
|
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,
|
ignoredPathPatterns: ignoredLifecyclePaths,
|
||||||
})
|
})
|
||||||
).toEqual([]);
|
).toEqual([]);
|
||||||
|
expect(semanticLogSignatures(core.after.logs)).toEqual(
|
||||||
|
semanticLogSignatures(addedReferenceLogs(reference.before, reference.after.logs))
|
||||||
|
);
|
||||||
},
|
},
|
||||||
120_000
|
120_000
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user