Skip to content

DOC-6909 Teach the feed pipeline and version archiver the /content/ link form - #3796

Open
andy-stark-redis wants to merge 1 commit into
DOC-6909-1-link-fixesfrom
DOC-6909-2-link-tooling
Open

DOC-6909 Teach the feed pipeline and version archiver the /content/ link form#3796
andy-stark-redis wants to merge 1 commit into
DOC-6909-1-link-fixesfrom
DOC-6909-2-link-tooling

Conversation

@andy-stark-redis

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

Copy link
Copy Markdown
Contributor

Part 2 of 4. Stack: #3795#3796 (this)#3797#3798

What this is

Updates the two tools that read relref as a literal string, ahead of any content moving off it. This is @paoloredis's review point from #3732, and it turns out not to be a "before we remove relref" concern — it bites per section, at migration time.

Both changes are inert until content actually uses repo-root-relative links, so this is safe to land on its own.

Tool Blind spot Consequence
process-markdown-content.html rewrote only relref to absolute URLs a migrated page ships raw source paths into the AI Markdown/JSON feed, resolving nowhere
version_archiver.py pattern matched only relref links in an archived version keep resolving to latest instead of the frozen copy — silently, no error

The archiver one was found by probe rather than by reasoning, and it's the more expensive: wrong content in a frozen version, discovered late.

Notes for review

  • Both patterns anchor on a Markdown link destination (](/content/…), not the bare /content/ prefix — otherwise they rewrite the github.com blob URLs that legitimately embed the same path segment. There's a test pinning this.
  • The archiver shares one replace_link closure across both notations, so the release-notes exemption and the already-versioned guard can't drift apart.
  • Source-relative links need no archiver rewriting — the whole subtree is copied, so a link between two pages inside it already resolves within the version. test_source_relative_link_is_left_alone asserts the resolution, not just that the text is unchanged.
  • build/test_version_archiver.py (8 tests) was confirmed to fail with only the new substitution disabled, so it isn't passing vacuously. Like its build/test_*.py siblings it isn't wired into CI.

Not covered

394 .html.md files still leak pre-existing ../ relative links into the feed, plus 21 with rooted non-/content/ links. That defect predates this work entirely and is out of scope here.


Note

Medium Risk
Changes affect archived-version link correctness and AI-facing URLs, but behavior is inert until migrated content uses /content/ links and is backed by targeted archiver tests.

Overview
Teaches the docs pipeline and version archiver to handle repo-root-relative Markdown links (](/content/...) the same way they already handle relref, ahead of DOC-6909 section migrations.

In process-markdown-content.html, new replaceRE rules rewrite those link destinations to https://redis.io/docs/latest/..., including _index.md / index.md handling so section URLs match published paths; anchors stay outside the match.

In version_archiver.py, a second pattern anchored on ](/content/<prefix>/<product>/...) runs through the existing replace_link logic so frozen versions do not keep pointing at latest; release-notes exemption, idempotency, and “don’t touch other products / GitHub blob URLs” behavior stay shared with relref.

Adds build/test_version_archiver.py (8 cases) covering both notations, anchors, source-relative links left alone, and false-positive guards.

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

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

DOC-6909

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 11 related items from repository history:

Memory updated at 522e174

@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 high effort and found 3 potential issues.

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 c87015c. Configure here.

{{- $content := .RawContent -}}
{{- $visited := .Visited | default (slice) -}}

{{- /* Drop HTML-comment blocks before anything else looks at the content.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

HTML comment stripping removed

High Severity

This commit drops the line-anchored HTML-comment strip from process-markdown-content.html, so draft blocks authors park in <!-- --> now flow into the AI Markdown/JSON feed as published body text. toc-from-markdown.html still strips those comments and documents that the two must stay aligned, so TOC and body also diverge.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c87015c. Configure here.

{{- /* Match non-greedily to the first ">}}": a [^>]* class is defeated by a ">" inside
an attribute value (e.g. columnNames="...<br/>...") and leaks the raw shortcode. */ -}}
{{- $content = $content | replaceRE `(?s)\{\{<\s*/?.*?>\}\}` "" -}}
{{- $content = $content | replaceRE `\{\{<\s*/?[^>]*>\}\}` "" -}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Table-children expansion dropped

High Severity

The call to markdown-table-children.html (and its follow-up unescape) was removed from process-markdown-content.html, even though the partial still exists and documents that without it release-notes index bodies are emptied in the feed. Pages whose only body is a table-children shortcode lose their tables and version metadata columns.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c87015c. Configure here.

Comment thread layouts/partials/process-markdown-content.html Outdated
…ink form

Prepares the two tools that read relref as a literal string, ahead of any
content moving off it. Both changes are inert until content actually uses
repo-root-relative links, so this is safe to land on its own.

The AI-facing Markdown and JSON output rewrote only relref to absolute
redis.io URLs, so a migrated page would ship raw source paths that resolve
nowhere. The version archiver had the same blind spot with worse
consequences: links in an archived version would keep resolving to the
latest page instead of the frozen copy, silently, with no error.

Both patterns anchor on a Markdown link destination rather than the bare
content prefix, or they would rewrite the github.com blob URLs that
legitimately embed the same path segment. The archiver shares one
replace_link closure between notations so the release-notes exemption and
the already-versioned guard cannot drift apart.

Source-relative links need no archiver rewriting: the whole subtree is
copied, so a link between two pages inside it already resolves within the
version. The accompanying tests pin that, and were confirmed to fail with
only the new substitution disabled.

Amended after Bugbot found that the first version of this commit silently
reverted two DOC-6939 improvements to the same partial. The stack was carved
out of the old single PR by checking each file out wholesale from a tag, which
replaces the file rather than applying a delta, so any change main had made to
it in the meantime was undone: the line-anchored HTML-comment strip, the
table-children expansion, and a catch-all shortcode regex that had been
tightened from [^>]* to a non-greedy match. Nothing warned, because reverting
those produces silently wrong feed output rather than a build error, and the
verification build was green. The rules are now inserted into main's current
version of the file, so this commit is purely additive.

Constraint: carve a branch out of an old state with a delta, never a wholesale file checkout from a tag, or any change main made to that file since the branch point is silently reverted
Ticket: DOC-6909
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

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

LGTM, but this definitely needs @paoloredis's eyes.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants