Skip to content

[8.10] Backport getWithPath (V9) and pathParseNoErrorMsg (V10) LLAPI - #1693

Merged
AvivDavid23 merged 3 commits into
RedisJSON:8.10from
Itzikvaknin:itzik-backport-getwithpath-8.10
Nov 11, 2026
Merged

AvivDavid23 merged 3 commits into
RedisJSON:8.10from
Itzikvaknin:itzik-backport-getwithpath-8.10

Conversation

@Itzikvaknin

@Itzikvaknin Itzikvaknin commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Backports two LLAPI additions onto 8.10 as separate commits, in order:

RedisJSONAPI_LATEST_API_VER goes 8 → 10. The RedisJSONAPI struct layout for V1–V10 is identical to master's, so a consumer built against master's header binds the same slots on 8.10. Master's V11 entries are not part of this backport.

One adaptation in the #1623 commit: on 8.10 (after #1653) the pre-command hook is optional in export_shared_api!, so JSONAPI_getWithPath uses the optional $(pre_command: …)? form. That is the form it has on master. The verbatim pick fails to compile with variable 'pre_command_function_expr' is still repeating at this depth. #1666 applied cleanly.

A third commit drops an unused get_llapi_ctx import from lib.rs. It is not part of either backport: base 8.10 already fails cargo clippy --release -- -D warnings on it, because export_shared_api! imports the function itself now that the hook is optional. Master has the same removal.

Validation (local, macOS):

  • CI's clippy invocation, cargo fmt -- --check, cargo test --all, cargo test -p redis_json --features as-library, cargo build --release all pass.
  • tests/pytest/test_llapi.py: 20/20 pass, including testLLAPIOpenGetWithPath, testLLAPIOpenGetWithPathErrors, and testLLAPIPathParseNoErrorMsg.
  • The touched files match master's state as of [MOD-19414] Add pathParseNoErrorMsg to the RedisJSON LLAPI (V10) #1666, apart from the later V11 additions.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

New LLAPI entries getWithPath (evaluate a pre-compiled JSONPath, avoiding repeated path parsing) and pathParseNoErrorMsg (compile a JSONPath without a Redis context or error string).

🤖 Generated with Claude Code


Note

Medium Risk
Extends the versioned public C ABI (new struct tail fields); correct for consumers binding RedisJSON_V10, with thread-safety constraints on reused path handles.

Overview
Backports two RedisJSON shared C API (LLAPI) entries onto this branch and bumps RedisJSONAPI_LATEST_API_VER from 8 to 10 in Rust and rejson_api.h, wiring them into RedisJSONAPI / RedisJSONAPI_CURRENT and the exported JSONAPI_* shims.

V9 getWithPath evaluates a document against a pre-compiled JSONPath from pathParse or pathParseNoErrorMsg, avoiding re-parsing on each read; projection paths still return null, matching string-based get. Callers must not use the same compiled handle concurrently across threads.

V10 pathParseNoErrorMsg compiles a path without a Redis context or error string—invalid, UTF-8-bad, or projection paths return null.

The LLAPI pytest consumer gains LLAPI.OPEN_GET_WITH_PATH and LLAPI.PATHPARSE_NO_ERROR_MSG, with Rust unit tests and Python flow tests asserting parity with OPEN_GET / PATHPARSE and error behavior.

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

Itzikvaknin and others added 3 commits November 10, 2026 17:01
…RedisJSON#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)
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]>
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.89%. Comparing base (9fdab3f) to head (9b345fe).

Files with missing lines Patch % Lines
redis_json/src/c_api.rs 94.87% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             8.10    #1693      +/-   ##
==========================================
+ Coverage   85.80%   85.89%   +0.08%     
==========================================
  Files          15       15              
  Lines        5249     5288      +39     
==========================================
+ Hits         4504     4542      +38     
- Misses        745      746       +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.

@AvivDavid23
AvivDavid23 merged commit ccfe334 into RedisJSON:8.10 Nov 11, 2026
19 of 62 checks passed
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.

3 participants