feat(kebab-store-sqlite): add NotIndexed typed error (fb-27)
New `SqliteStore::open_existing` API + `NotIndexed` signal for the
missing-DB case. kebab-app re-exports the type via its `error_signal`
module so kebab-cli's `error_classify` can map it to
`error.v1 { code: "not_indexed" }`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
19
crates/kebab-store-sqlite/tests/not_indexed.rs
Normal file
19
crates/kebab-store-sqlite/tests/not_indexed.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
//! Signal test: `SqliteStore::open_existing` emits `NotIndexed` when the DB
|
||||
//! file is absent.
|
||||
|
||||
use kebab_store_sqlite::{NotIndexed, SqliteStore};
|
||||
|
||||
#[test]
|
||||
fn not_indexed_signal_emitted_when_db_missing() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let nonexistent_db = dir.path().join("does-not-exist.sqlite");
|
||||
let res = SqliteStore::open_existing(&nonexistent_db);
|
||||
let err = match res {
|
||||
Ok(_) => panic!("opening a missing DB should fail"),
|
||||
Err(e) => e,
|
||||
};
|
||||
let signal = err
|
||||
.downcast_ref::<NotIndexed>()
|
||||
.expect("missing DB error should downcast to NotIndexed");
|
||||
assert_eq!(signal.expected, nonexistent_db.to_string_lossy().as_ref());
|
||||
}
|
||||
Reference in New Issue
Block a user