사람 승인 게이트를 명시화

This commit is contained in:
Yun Chan 2026-08-29 23:59:29 +09:00
parent 707dba4f8f
commit 3a7b6f7760
5 changed files with 133 additions and 3 deletions

View file

@ -280,6 +280,51 @@ SELECT set_config('app.current_ai_view','',true);
SELECT set_config('app.current_role','admin',true);
SELECT set_config('app.current_uid','14000000-0000-0000-0000-000000000001',true);
-- 보류와 반려는 모든 대상에서 감사 기록만 남기고 효과를 만들지 않는다.
INSERT INTO app.ci_ingestion_submission (
submission_id, content_hash, operation_kind, result_id
) VALUES
('14000000-0000-0000-0000-000000000064',repeat('8',64),'human_approval','14000000-0000-0000-0000-000000000065'),
('14000000-0000-0000-0000-000000000066',repeat('9',64),'human_approval','14000000-0000-0000-0000-000000000067');
INSERT INTO audit.ci_human_approval_event (
approval_event_id, submission_id, target_kind, target_id, decision, actor_uid,
reason_code, evidence_refs, content_hash
) VALUES
(
'14000000-0000-0000-0000-000000000065','14000000-0000-0000-0000-000000000064',
'content_qualification','14000000-0000-0000-0000-000000000019','keep_quarantine',
'14000000-0000-0000-0000-000000000001','more-evidence-required',
'{audit://synthetic/g8/content-hold}',repeat('8',64)
),
(
'14000000-0000-0000-0000-000000000067','14000000-0000-0000-0000-000000000066',
'release_gate','14000000-0000-0000-0000-000000000021','reject',
'14000000-0000-0000-0000-000000000001','release-rejected',
'{audit://synthetic/g8/release-reject}',repeat('9',64)
);
DO $$
BEGIN
IF (SELECT count(*) FROM audit.ci_human_approval_event
WHERE approval_event_id IN (
'14000000-0000-0000-0000-000000000065',
'14000000-0000-0000-0000-000000000067'
)) <> 2
OR EXISTS (
SELECT 1 FROM app.ci_catalog_entry
WHERE approval_event_id = '14000000-0000-0000-0000-000000000065'
)
OR EXISTS (
SELECT 1 FROM audit.ci_lifecycle_event
WHERE approval_event_id IN (
'14000000-0000-0000-0000-000000000065',
'14000000-0000-0000-0000-000000000067'
)
) THEN
RAISE EXCEPTION 'fail-closed human decision created a side effect';
END IF;
END;
$$;
INSERT INTO app.ci_ingestion_submission (
submission_id, content_hash, operation_kind, result_id
) VALUES (