fix(knowledge): honor import frontmatter identity - #2309
Conversation
|
Deriving a record's identity from the file being imported is a trust boundary, and two things cross A same-slug row with no identity claim is overwritten without any ownership check. The collision if let Some(existing_slug) = existing_slugs.iter().find(|s| *s != &prepared.slug) { return Err(...) }An existing row that simply occupies the target slug but has never recorded an identity claim never Concretely: an atom exists at slug A UUID-shaped canonical identity becomes a slug that let resolved_id = if let Ok(uuid) = id.parse::<Uuid>() { Some(uuid.to_string()) } else { /* exact slug lookup first */ }( What makes this a gap rather than a design choice is the branch immediately below it: the non-UUID Two smaller things. The frontmatter is deserialized whole into The identity value itself is validated only as a non-empty trimmed string ( Worth keeping as-is: the alias agreement rule is genuinely well specified — One backward-compatibility note that should be called out explicitly: a document whose body merely The added tests cover the happy path, the different-slug identity refusal, in-batch collision, and |
|
One real failure; the other red rows are sibling matrix shards cancelled by fail-fast.
This branch is 10 commits behind |
The red
|
ohdearquant
left a comment
There was a problem hiding this comment.
Automated review. Posted by this repository's automated pull-request review pipeline; this is not a human read and does not gate the merge by itself.
Verdict on head 20dbc77: REQUEST-CHANGES, 2 blocking findings. Finding details are delivered to the review's recipients rather than posted here. Do not merge this head while blocking findings are outstanding; a pipeline comment on a newer head supersedes this one.
Two conflicts: - `crates/khive-pack-knowledge/README.md`: main's verb table is taken, since it carries the corrected `knowledge.index` row (FTS rebuild is `kkernel reindex` only). Only the `knowledge.import` row is updated, to name frontmatter as well as path identity, which is what this branch changes. - `crates/Cargo.lock`: resolved to main's and then regenerated against the merged manifests, which adds one line. `cargo metadata --locked` resolves cleanly at this tree, so `--locked` builds will not be asked to update it.
Summary
id,atlas_id, oratlas-idaliasesname/title, tags, nested properties, and other structured metadata while storing and indexing only the post-frontmatter markdown bodyatlas_id:provenance for documents without canonical frontmatterValidation
cargo test -p khive-pack-knowledge --test import_integrity(13 passed)cargo test -p khive-pack-knowledge(405 passed, 1 ignored)cargo check --workspace --all-targetscargo clippy --workspace --all-targets -- -D warningscargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkdeno fmt --check(206 files)git diff --checkCloses #1984