Skip to content

Conversation

@ihabadham
Copy link
Collaborator

@ihabadham ihabadham commented Feb 10, 2026

Summary

  • Adds .docs-config.yml manifest files to docs/ (OSS) and react_on_rails_pro/docs/ (Pro) that declare category ordering, file ordering, and exclusions for the shakacode.com docs website
  • Adds a CI validator (scripts/validate-docs-config.cjs) that runs on every PR touching docs and blocks merge if the manifest doesn't match the actual folder structure
  • Adds a GitHub Actions workflow (.github/workflows/validate-docs-config.yml) that triggers validation on PRs and pushes to master

Why

When docs structure changes (new directories, renamed/moved files), the shakacode.com website's hardcoded navigation config becomes stale — broken sidebar ordering has sat in production for weeks/months with no detection. This makes the manifests the single source of truth that sc-website will read at build time (in a follow-up PR), replacing its current hardcoded arrays.

What the validator checks

  1. Category completeness — every non-excluded directory with docs must be in categoryOrder (ERROR if missing)
  2. File existence — every file in fileOrder must exist on disk (ERROR if missing)
  3. Stale exclusions — exclusion patterns that match no files (WARNING)
  4. Stale categories — categories referencing nonexistent directories (WARNING)
  5. Root-level files — root .md files require "" in categoryOrder (ERROR if missing)
  6. Duplicates — duplicate entries in categoryOrder or fileOrder arrays (ERROR)

Notes

  • The Pro manifest explicitly lists react-server-components and release-notes in categoryOrder. These folders already exist and appear dynamically at the end of the sidebar today — the manifest just makes the implicit order explicit.
  • The validator script uses .cjs extension because the repo has "type": "module" in package.json.
  • CI installs js-yaml and micromatch to a temp directory (/tmp/docs-validator) to avoid touching the repo's pnpm-lock.yaml.

Test plan

  • CI workflow passes on this PR
  • Manually verify: node scripts/validate-docs-config.cjs docs passes
  • Manually verify: node scripts/validate-docs-config.cjs react_on_rails_pro/docs passes
  • Break test: remove a folder from categoryOrder → validator should ERROR
  • Break test: add a nonexistent file to fileOrder → validator should ERROR

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Implemented automated validation of documentation configurations to maintain consistency across documentation sites.
    • Configured documentation organization with structured category ordering and file sequencing for improved documentation navigation and discoverability.

When docs structure changes (new directories, renamed files, moved docs),
the shakacode.com website config becomes stale because there's no
enforcement linking folder structure to navigation config. This adds a
.docs-config.yml manifest to both docs/ and react_on_rails_pro/docs/
that declares category ordering, file ordering, and exclusions — and a
CI validator that blocks PRs if the manifest doesn't match the actual
folder structure.

The manifests are the source of truth that sc-website will read at build
time (in a follow-up PR) instead of its current hardcoded arrays.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

Walkthrough

Introduce automated validation of documentation configurations via a GitHub Actions workflow and Node.js validation script. Add YAML configuration files for OSS and Pro documentation directories that specify exclusions, category ordering, and file ordering. Validation runs on relevant pull requests and pushes.

Changes

Cohort / File(s) Summary
Documentation Validation Infrastructure
.github/workflows/validate-docs-config.yml, scripts/validate-docs-config.cjs
GitHub Actions workflow that runs on docs-related paths, installing validator dependencies and executing validation commands. Node.js script validates YAML config schema (exclude, categoryOrder, fileOrder), checks structural alignment with actual docs directories, detects stale entries, and reports errors/warnings.
Documentation Configuration Files
docs/.docs-config.yml, react_on_rails_pro/docs/.docs-config.yml
YAML configuration files defining exclusions, category hierarchies, and per-folder file ordering for docs site generation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Hops through workflows with glee,
Validating docs with scrutiny!
Config files now dance in place,
YAML schemas keep the pace.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main changes: adding .docs-config.yml manifest files and implementing CI validation for them.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ihabadham/feature/docs-manifest

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
react_on_rails_pro/docs/.docs-config.yml (1)

