Skip to content

fix: preview upcoming Operator docs before release - #691

Open
shahsahil264 wants to merge 2 commits into
krkn-chaos:mainfrom
shahsahil264:fix/operator-docs-deploy-preview
Open

shahsahil264 wants to merge 2 commits into
krkn-chaos:mainfrom
shahsahil264:fix/operator-docs-deploy-preview

Conversation

@shahsahil264

Copy link
Copy Markdown
Member

Summary

Netlify deploy previews now show the editable Operator docs at their normal unversioned URLs, labeled as upcoming and unpublished. Registered version URLs continue to render their frozen snapshots, and preview builds skip generated compatibility redirects that would otherwise send reviewers away from the editable source. Production behavior is unchanged: source docs stay hidden and unversioned links redirect to the newest stable snapshot.

The preview browser search includes editable source pages. The documentation assistant is hidden on those draft pages because it answers from published documentation.

For the v1.2.0 roadmap example, reviewers can use /docs/krkn-operator/releases/ in the deploy preview to see the pending update; /docs/krkn-operator/versions/v1.1.0/releases/ remains frozen.

Validation

  • npm run test:operator-docs — 75 passed.
  • npm run test:operator-docs:site — 3 passed, including the v1.2.0 source / frozen v1.1.0 roadmap case.
  • npm run check:operator-docs — passed.
  • Direct Netlify-mode Hugo build verified editable source at the unversioned route and frozen v1.1.0 at its versioned route.
  • Direct production-mode Hugo build verified the source remains hidden and the unversioned roadmap URL redirects to v1.1.0.
  • The build:preview command's bundled post-build link check stalled in this local sandbox after Hugo completed; no GitHub checks were watched.

Signed-off-by: Sahil Shah <sahshah@redhat.com>
@netlify

netlify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for krkn-chaos ready!

Name Link
🔨 Latest commit 9dedc91
🔍 Latest deploy log https://app.netlify.com/projects/krkn-chaos/deploys/6ada72057f040914f3448ec2
😎 Deploy Preview https://deploy-preview-691--krkn-chaos.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Show upcoming Operator docs in Netlify deploy previews

🐞 Bug fix ✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Show editable Operator docs at unversioned deploy-preview URLs while preserving frozen release
 pages.
• Skip preview compatibility redirects, label drafts as unpublished, and hide their published-docs
 assistant.
• Include drafts in browser search and test preview behavior against production redirects.
Diagram

graph TD
  N["Netlify context"] --> W["Build wrapper"] --> D{"Preview mode?"} -->|yes| M["Source mount"] --> U["Unversioned pages"]
  D -->|no| R["Compatibility redirects"] --> U
  D -->|both| S["Frozen snapshots"] --> V["Versioned pages"]
Loading
High-Level Assessment

Keep the mode-specific Hugo mounts and redirects. They expose drafts at the URLs reviewers need without altering registered snapshots or production behavior; serving drafts at a separate preview path would not exercise the normal links.

Files changed (8) +215 / -30

Enhancement (2) +53 / -20
_td-content-after-header.htmlLabel draft pages as upcoming and unpublished +2/-1

Label draft pages as upcoming and unpublished

• Rewords the authoring banner to identify upcoming Operator documentation and explain that versioned releases remain frozen and the assistant is disabled on drafts.

layouts/_td-content-after-header.html

operator-docs-hugo.jsMount draft source alongside frozen snapshots in previews +51/-19

Mount draft source alongside frozen snapshots in previews

• Generates mode-specific Hugo mounts so previews serve editable source at unversioned URLs without generating compatibility redirects. Retains registered snapshot mounts and supports an unpublished-source notice even with an empty release registry.

scripts/lib/operator-docs-hugo.js

Bug fix (2) +14 / -5
body-end.htmlHide the assistant on draft Operator pages +2/-1

Hide the assistant on draft Operator pages

• Suppresses the published-documentation chatbot on unversioned Operator source pages in preview mode. Registered release pages retain their existing assistant behavior.

