feat: ingest_doc 확인 루프 — confirm_ingest 툴 추가 및 OkfBundle 연동#243
Merged
seyoung4503 merged 11 commits intoJul 19, 2026
Conversation
비즈니스 용어를 Metric/Table/Rule/Dimension으로 분류할 수 있도록 FedEntry에 kind, applies_to, tags 필드를 추가한다. - FedEntry: kind, applies_to, tags 필드 추가 (기존 JSON 하위호환) - term_custom tool spec: 세 파라미터 노출 - _fmt_entry: kind 배지 표시 (`metric` 등) - 신규 테스트 3개: round-trip, 하위호환, kind 배지 렌더링 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pre-commit black check (--all-files) was consistently failing on master and all PR branches. This commit formats all Python files to make CI green. No logic changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Google OKF 스펙을 따라 KV 용어를 .md 파일로 내보내고 불러오는 OkfBundle 어댑터를 추가한다. - adapters/storage/okf_bundle.py 신규: export/import, kind별 폴더 라우팅 - pyproject.toml: PyYAML 의존성 추가 - 신규 테스트 9개: 직렬화 단위, 폴더 구조, round-trip Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ingest_doc: 추출된 후보를 KV에 pending_ingest:{ref} 키로 임시 저장
- confirm_ingest: pending 후보를 FedEntry로 변환해 KV 등록 (all/인덱스 선택)
- OKF_BUNDLE_DIR env var 설정 시 confirm 후 OkfBundle로 자동 export
- HarnessContext.okf_bundle_dir 필드 추가 (ContextConcierge가 env에서 주입)
- 테스트 14개 신규 추가
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- confirm_ingest: FedEntry 등록 성공 후 pending_ingest:{ref} 키 삭제
- ingest_doc: content 인라인 입력 시 ref를 md5 해시 기반으로 고유화
('inline' 고정 → 'inline:{md5[:8]}')하여 연속 ingestion 시 키 충돌 방지
- 테스트: pending 키 삭제 검증 케이스 추가
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Jul 19, 2026
- _validate_layer 공통 함수 추출: layer 정규화, guild is_admin 체크,
빈 channel_id 가드를 define/confirm_ingest 양쪽에서 공유
- okf_bundle: term에 /,\ 포함 시 path traversal 차단 + is_relative_to 가드
- okf_bundle: frontmatter 파싱을 split("\n---\n") 방식으로 교체해
definition 본문에 --- 포함 시 조용히 유실되던 버그 수정
- 테스트: guild 비관리자, 빈 channel_id, 잘못된 layer 케이스 3개 추가
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
_concept_path의 ValueError를 try/except 범위 안으로 포함해 악의적인 term 하나가 export 루프 전체를 중단시키지 않도록 수정 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
Author
수정 사항 정리리뷰 감사합니다. 아래 내용을 반영해 confirm_ingest — 검증 로직 보강
okf_bundle — 경로 안전성 및 파싱 버그 수정
테스트 추가
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 tasks
Collaborator
|
머지 가능합니다. 테스트 151개 통과. 수정 확인했습니다 — 비관리자 전사 등록 거부, 빈 채널 ID 거부, 로컬 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ Issue Number
없음
📝 요약(Summary)
한 줄 요약: 문서에서 뽑은 비즈니스 용어 후보를 사용자가 검토·승인하면 시멘틱 레이어에 자동 등록되는 확인 루프를 추가합니다.
해결하려는 문제
기존
ingest_doc은 문서에서 용어 후보를 추출해 텍스트로만 보여줬습니다. 사용자가 "좋아 보여"라고 해도 실제로 저장되는 건 없었습니다. 확인 단계와 저장 단계 사이의 연결고리가 없는 상태였습니다.이번 변경으로 달라지는 것
2단계 확인 루프가 완성됩니다.
Step 1 — 문서 업로드 및 후보 추출
후보는 KV에
pending_ingest:defs.md키로 임시 보관됩니다.Step 2 — 확인 및 등록
confirm 시점에
FedEntry로 변환되어 KV에 저장됩니다.OkfBundle 연동 (PR2와의 연결)
OKF_BUNDLE_DIR환경변수를 설정하면 confirm 후 자동으로 OkfBundle로도 내보냅니다. 설정하지 않으면 KV 저장만 합니다.다음 PR과의 관계
PR4에서는 등록된 kind 정보를 system prompt에 주입해 SQL 생성 정확도를 높입니다.
💬 To Reviewers
이 PR은 총 4개로 구성된 시리즈의 세 번째입니다. PR2 머지 후 순차 머지 부탁드립니다.
pending_ingest:{ref}키의 TTL(만료) 처리는 v1.5에서 논의할 수 있습니다. 현재는 만료 없이 KV에 남아 있습니다.accept파라미터로 인덱스 선택 외에 용어명 직접 지정 방식도 고려했으나, 인덱스 방식이 LLM 툴콜 관점에서 더 간결하다고 판단했습니다.PR Checklist