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
Touches archived-version link rewriting (silent wrong content if mis-matched) and AI feed Markdown generation; the extra removals in process-markdown-content.html could regress feed output for commented or table-children content.

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

In version_archiver.py, a second regex anchored on Markdown link destinations rewrites intra-product /content/<prefix>/<product>/… paths to include the frozen version, reusing the existing replace_link logic (release-notes skip, idempotency, other products untouched). build/test_version_archiver.py adds eight isolated tests for relref vs plain links, anchors, source-relative paths, exemptions, and GitHub URL safety.

In process-markdown-content.html, three replaceRE rules turn those /content/… destinations into https://redis.io/docs/latest/… URLs (including _index.md / index.md handling) so JSON/Markdown feeds do not emit raw source paths.

The same partial diff also removes line-anchored HTML-comment stripping, the markdown-table-children expansion pass, and tightens the catch-all shortcode-removal regex—changes not called out in the PR description but present in the diff.

Reviewed by Cursor Bugbot for commit 07b7c9f. 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 9 related items from repository history:

Memory updated at 07b7c9f

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

{{- /* 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.

Shortcode strip regex regresses

High Severity

The remaining-shortcode remover changed from a non-greedy match to the first >}} into [^>]*, which stops at a > inside an attribute. Shortcodes such as table-children with &lt;br/&gt; in columnNames are only partially consumed, leaving raw shortcode fragments in the AI feed.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c87015c. Configure here.

@andy-stark-redis
andy-stark-redis force-pushed the DOC-6909-2-link-tooling branch from c87015c to 7ade771 Compare August 12, 2026 15:25
@andy-stark-redis
andy-stark-redis marked this pull request as draft August 12, 2026 15:26
…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.

Ticket: DOC-6909
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant