Skip to content

fix(knowledge): expose search body line counts - #2188

Draft
ohdearquant wants to merge 2 commits into
mainfrom
codex/knowledge-body-size-1981
Draft

fix(knowledge): expose search body line counts#2188
ohdearquant wants to merge 2 commits into
mainfrom
codex/knowledge-body-size-1981

Conversation

@ohdearquant

Copy link
Copy Markdown
Owner

Summary

  • expose body_lines on atom search results so callers can distinguish sectionless stubs from filled records
  • calculate section line counts with one namespace-scoped aggregate over the final result IDs
  • report null for domain results and deadline-degraded rows where atom body sizing is unavailable

Testing

  • cargo test -p khive-pack-knowledge --test integration search_body_lines_distinguishes_filled_atom_from_stub -- --nocapture
  • cargo test -p khive-pack-knowledge
  • cargo clippy -p khive-pack-knowledge --all-targets -- -D warnings
  • cargo fmt --package khive-pack-knowledge

Fixes #1981

…e-exact

A request read-deadline expiring during the body-line aggregate turned a
completed, ranked search into a hard Internal error, contradicting the
documented contract that deadline-degraded rows report body_lines null.
Preserve StorageError::Timeout from the lookup as Ok(None): hits are
kept, atom rows report body_lines null, the response carries a
degraded.body_lines_timeout flag, and the trailing deadline re-check is
skipped for the already-degraded response. Non-timeout storage errors
still propagate.

The aggregate also counted a terminal newline as an extra line. Pin the
convention to str::lines() semantics (terminal newline adds no line,
blank interior lines count, empty content is 0) in the SQL expression
and the verb doc, with regressions for the expired-deadline arm and the
newline convention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

knowledge.search: results carry no body-size signal, so a stub is indistinguishable from a filled atom

1 participant