DOC-6957 Add Ruby (redis-rb) array data type examples [PARKED] - #3784
Open
andy-stark-redis wants to merge 1 commit into
Open
DOC-6957 Add Ruby (redis-rb) array data type examples [PARKED]#3784andy-stark-redis wants to merge 1 commit into
andy-stark-redis wants to merge 1 commit into
Conversation
Adds local_examples/arrays_tutorial/ruby/dt_arrays.rb, covering all 11 steps that content/develop/data-types/arrays.md embeds. The page uses clients-example with no lang_filter, so the Ruby tab appears once examples.json regenerates — arrays.md itself needs no edit. Written against redis-rb master (unreleased): AR* support landed in redis/redis-rb#1371 on 2026-08-10, and the latest gem v6.0.0 (2026-07-31) has no lib/redis/commands/arrays.rb. Hence PARKED. ## How the expected outputs were established No Redis 8.8 with AR* was reachable (local server is 7.2.7, Docker daemon down), so nothing here ran end-to-end. The values come from three separate sources instead, which is worth knowing before trusting them: 1. Wire commands — VERIFIED BY EXECUTION. Replayed all 26 calls against the real redis-rb master (8a06ce6) in a throwaway git worktree with send_command stubbed, so no server was needed. Every call was accepted and serialized to the expected command array. This is what proves the keyword arguments are right (rev:, value:, with_values:, nocase:, logic:) — the error class most likely to be wrong when writing from docstrings. 2. Server reply values — INHERITED, NOT OBSERVED. Taken from the redis-py and predis examples in this same set, which agree with each other on every value. Two independent clients agreeing is good evidence about the wire, but it is still not an observation of Ruby's behaviour. 3. Ruby-side conversions — VERIFIED BY EXECUTION. arseek and arop are the only places Ruby diverges from the Python tab, because arrays.rb passes &Boolify and &Floatify. Fed the raw replies from (2) through the real lambdas: Boolify.call(1) => true, Floatify.call("60") => 60.0, ("30") => 30.0. ## The one expected output I would bet against Floatify.call(60) returns Integer 60, not 60.0 — it only produces a Float from a string. So `# 60.0` on the arop SUM/MAX lines is correct only if the server replies with a bulk string. It does according to both redis-py (asserts "60") and predis (asserts '60'), and both distinguish it from MATCH (integer 1), so the inference is sound — but this is the single line most likely to be wrong at unpark, and it will be wrong silently. Check arop first against a real 8.8. ## Deliberate choices - Mirrors the redis-py file's structure: each step is preceded by a REMOVE block that deletes its keys, rather than doing the reset inside the visible snippet. Chose within-set parallelism over the pattern in local_examples/ruby/dt_hash.rb, so the rendered Ruby and Python tabs read the same. Also means no "recreate the key" comments. - Directory is arrays_tutorial/ruby/, not arrays_tutorial/redis-rb/ — nine existing set dirs use `ruby`, and the language label in examples.json is `Ruby`. - armset takes redis-rb's Hash form, which reads closer to redis-py's dict than a flat pair list would. - arinfo is not covered, matching the other six clients in the set. Learned: verify a preemptive client example by executing the library with its transport stubbed, which separates "does the API accept this" from "does the server return that" — only the second needs a server Constraint: each STEP block is reset by the REMOVE block immediately before it, mirroring the redis-py file, so the rendered Ruby and Python tabs stay structurally parallel Rejected: resetting inside the visible snippet (the local_examples/ruby/dt_hash.rb pattern) | breaks parity with the other six tabs in this set Gaps: nothing ran against a real Redis 8.8 with AR* (local server is 7.2.7, Docker daemon down); every server reply value is inherited from the redis-py and predis examples rather than observed Directive: at unpark check arop SUM/MAX first — Floatify returns an Integer for an integer reply, so "# 60.0" is correct only if the server sends a bulk string, and it fails silently if not Recheck: when a released redis gem contains lib/redis/commands/arrays.rb Ticket: DOC-6957 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Contributor
🧠 Redis MemoryFound 5 related items from repository history (5 new this commit):
Memory updated at cea879b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DOC-6957 — Ruby (redis-rb) array data type examples
Adds
local_examples/arrays_tutorial/ruby/dt_arrays.rb, giving the array data type page a Ruby tab across all eleven of its steps:arset_arget,armset_armget,len_count,argetrange,arscan,arinsert,arring,arlastitems,arop,argrep,ardel.content/develop/data-types/arrays.mdembedsclients-examplewith nolang_filter, so the Ruby tab appears automatically once the example pipeline regeneratesexamples.json— no page edit is needed, and none is in this PR. Existing tabs (6): Go, Java-Async, Java-Reactive, Node.js, PHP, Python.Follow-up to DOC-6755, which created the
arrays_tutorialset.How much of this is actually verified
Worth reading before trusting the expected-output comments, because the three sources are not equally strong:
master(8a06ce6) withsend_commandstubbed, in a throwaway git worktree — no server needed. Every call accepted; every wire command matched expectation.arseek/aropare the only places Ruby diverges from the Python tab (arrays.rbpasses&Boolify/&Floatify). Fed the raw replies through the real lambdas:Boolify.call(1) => true,Floatify.call("60") => 60.0,Floatify.call("30") => 30.0.redis-pyandpredisexamples in this same set, which agree with each other on every value. Two independent clients agreeing is decent evidence about the wire — it is not an observation of Ruby against a server.Nothing ran end-to-end. No Redis 8.8 with the array commands was reachable: the local server is 7.2.7 and the Docker daemon was down. That is the gap the checklist below exists to close.
Park manifest
Ticket: DOC-6957
Parked at: 2026-08-11
Trigger to pick up: a released
redisgem (tag newer thanv6.0.0) that containslib/redis/commands/arrays.rb— testably,gh api "repos/redis/redis-rb/contents/lib/redis/commands?ref=<tag>" --jq '.[].name' | grep arraysreturns a match at that tag.Labels: parked, do not merge yet
Pinned sources (state observed at park time)
e184fe7d; basemaster; milestone none; 9 filesgh api repos/redis/redis-rb/pulls/1371 --jq '{state,merged,merged_at,head_sha:.head.sha,milestone:.milestone.title}'master— the tree the examples were verified against8a06ce6b0c2781ee57bee96c3da723911fded24e(2026-08-11T08:50:02Z, "Added support for Redis 8.8 new commands (#1372)")gh api repos/redis/redis-rb/commits/master --jq '{sha,date:.commit.author.date}'lib/redis/commands/arrays.rb@master— the file every signature came fromd32ec7031cc77c9142b607dd515daa889ea0d147, 14712 bytesgh api "repos/redis/redis-rb/contents/lib/redis/commands/arrays.rb?ref=master" --jq '{sha,size}'v6.0.0, published 2026-07-31; confirmed to have nolib/redis/commands/arrays.rbgh api repos/redis/redis-rb/releases --jq '.[0].tag_name'then check the path at that tagarrays.mdalready carriesbannerText: "Array is a new data type that is currently in preview and may be subject to change."No page edit needed or made.The blob SHA is the cheap drift tripwire: if
d32ec703still matches at unpark, no signature in this PR can have moved.Observed shape the page assumes
Confidence is split, deliberately — this is not uniformly LOW:
arrays.rbat a known blob SHA and executed against that library.arset(key, index, *values),armset(key, Hash),armget(key, *indices),argetrange(key, start, stop),arlen,arcount,arscan(key, start, stop, limit:),arinsert(key, *values),arnext,arseek(key, index),arlastitems(key, count, rev:),arring(key, size, *values),arop(key, start, stop, operation, value:),argrep(key, start, stop, exact:/match:/glob:/re:, logic:, limit:, with_values:, nocase:),ardel(key, *indices),ardelrange(key, *ranges).arseek → trueandarop :sum/:max → Floatfollow from&Boolify/&Floatifyin the source, and the lambdas were run against the inherited raw replies. Medium rather than high only because the input to those lambdas is inherited.Re-check checklist (work these on unpark)
aropSUM/MAX:# 60.0/# 30.0assume a bulk-string reply, becauseFloatify.call(60)returns Integer60whileFloatify.call("60")returns60.0. Both redis-py ("60") and predis ('60') assert a string, so the inference is sound — but if the server sends a RESP integer the docs show the wrong type and nothing will fail loudly. Check this first.REMOVE-block asserts become genuine oracles at that point.arseek → true: confirm the released gem still routes it throughBoolify(a raw1would make the comment wrong).arrays.rbagainst blobd32ec703. Array support is a preview server feature, so signatures may still move before the gem ships.arrays.mdfor all 11 steps afterexamples.jsonregenerates — the no-lang_filterassumption is the reason this PR touches no page, so it is worth confirming rather than assuming.arrays_tutorial/ruby/yields theRubytab label (nine existing set dirs useruby, but this set had no Ruby tab before).rubyentries to the 18data/command-api-mapping/AR*.jsonfiles (in DOC-6957's scope, deliberately not in this PR — mapping entries have been aspirational before, so they should land only once the gem is released).arinfo, plus the methods no tab exercises. Not required for parity: the other six clients skip it too.On unpark, then
When the trigger fires, run
/unpark <this PR>: it re-fetches each pinned source, diffs it against the snapshots above, reports what changed versus what was predicted, then reconciles the docs and resumes the normal pipeline toward merge./finalizeis deliberately deferred until then, so these re-check notes survive. Thedo not merge yetguard holds until/finalizecompletes.🤖 Generated with Claude Code
Note
Low Risk
Documentation-only new example file with no production code or auth/data-path changes; main risk is publishing examples before the gem release ships array support.
Overview
Adds
local_examples/arrays_tutorial/ruby/dt_arrays.rb, a new Ruby (redis-rb) client example for the existingarrays_tutorialset so the arrays data type docs can show a Ruby tab alongside Go, Java, Node, PHP, and Python.The file is structured like the other tutorial examples:
STEP_START/STEP_ENDblocks for eleven steps (arset_arget,armset_armget,len_count,argetrange,arscan,arinsert,arring,arlastitems,arop,argrep,ardel), withHIDE_STARTboilerplate (require 'redis',Redis.new) andREMOVE_STARTcleanup plusassert_equalchecks. It exercises redis-rb array APIs (arset,arget,armset,armget,arlen,arcount,argetrange,arscan,arinsert,arnext,arseek,arring,arlastitems,arop,argrep,ardel,ardelrange) with printed expected outputs aligned to the other clients.No markdown or page edits are in this diff; the Ruby tab is intended to appear after the examples pipeline regenerates
examples.jsonfrom this file. The PR description notes it is parked until a releasedredisgem includes array commands (current examples target unreleased redis-rbmaster).Reviewed by Cursor Bugbot for commit cea879b. Bugbot is set up for automated code reviews on this repo. Configure here.