Skip to content

[MOD-11888] Return descriptive errors from VecSimIndex_ResolveParams - #1051

Merged
alonre24 merged 3 commits into
mainfrom
MOD-11888-vecsim-resolve-params-error-messages
Oct 8, 2026
Merged

alonre24 merged 3 commits into
mainfrom
MOD-11888-vecsim-resolve-params-error-messages

Conversation

@alonre24

@alonre24 alonre24 commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Query-time parameter rejections (e.g. EPSILON, EF_RUNTIME, RERANK, hybrid policy) only ever surfaced a bare VecSimResolveCode, giving callers no way to explain why a specific parameter or value was rejected (e.g. the classic "Error parsing vector similarity parameters: Invalid option" with no further detail).
  • VecSimIndex_ResolveParams gains an optional const char **err_msg out-param; each _ResolveParams_* helper now returns through a new SetResolveErr() helper that formats a specific message (e.g. "EPSILON is only valid for HNSW or SVS indexes") into a thread-local buffer instead of a bare error code.
  • Adds a .claude/skills/vecsim-error-messages/SKILL.md documenting the pattern for future additions.

Index-creation-time error reporting (VecSimIndex_New returning NULL with no message) was considered under the same ticket but is descoped from this PR.

Test plan

  • Existing unit tests (test_common, test_bruteforce, test_hnsw, test_svs) updated for the new VecSimIndex_ResolveParams signature and pass on CI
  • check-format.sh / clang-format clean
  • Follow-up (tracked separately under MOD-11888): wire RediSearch's VecSim_ResolveQueryParams to forward these messages into the client-facing error, and update RediSearch's tests accordingly

🤖 Generated with Claude Code


Note

Medium Risk
Breaking C API signature for VecSimIndex_ResolveParams requires all callers to pass the new argument; behavior on success is unchanged and err_msg is optional, but any missed call sites will fail to compile.

Overview
Query-time VecSim parameter resolution now exposes why a runtime param failed, not only a VecSimResolveCode.

VecSimIndex_ResolveParams takes an optional const char **err_msg. On failure, helpers route through new SetResolveErr() (printf into a thread-local 256-byte buffer) instead of returning bare codes. Messages name params via VecSimCommonStrings::*_STRING and describe constraints (wrong index type, query type, duplicate param, bad value, unknown param, hybrid policy conflicts). HYBRID_POLICY invalid values get a clearer message listing expected options.

A contributor skill doc (vecsim-error-messages) documents the pattern; RediSearch still uses canned errors and does not forward err_msg yet (follow-up under MOD-11888). Unit tests were updated for the new signature and assert representative error strings; nullptr for err_msg remains safe.

Reviewed by Cursor Bugbot for commit f7572c0. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.57%. Comparing base (ab6bb4f) to head (f7572c0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1051      +/-   ##
==========================================
+ Coverage   97.54%   97.57%   +0.03%     
==========================================
  Files         142      142              
  Lines        9405     9444      +39     
==========================================
+ Hits         9174     9215      +41     
+ Misses        231      229       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

alonre24 and others added 2 commits October 7, 2026 17:39
Query-time parameter rejections (EPSILON, EF_RUNTIME, RERANK, hybrid
policy, etc.) only ever returned a bare VecSimResolveCode, so callers
had no way to explain to users why a specific parameter/value was
rejected. Add an optional err_msg out-param that each resolver helper
fills with a message describing the actual constraint that failed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The previous commit threaded the new err_msg out-param through every
existing test call site but always passed nullptr, so nothing
actually exercised SetResolveErr()'s message content. Capture it for
a representative case per resolver (unknown param, already-set, bad
value, invalid policy, hybrid-adhoc interactions) and assert on the
exact text.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alonre24
alonre24 force-pushed the MOD-11888-vecsim-resolve-params-error-messages branch from d1c3eaa to c85af41 Compare October 7, 2026 14:39
Exercise the "only valid for SVS indexes" branches of the SEARCH_WINDOW_SIZE,
SEARCH_BUFFER_CAPACITY and USE_SEARCH_HISTORY resolvers from the BF resolver test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alonre24
alonre24 added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit 0348684 Oct 8, 2026
16 checks passed
@alonre24
alonre24 deleted the MOD-11888-vecsim-resolve-params-error-messages branch October 8, 2026 16:33
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.

2 participants