Skip to content

Add docs audit severities, CI report upload, and dead Pro-link cleanup#61

Merged
justin808 merged 2 commits intomainfrom
jg-codex/docs-audit-severity-and-ci
Apr 8, 2026
Merged

Add docs audit severities, CI report upload, and dead Pro-link cleanup#61
justin808 merged 2 commits intomainfrom
jg-codex/docs-audit-severity-and-ci

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Mar 26, 2026

Closes #12
Closes #13
Closes #59

Summary

  • rewrite scripts/audit-docs.mjs to support severity levels (error, warn, info)
  • ignore fenced code blocks for placeholder detection and narrow version-floor checks to React on Rails context
  • fail CI only on error-level audit findings, while uploading the report as an artifact and summarizing counts in the workflow summary
  • replace dead pro.reactonrails.com references with the canonical Pro docs destination in both prepared docs output and the site Pro page

Verification

  • npm run prepare && npm run audit:docs -- --output VALIDATION_REPORT_CI.md --fail-on error && npm run build
  • audit now reports Errors: 0 on the prepared docs set
  • Docusaurus still reports existing non-blocking broken link/anchor warnings from generated docs content, unchanged by this PR

Note

Medium Risk
Changes the docs validation logic and makes CI fail based on new severity thresholds, which could affect build gating and allow/block deployments if misclassified.

Overview
Adds a docs audit step to the site GitHub Actions workflow that always uploads VALIDATION_REPORT_CI.md as an artifact and posts a short counts summary to the job summary, while failing the build only when the audit step reports blocking findings.

Reworks scripts/audit-docs.mjs to produce severity-tagged findings (error/warn/info), ignore fenced code blocks for several checks, tighten the “version floor” scan to React-on-Rails-context mentions, and support --fail-on to control when the audit exits non-zero.

Cleans up dead pro.reactonrails.com references by rewriting them to the canonical Pro docs URL during prepare-docs and updating the Docusaurus Pro page CTA to point at /docs/pro.

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

Summary by CodeRabbit

  • New Features

    • Added automated documentation audit phase to the build process that validates documentation quality and generates audit reports.
  • Improvements

    • Updated Pro pricing documentation link to route through internal docs site instead of external URL.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

Walkthrough

The changes introduce a documentation audit system with severity levels into the CI workflow, execute it during builds, upload reports as artifacts, and implement a conditional quality gate for error-level findings. The audit script is refactored to emit severity-categorized findings, track line numbers while ignoring fenced code blocks, and improve detection patterns. External Pro domain links are normalized to the canonical internal route.

Changes

Cohort / File(s) Summary
CI Audit Quality Gate
.github/workflows/site-build-deploy.yml
Added docs audit step after npm run prepare:docs, redirecting output to VALIDATION_REPORT_CI.md. Configured to continue on error but uploads audit report as artifact unconditionally. Appends "Docs Audit" section to job summary via grep extraction. Implements conditional hard-fail step when audit detects errors.
Docs Audit Script
scripts/audit-docs.mjs
Refactored page analysis to emit structured {severity, message} findings instead of comments. Added --fail-on CLI option with severity thresholds (info/warn/error). Introduced fence-aware line tracking via createLineInfo to skip checks within code blocks. Enhanced placeholder and suspicious link detection (now flags pro.reactonrails.com). Report header now includes severity counts and pages-affected metrics. Sets process.exitCode = 1 when findings meet or exceed specified threshold.
Docs Link Rewriting
scripts/prepare-docs.mjs
Extended URL normalization in both rewriteProLinks and rewriteFlattenedOssLinks to convert https://pro.reactonrails.com (with optional trailing /) to https://reactonrails.com/docs/pro/.
Page Navigation Link
prototypes/docusaurus/src/pages/pro.tsx
Updated "Need pricing…" call-to-action link target from https://pro.reactonrails.com/ to internal Docusaurus route /docs/pro.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hop, hop, the audit's on its way,
Severity levels guide the path today,
Code fences fend off false alarms,
Pro links now point where safety warms,
CI gates catch the errors with care! 📋✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the three main changes: adding severity levels to the docs audit, uploading CI reports, and fixing dead Pro links.
Linked Issues check ✅ Passed All code requirements from issues #12, #13, and #59 are met: severity levels added, CI audit step with artifact upload implemented, and dead pro.reactonrails.com links replaced.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the three linked issues; no unrelated modifications detected in the workflow, scripts, or page files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg-codex/docs-audit-severity-and-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 26, 2026

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Missing blank line between report header and body
    • Added an explicit newline between the joined header and body so the Markdown section heading is separated from the first page entry by a blank line.

