Skip to content

fix(sqlite): deserialize JSON columns#1797

Merged
gold-silver-copper merged 1 commit into
0xPlaygrounds:mainfrom
gold-silver-copper:fix/sqlite-json-column-deserialization
May 21, 2026
Merged

fix(sqlite): deserialize JSON columns#1797
gold-silver-copper merged 1 commit into
0xPlaygrounds:mainfrom
gold-silver-copper:fix/sqlite-json-column-deserialization

Conversation

@gold-silver-copper
Copy link
Copy Markdown
Contributor

Summary

Fixes #1794.

  • Decode declared SQLite JSON columns into structured JSON values when rebuilding documents from top_n results.
  • Keep ordinary TEXT columns unchanged, including JSON-looking strings.
  • Return a SQLite conversion error for invalid JSON stored in a declared JSON column.
  • Add unit coverage for JSON/TEXT column conversion and a live sqlite-vector regression matching the issue's structured metadata field.

Root Cause

rig-sqlite rebuilt document rows as serde_json::Value::Object before deserializing them into the caller's document type. SQLite text values were always converted to serde_json::Value::String, even for columns declared as JSON. That made a stored metadata object like {"user_id":1,...} deserialize as a string instead of the expected Rust metadata struct.

Validation

  • cargo fmt --check
  • cargo test -p rig-sqlite json_column
  • cargo test -p rig-sqlite text_column_json_looking_text_stays_string
  • cargo test -p rig-sqlite
  • cargo clippy -p rig-sqlite --all-targets --all-features
  • git diff --check

@gold-silver-copper gold-silver-copper marked this pull request as ready for review May 21, 2026 20:21
@gold-silver-copper gold-silver-copper added this pull request to the merge queue May 21, 2026
Merged via the queue into 0xPlaygrounds:main with commit 02e9cc9 May 21, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request May 21, 2026
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.

bug: sqlite - query result deserialization failed

1 participant