Skip to content

DOC-6842 Add redis-rb (Ruby) JSON docs [PARKED]#3629

Open
andy-stark-redis wants to merge 1 commit into
mainfrom
DOC-6842-redis-rb-json-docs
Open

DOC-6842 Add redis-rb (Ruby) JSON docs [PARKED]#3629
andy-stark-redis wants to merge 1 commit into
mainfrom
DOC-6842-redis-rb-json-docs

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

DOC-6842 — redis-rb (Ruby) JSON docs

Adds Ruby (redis-rb) coverage for the JSON data type, in two parts:

  • Example: a Ruby port of the json_tutorial doctest set (local_examples/tmp/datatypes/json/dt_json.rb, all 18 steps) using redis-rb's json_* methods. The Ruby tab on the JSON data-type page is generated from this .rb source at build time (data/examples.json is git-ignored, so it is intentionally not in this diff).
  • Command mappings: redis_rb method signatures added to the 22 JSON.* command-api-mapping files, with descriptions taken from redis-rb's YARD docs.

Foundation for the follow-up redis-rb Query Engine docs (redis-rb#1356), which index JSON documents and build on this.

Warning

Do not merge yet — parked. These docs are written against redis-rb's JSON module, which is merged to master but not in any released gem (latest is v5.4.1, July 2025, which predates the module). Merge only after the trigger below fires. See redis-rb#1346#1349.

Park manifest

Ticket: DOC-6842
Parked at: 2026-07-14
Trigger to pick up: a redis-rb gem is released (a tag/version later than v5.4.1) that includes lib/redis/commands/modules/json.rb
Labels: parked, do not merge yet

Pinned sources (state observed at park time)

Source State at park time Re-fetch
redis-rb gem releases Latest tag v5.4.1, dated 2025-07-17 — predates the JSON module. No release yet contains JSON. gh api repos/redis/redis-rb/tags --jq '.[0:5][].name' then confirm gh api "repos/redis/redis-rb/contents/lib/redis/commands/modules/json.rb?ref=<tag>" returns 200
redis-rb JSON module (json.rb on master) Present; last commit fa90f44, 2026-06-11. Merged via PRs #1346#1349. gh api "repos/redis/redis-rb/commits?path=lib/redis/commands/modules/json.rb&per_page=1" --jq '.[0].sha'
redis-rb#1356 (Query Engine — follow-up dependency, not this PR) Merged 2026-07-14 (head 659d885); now also master-only/unreleased. gh api repos/redis/redis-rb/pulls/1356 --jq '{merged,head_sha}'

Observed shape the page assumes — confidence: HIGH (unusual for a parked PR)

The example and mappings were run-verified against the pinned source, not written blind against a diff: dt_json.rb executed against the redis-rb fork at master (json.rb fa90f44) on Redis 8.8 (ReJSON), exit 0, all 18 assert_equal blocks passing. Mapping signatures/types/descriptions were read from the same json.rb YARD source. Residual risk is only API drift between master and the eventual release — return shapes like json_set → "OK", json_arrpop parsed values, and the Array<…> vs scalar JSONPath/legacy-path distinction are the things to re-confirm if the API moves before the gem ships.

Re-check checklist (on pickup)

  • (highest risk) Re-run local_examples/tmp/datatypes/json/dt_json.rb against the released gem — all 18 asserts must still pass.
  • Diff the released json.rb against master@fa90f44 for signature/return-shape changes to any json_* method.
  • If any signature changed, update the matching data/command-api-mapping/JSON.*.json file and re-run build/merge-command-api-mapping.sh (never hand-edit the merged data/command-api-mapping.json).
  • Confirm the Ruby tab renders on the JSON data-type page once data/examples.json regenerates (it is generated from the .rb source; not in this diff).
  • No data/examples.json entry was hand-added (it is git-ignored/generated) — verify none crept in.

On pickup, then

When the trigger fires, run /pickup 6842: it reconciles the docs against the now-released gem and takes the PR through the normal /reflect/finalize pipeline to merge. /finalize is deferred until then — the episodic Recheck:/Gaps: commit trailers must survive for pickup. The do not merge yet guard holds until /finalize completes.

🤖 Generated with Claude Code


Note

Low Risk
Documentation and static JSON mapping only; no runtime or security-sensitive code paths, with merge deferred until the client gem release.

Overview
Adds Ruby (redis-rb) coverage for the JSON data type: a new json_tutorial example and redis_rb entries on 22 JSON.* commands in the command API mapping data.

local_examples/tmp/datatypes/json/dt_json.rb is a Ruby port of the existing JSON tutorial (18 STEP_* sections) using r.json_set, r.json_get, array/object helpers, JSONPath filters, and assert_equal checks—intended to drive the Ruby tab on the JSON docs at build time.

Command mappings gain a redis_rb block per affected command (e.g. json_arrappend, json_get, json_set with nx/xx/raw) with signatures, parameter types, and return-shape notes aligned with redis-rb’s YARD docs. The same updates appear in per-command files under data/command-api-mapping/ and in the merged data/command-api-mapping.json.

The PR description notes it is parked until a redis-rb release ships the JSON module (newer than v5.4.1).

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

…mmand mappings

Preemptive, parked docs for redis-rb's JSON module (merged upstream in
redis-rb #1346-#1349 but not yet in a released gem — the latest is v5.4.1
from July 2025, which predates the module). Adds a Ruby port of the
json_tutorial doctest set and redis_rb signatures across the 22 JSON.*
command-api-mapping files. Foundation for the redis-rb Query Engine docs,
which index JSON documents and will build on this.

Two non-obvious things for whoever edits these next. First, data/examples.json
is deliberately absent from this change: it is git-ignored and generated, and
the new Ruby tab on the JSON data-type page comes entirely from the dt_json.rb
source via build/local_examples.py (.rb maps to ruby maps to the "Ruby" tab).
Do not hand-add a Ruby entry there. Second, the example's expected outputs and
REMOVE-block asserts are not guesses — the file was run against the local
redis-rb fork (master) on Redis 8.8 and passed all 18 steps, so the only
remaining risk is the upstream API changing before the gem ships.

Learned: examples.json is generated (Ruby tab derives from the .rb source); example outputs were run-verified against the redis-rb fork, not guessed
Constraint: regenerate data/command-api-mapping.json with build/merge-command-api-mapping.sh after editing per-command files — never hand-edit the merged file
Directive: parked — do not merge until redis-rb ships the JSON module in a released gem
Recheck: next redis-rb gem release (currently unreleased; JSON module is master-only)
Gaps: verified against fork master on Redis 8.8, not a released gem — re-run the example at pickup
Ticket: DOC-6842
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@andy-stark-redis andy-stark-redis added do not merge yet parked PR speculatively added based on pre-release info. Check validity when release goes ahead. labels Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

DOC-6842

@andy-stark-redis andy-stark-redis self-assigned this Jul 14, 2026
[%w[black silver pink], %w[black white], %w[black silver pink]],
res21
)
# REMOVE_END

@vladvildanov vladvildanov Jul 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it also makes sense to add an examples with raw: true option. We allow to pass a raw JSON strings as an arguments or return raw JSON as a response to skip object mapping step in case data stored as plain JSON.

https://github.com/redis/redis-rb/blob/master/test/lint/json.rb#L15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge yet parked PR speculatively added based on pre-release info. Check validity when release goes ahead.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants