Skip to content

Conversation

@ihabadham
Copy link
Collaborator

@ihabadham ihabadham commented Dec 13, 2025

Summary

  • Fixed malformed markdown code fences in docs/guides/improved-error-messages.md
  • This was causing MDX parsing errors during Gatsby builds on the ShakaCode website

Problem

The markdown file had mismatched code fence delimiters which broke the sc-website Cloudflare Pages build:

  • Nested erb code block wasn't properly closed before outer fence closed
  • Stray triple backticks after the first code example
  • Two code blocks used ```````` to close when opened with ```````

The MDX parser failed with: Objects are not valid as a React child (found: [object RegExp])

Test plan

  • Verify markdown renders correctly on GitHub
  • Confirm sc-website Cloudflare Pages build succeeds after merge

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Improved formatting consistency in error message guides for better readability.

✏️ Tip: You can customize this high-level summary in your review settings.

The markdown file had mismatched code fence delimiters (mixing ``` and ````)
which caused MDX parsing errors during Gatsby builds:
- Nested erb code block wasn't properly closed before outer fence
- Stray triple backticks after the first code example
- Two code blocks used 4 backticks to close when opened with 3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

Walkthrough

Formatting adjustments to a documentation file address code fence syntax and whitespace consistency in markdown, affecting sections covering manual registration and enhanced error handling without altering any content or examples.

Changes

Cohort / File(s) Summary
Documentation formatting
docs/guides/improved-error-messages.md
Fixed code fence syntax (adjusted closing fence tokens) and removed extraneous whitespace around code blocks in manual registration and enhanced SSR errors sections

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops through markdown neat,
With fences fixed and spacing sweet,
The docs now dance in perfect form,
Where code blocks shine, all clean and warm! 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing malformed code fences in a specific Markdown documentation file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/docs-improved-error-messages-markdown

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b15bd2 and 56ea5ff.

