혼합 출처 KB(위키+jira 등)에서 색인은 전부 하되 질의 시 출처로 좁히는 provenance 레버. 전역 trust 곱셈가중(weighted-RRF)은 A/B 에서 반증(θ=0.85 만으로 incident MRR 0.918→0.340 절벽, 점수 압축) — 필터가 see-saw 없는 올바른 레버. - config [[workspace.sources]] (각 id/root/exclude/trust_level/source_type); 단일 root 는 implicit `default` source 로 정규화. validate: id 유일·비어있지 않음. - config schema v3→v4 (step_3_to_4, root→[[workspace.sources]] id=default 미러, 멱등) - V014 documents.source_id 컬럼+인덱스 (additive, DEFAULT 'default', 재색인 0) - Metadata.source_id + BodyHints trust precedence(frontmatter > source 기본값 > Primary) - ingest: --root 미지정 시 resolved_sources() 순회 + doc 마다 source_id/trust stamp - 검색 SearchFilters.source_type/source_id → lexical + vector 두 site (IN, OR) - CLI kebab search --source <id> / --source-type <type> (repeatable/comma-sep) 도그푸딩(620 doc, jira400+wiki220): --source wiki 로 개념 질의 MRR 0.780→0.810, --source jira 로 incident 0.918→0.975. trust precedence 실측(jira=secondary 기본값). version bump 0.28.0 → 0.29.0 (신규 CLI flag + config 키 + V014 migration → minor). follow-up: MCP search 필터 미노출 · kebab list source_id 미표시 · RAG provenance 라벨. 자세한 내용: tasks/HOTFIXES.md (2026-06-21), docs/release-notes/v0.29.0-draft.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Mc6W1fgsrbFKTsqA6P8La
54 lines
2.5 KiB
Rust
54 lines
2.5 KiB
Rust
//! v3 마이그레이션 무손실 골든 — 사용자 실제 v2 config.
|
|
//!
|
|
//! 불변식: 사용자가 손본 값·주석·대안(commented) 줄이 [ingest.*] relocation
|
|
//! 후에도 전부 보존되고, v3 Config 로 파싱했을 때 같은 값을 내며, 재실행이
|
|
//! 멱등이어야 한다.
|
|
use kebab_config::migrate::migrate_document;
|
|
|
|
const USER_V2: &str = include_str!("fixtures/user_v2_config.toml");
|
|
|
|
#[test]
|
|
fn user_v2_migrates_losslessly() {
|
|
let out = migrate_document(USER_V2);
|
|
assert_eq!(out.from_schema_version, 2);
|
|
// v2 → CURRENT(=4): v3 의 [ingest.*] relocation 에 더해 v4 의
|
|
// [[workspace.sources]] default source 미러링까지 적용된다.
|
|
assert_eq!(out.to_schema_version, 4);
|
|
let t = &out.new_text;
|
|
|
|
// 사용자 값 보존.
|
|
assert!(t.contains("root = \"/Users/user/Obsidian/Default\""), "{t}");
|
|
// v4: workspace.root → [[workspace.sources]] id=default 미러링.
|
|
assert!(t.contains("[[workspace.sources]]"), "v4 sources 누락:\n{t}");
|
|
assert!(t.contains("id = \"default\""), "default source 누락:\n{t}");
|
|
assert!(t.contains("model = \"snowflake-arctic-embed2\""));
|
|
assert!(t.contains("endpoint = \"http://192.168.0.2:11943\""));
|
|
// 사용자 주석/대안 줄 보존.
|
|
assert!(t.contains("# engine = \"ollama-vision\""), "대안 주석 유실:\n{t}");
|
|
assert!(t.contains("# provider = \"candle\""));
|
|
// 새 위치.
|
|
assert!(t.contains("[ingest.image.ocr]"));
|
|
assert!(t.contains("[ingest.pdf.ocr]"));
|
|
assert!(t.contains("[ingest.chunking]"));
|
|
assert!(t.contains("[ingest.image.caption]"));
|
|
// 옛 top-level 위치 제거.
|
|
assert!(!t.contains("\n[chunking]"));
|
|
assert!(!t.contains("\n[image.ocr]"));
|
|
assert!(!t.contains("\n[indexing]"));
|
|
|
|
// v3 Config 로 parse + 값 동일.
|
|
let cfg: kebab_config::Config = toml::from_str(t).expect("v3 parse");
|
|
assert!(cfg.ingest.image.ocr.enabled);
|
|
assert_eq!(cfg.ingest.image.ocr.engine, "paddle-onnx");
|
|
assert_eq!(cfg.models.embedding.model, "snowflake-arctic-embed2");
|
|
assert_eq!(cfg.models.llm.endpoint, "http://192.168.0.2:11943");
|
|
// pdf paddle 값 보존(v2 비대칭 → pdf 대칭 키로 복사). user 의 pdf.ocr 는
|
|
// engine=paddle-onnx 이고 자체 det_model 없으므로 번들(None) 유지.
|
|
assert_eq!(cfg.ingest.pdf.ocr.engine, "paddle-onnx");
|
|
|
|
// 멱등.
|
|
let again = migrate_document(t);
|
|
assert!(!again.changed(), "재실행 변경: {:?}", again.changes);
|
|
assert_eq!(again.new_text, *t);
|
|
}
|