혼합 출처 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
80 lines
2.6 KiB
Rust
80 lines
2.6 KiB
Rust
//! Integration tests for Bug #13: schema.v1.models.active_parsers + active_chunkers.
|
|
|
|
use kebab_app::schema_with_config;
|
|
use kebab_config::Config;
|
|
use kebab_core::SourceScope;
|
|
|
|
fn minimal_config(data_dir: &std::path::Path, workspace_root: &std::path::Path) -> Config {
|
|
let mut cfg = Config::defaults();
|
|
cfg.workspace.root = Some(workspace_root.to_string_lossy().into_owned());
|
|
cfg.workspace.exclude.clear();
|
|
cfg.storage.data_dir = data_dir.to_string_lossy().into_owned();
|
|
cfg.storage.model_dir = data_dir.join("models").to_string_lossy().into_owned();
|
|
cfg.models.embedding.provider = "none".to_string();
|
|
cfg.models.embedding.dimensions = 0;
|
|
cfg.ingest.chunking.target_tokens = 80;
|
|
cfg.ingest.chunking.overlap_tokens = 20;
|
|
cfg
|
|
}
|
|
|
|
fn minimal_scope(workspace_root: &std::path::Path) -> SourceScope {
|
|
SourceScope {
|
|
root: workspace_root.to_path_buf(),
|
|
include: vec![],
|
|
exclude: vec![],
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn schema_models_active_arrays_empty_on_empty_corpus() {
|
|
let dir = tempfile::tempdir().unwrap();
|
|
let workspace = dir.path().join("kb");
|
|
std::fs::create_dir_all(&workspace).unwrap();
|
|
let cfg = minimal_config(dir.path(), &workspace);
|
|
|
|
let store = kebab_store_sqlite::SqliteStore::open(&cfg).unwrap();
|
|
store.run_migrations().unwrap();
|
|
drop(store);
|
|
|
|
let s = schema_with_config(&cfg).unwrap();
|
|
assert!(
|
|
s.models.active_parsers.is_empty(),
|
|
"empty corpus → no parsers"
|
|
);
|
|
assert!(
|
|
s.models.active_chunkers.is_empty(),
|
|
"empty corpus → no chunkers"
|
|
);
|
|
// backward compat: 기존 단일 field 는 markdown default 보존.
|
|
assert_eq!(s.models.parser_version, kebab_parse_md::PARSER_VERSION);
|
|
}
|
|
|
|
#[test]
|
|
fn schema_emits_active_parsers_and_chunkers_array_after_ingest() {
|
|
let dir = tempfile::tempdir().unwrap();
|
|
let workspace = dir.path().join("kb");
|
|
std::fs::create_dir_all(&workspace).unwrap();
|
|
std::fs::write(workspace.join("a.md"), "# A\nhello world\n").unwrap();
|
|
let cfg = minimal_config(dir.path(), &workspace);
|
|
let scope = minimal_scope(&workspace);
|
|
|
|
kebab_app::ingest_with_config(cfg.clone(), scope, false).unwrap();
|
|
|
|
let s = schema_with_config(&cfg).unwrap();
|
|
assert!(
|
|
!s.models.active_parsers.is_empty(),
|
|
"active_parsers populated after ingest"
|
|
);
|
|
assert!(
|
|
!s.models.active_chunkers.is_empty(),
|
|
"active_chunkers populated after ingest"
|
|
);
|
|
// active arrays must be sorted (ORDER BY in SQL).
|
|
let mut sorted = s.models.active_parsers.clone();
|
|
sorted.sort();
|
|
assert_eq!(
|
|
s.models.active_parsers, sorted,
|
|
"active_parsers must be sorted"
|
|
);
|
|
}
|