Skip to content

DOC-6968 Omit a clients-example tab when that client lacks the requested step - #3811

Merged
andy-stark-redis merged 1 commit into
mainfrom
DOC-6968-clients-example-omit-missing-step
Aug 13, 2026
Merged

DOC-6968 Omit a clients-example tab when that client lacks the requested step#3811
andy-stark-redis merged 1 commit into
mainfrom
DOC-6968-clients-example-omit-missing-step

Conversation

@andy-stark-redis

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

Copy link
Copy Markdown
Contributor

DOC-6968 — omit a clients-example tab when the client lacks the requested step

29 lines in one partial. It stops 63 panes site-wide from rendering a client's entire example file where a snippet belongs — the worst being 258 lines of Go (package, imports and several unrelated examples) on commands/scan.md.

This is the fix the rest of DOC-6968 was clearing the way for. The coverage work that had to land first is already on main (#3809).

The condition, and why each clause matters

step != ""  AND  step not in named_steps  AND  len(named_steps) > 0

The shortcode's else branch was conflating three situations. Only the middle one is a defect:

Case Panes Behaviour
step="" — explicitly empty 12 Unchanged. The whole file is the example (data-store.md)
File has other steps, not this one 63 Omit the tab — an authoring gap
File has no steps at all 25 Unchanged. Predates STEP markers; the whole file is still the closest thing to an example

Dropping the len > 0 clause would strip every client tab from commands/set.md and commands/get.md — 12 each — because those files have no STEP markers. That's a regression, not a fix, so the clause is load-bearing rather than defensive.

It deliberately tests membership in named_steps rather than $sliceable: a step that exists but whose line range is malformed or out of bounds should still fall through to the whole-file path, which is exactly the drift $sliceable was written to absorb.

The continue fires before any content is built, not just before the tab is appended — the legacy path mutates .Page.Store and inlines the file once per page, so building it for a tab we then drop would leave orphaned markup and a wasted copy of the file in the output.

Loud, not silent

Each omission emits a warnf naming page, client, step and set, so the gaps become a worklist rather than an invisible absence:

WARN  [tabbed-clients-example] ".../content/commands/scan.md": client "Go" has no step
      "scan1" in set "cmds_generic" — tab omitted. Add the step to that client's example
      file, or name the supporting clients in lang_filter.

Self-extinguishing — it drops to zero as the examples get written. CI runs plain hugo -d output with no --panicOnWarning, and the build still exits 0, so this surfaces the gaps without failing anything. Deliberately not warning on the 25 zero-step files, which would produce permanent warnings nobody can action.

Verification

Two builds of the identical tree, with and without the change:

Before After
Tab panes 2711 2648 (−63)
Legacy-fallback panes 100 37 (−63)
Legacy clone panes 23 0
Omission warnings 63

The 63 warnings correspond one-to-one with the 63 removed panes, and what remains on the legacy path is exactly the two protected classes (25 cosmetic + 12 by-design).

Structural checks, because a change like this fails quietly:

  • All 594 tab groups survive with ≥1 pane — nothing renders empty.
  • Selector options still match panes on the worst-hit group (scan1: 6 and 6, identical sets) — no tab button left without a pane.
  • commands/incr.md untouched at 12 clients, thanks to the examples added in DOC-6968 Fix two node-redis step names, and add the missing incr step for nine clients #3809.
  • commands/set.md / commands/get.md untouched, 12 client tabs each.
  • data-store.md (step="") untouched.
  • hashes.md hexpire keeps all 11 clients including Ruby; hexpireat keeps its 10 (Ruby excluded by lang_filter, so it never reaches this check).
  • vector3/vector4 degrade to a CLI-only tab as agreed — a 1-pane shape that already exists elsewhere on the site (nredisstack/prob).

What this does not fix

The 63 panes stop rendering wrongly; the missing coverage is still missing. commands/scan.md drops from 12 client tabs to 5, the h* pages from 14 to 12, and del/expire/ttl from 12 to 7. The four cmds_generic scan steps are 28 of the 63 and remain the biggest lever — see the DOC-6968 status comment for the full per-page table. The warnf output is the worklist.

🤖 Generated with Claude Code


Note

Low Risk
Docs layout-only change with explicit guards for legacy no-step files; build still succeeds and tab groups retain at least one pane per verification notes.

Overview
Client example tabs in tabbed-clients-example.html now skip a language tab when the shortcode asks for a named step that client’s example file does not define, but that file does define other steps.

That stops the legacy whole-file path from dumping full multi-example sources (imports, unrelated snippets) into a pane meant for one command—63 panes site-wide, per the PR verification.

Unchanged behavior: empty step still uses the whole file; files with no STEP markers at all still get a tab (so pages like set/get keep all client tabs). Malformed or out-of-bounds ranges still use the existing whole-file fallback via $sliceable, not this omission rule.

Each omission logs a warnf with page, client, step, and example set. The loop continues before building tab content so legacy .Page.Store inlining does not run for tabs that are dropped.

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

…ted step

Splits the shortcode's whole-file fallback three ways, so that a step a client
does not have omits its tab instead of dumping the client's entire file into
the pane. 63 panes site-wide were doing that, the worst rendering 258 lines of
Go — package declaration, imports and several unrelated examples — where the
reader expected a snippet for one command.

The condition has three clauses and each one is load-bearing:

  step != ""  AND  step not in named_steps  AND  len(named_steps) > 0

Dropping the last would strip every client tab from commands/set.md and
commands/get.md, whose files have no STEP markers at all, so the whole file
genuinely is the example. Dropping the first would break the deliberate
step="" usage on data-store.md. Both are verified as untouched below.

It tests membership in named_steps rather than $sliceable on purpose. A step
that exists but whose line range is malformed or out of bounds should still
fall through to the whole-file path — that is precisely the drift the
$sliceable guard was written to absorb, and conflating the two would turn a
data problem into a missing tab.

The continue fires before any content is built, not merely before the tab is
appended. The legacy path mutates .Page.Store and inlines the file once per
page, so building it for a tab we then drop would leave orphaned markup and a
wasted copy of the file in the output.

Each omission emits a warnf naming the page, client, step and set, which is
self-extinguishing: it goes to zero as the missing examples get written. CI
runs plain `hugo -d output` with no --panicOnWarning, and the build still
exits 0, so this surfaces the gaps without turning them into a failure.

Verified before and after on identical data: 2711 panes -> 2648 (63 removed),
legacy panes 100 -> 37, and the 63 warnings correspond one-to-one with the 63
removed panes. What remains on the legacy path is exactly the two protected
classes: 25 cosmetic panes in zero-step files and 12 from step="". All 594 tab
groups survive with at least one pane, so nothing renders empty; selector
options still match panes exactly on the worst-affected group (scan1, 6 and
6), so no tab button is left without a pane; commands/incr.md is untouched at
12 clients; and vector3/vector4 degrade to a CLI-only tab as agreed, a shape
that already exists elsewhere on the site.

One measurement trap cost me a false discrepancy first time round. data/examples.json
is gitignored build output, so after checking out a branch it still describes the
previous tree: my first run reported 65 warnings against 63 known panes, purely
because Ruby's newly merged hexpire steps were absent from the stale data. Rebuilding
it reconciled both numbers exactly.

Learned: data/examples.json is gitignored build output, so it must be regenerated after any branch switch before rendering is measured, or the measurement describes the tree you were on before
Constraint: keep all three clauses of the omit condition — dropping the len(named_steps) > 0 test strips every client tab from commands/set.md and commands/get.md, which have no STEP markers at all
Constraint: the continue must fire before content is built, because the legacy path mutates .Page.Store and inlines the whole file once per page
Rejected: gating omission on $sliceable rather than named_steps membership | a step whose range is malformed should still fall back to the whole file, which is what that guard exists for
Directive: do not add a whole-file last resort for groups that lose every client tab — vector3/vector4 intentionally degrade to CLI-only, and a 1-pane group is an existing shape
Gaps: scan.md still loses 7 of its 12 client tabs, and the h* pages 2 each, until the cmds_generic and cmds_hash steps are written; the warnf output is the worklist
Ticket: DOC-6968
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

DOC-6968

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

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

Memory updated at 94cb5ab

@andy-stark-redis
andy-stark-redis requested a review from a team August 13, 2026 15:00
@andy-stark-redis andy-stark-redis self-assigned this Aug 13, 2026
@andy-stark-redis andy-stark-redis added the clients Client library docs label Aug 13, 2026

@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.

GAH! ZOMG! So many new warnings! OCD triggered bigly. 😲

That said, please proceed.

@andy-stark-redis

Copy link
Copy Markdown
Contributor Author

GAH! ZOMG! So many new warnings! OCD triggered bigly. 😲

Thanks for the review @dwdougherty ! Yeah, I prefer to be clear of warnings too - next PR is all about fixing them :-)

@andy-stark-redis
andy-stark-redis merged commit 0d5aeb7 into main Aug 13, 2026
90 checks passed
@andy-stark-redis
andy-stark-redis deleted the DOC-6968-clients-example-omit-missing-step branch August 13, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients Client library docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants