feat(kebab-store-sqlite): p9-fb-23 task 4 — get_asset_by_workspace_path

Add `DocumentStore::get_asset_by_workspace_path` trait method to
`kebab-core` and implement it on `SqliteStore` via a private
`asset_from_row` helper. Used by the incremental-ingest skip path to
compare a freshly-computed blake3 checksum against the persisted row
without a full round-trip through `put_asset_with_bytes`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-04 17:58:23 +00:00
parent 4261c8953c
commit 366e89e5e2
3 changed files with 119 additions and 1 deletions

View File

@@ -117,3 +117,32 @@ fn put_then_get_document_roundtrips_none_stamps() {
"last_embedding_version must be None when not set"
);
}
#[test]
fn get_asset_by_workspace_path_roundtrips() {
let env = common::TestEnv::new();
let store = SqliteStore::open(&env.config()).unwrap();
store.run_migrations().unwrap();
let asset = make_asset();
store.put_asset(&asset).unwrap();
let loaded = store
.get_asset_by_workspace_path(&asset.workspace_path)
.unwrap()
.expect("asset must round-trip");
assert_eq!(loaded.asset_id, asset.asset_id);
assert_eq!(loaded.checksum, asset.checksum);
assert_eq!(loaded.byte_len, asset.byte_len);
}
#[test]
fn get_asset_by_workspace_path_returns_none_for_unknown() {
let env = common::TestEnv::new();
let store = SqliteStore::open(&env.config()).unwrap();
store.run_migrations().unwrap();
let path = WorkspacePath::new("notes/missing.md".into()).unwrap();
assert!(store.get_asset_by_workspace_path(&path).unwrap().is_none());
}