From 2fedaa065ba83215863b2e93dfcbd0c423656fa7 Mon Sep 17 00:00:00 2001 From: hyungi Date: Sat, 27 Jun 2026 07:10:24 +0900 Subject: [PATCH] =?UTF-8?q?fix(study):=20subject=5Fnote=5Frag=20=EC=97=90?= =?UTF-8?q?=20licensed=5Frestricted=20=ED=95=84=ED=84=B0=20=EB=88=84?= =?UTF-8?q?=EB=9D=BD=20=E2=80=94=20=EA=B5=AC=EB=A7=A4=EC=9E=90=EB=A3=8C=20?= =?UTF-8?q?=EB=B6=84=EC=95=BC=EB=85=B8=ED=8A=B8=20RAG=20=EB=88=84=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit explanation_rag 는 restricted_exclude_orm() 으로 licensed_restricted 문서를 제외하는데(B-4, a안 U-2① 단일술어), 복제된 subject_note_rag._gather_document_evidence 는 이 술어를 빠뜨려 구매 자료 verbatim 이 분야노트 RAG 로 샐 수 있었음(services 리뷰 P1 보안 drift). doc_meta 쿼리에 필터 추가 → valid_doc_ids → 청크 쿼리까지 자동 전파(explanation_rag 동일 구조). Co-Authored-By: Claude Opus 4.8 (1M context) --- app/services/study/subject_note_rag.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/services/study/subject_note_rag.py b/app/services/study/subject_note_rag.py index 0f398bb..6ecc663 100644 --- a/app/services/study/subject_note_rag.py +++ b/app/services/study/subject_note_rag.py @@ -20,6 +20,7 @@ from models.chunk import DocumentChunk from models.document import Document from models.study_question import StudyQuestion from models.study_topic import StudyTopicDocument +from services.search.license_filter import restricted_exclude_orm logger = logging.getLogger(__name__) @@ -113,6 +114,9 @@ async def _gather_document_evidence( select(Document.id, Document.title, Document.ai_summary).where( Document.id.in_(doc_ids), Document.deleted_at.is_(None), + # B-4: licensed_restricted 제외 — explanation_rag 와 동일 술어(a안 U-2①). 누락 시 + # 구매 자료 verbatim 이 분야노트 RAG 로 새던 보안 drift(복제 과정 누락). + restricted_exclude_orm(), ) ) ).all()