Create PR

Or push these changes by commenting:

@cursor push 26ab85dc5e
Preview (26ab85dc5e)
diff --git a/scripts/audit-docs.mjs b/scripts/audit-docs.mjs
--- a/scripts/audit-docs.mjs
+++ b/scripts/audit-docs.mjs
@@ -309,7 +309,7 @@
     })
     .join("\n");
 
-  return `${header.join("\n")}${body}`;
+  return `${header.join("\n")}\n${body}`;
 }
 
 function shouldFailAudit(pages) {

Comment thread scripts/audit-docs.mjs Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
scripts/prepare-docs.mjs (1)

438-439: URL normalization for OSS docs complete.

The same pattern is correctly applied to non-Pro docs. Note that this replacement pattern now appears in three places (fixKnownDocsIssues, rewriteProLinks, and rewriteFlattenedOssLinks). While idempotent, consider extracting a shared constant for the URL patterns if they need to stay synchronized. As per coding guidelines, "Ask first before making changes to build scripts (scripts/ directory)."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/prepare-docs.mjs` around lines 438 - 439, The same URL-rewrite regex
literals are duplicated across fixKnownDocsIssues, rewriteProLinks, and
rewriteFlattenedOssLinks; extract the common patterns into a single shared
constant (e.g., PRO_DOCS_REPLACEMENTS or PRO_DOCS_URL_PATTERNS) and reference
that constant from each function instead of repeating the .replace() literals so
updates stay synchronized; before applying the change, confirm with the team per
the "ask first" guideline for edits under scripts/.
prototypes/docusaurus/src/pages/pro.tsx (1)

147-147: Use docsRoutes.proOverview for consistency.

Line 76 already uses docsRoutes.proOverview for the same /docs/pro route. Using the constant here maintains consistency and ensures route changes propagate automatically.

Suggested change
-            <a href="/docs/pro">the Pro docs landing page</a>.
+            <Link to={docsRoutes.proOverview}>the Pro docs landing page</Link>.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@prototypes/docusaurus/src/pages/pro.tsx` at line 147, Replace the hard-coded
"/docs/pro" anchor href with the route constant docsRoutes.proOverview (i.e.,
use docsRoutes.proOverview instead of the literal string) in the <a> tag around
"the Pro docs landing page"; if docsRoutes is not already imported in pro.tsx,
add the appropriate import for docsRoutes so the constant is available. Ensure
the anchor uses the constant value (or the Link component with
docsRoutes.proOverview) so future route changes propagate automatically.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@prototypes/docusaurus/src/pages/pro.tsx`:
- Line 147: Replace the hard-coded "/docs/pro" anchor href with the route
constant docsRoutes.proOverview (i.e., use docsRoutes.proOverview instead of the
literal string) in the <a> tag around "the Pro docs landing page"; if docsRoutes
is not already imported in pro.tsx, add the appropriate import for docsRoutes so
the constant is available. Ensure the anchor uses the constant value (or the
Link component with docsRoutes.proOverview) so future route changes propagate
automatically.

In `@scripts/prepare-docs.mjs`:
- Around line 438-439: The same URL-rewrite regex literals are duplicated across
fixKnownDocsIssues, rewriteProLinks, and rewriteFlattenedOssLinks; extract the
common patterns into a single shared constant (e.g., PRO_DOCS_REPLACEMENTS or
PRO_DOCS_URL_PATTERNS) and reference that constant from each function instead of
repeating the .replace() literals so updates stay synchronized; before applying
the change, confirm with the team per the "ask first" guideline for edits under
scripts/.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 11f49eaf-d043-4081-ada1-f60eb9117452

📥 Commits

Reviewing files that changed from the base of the PR and between e554be0 and 7c5bc0c.

📒 Files selected for processing (4)
  • .github/workflows/site-build-deploy.yml
  • prototypes/docusaurus/src/pages/pro.tsx
  • scripts/audit-docs.mjs
  • scripts/prepare-docs.mjs

@justin808 justin808 merged commit 1da4d69 into main Apr 8, 2026
4 checks passed
@justin808 justin808 deleted the jg-codex/docs-audit-severity-and-ci branch April 8, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant