🏗️ refactor(kebab-app): consolidate PARSER_VERSION + clarify intent (fb-27)

Replace kebab-app's private `KEBAB_PARSE_MD_VERSION` literal with a
direct reference to `kebab_parse_md::PARSER_VERSION` so the parser
version cascade has a single source of truth (design §9 invariant).

Add maintenance comment on schema.rs WIRE_SCHEMAS const pointing to
docs/wire-schema/v1/ + kebab-cli wire helpers as the authoritative
sources to keep in sync.

Tighten open_existing doc comment to match the actual SQLITE_OPEN_READ_WRITE
flag (needed for WAL pragma application) — callers should still avoid
issuing mutations through this connection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
th-kim0823
2026-05-07 11:58:06 +09:00
parent 39b4433549
commit 61aae1c1d5
3 changed files with 6 additions and 19 deletions

View File

@@ -74,21 +74,6 @@ pub use schema::{Capabilities, Models, SchemaV1, Stats, WireBlock, schema_with_c
/// compatibility break.
pub const NO_EXT_SENTINEL: &str = "<no-ext>";
/// Parser-version label persisted in `documents.parser_version` for
/// every Markdown file ingested through the `kb-parse-md` pipeline.
/// Kept in lock-step with the literal used in the `kb-store-sqlite`
/// idempotency / round-trip tests so the version label written by the
/// app and the one used in cross-crate fixtures match.
///
/// p9-fb-07 bumped this from `pulldown-cmark-0.x` to `md-frontmatter-v2`
/// because `kebab-normalize::derive_title` now applies a fallback chain
/// (frontmatter → H1 → H2 → first paragraph → file stem) when the
/// frontmatter title is blank. The bump invalidates `doc_id` for every
/// pre-existing Markdown document, so a re-ingest is required for the
/// new titles to land — this is the documented cascade behavior per
/// design §9.
const KEBAB_PARSE_MD_VERSION: &str = "md-frontmatter-v2";
/// Caller-supplied knobs for one [`ask`] invocation.
///
/// Re-exported from [`kebab_rag::AskOpts`] (P4-3 owns the type) so kb-cli's
@@ -333,7 +318,7 @@ pub fn ingest_with_config_opts(
.context("kb-app::ingest: ensure Lance table")?;
}
let parser_version = ParserVersion(KEBAB_PARSE_MD_VERSION.to_string());
let parser_version = ParserVersion(kebab_parse_md::PARSER_VERSION.to_string());
let chunk_policy = chunk_policy_from_config(&app.config);
// P6-4: build OCR / caption adapters once per ingest invocation,

View File

@@ -54,6 +54,8 @@ pub struct Stats {
const KEBAB_VERSION: &str = env!("CARGO_PKG_VERSION");
// Authoritative list of wire schemas this binary emits. Keep in sync with
// `docs/wire-schema/v1/*.schema.json` and `kebab-cli::wire::wire_*` helpers.
const WIRE_SCHEMAS: &[&str] = &[
"answer.v1",
"search_hit.v1",

View File

@@ -79,9 +79,9 @@ impl SqliteStore {
///
/// Unlike [`Self::open`], this does NOT create the file — if it is
/// missing, returns a [`NotIndexed`] signal suitable for `error.v1`
/// translation. Stores returned by this method are intended for read-only
/// introspection (`schema_with_config`); use [`Self::open`] for any path
/// that calls `put_asset_with_bytes`.
/// translation. Opens read-write to support WAL pragmas; callers should
/// not issue mutations through this connection — use [`Self::open`] for
/// ingest paths.
///
/// **Does not run migrations** — call [`Self::run_migrations`] next if
/// you need the schema initialised.