fix(types): SearchHit.anchor tolerates the explicit null of page-grain hits#238
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A page-granularity hit (and a
sql_viewcandidate) has no block anchor; the gateway emits an explicit"anchor": null(search.rspage-level hits carryanchor: None→ JSON null on the wire). The typed client failed to decode that (invalid type: null, expected a string) — silently breakingsearch()for any result set containing such hits. Downstream consumers (the datazoo-agent-template) have been working around it withcall_raw+ hand-parsing since 2026-06.One-line fix:
null_as_defaultonSearchHit.anchor, the establishedescurel-types/src/null.rspattern (same asWikilinkParsed.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_hits— no-mock: real gateway + real DuckDB + a materialisedsql_viewinstance, typedsearch()at page granularity (every wire hit carriesanchor: null); proven red without the fix, green with it. Addsescurel-embed/escurel-storagedev-deps (same dev-only rationale as the existing backend dev-deps).fmt --check,clippy --workspace --all-targets -D warnings, workspace tests 153 suites / 0 failures, release build.🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.