Ontology LNG 가스공사 시나리오 e2e
본 가이드는 Epic #1246 M4 Step 3 의 LNG 도메인 통합 e2e 를 다룹니다. M1 Step 5 의 LNG 시드 (3 Class / 12 attr / 8 instance) 위에서 M4 Step 1 (LLM identifier) + M4 Step 2 (row-mask) 통합 검증 + 가스공사 납품 데모.
사전 시드
cd apps/api && python -m gend_api.scripts.seed_ontology_lng
seed_ontology_lng.py (M1 Step 5) 산출:
| Class | Properties | Instance |
|---|---|---|
| Equipment | 5 (tag_id, name_ko, design_pressure, ...) | 4 (T-001~T-004) |
| Process | 4 (process_code, name_ko, ...) | 2 (재기화, 송출) |
| OperatingEvent | 3 (occurred_at, severity, ...) | 2 (WARN / CRITICAL) |
5 단계 시나리오
Step 1 — Admin 모델 탐색
- Admin 로그인 →
/ontology진입 - Class 목록에 Equipment / Process / OperatingEvent 3개 visible
/ontology/<equipment-id>Designer 진입 → Property 5 + Instances 탭 4 row- (스크린샷 1) Class 목록 화면
- (스크린샷 2) Designer Properties 탭
Step 2 — Viewer 권한 차이 (M3 Step 1 + M4 Step 2)
사전 grant 정의 (admin 으로 SQL):
-- viewer-team 은 Equipment 만 read 가능, secret_pressure 컬럼은 mask.
INSERT INTO ontology_class_grants
(layer, class_id, subject_id, action, condition_expr, mask_columns)
VALUES (
'L2', '<equipment-uuid>', 'viewer-team', 'read',
'instance.severity != ''CRITICAL''', -- CRITICAL 인스턴스는 hide
'["secret_pressure"]'::jsonb
);
- Viewer 로 token swap → Class 목록에 Equipment 만 visible
- Equipment Designer Instances 탭 —
severity=CRITICALrow 제외 +secret_pressure컬럼***MASKED*** - (스크린샷 3) Viewer Class 목록
- (스크린샷 4) Viewer Instances 탭 (mask 적용)
Step 3 — Hybrid RAG (M4 Step 1 LLM identifier)
/ai/chat진입- 질의: "재기화 공정 출구 압력 모니터링"
- 응답에 "Process" 또는 "Equipment" Class 카드 포함 (LLM identifier 가 자연어 매핑)
- RAGContext 메타에
ontology_identifier_method=\"llm\"(실패 시substring_fallback) - (스크린샷 5) AI Chat 응답
Step 4 — Snapshot + Diff
- Equipment Designer Versions 탭 → Snapshot 생성 (label
lng-baseline) - Equipment Property 1개 추가 (e.g.,
inlet_temperature) - 다시 Snapshot 생성 (label
lng-baseline-v2) - 두 snapshot 선택 → Diff 결과에서
changedentry 단언 - (스크린샷 6) Diff 결과 화면
Step 5 — 메트릭 시리즈 확인
curl -s https://gend.genon.ai/api/v1/metrics | grep gend_ontology_
기대 시리즈 (M3 Step 2 + M4 Step 1/2):
gend_ontology_class_count{layer}>= 0gend_ontology_class_mutations_total{action}(Designer 액션 후 ≥ 1)gend_ontology_mapper_suggestions_total{result}(RAG 호출 후 ≥ 1)gend_ontology_grant_evaluations_total{decision}(모든 endpoint 호출 후)gend_ontology_row_mask_total{class_name, action}(M4 Step 2 — Viewer 호출 후 ≥ 1)
회귀 가드
| 파일 | 범위 |
|---|---|
ui/tests/ontology-lng-scenario.spec.ts | 5 단계 smoke (각 endpoint no 5xx + metrics series 노출) — 9 |
apps/api/tests/test_ontology_lng_scenario.py | M1+M2+M3+M4 통합 (시드 + ABAC + row-mask + snapshot) end-to-end |
가스공사 데모 PPT 자료
스크린샷 6장 → docs-site/static/img/ontology-lng-scenario/ 디렉터리 (배포 시 생성):
01-class-list.png— Admin Class 목록02-designer-properties.png— Designer Properties 탭03-viewer-class-list.png— Viewer 권한 차이04-viewer-instances-masked.png— Mask 적용된 Instances05-ai-chat-rag.png— Hybrid RAG 응답06-versions-diff.png— Snapshot Diff
관련
- Epic: #1246 M4
- 의존: M1 Step 5 (#1052) LNG 시드, M3 (전체), M4 Step 1 (#1247) + Step 2 (#1248)
- 후속: M4 Step 4 (combined fall-through)