Skip to content

fix(types): SearchHit.anchor tolerates the explicit null of page-grain hits#238

Merged
jrosskopf merged 2 commits into
mainfrom
fix/search-hit-null-anchor
Jul 3, 2026
Merged

fix(types): SearchHit.anchor tolerates the explicit null of page-grain hits#238
jrosskopf merged 2 commits into
mainfrom
fix/search-hit-null-anchor

Conversation

@jrosskopf

@jrosskopf jrosskopf commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

A page-granularity hit (and a sql_view candidate) has no block anchor; the gateway emits an explicit "anchor": null (search.rs page-level hits carry anchor: None → JSON null on the wire). The typed client failed to decode that (invalid type: null, expected a string) — silently breaking search() for any result set containing such hits. Downstream consumers (the datazoo-agent-template) have been working around it with call_raw + hand-parsing since 2026-06.

One-line fix: null_as_default on SearchHit.anchor, the established escurel-types/src/null.rs pattern (same as WikilinkParsed.anchor).

Test plan

  • escurel-types/tests/wire_contract.rs::search_hit_tolerates_null_anchor — unit, red first with the exact decode error.
  • escurel-client/tests/sql_view_search.rs::typed_search_decodes_sql_view_hitsno-mock: real gateway + real DuckDB + a materialised sql_view instance, typed search() at page granularity (every wire hit carries anchor: null); proven red without the fix, green with it. Adds escurel-embed/escurel-storage dev-deps (same dev-only rationale as the existing backend dev-deps).
  • Local gate: fmt --check, clippy --workspace --all-targets -D warnings, workspace tests 153 suites / 0 failures, release build.

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

jrosskopf and others added 2 commits July 3, 2026 20:04
…n hits

A page-granularity hit (and a sql_view candidate) has no block anchor;
the gateway emits an explicit "anchor": null, which the typed client
failed to decode ('invalid type: null, expected a string') — silently
breaking search() for any result set containing such hits. Consumers
(the datazoo-agent-template) had to fall back to call_raw.

null_as_default per the established escurel-types/src/null.rs pattern
(same as WikilinkParsed.anchor).

Test plan: wire_contract::search_hit_tolerates_null_anchor (unit, red
first with the exact decode error) and the new no-mock
escurel-client/tests/sql_view_search.rs (typed search over a real
gateway + materialised sql_view at page granularity; proven red
without the fix). Local gate: fmt, clippy -D warnings, workspace tests
153 suites / 0 failures, release build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jrosskopf jrosskopf merged commit 6c23d5d into main Jul 3, 2026
1 check passed
@jrosskopf jrosskopf deleted the fix/search-hit-null-anchor branch July 3, 2026 18:05
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.

1 participant