Skip to content

feat: complete Valkey & Redis JSON module support (v0.2.0) - #24

Merged
3d24rd0 merged 7 commits into
mainfrom
feat/json-commands
Oct 8, 2026
Merged

3d24rd0 merged 7 commits into
mainfrom
feat/json-commands

Conversation

@3d24rd0

@3d24rd0 3d24rd0 commented Oct 7, 2026

Copy link
Copy Markdown
Member

Summary

This PR implements complete, robust, and type-safe support for the Valkey and Redis JSON module in dart_valkey (v0.2.0), achieving 100% test coverage across all JSON commands and high-level ergonomic APIs.

🌟 What's New

  1. Complete 23 JSON Commands:

    • JSON.SET, JSON.GET, JSON.DEL, JSON.FORGET, JSON.MGET, JSON.MSET
    • JSON.DEBUG (with all 4 subcommands: MEMORY, DEPTH, FIELDS, HELP)
    • JSON.TYPE, JSON.NUMINCRBY, JSON.NUMMULTBY, JSON.TOGGLE
    • JSON.STRAPPEND, JSON.STRLEN
    • JSON.ARRAPPEND, JSON.ARRINSERT, JSON.ARRLEN, JSON.ARRPOP, JSON.ARRINDEX, JSON.ARRTRIM
    • JSON.OBJKEYS, JSON.OBJLEN, JSON.MERGE, JSON.CLEAR, JSON.RESP
  2. High-Level Ergonomic APIs:

    • ValkeyJsonStore<T>: Strongly-typed repository pattern for managing JSON documents with automatic key generation, TTL handling, atomic batch saving (saveMany), and sub-field mutations.
    • JsonPath Builder: Immutable, type-safe JSONPath DSL supporting nested fields, array indices, wildcards, slicing, and filter expressions (JsonPath.root['store']['items'][0]).
    • JsonUpdateBuilder (client.jsonUpdate): Fluent batch document updater for applying multiple atomic mutations in a single cascade.
    • jsonStreamArray<T>: Paginated chunked streaming for processing massive JSON arrays without loading them entirely into memory.
    • Pattern Matching & Model Factories: Seamless support for Dart 3 Pattern Matching, custom fromJson factories, and pluggable serialization libraries.
  3. Core Fixes & Enhancements:

    • Fixed keyPrefix constructor evaluation when null.
    • Fixed protocol error propagation (RespException) to immediately reject pending futures.
    • Enhanced HGETALL, PUBSUB NUMSUB, and PUBSUB SHARDNUMSUB to support both native RESP2 (List) and RESP3 (Map) replies.

🧪 Verification

  • 909 Unit & Integration Tests: 100% passing.
  • 100.0% Coverage: On all 27 files in lib/src/commands/json/.
  • Static Analysis: 0 errors / 0 warnings (dart analyze).
  • Pub Verification: dart pub publish --dry-run passed.

…overage, Dart 3.13 generics and ergonomic defaults
…ch APIs

- Implement JSON.MSET with JsonMSetCommand, JsonMSetEntry, client.jsonMSet, and ValkeyJsonStore.saveMany
- Implement JSON.DEBUG with MEMORY, DEPTH, FIELDS, and HELP subcommands
- Enhance HGETALL, PUBSUB NUMSUB, and PUBSUB SHARDNUMSUB to handle both Map and List responses
- Update COMMANDS.md, CHANGELOG.md, and README.md with comprehensive documentation and examples
- Achieve 100% test coverage across all 27 JSON module files
@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 97.55%. Comparing base (2c15948) to head (d72c357).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #24       +/-   ##
===========================================
+ Coverage   84.55%   97.55%   +13.00%     
===========================================
  Files         260      162       -98     
  Lines        6143     2620     -3523     
===========================================
- Hits         5194     2556     -2638     
+ Misses        949       64      -885     

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

…commands

- Add --report-on=lib in GitHub Actions CI LCOV generation
- Add codecov.yml to ignore test and example files
- Add unit test coverage for jsonStreamArray and jsonStrAppendRaw path parameter
@3d24rd0
3d24rd0 merged commit beef9c2 into main Oct 8, 2026
3 checks passed
@3d24rd0
3d24rd0 deleted the feat/json-commands branch October 8, 2026 06:08
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