layouts/_partials/hooks/body-end.html

hugo-with-operator-docs.jsSelect preview Hugo inputs and skip redirect finalization +12/-4

Select preview Hugo inputs and skip redirect finalization

• Passes deploy-preview mode into Hugo input preparation and uses its generated configuration. Skips compatibility redirect finalization for preview builds while retaining it for production.

scripts/hugo-with-operator-docs.js

Tests (2) +131 / -3
operator-docs-hugo.test.jsTest preview mounts and empty-registry configuration +40/-0

Test preview mounts and empty-registry configuration

• Checks that preview preparation mounts source and registered snapshots, omits redirects, and enables the authoring notice even when no releases are registered.

scripts/tests/operator-docs-hugo.test.js

operator-docs-site.jsVerify draft and frozen roadmap pages in generated sites +91/-3

Verify draft and frozen roadmap pages in generated sites

• Builds production and preview fixtures with distinct upcoming and captured roadmap data. Verifies preview search, banner, chatbot suppression, and redirect behavior alongside the unchanged frozen v1.1.0 page.

scripts/tests/operator-docs-site.js

Documentation (1) +16 / -2
operator-docs-versioning.mdExplain deploy-preview and production documentation behavior +16/-2

Explain deploy-preview and production documentation behavior

• Documents where reviewers can inspect unpublished source and frozen releases, including the roadmap example. Clarifies that production still hides source pages and redirects unversioned URLs.

docs/operator-docs-versioning.md

Other (1) +1 / -0
netlify.tomlEnable Operator source mode for Netlify deploy previews +1/-0

Enable Operator source mode for Netlify deploy previews

• Sets the preview-specific environment flag without changing the production build context.

netlify.toml

@qodo-code-review

qodo-code-review Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Unrelated docs appear to be unpublished ✓ Resolved
Description
writeHugoConfig enables operator_docs_authoring_preview for the entire deploy-preview site,
while _td-content-after-header.html renders its authoring notice on every page without an enabled
Operator release context. In a deploy preview, ordinary documentation pages outside
/docs/krkn-operator/ therefore display the “Upcoming Operator documentation preview — not
published” notice too.
Code

scripts/lib/operator-docs-hugo.js[287]

+      ...(includeAuthoringSourcePreview ? { operator_docs_authoring_preview: true } : {}),
Relevance

●●● Strong

Clear scope bug: the preview flag is global, but the banner must be limited to Operator URLs.

PR-#680

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new generated parameter activates the layout’s existing site-wide else if branch. That branch
has no Operator-path check; the site fixture includes a separate /docs/scenarios/current/ page,
which cannot have an enabled Operator version context.

scripts/lib/operator-docs-hugo.js[281-290]
layouts/_td-content-after-header.html[1-9]
layouts/_partials/operator-docs/context.html[1-6]
scripts/tests/operator-docs-site.js[82-89]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Deploy-preview configuration enables the authoring notice site-wide, so unrelated documentation pages are labeled as unpublished Operator drafts.
## Fix Focus Areas
- scripts/lib/operator-docs-hugo.js[281-290]
- layouts/_td-content-after-header.html[1-9]
## Recommended Fix
Keep the preview flag for the deploy build, but render the authoring notice only when the page is an unversioned Operator source page. Preserve the existing release banner on registered version pages and verify that unrelated documentation pages have neither Operator notice.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 28 rules
✅ Cross-repo context — repo relationships
  Explored: repo: krkn-chaos/krkn-operator (sha: 360e48f4) — View relationship
Review mode: Auto: ⚖️ Balanced: Downgraded extended -> standard: change is below the extended eligibility bar (hunks 17/18, lines 245/200; both must reach the floor). Router rationale: Multiple preview, routing, Hugo, template, and search behaviors create defect-dense logic.

Grey Divider

Tip of the day
💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread scripts/lib/operator-docs-hugo.js
Signed-off-by: Sahil Shah <sahshah@redhat.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.

2 participants