📒 Files selected for processing (1)
  • docs/guides/improved-error-messages.md (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{rb,js,ts,jsx,tsx,json,yml,yaml,md}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{rb,js,ts,jsx,tsx,json,yml,yaml,md}: ALWAYS run bundle exec rubocop and fix ALL violations before every commit/push
ALWAYS ensure files end with a newline character before committing

Files:

  • docs/guides/improved-error-messages.md
**/*.{js,ts,jsx,tsx,json,css,scss,md}

📄 CodeRabbit inference engine (CLAUDE.md)

ALWAYS let Prettier handle ALL formatting - never manually format code

Files:

  • docs/guides/improved-error-messages.md
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T09:27:45.105Z
Learning: Applies to /CHANGELOG.md : Update `/CHANGELOG.md` for open-source features, bug fixes, breaking changes, deprecations, and performance improvements using format: `[PR 1818](https://github.com/shakacode/react_on_rails/pull/1818) by [username](https://github.com/username)`
📚 Learning: 2024-12-12T13:07:09.929Z
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/ReactOnRailsRSC.ts:87-87
Timestamp: 2024-12-12T13:07:09.929Z
Learning: When handling errors in 'node_package/src/ReactOnRailsRSC.ts', include the error stack in error messages in development and test environments to aid debugging.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2024-10-08T20:53:47.076Z
Learnt from: theforestvn88
Repo: shakacode/react_on_rails PR: 1620
File: spec/dummy/client/app/startup/HelloTurboStream.jsx:3-3
Timestamp: 2024-10-08T20:53:47.076Z
Learning: The `RailsContext` import in `spec/dummy/client/app/startup/HelloTurboStream.jsx` is used later in the project, as clarified by the user theforestvn88.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-09-15T21:24:48.207Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1781
File: node_package/src/ClientSideRenderer.ts:82-95
Timestamp: 2025-09-15T21:24:48.207Z
Learning: In React on Rails, the force_load feature includes both explicit `data-force-load="true"` usage and the ability to hydrate components during the page loading state (`document.readyState === 'loading'`). Both capabilities require a Pro license, so the condition `!railsContext.rorPro && (isComponentForceLoaded || document.readyState === 'loading')` correctly gates both scenarios.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-12-10T09:27:45.105Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T09:27:45.105Z
Learning: Applies to lib/react_on_rails/**/*.rb : Engine code has limited access to host application; use `Rails.root` for host app paths and `ReactOnRails.configure` for engine configuration

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-12-10T09:27:45.105Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T09:27:45.105Z
Learning: Applies to lib/generators/react_on_rails/**/*.rb : Generators run in host app context, not engine context; do not assume host app structure (e.g., `app/javascript/` may not exist in older apps)

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-07-08T05:57:29.630Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The global `generateRSCPayload` function in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. The `declare global` statements are used to document the expected interface that RORP will inject at runtime.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-12-10T09:27:45.105Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T09:27:45.105Z
Learning: Applies to spec/dummy/**/*.{spec,test}.{js,ts} : Playwright E2E tests use `cypress-on-rails` gem for Rails integration; use helpers like `app('clean')`, `appEval()`, and `appFactories()` for test setup instead of UI automation

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-10-23T17:22:01.074Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
1. Pro version check in `run_stream_inside_fiber`
2. RSC support check during pack generation via `ReactOnRailsPro.configuration.enable_rsc_support`
3. RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-12-10T09:27:45.105Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T09:27:45.105Z
Learning: Applies to lib/react_on_rails/**/*.rb : Create corresponding RBS signature files in `sig/react_on_rails/` for new Ruby files and add them to Steepfile for type checking

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-02-13T16:50:26.861Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/turbolinksUtils.ts:34-36
Timestamp: 2025-02-13T16:50:26.861Z
Learning: In React on Rails, when checking for Turbolinks version 5 using `turbolinksVersion5()`, always ensure `Turbolinks` exists first by checking `turbolinksInstalled()` to prevent TypeError when accessing properties.

Applied to files:

  • docs/guides/improved-error-messages.md
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in the `rsc_payload_react_component` helper method.

Applied to files:

  • docs/guides/improved-error-messages.md
🔇 Additional comments (4)
docs/guides/improved-error-messages.md (4)

61-103: Code fence nesting structure is correct.

The nested ERB block (lines 99–102) is properly closed before the outer 4-backtick fence closes (line 103), resolving the MDX parsing issue where nested fences were causing "Objects are not valid as a React child (found: [object RegExp])" errors.


117-140: Code fence backtick counts are consistent.

Lines 117–140 now have matching opening (3 backticks) and closing (3 backticks) fences, fixing the inconsistent backtick count issue mentioned in the PR objectives.


148-156: Code fence backtick counts are consistent.

Lines 148–156 now have matching opening and closing fences (3 backticks each), resolving code fence inconsistencies.


1-200: The file docs/guides/improved-error-messages.md ends with a newline as required. Prettier formatting verification could not be completed in the sandbox environment due to permission constraints, but no formatting issues are evident in the file content.


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.

@claude
Copy link

claude bot commented Dec 13, 2025

Code Review - PR #2222

Summary

This PR fixes malformed markdown code fences in docs/guides/improved-error-messages.md. The changes are well-scoped, correct, and address a real build issue.


✅ What's Good

1. Problem Correctly Identified

  • The nested ERB code block at lines 99-102 was missing its closing ``` before the outer ```` fence closed
  • Stray triple backticks after the first code example (line 105)
  • Two code blocks (lines 140, 156) used 4 backticks to close when they should use 3

2. Fixes Are Minimal and Precise

  • Line 102: Added missing ``` to properly close the nested ERB block
  • Line 105: Removed stray ```
  • Lines 140, 156: Changed ```` to ``` for proper fence closure

3. No Functional Changes

  • This is purely a documentation formatting fix
  • No code logic or functionality is altered
  • Follows the CLAUDE.md guidance about not requiring changelog entries for documentation fixes

📋 Verification Checklist

Markdown Structure Analysis:

  • ✅ Line 61: Opens with ```` (4 backticks) for the large error message block
  • ✅ Line 99: Nested ERB code block opens with ```erb
  • ✅ Line 102: NEW - Properly closes nested block with ```
  • ✅ Line 103: Closes outer block with ```` (4 backticks) - matches line 61 ✓
  • ✅ Line 117: Opens with ``` (3 backticks) for SSR error example
  • ✅ Line 140: FIXED - Closes with ``` (was incorrectly ````)
  • ✅ Line 148: Opens with ```ruby (3 backticks)
  • ✅ Line 156: FIXED - Closes with ``` (was incorrectly ````)

All code fences now properly match!


🔍 Potential Considerations

1. Testing on sc-website (mentioned in PR description)
Since this was breaking the Gatsby build on ShakaCode's website, you should:

  • Verify the Cloudflare Pages build succeeds after merge
  • Consider adding a markdown linting step to CI to catch these issues earlier

2. MDX vs Standard Markdown
The error message mentions MDX parsing (Objects are not valid as a React child (found: [object RegExp])). This suggests the docs site uses MDX. Consider:

  • Adding .mdx extension if using MDX-specific features
  • Or keep .md if it's just regular markdown (current approach is fine)

🎯 Recommendation

LGTM! ✅ Approve and merge.

This is a straightforward documentation fix that:

  • Solves a real build failure
  • Makes minimal, surgical changes
  • Follows proper markdown syntax
  • Requires no changelog entry per CLAUDE.md guidelines

No further testing needed - the markdown structure is now correct and GitHub's preview already validates it renders properly.


Reviewed by Claude Code following React on Rails conventions from CLAUDE.md

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