Skip to content

MOD-16685 Add RedisJSON API to open from RedisModuleKey (#1619) - #1620

Merged
TalBarYakar merged 1 commit into
8.10from
tal.ba/8.10/new_open_handle_key
Jul 12, 2026
Merged

TalBarYakar merged 1 commit into
8.10from
tal.ba/8.10/new_open_handle_key

Conversation

@TalBarYakar

@TalBarYakar TalBarYakar commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor
  • MOD-16685 Add RedisJSON API to open from RedisModuleKey

Add a RedisJSON shared API V8 entry that opens a JSON root from an already-open RedisModuleKey handle. This lets consumers such as RediSearch reuse an existing key handle instead of manually checking isJSON and calling RedisModule_ModuleTypeGetValue.

Update the RediSearch RedisJSON API header copy and add LLAPI coverage for the new openKeyFromHandle path.

  • use Imanager to get value for json

  • fix clippy

  • rename functions

  • fix compilation


Note

Medium Risk
Extends the stable C shared-API struct (V8) and exposes raw pointers tied to caller-owned key lifetime; incorrect use could crash, but scope is read-only JSON access with explicit validation.

Overview
Bumps the RedisJSON shared C API to V8 with a new getJsonFromHandle entry that returns the document root from an already-open RedisModuleKey, so consumers (e.g. RediSearch) can reuse a key handle instead of re-opening or calling RedisModule_ModuleTypeGetValue themselves.

The Rust side adds json_api_get_value_from_handle_internal / JSONAPI_getJsonFromHandle, wires the function into the exported RedisJSONAPI struct and rejson_api.h, and implements Manager::get_value_from_handle on the IValue manager (module-type value → root IValue pointer). NULL, non-module, and non-JSON keys return NULL before dereferencing.

LLAPI test module and pytest exercise LLAPI.GETJSONFROMHANDLE on valid JSON keys and expect errors for missing or plain string keys.

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

* MOD-16685 Add RedisJSON API to open from RedisModuleKey

Add a RedisJSON shared API V8 entry that opens a JSON root from an
already-open RedisModuleKey handle. This lets consumers such as RediSearch
reuse an existing key handle instead of manually checking isJSON and calling
RedisModule_ModuleTypeGetValue.

Update the RediSearch RedisJSON API header copy and add LLAPI coverage for the
new openKeyFromHandle path.

* use Imanager to get value for json

* fix clippy

* rename functions

* fix compilation
@TalBarYakar
TalBarYakar requested a review from AvivDavid23 July 9, 2026 06:58
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.86%. Comparing base (d28f49a) to head (2fef684).

Files with missing lines Patch % Lines
redis_json/src/c_api.rs 95.23% 1 Missing ⚠️
redis_json/src/ivalue_manager.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             8.10    #1620      +/-   ##
==========================================
+ Coverage   85.82%   85.86%   +0.04%     
==========================================
  Files          15       15              
  Lines        5212     5241      +29     
==========================================
+ Hits         4473     4500      +27     
- Misses        739      741       +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.

@TalBarYakar
TalBarYakar merged commit 5de66b4 into 8.10 Jul 12, 2026
61 checks passed
@TalBarYakar
TalBarYakar deleted the tal.ba/8.10/new_open_handle_key branch July 12, 2026 19:22
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