12-13: Nit: Inconsistent quoting for the empty-string category.

The OSS config uses "" (double quotes) while this file uses '' (single quotes) for the root-level category marker. Both are valid YAML, but consistency across configs would be nice.

scripts/validate-docs-config.cjs (3)

52-55: Biome lint: forEach callbacks should not implicitly return a value.

The arrow functions at Lines 53, 225, and 230 implicitly return the result of console.error/console.warn. Biome flags this because forEach callbacks aren't expected to return values. Wrap in braces to silence the lint.

♻️ Proposed fix (apply same pattern at Lines 225 and 230)
-  errors.forEach(e => console.error(`ERROR: ${e}`));
+  errors.forEach(e => { console.error(`ERROR: ${e}`); });

158-180: Root-level file fallback in fileOrder check may cause confusion.

When a file listed under fileOrder.getting-started (for example) doesn't exist in getting-started/ but does exist at the docs root, the validator only warns. If the intent is that fileOrder entries must match files in their declared folder, this should arguably be an error rather than a warning, since a stale cross-category mapping could silently break ordering.


192-204: listAllRelativePaths is defined after its first use.

listAllRelativePaths is called at Line 184 but defined at Line 192. This works in CJS due to function hoisting, but placing the definition before its call site would improve readability and match the style of other helpers in this file.

.github/workflows/validate-docs-config.yml (1)

30-31: Pin dependency versions to avoid non-deterministic CI.

npm install ... js-yaml micromatch installs the latest versions. A breaking release of either package could cause unexpected CI failures. Pin to specific versions to ensure reproducibility.

♻️ Proposed fix
-        run: npm install --prefix /tmp/docs-validator --no-package-lock js-yaml micromatch
+        run: npm install --prefix /tmp/docs-validator --no-package-lock js-yaml@4 micromatch@4

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.

@ihabadham ihabadham changed the title Add .docs-config.yml manifests with CI validation WIP: Add .docs-config.yml manifests with CI validation Feb 10, 2026
@ihabadham ihabadham marked this pull request as draft February 10, 2026 20:07
@greptile-apps
Copy link

greptile-apps bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

Adds comprehensive docs configuration validation system to prevent stale navigation on shakacode.com. Creates YAML manifests that declare category ordering, file ordering, and exclusions for both OSS and Pro docs, replacing the website's current hardcoded navigation config.

Key Changes:

  • CI workflow validates manifests on every docs-touching PR and blocks merge on errors
  • Validator performs 5 checks: category completeness, file existence, stale exclusions, stale categories, and root-level file handling
  • Dependencies installed to /tmp/docs-validator to avoid polluting the repo's lock file
  • Uses .cjs extension for validator script to work with repo's "type": "module" setting

Minor Issues:

  • Inconsistent quote style between OSS ("") and Pro ('') configs for empty string in categoryOrder (functionally equivalent in YAML, but inconsistent)

The implementation is solid and addresses a real pain point of broken sidebar ordering sitting undetected in production.

Confidence Score: 5/5

  • Safe to merge - well-designed validation system with no functional issues
  • The implementation is thorough and addresses a real problem. The validator script is comprehensive with proper error handling, the GitHub workflow is correctly configured, and the manifest files accurately reflect the current directory structure. Only minor style inconsistency found (quote style), which has no functional impact.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/validate-docs-config.yml Added CI workflow that validates docs config on PRs and pushes to master, installs dependencies to temp directory to avoid lock file changes
