Skip to content

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

Open
andy-stark-redis wants to merge 2 commits 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 2 commits 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 reference JSON only; no runtime or auth changes. Residual risk is docs drifting from the eventual redis-rb gem release until pickup re-verification.

Overview
Adds Ruby (redis-rb) coverage for the JSON data type: a new json_tutorial doctest source and redis_rb entries on the existing JSON command reference data.

local_examples/tmp/datatypes/json/dt_json.rb is a Ruby port of the shared JSON tutorial (18 stepped sections). It exercises redis-rb’s json_* helpers—set/get, strings, numbers, arrays, objects, path queries, filters, and bulk updates—and documents the raw: option for pre-encoded JSON on several calls. Build output feeds the JSON data-type page Ruby tab (via generated examples.json, not in this diff).

data/command-api-mapping/JSON.*.json (22 commands) and the merged data/command-api-mapping.json each gain a redis_rb block: method signatures, parameters, and return descriptions aligned with redis-rb’s YARD docs (including JSONPath vs legacy path return shapes and optional raw).

PR is parked until a redis-rb release ships the JSON module (post–v5.4.1); docs target unreleased master API.

Reviewed by Cursor Bugbot for commit a42f75e. 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

… steps

Adds raw: true examples to the set_get, arr, arr2, and obj steps of the Ruby
JSON tutorial, per maintainer feedback (vladvildanov on PR #3629): raw input
(pass an already-encoded JSON string, skipping serialization) and raw output
(get the unparsed JSON string back instead of a Ruby object).

These land only on the Ruby tab of those shared steps because raw: is a
redis-rb-specific kwarg — the other clients on the json_tutorial set have no
equivalent option, so the raw lines are deliberately not mirrored to their tabs.
Re-verified end-to-end against the redis-rb fork (master) on Redis 8.8 — all
asserts pass, including the five new raw ones.

Directive: the raw: examples are Ruby-only by design (redis-rb-specific kwarg) — don't mirror them to other clients' tabs on these shared json_tutorial steps
Ticket: DOC-6842
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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