8월 7일까지 워킹트리에만 남아 있던 미커밋 작업을 커밋한다. 여러 사본 폴더(worktree·clone)에 흩어져 있던 중간 스냅샷을 정리하기 전에 원본을 git 이력으로 고정하는 것이 목적이다. - contracts/routes/services: measurement, outcome_trajectory, rupture_repair, deliberate_practice, calibration_transfer, supervision_research, multimodal_alliance, continuous_improvement 계열 신규 모듈과 테스트 - infra/db/init: 07~16 마이그레이션(측정 기반~calibration transfer 실행) - apps/web: 세션 리뷰 카드·관리 화면·E2E 스펙 추가 - docs/ops: G0~G8 라이브 통합·배포·롤백 증거 문서와 evidence JSON/PNG - scripts: smoke·ledger·릴리스 에이전트·NAS 프리뷰 운영 스크립트 engine.public 로그 .bak과 apps/web/test-results 산출물은 커밋에서 제외했다.
96 lines
2.7 KiB
SQL
96 lines
2.7 KiB
SQL
\set ON_ERROR_STOP on
|
|
\if :{?app_role}
|
|
\else
|
|
\set app_role vignette
|
|
\endif
|
|
|
|
DO $$
|
|
DECLARE
|
|
relation_count INT;
|
|
rls_count INT;
|
|
append_guard_count INT;
|
|
policy_count INT;
|
|
BEGIN
|
|
SELECT count(*) INTO relation_count
|
|
FROM pg_class c
|
|
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
WHERE n.nspname = 'app'
|
|
AND c.relname = ANY(ARRAY[
|
|
'practice_prescription_submission',
|
|
'practice_coaching_card',
|
|
'practice_prescription',
|
|
'practice_episode_submission',
|
|
'practice_attempt_evidence',
|
|
'competency_graph_snapshot',
|
|
'practice_curriculum_decision_event',
|
|
'practice_teacher_correction'
|
|
]);
|
|
IF relation_count <> 8 THEN
|
|
RAISE EXCEPTION 'expected 8 G4 relations, found %', relation_count;
|
|
END IF;
|
|
|
|
SELECT count(*) INTO rls_count
|
|
FROM pg_class c
|
|
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
WHERE n.nspname = 'app'
|
|
AND c.relname = ANY(ARRAY[
|
|
'practice_prescription_submission',
|
|
'practice_coaching_card',
|
|
'practice_prescription',
|
|
'practice_episode_submission',
|
|
'practice_attempt_evidence',
|
|
'competency_graph_snapshot',
|
|
'practice_curriculum_decision_event',
|
|
'practice_teacher_correction'
|
|
])
|
|
AND c.relrowsecurity;
|
|
IF rls_count <> 8 THEN
|
|
RAISE EXCEPTION 'expected RLS on 8 G4 relations, found %', rls_count;
|
|
END IF;
|
|
|
|
SELECT count(*) INTO append_guard_count
|
|
FROM pg_trigger t
|
|
JOIN pg_class c ON c.oid = t.tgrelid
|
|
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
WHERE n.nspname = 'app'
|
|
AND c.relname = ANY(ARRAY[
|
|
'practice_prescription_submission',
|
|
'practice_coaching_card',
|
|
'practice_prescription',
|
|
'practice_episode_submission',
|
|
'practice_attempt_evidence',
|
|
'competency_graph_snapshot',
|
|
'practice_curriculum_decision_event',
|
|
'practice_teacher_correction'
|
|
])
|
|
AND t.tgname LIKE '%append_only'
|
|
AND NOT t.tgisinternal;
|
|
IF append_guard_count <> 8 THEN
|
|
RAISE EXCEPTION 'expected 8 append guards, found %', append_guard_count;
|
|
END IF;
|
|
|
|
SELECT count(*) INTO policy_count
|
|
FROM pg_policies p
|
|
WHERE p.schemaname = 'app'
|
|
AND p.tablename = ANY(ARRAY[
|
|
'practice_prescription_submission',
|
|
'practice_coaching_card',
|
|
'practice_prescription',
|
|
'practice_episode_submission',
|
|
'practice_attempt_evidence',
|
|
'competency_graph_snapshot',
|
|
'practice_curriculum_decision_event',
|
|
'practice_teacher_correction'
|
|
]);
|
|
IF policy_count <> 16 THEN
|
|
RAISE EXCEPTION 'expected 16 G4 RLS policies, found %', policy_count;
|
|
END IF;
|
|
END;
|
|
$$;
|
|
|
|
SELECT
|
|
8 AS relation_count,
|
|
8 AS rls_relation_count,
|
|
8 AS append_guard_count,
|
|
16 AS rls_policy_count,
|
|
(SELECT rolbypassrls FROM pg_roles WHERE rolname = :'app_role') AS app_role_bypassrls;
|