docs/.docs-config.yml Manifest declaring category order, file order, and exclusions for OSS docs - uses double quotes for empty string in categoryOrder
react_on_rails_pro/docs/.docs-config.yml Manifest for Pro docs with category ordering - uses single quotes for empty string, inconsistent with OSS config
scripts/validate-docs-config.cjs Validator script checking config completeness, file existence, and stale entries - has potential issue with nested directory handling

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub PR
    participant CI as CI Workflow
    participant Val as Validator Script
    participant FS as File System
    
    Dev->>GH: Push changes to docs/
    GH->>CI: Trigger validate-docs-config.yml
    CI->>CI: Setup Node.js 20
    CI->>CI: Install js-yaml & micromatch to /tmp
    CI->>Val: Run validator for docs/
    Val->>FS: Read .docs-config.yml
    Val->>FS: Scan directory structure
    Val->>Val: Validate schema
    Val->>Val: Check category completeness
    Val->>Val: Check file existence
    Val->>Val: Check stale entries
    Val-->>CI: Return errors/warnings
    CI->>Val: Run validator for react_on_rails_pro/docs/
    Val->>FS: Read .docs-config.yml
    Val->>FS: Scan directory structure
    Val->>Val: Perform all validations
    Val-->>CI: Return errors/warnings
    CI-->>GH: Report success/failure
    GH-->>Dev: Block merge if errors found
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

# Sidebar category order. Uses folder names (kebab-case).
# "" = root-level files (no category header).
categoryOrder:
- ''
Copy link

Choose a reason for hiding this comment

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

Inconsistent quote style - OSS config uses "" for empty string (line 22 in docs/.docs-config.yml), but this uses ''

Suggested change
- ''
- ""

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

The validate-docs-config.cjs script requires these packages but they
were only available as transitive dependencies. Knip flagged them as
unlisted dependencies, causing CI to fail.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Comment on lines +20 to +37
runs-on: ubuntu-latest
env:
NODE_PATH: /tmp/docs-validator/node_modules
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install validator dependencies
run: npm install --prefix /tmp/docs-validator --no-package-lock js-yaml micromatch

- name: Validate OSS docs config
run: node scripts/validate-docs-config.cjs docs

- name: Validate Pro docs config
run: node scripts/validate-docs-config.cjs react_on_rails_pro/docs

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 2 days ago

In general, the fix is to add an explicit permissions block that grants only the minimal scopes required. For this workflow, the steps only read repository contents and run local Node scripts, so contents: read is sufficient. We can attach the permissions block either at the root of the workflow (applying to all jobs) or directly under the validate job. To keep the change tightly scoped to the highlighted job, we’ll add it under jobs.validate.

Concretely, in .github/workflows/validate-docs-config.yml, add a permissions: section under jobs: validate: at the same indentation level as runs-on. The block should be:

permissions:
  contents: read

No new imports or external tools are needed; this is pure workflow configuration. Existing functionality is unaffected because the workflow never wrote to the repository or other GitHub resources.

Suggested changeset 1
.github/workflows/validate-docs-config.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/validate-docs-config.yml b/.github/workflows/validate-docs-config.yml
--- a/.github/workflows/validate-docs-config.yml
+++ b/.github/workflows/validate-docs-config.yml
@@ -18,6 +18,8 @@
 jobs:
   validate:
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
     env:
       NODE_PATH: /tmp/docs-validator/node_modules
     steps:
EOF
@@ -18,6 +18,8 @@
jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read
env:
NODE_PATH: /tmp/docs-validator/node_modules
steps:
Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
react-on-rails/client bundled (gzip) 62.5 KB (0%)
react-on-rails/client bundled (gzip) (time) 62.5 KB (0%)
react-on-rails/client bundled (brotli) 53.71 KB (0%)
react-on-rails/client bundled (brotli) (time) 53.71 KB (0%)
react-on-rails-pro/client bundled (gzip) 63.5 KB (0%)
react-on-rails-pro/client bundled (gzip) (time) 63.5 KB (0%)
react-on-rails-pro/client bundled (brotli) 54.67 KB (0%)
react-on-rails-pro/client bundled (brotli) (time) 54.67 KB (0%)
registerServerComponent/client bundled (gzip) 127.11 KB (0%)
registerServerComponent/client bundled (gzip) (time) 127.11 KB (0%)
registerServerComponent/client bundled (brotli) 61.52 KB (0%)
registerServerComponent/client bundled (brotli) (time) 61.52 KB (0%)
wrapServerComponentRenderer/client bundled (gzip) 121.61 KB (0%)
wrapServerComponentRenderer/client bundled (gzip) (time) 121.61 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) 56.58 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) (time) 56.58 KB (0%)

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