From 8dfeb007e0e352fa8fcfda6998beae53f36bc346 Mon Sep 17 00:00:00 2001 From: altair823 Date: Fri, 26 Jun 2026 17:25:03 +0000 Subject: [PATCH] =?UTF-8?q?chore(search):=20PR=20#219=20=ED=9A=8C=EC=B0=A8?= =?UTF-8?q?=201=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81=20=E2=80=94=20?= =?UTF-8?q?=EC=9E=94=EC=A1=B4=20dead-cache=20=EC=A3=BC=EC=84=9D/help=20tex?= =?UTF-8?q?t=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 리뷰어 지적 6건 + 전체-트리 grep 으로 추가 발견한 동일 부류 4건: - search --trace help text(CLI main.rs + MCP search tool) "Bypasses cache" → "always a fresh retriever run" (없는 캐시 광고 제거) - corpus_revision 의 실제 소비자는 incremental ingest 가 아니라 cursor pagination(stale_cursor) 임을 반영 — HANDOFF 노트 사실 정정 + ingest.rs bump 주석/warn 로그 + corpus_revision/search_lexical 테스트 주석 재서술 (검증: cursor.rs + app.rs:327/333/498 가 유일 소비자, ingest 는 bump 만) - bulk.rs "LRU cache amortize" → embedder cold-start 만 amortize - app.rs lexical_index_version "search cache 무효화" 제거 - app-facade README 의 search cache bullet 을 "(제거됨 — 이력)" 표시 잔여 dead-cache 개념 참조 0건(active tree), clippy -D warnings 클린. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_012Mc6W1fgsrbFKTsqA6P8La --- crates/kebab-app/src/app.rs | 2 +- crates/kebab-app/src/bulk.rs | 2 +- crates/kebab-app/src/ingest.rs | 10 +++++----- crates/kebab-app/tests/search_lexical.rs | 2 +- crates/kebab-cli/src/main.rs | 4 ++-- crates/kebab-mcp/src/tools/search.rs | 2 +- crates/kebab-store-sqlite/tests/corpus_revision.rs | 9 +++++---- docs/components/app-facade/README.md | 2 +- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/crates/kebab-app/src/app.rs b/crates/kebab-app/src/app.rs index eaa41a9..8a1bfb0 100644 --- a/crates/kebab-app/src/app.rs +++ b/crates/kebab-app/src/app.rs @@ -774,7 +774,7 @@ impl App { /// V009 (2026-05-28): FTS5 tokenizer 가 trigram → unicode61 + 한국어 /// 형태소 분해 column 로 갱신됨. `fts5-v009-korean-morphological` /// suffix 가 V007 baseline 과 구별되어 eval runner 의 config -/// snapshot 및 search cache 무효화에 picks up 된다. +/// snapshot 에 picks up 된다. fn lexical_index_version(config: &kebab_config::Config) -> IndexVersion { IndexVersion(format!( "lex:{}:fts5-v009-korean-morphological", diff --git a/crates/kebab-app/src/bulk.rs b/crates/kebab-app/src/bulk.rs index 9284303..4a26dd0 100644 --- a/crates/kebab-app/src/bulk.rs +++ b/crates/kebab-app/src/bulk.rs @@ -1,5 +1,5 @@ //! p9-fb-42: bulk multi-query facade. Sequential for-loop reusing -//! one App instance so embedder cold-start + LRU cache amortize +//! one App instance so the embedder cold-start amortizes //! across the N queries. use anyhow::Context; diff --git a/crates/kebab-app/src/ingest.rs b/crates/kebab-app/src/ingest.rs index 30fb9d7..2f60d89 100644 --- a/crates/kebab-app/src/ingest.rs +++ b/crates/kebab-app/src/ingest.rs @@ -604,10 +604,10 @@ pub fn ingest_with_config( crate::ingest_progress::emit(progress, terminal_event); // p9-fb-19: bump the persistent corpus_revision counter when a - // commit landed (any new / updated / purged). This invalidates every - // entry in any in-process LRU search cache (in this process or - // a sibling) on the next lookup. No-op when nothing changed - // (skipped-only run) — the cache stays valid. + // commit landed (any new / updated / purged). This invalidates any + // outstanding search pagination cursors (stale_cursor) on the next + // page request. No-op when nothing changed (skipped-only run) — + // outstanding cursors stay valid. if new_count > 0 || updated_count > 0 || purged_deleted_files > 0 { match app.sqlite.bump_corpus_revision() { Ok(rev) => tracing::debug!( @@ -618,7 +618,7 @@ pub fn ingest_with_config( Err(e) => tracing::warn!( target: "kebab-app", error = %e, - "bump_corpus_revision failed; cache may serve stale results until process restart" + "bump_corpus_revision failed; outstanding search cursors may not be invalidated until the next successful ingest" ), } } diff --git a/crates/kebab-app/tests/search_lexical.rs b/crates/kebab-app/tests/search_lexical.rs index eca440f..680eeae 100644 --- a/crates/kebab-app/tests/search_lexical.rs +++ b/crates/kebab-app/tests/search_lexical.rs @@ -90,7 +90,7 @@ fn first_ingest_bumps_corpus_revision() { let store_before = kebab_store_sqlite::SqliteStore::open(&env.config.storage).unwrap(); store_before.run_migrations().unwrap(); // V004 seeds 0; V009 + V010 + V011 migrations each bump by 1 to - // invalidate stale LRU caches (spec §5.2). Baseline before ingest = 3. + // invalidate outstanding pagination cursors (spec §5.2). Baseline before ingest = 3. // (V012 derivation_cache + V013 drop-chunk-aliases are structural/additive // — neither bumps corpus_revision.) let baseline = store_before.corpus_revision(); diff --git a/crates/kebab-cli/src/main.rs b/crates/kebab-cli/src/main.rs index e3dd00c..8c554e7 100644 --- a/crates/kebab-cli/src/main.rs +++ b/crates/kebab-cli/src/main.rs @@ -206,8 +206,8 @@ enum Cmd { source: Vec, /// p9-fb-37: emit pre-fusion lexical / vector / RRF candidate - /// lists + per-stage timing in the response. Bypasses cache - /// (debug intent — fresh run guaranteed). Requires embeddings + /// lists + per-stage timing in the response (debug intent — + /// always a fresh retriever run). Requires embeddings /// when `--mode hybrid` or `--mode vector`; lexical mode runs /// without embeddings via a no-op vector stub. #[arg(long)] diff --git a/crates/kebab-mcp/src/tools/search.rs b/crates/kebab-mcp/src/tools/search.rs index fe1120d..3935dfb 100644 --- a/crates/kebab-mcp/src/tools/search.rs +++ b/crates/kebab-mcp/src/tools/search.rs @@ -49,7 +49,7 @@ pub struct SearchInput { pub doc_id: Option, /// p9-fb-37: when true, include a `trace` field on the response /// with pre-fusion lexical/vector candidate lists + per-stage timing. - /// Bypasses cache (debug intent — fresh run guaranteed). Default false. + /// Debug intent — always a fresh retriever run. Default false. pub trace: Option, } diff --git a/crates/kebab-store-sqlite/tests/corpus_revision.rs b/crates/kebab-store-sqlite/tests/corpus_revision.rs index 3f59937..2ff2eac 100644 --- a/crates/kebab-store-sqlite/tests/corpus_revision.rs +++ b/crates/kebab-store-sqlite/tests/corpus_revision.rs @@ -1,7 +1,7 @@ //! p9-fb-19: `corpus_revision` kv counter — exposed on `SqliteStore` //! so `kebab-app::ingest` can bump after a successful commit and -//! `App::search`'s LRU cache key can snapshot the current value for -//! invalidation. +//! search pagination cursors can snapshot the current value to detect +//! staleness (`stale_cursor`). use kebab_config::Config; use kebab_store_sqlite::SqliteStore; @@ -21,8 +21,9 @@ fn open_store(tmp: &TempDir) -> SqliteStore { } /// Fresh store baseline: V004 seeds `corpus_revision = 0`, then V009, -/// V010, and V011 migrations bump it by one each to invalidate any stale -/// LRU cache — so a fresh store after `run_migrations()` reads back as `3`. +/// V010, and V011 migrations bump it by one each to invalidate any +/// outstanding pagination cursor — so a fresh store after +/// `run_migrations()` reads back as `3`. /// (V012 derivation_cache + V013 drop-chunk-aliases are structural/additive /// and do NOT bump corpus_revision.) #[test] diff --git a/docs/components/app-facade/README.md b/docs/components/app-facade/README.md index 9ae994f..4404888 100644 --- a/docs/components/app-facade/README.md +++ b/docs/components/app-facade/README.md @@ -177,6 +177,6 @@ flowchart LR - app skeleton + ingest wiring: [`tasks/p3/p3-5-app-wiring.md`](../../../tasks/p3/p3-5-app-wiring.md), [`tasks/p6/p6-4-image-ingest-wiring.md`](../../../tasks/p6/p6-4-image-ingest-wiring.md), [`tasks/p7/p7-3-pdf-ingest-wiring.md`](../../../tasks/p7/p7-3-pdf-ingest-wiring.md) - reset: [`tasks/p9/p9-fb-06-data-reset-command.md`](../../../tasks/p9/p9-fb-06-data-reset-command.md) - ingest progress / cancel: [`tasks/p9/p9-fb-03-tui-ingest-background.md`](../../../tasks/p9/p9-fb-03-tui-ingest-background.md), [`tasks/p9/p9-fb-04-ingest-cancellation.md`](../../../tasks/p9/p9-fb-04-ingest-cancellation.md) - - search cache: [`tasks/p9/p9-fb-19-search-cache.md`](../../../tasks/p9/p9-fb-19-search-cache.md) + - search cache (제거됨 — 이력): [`tasks/p9/p9-fb-19-search-cache.md`](../../../tasks/p9/p9-fb-19-search-cache.md) - chat session CLI: [`tasks/p9/p9-fb-18-cli-ask-session-repl.md`](../../../tasks/p9/p9-fb-18-cli-ask-session-repl.md) - HOTFIXES (P3-5/P4-3 `--config` 누락 + `*_with_config` 패턴, P7-3 storage UNIQUE bug, p9-fb-* 도그푸딩 후속): [`tasks/HOTFIXES.md`](../../../tasks/HOTFIXES.md)