Skip to content

[MOD-19414] Add pathParseNoErrorMsg to the RedisJSON LLAPI (V10) - #1666

Merged
dkyurtovv merged 6 commits into
masterfrom
task/add-path-parse-no-error-msg
Oct 12, 2026
Merged

dkyurtovv merged 6 commits into
masterfrom
task/add-path-parse-no-error-msg

Conversation

@dkyurtovv

@dkyurtovv dkyurtovv commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Compile JSON paths without a Redis context or error string

Search's JSON loader path cache discards parse errors, but the existing pathParse API requires a Redis context and an error-message output parameter. Add pathParseNoErrorMsg(const char *path) to the V10 LLAPI so callers can compile a path and receive a handle or NULL without allocating a Redis error string.

The new entry preserves pathParse semantics, including rejection of invalid UTF-8, malformed paths, and computed/projection expressions. Successful handles work with the existing path-property functions, getWithPath, and pathFree. Both API version constants advance to 10; the new field is appended after V9 without changing existing entries.

Validation

  • Rust workspace tests and redis_json tests with as-library passed. Coverage includes path properties, result parity, reuse across documents, and parse failures.
  • Final LLAPI flow suite passed: 20 tests, including calls through the C function table and evaluation of handles from the new parser.
  • Formatting, Clippy with warnings denied, and the release module build passed.

Note

Medium Risk
Extends the stable C shared-API layout and version binding; existing V9 consumers are unaffected, but modules that assume API v9 must bind v10 to use the new field.

Overview
RedisJSON LLAPI v10 adds pathParseNoErrorMsg, which compiles a JSONPath string into a handle (or NULL) without a RedisModuleCtx or error-string output—matching pathParse rejection rules for bad UTF-8, invalid syntax, and projection/computed paths.

The new function pointer is appended to the shared RedisJSONAPI struct (Rust export macro, rejson_api.h, and version constant 9 → 10). Handles from either parser work with existing pathFree, path metadata, and getWithPath. The LLAPI test module and pytest/Rust tests cover success parity with pathParse and silent failure on invalid paths.

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

@CLAassistant

CLAassistant commented Oct 7, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.25%. Comparing base (eae989d) to head (b6185a1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1666      +/-   ##
==========================================
+ Coverage   88.22%   88.25%   +0.03%     
==========================================
  Files          17       17              
  Lines        6063     6073      +10     
==========================================
+ Hits         5349     5360      +11     
+ Misses        714      713       -1     

☔ 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.

Comment thread redis_json/src/include/rejson_api.h Resolved
Comment thread redis_json/src/include/rejson_api.h Resolved
Comment thread redis_json/src/c_api.rs Resolved
Comment thread redis_json/src/c_api.rs Resolved
Comment thread tests/pytest/llapi_test_module/module.c Resolved
@dkyurtovv
dkyurtovv requested a review from Itzikvaknin October 12, 2026 06:28
Comment thread redis_json/src/c_api.rs Resolved
@dkyurtovv
dkyurtovv merged commit 4635c87 into master Oct 12, 2026
62 checks passed
@dkyurtovv
dkyurtovv deleted the task/add-path-parse-no-error-msg branch October 12, 2026 10:52
AvivDavid23 pushed a commit that referenced this pull request Nov 11, 2026
…1693)

* [MOD-17021] Add getWithPath LLAPI to evaluate a pre-compiled JSONPath (#1623)

* MOD-16899: add getWithPath LLAPI to evaluate a pre-compiled JSONPath

Adds a V9 RedisJSON C API entry getWithPath(json, JSONPath) that evaluates an already-compiled path (from pathParse) instead of a path string, skipping the per-call pest compilation. Callers that resolve the same path across many documents (e.g. RediSearch FT.AGGREGATE LOAD) can compile once and reuse the handle.

- c_api.rs: json_api_get_with_path + exported JSONAPI_getWithPath, struct/initializer entry, REDIS_JSONAPI_LATEST_API_VER 8->9; parity unit test (getWithPath == get).

- include/rejson_api.h: getWithPath declaration + LATEST_API_VER bump. lib.rs: register the entrypoint.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* MOD-16899: add LLAPI flow test for getWithPath

Extend the llapi_test_module consumer with LLAPI.OPEN_GET_WITH_PATH (pathParse + getWithPath, via an open_and_get_with_path helper mirroring open_and_get, sharing reply_nodes_as_json with OPEN_GET) and assert in test_llapi.py that it matches LLAPI.OPEN_GET, plus missing-key / bad-path / projection error cases.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* getWithPath: reject projections at runtime like json_api_get

Replace the debug_assert with 'if query.is_projection() { return null(); }' so a projection path is handled identically to the string-based json_api_get in all builds (not just debug), and defensively at the FFI boundary. Add a unit test passing a compiled projection Query directly.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* getWithPath: trim projection comments

Drop the self-explanatory test doc comment and shorten the guard comment to a one-liner referencing json_api_get.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* getWithPath: drop json_api_get reference from projection guard comment

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
(cherry picked from commit 628013e)

* [MOD-19414] Add pathParseNoErrorMsg to the RedisJSON LLAPI (V10) (#1666)

(cherry picked from commit 4635c87)

* Drop unused get_llapi_ctx import that fails clippy on 8.10

Since the pre-command hook became optional, export_shared_api! imports
get_llapi_ctx itself, so the top-level import is unused and
`cargo clippy -- -D warnings` fails on 8.10. Matches master.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: Dimitar Kyurtov <[email protected]>
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.

4 participants