refactor(spec): cleanup pass over component specs
Address 8 issues found in spec audit (post PR #2): 1. §refs label: distinguish design vs report sections in p3-1 / p3-2 / p4-2 / p9-1 / p9-5 contract_sections (e.g., "report §11.2 Ollama" not "§11.2"). 2. mock feature gate: gate MockEmbedder (p3-1) and MockLanguageModel (p4-1) behind `mock` cargo feature, default OFF; add CI symbol-scan as DoD item. 3. Warning type unification: p1-2 frontmatter now emits `kb_parse_types::Warning` (matches p1-3 / p1-4); drops crate-internal type. 4. p4-3 streaming thread: explicitly single-threaded inside RagPipeline::ask; collection + sink.send share the calling thread, no race. UI concurrency is callers responsibility (TUI worker thread pattern in p9-3). 5. p6-2 tesseract version: noted that `tesseract` 0.13 has no stable Rust `version()` accessor; use TessVersion FFI or shell-out + cache approach. 6. p9-* App struct extensions: introduce `kb_tui::{Library,Search,Ask,Inspect}State` slots in p9-1 forward-decl form; p9-2/3/4 fill bodies in their own crate without editing `App`. Parallel-safety contract added. 7. p3-3 cosine score: shift `(sim+1)/2` instead of clamp; preserve ranking signal between unrelated and opposite vectors. Clamp reserved for NaN. 8. fixtures/ root: p0-1 DoD now creates all fixture subdirs with .gitkeep so downstream tasks have a stable target path.
This commit is contained in:
@@ -27,6 +27,7 @@ Provide the `kb-llm` crate that re-exports the `LanguageModel` trait and helper
|
||||
- `serde`
|
||||
- `thiserror`
|
||||
- `tracing`
|
||||
- `[features] mock = []` — opt-in feature flag exposing `MockLanguageModel`. Default OFF. Release builds compile mock out entirely.
|
||||
|
||||
## Forbidden dependencies
|
||||
|
||||
@@ -51,7 +52,8 @@ Provide the `kb-llm` crate that re-exports the `LanguageModel` trait and helper
|
||||
```rust
|
||||
pub use kb_core::{LanguageModel, GenerateRequest, TokenChunk, FinishReason, TokenUsage, ModelRef};
|
||||
|
||||
/// Test-only deterministic mock.
|
||||
/// Test-only deterministic mock. Compiled only when `mock` feature is on.
|
||||
#[cfg(feature = "mock")]
|
||||
pub struct MockLanguageModel {
|
||||
pub model_id: String,
|
||||
pub provider: String,
|
||||
@@ -61,6 +63,7 @@ pub struct MockLanguageModel {
|
||||
pub canned_usage: kb_core::TokenUsage,
|
||||
}
|
||||
|
||||
#[cfg(feature = "mock")]
|
||||
impl kb_core::LanguageModel for MockLanguageModel { /* per §7.2 */ }
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user