Skip to content

Gather docs from the code repositories - #41

Open
madolson wants to merge 8 commits into
mainfrom
gather-docs-from-repos
Open

madolson wants to merge 8 commits into
mainfrom
gather-docs-from-repos

Conversation

@madolson

@madolson madolson commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

The site now reads its command and topic pages from the code repos (docs/commands/, docs/topics/, docs/nav.yml in valkey and each module), with valkey-doc as the fallback for anything not moved yet and for the pages that stay there (the Valkey Bundle page), so the content PRs can merge in any order. The repos are one [[source]] table each in build/doc-sources.toml, which drives both the CI checkout and the gathering. Two code repos providing the same page fail the build, and every page's "Update this Page on GitHub" link points at its real source. The module API reference is generated from valkey's src/module.c at build time.

AI generated details

Epic: madolson/valkey#233. Spec: valkey-io/valkey#4940 ("Website changes", "Cutover plan"), with the differences in the epic's contract (website lands first, modules-api-ref.md generated, valkey-large-object moves too).

Registry

[[source]]
name = "valkey"
repository = "valkey-io/valkey"
branch = "unstable"
path = "valkey"
role = "core"

[[source]]
name = "valkey-bloom"
...

role: core gives the core menu, groups.json and the API reference; fallback is valkey-doc; module gets the menu badge. valkey-bundle is not a source: its page stays in valkey-doc (madolson, 2026-11-30), and the fallback's menu files that no source is named after (modules-nav/valkey-bundle.yml) are merged last. That left other without a user, so it is gone. Table order is the menu merge order (same as the old nav_sources). config.toml loses nav_sources, nav_badges and the four per-module JSON paths. To build against a content PR before it merges, change that source's repository and branch.

The file opens with a comment explaining each key, the roles and how to add a module. The templates read it with load_data. The shell scripts read it through build/doc-sources.py (stdlib tomllib), which fails on an unknown role, a missing key, or anything but exactly one core and one fallback. That needs Python 3.11 or later. CI's ubuntu-latest (26.04) has 3.14, so no setup-python step. A local build with an older python3 stops with build/doc-sources.py needs Python 3.11 or later (for tomllib), found 3.7. Proposal: accept; the alternative is parsing TOML in bash.

Decisions

  1. One script. build/init-docs.sh <sources-dir> replaces init-topics.sh and init-commands.sh, because both need the same registry and duplicate rules. Proposal: keep it. #4940 names the old scripts, but nothing outside this repo calls them.
  2. Checkout by git clone instead of actions/checkout. A composite action can't loop over uses: steps, so registering a repo would otherwise mean editing the action too. build/checkout-doc-sources.sh clones each source at depth 1. Proposal: keep it. The repos are public; nothing needs a token.
  3. valkey tags. "Available since" comes from git tag. Every tag fetched at depth 1 produces byte-identical output to a full clone (table below). Proposal: keep depth 1 plus tags.
  4. Generated API reference shows wrong versions until Skip tags on unstable commits in the module API doc generator valkey#235 lands. Tag 8.0.8 points at an unstable commit, so the generator reports 17 APIs from 8.1.0/9.1.0 as "since 8.0.8". Proposal: promote Adds Netapp to participants valkey-io/valkey-io.github.io#235 before this PR merges.
  5. valkey-search docs/ already wins today. Its upstream copies differ from valkey-doc's (list below). Two anchor links in them are broken on the site because Zola slugs FT.HYBRID as ft-hybrid while GitHub uses fthybrid. Proposal: fix the heading or links in valkey-search. Until then, link-check on this PR reports those 2 as new.
  6. ../../ links. valkey-search pages link ../../COMPATIBILITY.md. The templates now send ../../<path> from a code repo's page to https://github.com/<repo>/blob/<branch>/<path>, which is the URL valkey-doc's copies hard-coded. Proposal: keep it, so code repos can link to their own files.
  7. resp2/resp3_replies.json. templates/command-page.html:180 still reads them, so init-docs.sh links them from valkey-doc when present; at valkey-doc@7c5512ae they're gone and no link is made. Proposal: drop that template block in a follow-up.
  8. commands/index.html whitespace. The command list loop now reads one JSON path instead of five, so 4 empty iterations' whitespace is gone. No visible change. Proposal: accept.
  9. After cutover the base side of link-check fails (old init-commands.sh reads valkey-doc/groups.json), so that PR lists every broken link instead of the new ones. That is the existing fallback in link-check.yml. Proposal: accept for the one cutover PR.

A. Transitional build (origin/main vs this branch, same sources)

