Skip to content

Build tooling to guarantee correct output from interactive redis-cli commands#3643

Merged
paoloredis merged 6 commits into
mainfrom
DOC-6844
Jul 20, 2026
Merged

Build tooling to guarantee correct output from interactive redis-cli commands#3643
paoloredis merged 6 commits into
mainfrom
DOC-6844

Conversation

@paoloredis

@paoloredis paoloredis commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Note

Low Risk
Changes are mostly documentation transcripts and a new optional CI script that calls the public redis.io CLI API; no runtime product or auth paths are modified.

Overview
Adds build/check_tryit_output.py, a CI-oriented verifier that parses clients-example transcripts, runs each page’s commands in one shared redis.io/cli session (batched to 20 commands), formats API replies like static/js/cli.js, and compares them to documented output. ERROR (command fails when docs expect real output) fails the build; MISMATCH is reported but only gates with --strict. It handles unordered commands, skips non-deterministic ones, and can mask volatile values (stream IDs, timestamps).

Across command and develop docs, example transcripts are updated so they match live redis-cli text: unquoted OK for simple strings, quoted bulk strings, nested array layout (e.g. ARSCAN, ARGREP, CMS.INCRBY), fixed typos/corruption in XADD examples, DEL setup in ZRANGE / ARGREP / SDIFF for isolated runs, fuller JSON wildcard/filter output, expanded TS.INFO blocks, runnable="false" on a heavy TS.MRANGE example, and small numeric/format fixes (t-digest, FT.SEARCH, lists DEL return values).

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

@CLAassistant

CLAassistant commented Jul 15, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ andy-stark-redis
❌ paoloredis
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

DOC-6844

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Comment thread build/check_tryit_output.py Outdated
Comment thread build/check_tryit_output.py
Comment thread build/check_tryit_output.py
@paoloredis

paoloredis commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

The command outputs embedded in the Markdown docs are the source of truth, each example records exactly what Redis should return. This script replays those commands against redis.io/cli and checks that the live output still matches the docs, so you can catch stale or broken examples.

Some examples won't match right now and that's expected for commands for which the output is random (e.g. SRANDMEMBER)

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7fb1cec. Configure here.

Comment thread build/check_tryit_output.py
@andy-stark-redis

Copy link
Copy Markdown
Contributor

I posted this a while ago but unfortunately, I added it to the wrong PR :-( </age>

Anyway, among other mismatches, I'm getting:

MISMATCH  content/develop/data-types/vector-sets/_index.md  [vecset_tutorial/vsim_options]
    cmd:      VSIM points ELE pt:A WITHSCORES COUNT 4
    expected: 1) "pt:A"
              2) "1"
              3) "pt:E"
              4) "0.8535534143447876"
              5) "pt:C"
              6) "0.5"
              7) "pt:D"
              8) "0.5"
    actual:   1) "pt:A"
              2) "1"
              3) "pt:E"
              4) "0.8535534143447876"
              5) "pt:D"
              6) "0.5"
              7) "pt:C"
              8) "0.5"

Looks like this is down to non-deterministic ordering rather than an actual error.

@paoloredis

Copy link
Copy Markdown
Collaborator Author

I posted this a while ago but unfortunately, I added it to the wrong PR :-( </age>

Anyway, among other mismatches, I'm getting:

MISMATCH  content/develop/data-types/vector-sets/_index.md  [vecset_tutorial/vsim_options]
    cmd:      VSIM points ELE pt:A WITHSCORES COUNT 4
    expected: 1) "pt:A"
              2) "1"
              3) "pt:E"
              4) "0.8535534143447876"
              5) "pt:C"
              6) "0.5"
              7) "pt:D"
              8) "0.5"
    actual:   1) "pt:A"
              2) "1"
              3) "pt:E"
              4) "0.8535534143447876"
              5) "pt:D"
              6) "0.5"
              7) "pt:C"
              8) "0.5"

Looks like this is down to non-deterministic ordering rather than an actual error.

I've added VSIM to the commands for which the order is not relevant

@andy-stark-redis

Copy link
Copy Markdown
Contributor

@paoloredis A few more issues:

  • I think the mismatch with the FT.SEARCH example is probably also just down to the result ordering (so this will presumably affect FT.AGGREGATE too, even though the error isn't currently showing up). I guess that after deployment we'll have to just add offending commands to the list as we find them?
  • The mismatch for content/develop/data-types/sets.md [sets_tutorial/srem] happens because it uses non-deterministic commands. This example isn't really checkable (and we don't check it in the client code either), so we should skip this if we'll be using this script as a Hugo build check or a Github action on each PR.
  • Some of the commands in UNORDERED_CMDS aren't correct because they have fully non-deterministic output rather than non-deterministic ordering. These are: SRANDMEMBER, SPOP, ZRANDMEMBER, HRANDFIELD. An alternative check might be to auto-skip whole examples that include these commands or warn if they've been used in examples that aren't manually skipped.

Aside from these things, the script catches some genuine, fixable mistake already - really useful!

@paoloredis

Copy link
Copy Markdown
Collaborator Author

@paoloredis A few more issues:

* I think the mismatch with the `FT.SEARCH` example is probably also just down to the result ordering (so this will presumably affect `FT.AGGREGATE` too, even though the error isn't currently showing up). I guess that after deployment we'll have to just add offending commands to the list as we find them?

* The mismatch for `content/develop/data-types/sets.md  [sets_tutorial/srem]` happens because it uses non-deterministic commands. This example isn't really checkable (and we don't check it in the client code either), so we should skip this if we'll be using this script as a Hugo build check or a Github action on each PR.

* Some of the commands in `UNORDERED_CMDS` aren't correct because they have fully non-deterministic output rather than non-deterministic ordering. These are: `SRANDMEMBER`, `SPOP`, `ZRANDMEMBER`, `HRANDFIELD`. An alternative check might be to auto-skip whole examples that include these commands or warn if they've been used in examples that aren't manually skipped.

Aside from these things, the script catches some genuine, fixable mistake already - really useful!

Thanks, I've now differentiated between unordered and non deterministic cmds

@andy-stark-redis andy-stark-redis left a comment

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.

The checker gives a clear run now, so LGTM.

@paoloredis

Copy link
Copy Markdown
Collaborator Author

@dwdougherty what do you think?

@dwdougherty dwdougherty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I haven't had a chance to look at this yet, but if @andy-stark-redis says it's good, then that's good enough for me.

@paoloredis
paoloredis merged commit a53b029 into main Jul 20, 2026
77 of 78 checks passed
@paoloredis
paoloredis deleted the DOC-6844 branch July 20, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants