DOC-6967 Add Ruby (redis-rb) hash field expiration examples - #3808
Merged
Conversation
Adds hexpire/httl and hpexpire/hpttl steps to the Ruby tab of the hash field expiration examples, and drops the two lang_filter allowlists that were keeping Ruby out. The interesting part is why this was possible at all. Those allowlists were not documenting an unsupported client — they encoded a gap in the *released* gem at the time the steps were authored (5.4.1 had no hash-field-expiration methods, so hexpire fell through method_missing). Gem 6.0.0 shipped hexpire/httl/hpexpire/hpttl on 2026-07-31 and nothing re-checked the premise, so the tab stayed suppressed for weeks after the reason expired. Nothing in the build flags this: a missing tab looks identical whether the client cannot do it or merely could not yet. Two things the run caught that inspection did not. A stubbed replay against the real gem confirmed arity and wire bytes, but the hpttl comment was inherited from the Python tab and said 59994 where Ruby actually returns 59999 — copying an expected value from a sibling tab is not verification of this one, even when the wire format is identical. And a hand-rolled detector for whole-file fallback panes reported none anywhere because an optional regex group always matched empty; the one real instance had already been seen by eye, which is the only reason the false negative surfaced. The output comments use the >>> marker rather than this file's own plain style. The sibling legacy-layout files for the same set (predis, rust) use >>> in every step, so the Ruby dt_*.rb family is the outlier, and a reader compares tabs within one step block far more readily than steps within one tab. Learned: a lang_filter exclusion encodes a release-time client gap and rots silently once the client catches up Constraint: the hexpireat step's lang_filter must keep excluding Ruby — a client whose file lacks the requested step renders its WHOLE file, not a skipped tab Rejected: plain "# value" output comments matching this file's other four steps | the same set's other legacy-layout files all use "# >>>", and cross-tab consistency within a step beats in-file consistency across steps Directive: never drop a lang_filter to expose a tab without first confirming every client in the set has that step — incrby_get_mget on this page is already failing that way, rendering the whole node-redis file because it has no such step Recheck: add Ruby to the hexpireat step's lang_filter when redis-rb#1374 (hexpireat/hpexpireat/hexpiretime/hpexpiretime) ships in a released gem Gaps: the four pre-existing steps in this file still use plain output comments, so the file is now internally mixed; the six sibling dt_*.rb files are untouched Ticket: DOC-6967 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Contributor
Contributor
🧠 Redis MemoryFound 5 related items from repository history (5 new this commit):
Memory updated at b3be4d3 |
Contributor
Author
|
Thanks @dwdougherty ! |
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-6967 — Ruby (redis-rb) hash field expiration examples
Adds a Ruby tab to two of the three hash field expiration examples on
content/develop/data-types/hashes.md:hexpire— set a TTL in seconds on two fields withhexpire, read it back withhttlhpexpire— set a TTL in milliseconds withhpexpire, read it back withhpttlBoth steps go into the existing
local_examples/ruby/dt_hash.rb(which previously stoppedafter
incrby_get_mget), and each self-resets withr.del+r.hsetso it stands alone.Why now — the exclusion was already stale
These three steps carry a
lang_filterallowlist of ten clients that omits Ruby. That wascorrect when authored under DOC-6887: the released gem was 5.4.1, which had no
hash-field-expiration methods at all, so
hexpirefell throughmethod_missingand omittedthe required
FIELDSkeyword.But gem 6.0.0 (published 2026-07-31) ships
hexpire,httl,hpexpire(key, ttl, *fields, nx:/xx:/gt:/lt:)andhpttl— verified by readinglib/redis/commands/hashes.rbat tagv6.0.0, not inferred from release notes. Nothingre-checked the premise, so the tab stayed suppressed after the reason for it expired. A
lang_filterexclusion encodes a release-time gap and rots silently, because a missing tablooks identical whether a client can't do something or merely couldn't yet.
Surfaced by the daily upstream PR scan of Thu 13 Aug 2026 while chasing
redis-rb#1374.
Also: two
lang_filterallowlists removedWith Ruby added, the
hexpireandhpexpireallowlists named all 11 clients in the set,making them no-ops. Both are removed, which is a net simplification of the page source.
Verified rather than assumed — two isolated builds (
hugo -d <dir>, not touchingpublic/)with the filters present vs removed:
index.htmlindex.jsonindex.html.mdTab order is unchanged because it comes from
config.toml, not the filter —lang_filterhasexactly one consumer,
clients-example.html:45,which sets the tab-selector scratch var and nothing else.
The
hexpireatallowlist stays, and is load-bearing. Ruby is the only client without thatstep, and
hexpireat/hpexpireat/hexpiretime/hpexpiretimeare absent from released gem6.0.0 (they're in the still-open redis-rb#1374). Removing that filter would not hide Ruby's
tab — it would render Ruby's entire file into the page via the legacy fallback.
Verification
build/example-test-harness/run.sh hash_tutorial ruby→ PASS, against Redis 8.8.0 and the released gem 6.0.0HEXPIRE … FIELDS 2 air_quality battery_level; a live server then echoed the identical arg list back[1, 1],[60, 60],[1],[59999]— all four printed by the real rundata/command-api-mapping/{HEXPIRE,HTTL,HPEXPIRE,HPTTL}.json, keyredis_rb, agree with the gem sourcehexpireat, noREMOVE/HIDEscaffolding in either paneverdict: pass, no findings (after one medium finding was fixed, see below)One comment was wrong before the run and would not have been caught by inspection:
hpttl'sexpected value was inherited from the Python tab as
59994, where Ruby actually returns59999. Copying an expected value from a sibling tab is not verification of this one, evenwhen the wire format is identical. It now carries an observed value, and keeps its
"may vary" caveat because consecutive runs gave 59999 and 59998.
The Codex review's one finding was that the new output comments omitted the
>>>marker. I'dused plain comments to match this file's other four steps, but the check went against me: the
same set's other legacy-layout files (
local_examples/php/DtHashTest.php,local_examples/rust-async/dt-hash.rs) use>>>in every step, so thedt_*.rbfamily isthe outlier — and a reader compares tabs within one step block far more readily than steps
within one tab. Fixed; re-review came back clean.
Out of scope, deliberately
hexpireatstep. Blocked on redis-rb#1374, which is open and not yet onmastereither —
hashes.rbatmasteris byte-identical tov6.0.0. Revisit when it ships in areleased gem.
data/command-api-mapping/entries. Already present forredis_rb; nothing to add.steps with
>>>, four without), as are its six siblingdt_*.rbfiles. Normalizing allseven is mechanical but reader-visible, so it belongs in its own change.
incrby_get_mgethas nolang_filter, and node-redis has noincrby_get_mgetstep. Sothat tab is hitting the whole-file fallback on the published page right now: the Node.js pane
renders the complete
dt-hash.js,importlines and all, instead of the counter example.Confirmed in the built HTML (
data-legacy-srcon that pane, body starting atimport).Two non-equivalent fixes — adding the step to the node-redis example (better; the other ten
clients all have it) or adding a
lang_filterexcluding Node.js (one line, but leaves acoverage gap). Being tracked separately, along with whether other pages share the shape.
🤖 Generated with Claude Code
Note
Low Risk
Documentation and example-harness only; no runtime product or security-sensitive code changes.
Overview
Adds Ruby (redis-rb) runnable steps for hash field expiration on the hashes data-type page:
hexpire/httl(second TTL) andhpexpire/hpttl(millisecond TTL), with self-containedsensor:sensor1setup and harness assertions inlocal_examples/ruby/dt_hash.rb.On
hashes.md, removes thelang_filterallowlists from thehexpireandhpexpireclients-exampleblocks so Ruby appears in those tabs now that redis-rb 6.0.0 supports the APIs. Thehexpireatblock keeps its filter (Ruby still lacks those commands).Reviewed by Cursor Bugbot for commit b3be4d3. Bugbot is set up for automated code reviews on this repo. Configure here.