Sources: valkey bb94c2ebd, valkey-doc 7c5512ae3, valkey-bloom 4d34db279, valkey-json b0b6b63ec, valkey-search c33d8c3ed, valkey-large-object 5f10fa111, valkey-ldap 0b7977315, valkey-bundle cad0a8622. Zola 0.23.6.

base pages: 1385, new pages: 1385
find -name index.html | sort: identical
files that differ: 19
  commands/ft.aggregate/index.html: content: 2 changed lines
  commands/ft.create/index.html: content: 4 changed lines
  commands/ft.cursor/index.html: content: 2 changed lines
  commands/ft.dropindex/index.html: edit link only
  commands/ft.hybrid/index.html: content: 2 changed lines
  commands/ft.info/index.html: edit link only
  commands/ft._list/index.html: content: 10 changed lines
  commands/ft.search/index.html: content: 5 changed lines
  commands/index.html: whitespace only
  community/index.html: content: 4 changed lines
  topics/modules-api-ref/index.html: content: 37 changed lines
  topics/search/index.html: edit link only
  topics/search-configurables/index.html: content: 1 changed lines
  topics/search-data-formats/index.html: edit link only
  topics/search-expressions/index.html: edit link only
  topics/search-observables/index.html: edit link only
  topics/search-query/index.html: edit link only
  topics/search-scoring/index.html: content: 4 changed lines
  topics/search-scoring-examples/index.html: content: 2 changed lines

"content" excludes the edit link. The other 530 valkey-doc pages keep the same edit URL, so they're byte-identical.

valkey-search pages (valkey-search docs/ vs valkey-doc copy):

Page Change
ft.aggregate TIMEOUT falls back to the index's QUERY_TIMEOUT
ft.create new QUERY_TIMEOUT argument
ft.cursor DEL error also covers a cursor whose index was replaced
ft.hybrid TIMEOUT falls back to QUERY_TIMEOUT
ft._list new REGEX <pattern> argument and example
ft.search TIMEOUT falls back to QUERY_TIMEOUT
search-configurables new search.max-regex-pattern-bytes
search-scoring, search-scoring-examples heading renamed to "Score Fusion in FT.HYBRID"
ft.dropindex, ft.info, search, search-data-formats, search-expressions, search-observables, search-query edit link only (text identical, or only the COMPATIBILITY.md link form)

search-monitoring.md isn't in valkey-search yet, so it still comes from valkey-doc.

