feat(search): provenance 출처 필터 — [[workspace.sources]] 멀티소스 + --source/--source-type

혼합 출처 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
This commit is contained in:
2026-06-21 08:35:19 +00:00
parent 403e162ac0
commit 58ac62d53a
101 changed files with 1201 additions and 111 deletions

View File

@@ -598,8 +598,7 @@ fn spawn_ask_worker(state: &mut App) {
fn make_conversation_id() -> String {
let nanos = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_nanos())
.unwrap_or(0);
.map_or(0, |d| d.as_nanos());
format!("conv_{nanos:032x}")
}

View File

@@ -34,11 +34,10 @@ pub fn start_ingest(app: &mut App) -> anyhow::Result<()> {
anyhow::bail!("ingest already running");
}
let cfg = app.config.clone();
let scope = SourceScope {
root: std::path::PathBuf::from(&cfg.workspace.root),
exclude: cfg.workspace.exclude.clone(),
..Default::default()
};
// [[workspace.sources]]: leave `scope.root` empty so the app iterates
// every configured source (`config.resolved_sources()`), mirroring the
// CLI `kebab ingest` path. Each source carries its own merged exclude.
let scope = SourceScope::default();
let (tx, rx) = mpsc::channel::<IngestEvent>();
let cancel = Arc::new(AtomicBool::new(false));
let cancel_for_worker = cancel.clone();

View File

@@ -304,10 +304,11 @@ pub fn handle_key_search(state: &mut App, key: KeyEvent) -> KeyOutcome {
// `terminal.clear()` couldn't happen — leaving the
// previous frame leaking through the new draw.
let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".into());
// `~/...` / `${XDG_…}` expansion via `kebab-config::expand_path`
// — same helper used by the markdown / image / PDF ingest
// paths (HOTFIXES 2026-05-02 P9-4 follow-up).
let workspace_root = kebab_config::expand_path(&state.config.workspace.root, "");
// [[workspace.sources]]: resolve the primary workspace root
// (first source / legacy `root`). `resolve_workspace_root` applies
// the same `~` / `${XDG_…}` / relative-to-config expansion as the
// markdown / image / PDF ingest paths (HOTFIXES 2026-05-02 P9-4).
let workspace_root = state.config.resolve_workspace_root();
state.pending_editor = Some(crate::app::EditorRequest {
citation: citation.unwrap(),
editor_env: editor,

View File

@@ -19,7 +19,7 @@ use time::OffsetDateTime;
fn fresh_app() -> App {
let mut config = Config::defaults();
config.storage.data_dir = "/tmp/kebab-tui-ask-tests-noop".to_string();
config.workspace.root = "/tmp/kebab-tui-ask-tests-noop/workspace".to_string();
config.workspace.root = Some("/tmp/kebab-tui-ask-tests-noop/workspace".to_string());
let mut app = App::new(config).expect("App::new");
app.focus = Pane::Ask;
// p9-fb-12 follow-up: mirror the run loop's auto-flip on pane

View File

@@ -12,7 +12,7 @@ use ratatui::layout::Rect;
fn fresh_app(focus: Pane) -> App {
let mut config = Config::defaults();
config.storage.data_dir = "/tmp/kebab-tui-cheatsheet-tests-noop".to_string();
config.workspace.root = "/tmp/kebab-tui-cheatsheet-tests-noop/workspace".to_string();
config.workspace.root = Some("/tmp/kebab-tui-cheatsheet-tests-noop/workspace".to_string());
let mut app = App::new(config).expect("App::new");
app.focus = focus;
app

View File

@@ -23,7 +23,7 @@ use time::OffsetDateTime;
fn fresh_app() -> App {
let mut config = Config::defaults();
config.storage.data_dir = "/tmp/kebab-tui-inspect-tests-noop".to_string();
config.workspace.root = "/tmp/kebab-tui-inspect-tests-noop/workspace".to_string();
config.workspace.root = Some("/tmp/kebab-tui-inspect-tests-noop/workspace".to_string());
let mut app = App::new(config).expect("App::new");
app.focus = Pane::Inspect;
app.inspect = Some(InspectState::default());
@@ -85,6 +85,7 @@ fn make_doc() -> CanonicalDocument {
git_branch: None,
git_commit: None,
code_lang: None,
source_id: None,
},
provenance: Provenance {
events: vec![ProvenanceEvent {

View File

@@ -9,7 +9,7 @@ use kebab_tui::{App, Mode, Pane, mode_intercept};
fn fresh_app(focus: Pane) -> App {
let mut config = Config::defaults();
config.storage.data_dir = "/tmp/kebab-tui-mode-tests-noop".to_string();
config.workspace.root = "/tmp/kebab-tui-mode-tests-noop/workspace".to_string();
config.workspace.root = Some("/tmp/kebab-tui-mode-tests-noop/workspace".to_string());
let mut app = App::new(config).expect("App::new");
app.focus = focus;
app.mode = Mode::auto_for(focus);

View File

@@ -18,7 +18,7 @@ use std::path::Path;
fn fresh_app() -> App {
let mut config = Config::defaults();
config.storage.data_dir = "/tmp/kebab-tui-search-tests-noop".to_string();
config.workspace.root = "/tmp/kebab-tui-search-tests-noop/workspace".to_string();
config.workspace.root = Some("/tmp/kebab-tui-search-tests-noop/workspace".to_string());
let mut app = App::new(config).expect("App::new");
app.focus = Pane::Search;
// p9-fb-12 follow-up: mirror the run loop's auto-flip — Search

View File

@@ -9,7 +9,7 @@ use ratatui::layout::Rect;
fn fresh_app(focus: Pane) -> App {
let mut config = Config::defaults();
config.storage.data_dir = "/tmp/kebab-tui-status-bar-tests-noop".to_string();
config.workspace.root = "/tmp/kebab-tui-status-bar-tests-noop/workspace".to_string();
config.workspace.root = Some("/tmp/kebab-tui-status-bar-tests-noop/workspace".to_string());
let mut app = App::new(config).expect("App::new");
app.focus = focus;
app