Skip to content

DOC-6957 Add Ruby (redis-rb) array data type examples [PARKED] - #3784

Open
andy-stark-redis wants to merge 1 commit into
mainfrom
DOC-6957-redis-rb-array-examples
Open

DOC-6957 Add Ruby (redis-rb) array data type examples [PARKED]#3784
andy-stark-redis wants to merge 1 commit into
mainfrom
DOC-6957-redis-rb-array-examples

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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.md embeds clients-example with no lang_filter, so the Ruby tab appears automatically once the example pipeline regenerates examples.jsonno 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_tutorial set.

⛔ Do not merge yet

These examples are written against redis-rb master, where array support is merged but
not released. redis-rb#1371 merged
2026-08-10; the latest gem, v6.0.0 (2026-07-31), does not contain
lib/redis/commands/arrays.rb
— verified, not assumed.

Merging to main auto-publishes. A reader on the released gem would get NoMethodError on
every line. Hold until a released gem ships the array commands.

How much of this is actually verified

Worth reading before trusting the expected-output comments, because the three sources are not equally strong:

Layer Status How
Method existence, arity, keyword names verified by execution Replayed all 26 calls against real redis-rb master (8a06ce6) with send_command stubbed, in a throwaway git worktree — no server needed. Every call accepted; every wire command matched expectation.
Ruby-side type conversions verified by execution arseek/arop are the only places Ruby diverges from the Python tab (arrays.rb passes &Boolify / &Floatify). Fed the raw replies through the real lambdas: Boolify.call(1) => true, Floatify.call("60") => 60.0, Floatify.call("30") => 30.0.
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 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 redis gem (tag newer than v6.0.0) that contains lib/redis/commands/arrays.rb — testably, gh api "repos/redis/redis-rb/contents/lib/redis/commands?ref=<tag>" --jq '.[].name' | grep arrays returns a match at that tag.
Labels: parked, do not merge yet

Pinned sources (state observed at park time)

Source State @ park (2026-08-11) Re-fetch
redis-rb#1371 — "Added support for Array commands + Updated agent specs" merged 2026-08-10T10:54:11Z; head e184fe7d; base master; milestone none; 9 files gh api repos/redis/redis-rb/pulls/1371 --jq '{state,merged,merged_at,head_sha:.head.sha,milestone:.milestone.title}'
redis-rb master — the tree the examples were verified against 8a06ce6b0c2781ee57bee96c3da723911fded24e (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 from blob d32ec7031cc77c9142b607dd515daa889ea0d147, 14712 bytes gh api "repos/redis/redis-rb/contents/lib/redis/commands/arrays.rb?ref=master" --jq '{sha,size}'
Released gem — the actual blocker latest release v6.0.0, published 2026-07-31; confirmed to have no lib/redis/commands/arrays.rb gh api repos/redis/redis-rb/releases --jq '.[0].tag_name' then check the path at that tag
Redis server — array commands are a preview feature arrays.md already carries bannerText: "Array is a new data type that is currently in preview and may be subject to change." No page edit needed or made. n/a

The blob SHA is the cheap drift tripwire: if d32ec703 still 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:

  • HIGH — method names, arity, keywords, wire serialization. Read from arrays.rb at 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).
  • MEDIUM — Ruby return types. arseek → true and arop :sum/:max → Float follow from &Boolify / &Floatify in 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.
  • LOW — every printed value. Inherited from the redis-py and predis examples. Not one line was observed from Ruby against a server.

Re-check checklist (work these on unpark)

  • (highest risk) arop SUM/MAX: # 60.0 / # 30.0 assume a bulk-string reply, because Floatify.call(60) returns Integer 60 while Floatify.call("60") returns 60.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.
  • Run the file end-to-end against a released gem + a Redis with the array commands, and regenerate every expected value from the real output rather than trusting the inherited ones. The REMOVE-block asserts become genuine oracles at that point.
  • arseek → true: confirm the released gem still routes it through Boolify (a raw 1 would make the comment wrong).
  • Re-diff arrays.rb against blob d32ec703. Array support is a preview server feature, so signatures may still move before the gem ships.
  • Confirm the Ruby tab actually renders on arrays.md for all 11 steps after examples.json regenerates — the no-lang_filter assumption is the reason this PR touches no page, so it is worth confirming rather than assuming.
  • Confirm the directory name arrays_tutorial/ruby/ yields the Ruby tab label (nine existing set dirs use ruby, but this set had no Ruby tab before).
  • Add ruby entries to the 18 data/command-api-mapping/AR*.json files (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).
  • Consider covering 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. /finalize is deliberately deferred until then, so these re-check notes survive. The do not merge yet guard holds until /finalize completes.

🤖 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 existing arrays_tutorial set 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_END blocks for eleven steps (arset_arget, armset_armget, len_count, argetrange, arscan, arinsert, arring, arlastitems, arop, argrep, ardel), with HIDE_START boilerplate (require 'redis', Redis.new) and REMOVE_START cleanup plus assert_equal checks. 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.json from this file. The PR description notes it is parked until a released redis gem includes array commands (current examples target unreleased redis-rb master).

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

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>
@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 Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

DOC-6957

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 5 related items from repository history (5 new this commit):

Memory updated at cea879b

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.

1 participant