modules-api-ref (generated vs committed), by line:

     17 > Available since:</strong> 8.0.8
      5 < Available since:</strong> 8.1.0
     12 < Available since:</strong> 9.1.0
      1 > cluster bus message size        (newer comment, valkey a70408edf #5269)
      1 < edit/main/topics/modules-api-ref.md
      1 > edit/unstable/src/module.c

With the generator fix (madolson/valkey#235), only the #5269 comment and the edit link differ.

B. Simulated cutover

Every repo's docs/ populated from valkey-doc@7c5512ae per the partition (valkey-search keeps its 16 existing files), nav.yml, modules-nav/<repo>.yml as <repo>/docs/nav.yml, groups.json in valkey docs/, and valkey-doc without commands/, topics/, nav.yml, modules-nav/, groups.json:

copied=538 kept-existing=16
B: index.html list identical to A
B vs A: 529 files differ, 0 beyond the edit link

All 546 edit links in B resolve to an existing file in the simulated repos.

C. Duplicates

Duplicate: search.md is provided by both valkey-json/docs/topics/search.md and valkey-search/docs/topics/search.md
Duplicate: get.md is provided by both valkey/docs/commands/get.md and valkey-bloom/docs/commands/get.md
Each command and topic must come from one repo. Remove the duplicates above.
exit=1

A duplicate src/commands/get.json fails the same way.

D. Link checks (baseline origin/main: 0 and 0)

== A broken-links
Broken by this change (2):
::error::/topics/search-scoring-examples/ links to /topics/search-scoring#score-fusion-in-fthybrid, but that page has no #score-fusion-in-fthybrid anchor
::error::/topics/search-scoring/ links to /topics/search-scoring/#score-fusion-in-fthybrid, but that page has no #score-fusion-in-fthybrid anchor
== A unconverted-doc-links
This change doesn't break any links.

B gives the same 2 and 0. Both are decision 5. Before commits 4 and 5 there were 13 and 11: 9 COMPATIBILITY.md links and ft.search's two links on one line.

Module API checkout

Checkout valkey .git Time Output md5
full clone 305 MB 10 s 5c888e62a6c8
depth 1 + all tags depth 1 16 MB 5 s 5c888e62a6c8
depth 1 + tags, blob:none 7 MB 2 s + 21 s lazy fetch 5c888e62a6c8
blob:none full history 27 MB 4 s + 20 s 5c888e62a6c8
depth 1, no tags 64fd90f70c38 (27 "unreleased")

A full site build from checkout-doc-sources.sh output is byte-identical to the A build. Without Ruby >= 2.3:

Warning: Ruby >= 2.3 not found: modules-api-ref.md is not generated, the fallback repo's copy is used if it has one.

The old build-site steps (link-check's base side) on the new checkout layout give output identical to the baseline. Without jq, output is identical too (the templates read the single JSON dir).

E. actionlint 1.7.12

No findings in link-check.yml, zola-deploy.yml or preview.yml. The whole repo has the same 6 SC2046 warnings in deply.yml before and after. shellcheck is clean on both new scripts.

Not verified

  • Byte identity of the CI build with the local one: the preview artifact adds a banner and its own base URL. Its page list matches A, and its API reference has the same 17 "since 8.0.8" lines. CI's link check reports the same 2 anchors as D. Its base side never builds on any PR, upstream included (Link check never builds the base commit #42).
  • macOS bash 3.2 and a case-insensitive filesystem. The script avoids bash 4 features, but I didn't run it there.

This was generated by AI but verified, with love, by a human.

build/doc-sources.csv lists the repos the command and topic pages come
from: valkey (core), the modules, valkey-bundle, and valkey-doc as the
fallback. build/checkout-doc-sources.sh clones them for CI, and
build/init-docs.sh replaces init-topics.sh and init-commands.sh: it
links docs/commands/*.md, docs/topics/* and src/commands/*.json from
every repo, and the fallback's commands/ and topics/ for names no code
repo provides, into build-command-docs/, build-topics/ and
build-command-json/. Two code repos providing the same name fail the
step. The menu comes from the core repo's docs/nav.yml and each other
repo's docs/nav.yml, else valkey-doc's nav.yml and modules-nav/.
groups.json comes from valkey docs/, else valkey-doc; modules.json stays
in valkey-doc.

The command JSON is in one directory, so the templates read one path,
and the menu takes its sources and "module" badges from the registry
instead of config.toml. Each stub records its source repo, branch and
path in [extra].

Adds valkey-ldap and valkey-bundle. valkey-search's docs/ copies of its
pages now win over valkey-doc's.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
The edit links were hard-coded to valkey-doc. They now use the source
repo, branch and path that build/init-docs.sh records in each stub.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
build/init-docs.sh runs valkey's utils/generate-module-api-doc.rb and
uses its output for /topics/modules-api-ref/ instead of valkey-doc's
committed copy, which goes stale between regenerations. The script
needs Ruby >= 2.3; without it the fallback's copy is used, with a
warning.

"Available since" comes from valkey's release tags, so
checkout-doc-sources.sh fetches every tag at depth 1. That gives the
same output as a full clone (16 MB instead of 305 MB of .git).

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
The ../topics/<name>.md patterns in fix_links_command matched from the
first link on a line to the .md of the next one, so valkey-search's
ft.search.md, which has both links to search-query.md on one line,
rendered /commands/topics/search-query#vector-range-match and
/topics/search-query.md. Stop the file name at a closing parenthesis.
No valkey-doc page changes.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
valkey-search's docs link to ../../COMPATIBILITY.md, which isn't a page
on the site. A ../../ link in a page from docs/commands/ or docs/topics/
now goes to that file in the page's repo on GitHub, which is what
valkey-doc's copies of those pages link to.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
README: how to check out and gather the docs, the file layout, the
precedence and duplicate rules, and how to register a repo. The
community page points contributors at the docs next to the code instead
of valkey-doc.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
@madolson madolson added the needs-review Staged work waiting on madolson's review label Nov 30, 2026
@github-actions

Copy link
Copy Markdown

One [[source]] table per repo, in the same order, with a comment block
that explains the keys and roles and how to add a module. The shell
scripts read it through build/doc-sources.py (stdlib tomllib, Python
3.11+), which also checks for unknown roles, missing keys and exactly
one core and one fallback repo. The templates load it as TOML.

The built site is identical.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Valkey Bundle isn't a module and its page stays in valkey-doc, so
valkey-bundle is no longer a doc source. The fallback's menu files that no
source is named after (modules-nav/valkey-bundle.yml) are merged last.
Without its only user, the "other" role goes away.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Staged work waiting on madolson's review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant