NPC 명령의 실제 검사와 준비 및 대체 실행 순서를 감사 기록에 연결

This commit is contained in:
2026-09-16 08:46:56 +00:00
parent eb680121c3
commit 028f985e7a
15 changed files with 391 additions and 24 deletions
@@ -16,6 +16,8 @@ export interface PendingAuditDecision {
summary: {
schemaVersion: 1;
coverage: 'PROCEDURES';
executionCoverage?: 'ATTEMPTS';
executionStatus?: 'PREPARING' | 'BLOCKED' | 'RESOLVED';
clockRevision: number;
codeVersion: string | null;
policyRefs: Record<string, string>;
@@ -14,7 +14,12 @@ export const persistAuditDecisions = async (
const headers = batch.map(({ steps, ...decision }) => {
if (!Number.isSafeInteger(decision.tick) || decision.tick < 0 || !steps.length)
throw new Error('Invalid play audit decision');
if (steps[0]?.kind !== 'DECISION_START' || steps.at(-1)?.kind !== 'DECISION_END')
if (
steps[0]?.kind !== 'DECISION_START' ||
!steps.some((step) => step.kind === 'DECISION_END') ||
!['DECISION_END', 'EXECUTION_ATTEMPT'].includes(steps.at(-1)!.kind) ||
(decision.summary.executionCoverage === 'ATTEMPTS' && steps.at(-1)?.kind !== 'EXECUTION_ATTEMPT')
)
throw new Error('Incomplete play audit decision');
if (
steps.some(