Skip to content

fix: handle uteke v0.1.0 empty results format in recall parser - #275

Merged
ajianaz merged 1 commit into
developfrom
fix/uteke-empty-results-parser
Jun 13, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/uteke-empty-results-parser

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Bug Fix: uteke v0.1.0 empty results compatibility

Problem

Uteke v0.1.0 changed the empty results JSON format:

Version Empty Results Format
v0.0.13 [] (bare array)
v0.1.0 {"message":"No memories above similarity threshold","results":[],"threshold":0.3,"total":0}

Cora's parser only handled bare []. On empty results from v0.1.0, it would silently swallow and return 0 memories (not a crash, but misleading — looked like recall was broken).

Fix

Extracted parse_recall_json() function that handles all formats:

  1. Bare array (non-empty): [{"memory":{"content":"..."},"score":0.x}]
  2. Wrapped object with results: {"results":[{"memory":{"content":"..."},...}]}
  3. Wrapped object empty: {"message":"...","results":[],"threshold":0.3}
  4. Invalid JSON: returns empty Vec

Tests Added (6 new)

test_parse_recall_json_nonempty_array      ✅
test_parse_recall_json_multiple_results    ✅
test_parse_recall_json_empty_wrapped_v010  ✅
test_parse_recall_json_empty_bare_array    ✅
test_parse_recall_json_wrapped_with_results ✅
test_parse_recall_json_invalid             ✅

Verification Matrix

Uteke Version recall --json remember --tags --namespace Empty Format Cora Compatible
v0.0.13 ✅ --json ✅ ✅ after subcommand [] ✅
v0.1.0 ✅ --json ✅ ✅ global + subcommand {"results":[]} ✅ (this PR)

All 523 tests pass. Clippy clean.

Uteke v0.1.0+ changed empty results format:
- Before (v0.0.13): bare [] when no results
- After  (v0.1.0):  {"message":"...","results":[],"threshold":0.3,...}

Extracted parse_recall_json() to handle both:
1. Bare JSON array: [{"memory":{"content":"..."},...}]
2. Wrapped object:  {"results":[{"memory":{"content":"..."},...}]}
3. Empty wrapped:   {"message":"No memories...","results":[]}

6 new unit tests covering all formats + edge cases.
All 523 tests pass.
@ajianaz
ajianaz merged commit 20fcce7 into develop Jun 13, 2026
10 checks passed
@ajianaz
ajianaz deleted the fix/uteke-empty-results-parser branch June 13, 2026 16:02
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