-
Notifications
You must be signed in to change notification settings - Fork 377
Enable Shakapacker early hints #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAdds Thruster HTTP/2 proxy integration and docs, bumps Ruby and Shakapacker, routes Rails through thrust in runfiles/Dockerfile/Procfiles, adds Early Hints verification scripts, adjusts webpack and test driver configs, updates dev startup to precompile, and adds a footer notice. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant Thruster as Thruster (HTTP/2 proxy)
participant Rails as Rails (Puma/App)
participant CDN as CDN (optional)
Note over Browser,Thruster: Browser connects via TLS/HTTP/2
Browser->>Thruster: GET / (HTTP/2)
Thruster->>Rails: proxied GET / (HTTP/1.1)
Rails-->>Thruster: 103 Early Hints (Link headers)
Thruster-->>Browser: 103 Early Hints (HTTP/2)
Rails-->>Thruster: 200 OK + body
Thruster-->>Browser: 200 OK + body
Note over CDN,Thruster: If CDN present, it may intercept 1xx responses (see investigation docs)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
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. Comment |
|
/deploy-review-app |
🚀 Quick Review App CommandsWelcome! Here are the commands you can use in this PR:
|
PR Review: Enable Shakapacker Early HintsThank you for this PR! Here's my comprehensive review: SummaryThis PR enables HTTP/2 early hints support by updating dependencies to use the Code Quality & Best PracticesGood:
Concerns:
Potential Bugs & Issues
Performance ConsiderationsPositive:
Considerations:
Security ConcernsLow Risk Changes:
Recommendations:
Test CoverageCurrent State:
Recommendations:
Additional Recommendations
Action Items Before Merge
Overall AssessmentVerdict: Needs revision before merge The concept and implementation approach are sound, but there are several concerns that should be addressed:
Once these items are addressed, this should be a valuable performance improvement! Let me know if you need help with any of these recommendations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
config/shakapacker.yml (1)
67-69: Add context and rationale for the early_hints configuration.The configuration enables early hints for production, which is aligned with the PR objective. However, the comment is minimal. Consider adding more detail:
- Explain what HTTP/2 Early Hints does (preloading critical resources)
- Note any performance or compatibility considerations
- Reference any related documentation or issues
Current implementation looks correct; this is a documentation enhancement request.
Consider updating the comment as follows:
# Cache manifest.json for performance cache_manifest: true # Early hints configuration # HTTP/2 Early Hints allows the server to proactively push resources # that the client is likely to need, improving perceived performance. # Requires HTTP/2 support and compatible browser/client. early_hints: enabled: true
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
Gemfile.lockis excluded by!**/*.lockyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (3)
Gemfile(1 hunks)config/shakapacker.yml(1 hunks)package.json(1 hunks)
🔇 Additional comments (3)
Gemfile (2)
6-6: Clarify the reason for downgrading Ruby from 3.4.6 to 3.4.3.This is a patch-version downgrade without explanation. Confirm whether this is:
- A required dependency constraint from the new Shakapacker branch
- A security or compatibility fix
- An intentional change with a specific reason
If unintentional or not required, consider reverting to 3.4.6.
9-9: Feature branch is under active development, but dependency risks remain.The
justin808/early-hintsbranch exists and is actively maintained (last commit verified Oct 17, 2025). Issues #721–#722 for Early Hints support were opened Oct 14, 2025, indicating intentional ongoing development. However, using an unreleased feature branch in production dependencies poses real risks:
- Non-deterministic builds: Branch can change without notice; successive deployments may pull different code.
- Incomplete feature: Early Hints is not yet released in any stable Shakapacker version (latest: 8.3.0, April 2025).
- No guarantees: Unvetted development code may introduce breaking changes, security issues, or be abandoned.
If this is intentional for temporary testing, explicitly document the temporal nature and plan for either pinning to a specific commit hash or awaiting an official release. Otherwise, consider reverting to a stable released version.
package.json (1)
95-95: Confirm intentionality of branch-based dependency and align Gemfile and package.json if upgrading.Both Gemfile and package.json consistently use
shakacode/shakapacker#justin808/early-hints, which currently resolves to version9.3.0.beta.2. While stable releases exist (9.1.0,9.2.0), the branch-based approach does introduce production risks: non-deterministic builds, unvetted pre-release code, and branch-dependent maintenance.Verify that this branch-based approach is intentional for the early-hints feature development. If migrating to a released version, update both files together to maintain consistency across your dependency management.
PR Review: Enable Shakapacker early hintsI've reviewed this PR and here's my comprehensive feedback: Overall AssessmentThis is a clean and focused PR that enables HTTP/2 Early Hints support for asset preloading. The changes are well-scoped and follow a logical pattern. Code Quality and Best PracticesStrengths:
Recommendations:
Performance ConsiderationsPositive Impact:Early Hints is excellent for performance:
Important Requirements:HTTP/2 Support Required:
Action Required:
Potential Bugs or IssuesCritical: Compatibility Check Needed
Security ConcernsLow Risk:
Considerations:
Test CoverageMissing Tests:Currently, there are no tests included for this feature. This is concerning for a production configuration change. Recommended Test Coverage:
Action Items SummaryBefore Merging:
Nice to Have:
ConclusionThis is a good quality PR with clear intent and clean implementation. The Early Hints feature should provide meaningful performance improvements for users on HTTP/2 connections. Main concerns:
Recommendation: Approve with conditions - Address the HTTP/2 verification and testing checklist before deploying to production. Great work on keeping the changes focused and well-organized! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (1)
package.json(2 hunks)
🔇 Additional comments (2)
package.json (2)
20-20: Verify the postinstall build produces the expected shakapacker bundle.The conditional build logic assumes that building shakapacker in
node_moduleswill produce a functional bundle. Confirm that:
- The
yarn buildstep in shakapacker completes successfully- The resulting
index.jsis actually generated and usable by the asset pipeline- No build artifacts are missing or corrupted
Test this locally on both Mac/Linux and Windows (or WSL) by running
yarn installand verifying the bundle integrity.
95-95: <!-- [scratchpad]
[task review_dependency_pinning 1/1]
Verify concerns about shakapacker branch pinning.[observations]
- Repository: react-webpack-rails-tutorial (by shakacode)
- Dependency: "shakapacker": "github:shakacode/shakapacker#justin808/early-hints"
- Branch justin808/early-hints is ACTIVE and recently updated (Oct 17, 2025)
- Latest commit: 6bf6bf5
- postinstall script present: builds shakapacker from source if needed
- yarn.lock is committed (visible from script output)
- Only GitHub dependency in package.json
- Recent commit message: "Add postinstall script to build shakapacker from GitHub branch"
[analysis]
- Review comment is technically correct: branch refs are mutable, commits are more reproducible
- HOWEVER: Context matters significantly here
- This is a tutorial repo testing an unreleased feature from upstream shakapacker
- postinstall script + committed yarn.lock already provide reproducibility guarantees
- The branch reference is intentional, not accidental
- This is a legitimate pattern for feature-branch testing before stable release
- Pinning to commit 6bf6bf5 would actually be worse if developers want to test updates
[conclusion]
Review comment's concern is valid but overly rigid for this development/testing scenario. The current setup mitigates the stated risks through:
- Committed yarn.lock (deterministic installs)
- postinstall build script (explicit build process)
- Active upstream maintenance
The developer should make an informed decision about whether this temporary feature-branch reference aligns with their project's dependency strategy.[done]
Verification complete. This is not an error or broken practice—it's an intentional development setup that requires developer confirmation of intent.
</scratchpad]Confirm whether pinning shakapacker to the feature branch is intentional and acceptable for your project's current development phase.
The review comment's concern about branch mutability is technically valid; however, your setup already mitigates the key reproducibility risks:
- yarn.lock is committed, making installs deterministic
- postinstall script builds shakapacker from source, showing deliberate integration testing
- Branch justin808/early-hints is active and maintained (latest commit: 6bf6bf5, updated Oct 17, 2025)
This is a legitimate pattern for testing unreleased features from an upstream branch before a stable release. If you plan to stay on this branch temporarily while testing early-hints, the current approach is acceptable. However, you should:
- Document in a comment why this branch reference exists (e.g., "TODO: pin to shakapacker release once early-hints merges")
- Plan to upgrade to a stable shakapacker release once the feature ships
- If you want extra safety now, pin to the specific commit (
#6bf6bf5) with a comment explaining it's temporary
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 9fca254 🎮 Control Plane Console |
Pull Request Review: Enable Shakapacker Early HintsThank you for this PR! I've reviewed the changes to enable early hints support in Shakapacker. Here's my detailed feedback: ✅ Code Quality & Best PracticesStrengths:
Concerns:
🐛 Potential Bugs & Issues
⚡ Performance ConsiderationsPositive Impacts:
Potential Issues:
🔒 Security Concerns
🧪 Test CoverageCurrent State:
Recommendations:
📝 Additional Recommendations
🎯 SummaryOverall Assessment: This is a well-intentioned performance optimization with clean implementation. However, it needs additional validation and testing before production deployment. Recommendation: Request Changes Required Before Merge:
Nice to Have:
Files Changed Review:
Great work on exploring performance optimizations! Please address the testing and documentation concerns before merging. Review generated with assistance from Claude Code |
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit eb1b3be 🎮 Control Plane Console |
Pull Request Review: Enable Shakapacker Early HintsOverviewThis PR updates the project to use a development branch of Shakapacker that includes early hints support, and enables the early hints feature in production. The changes are focused on dependency updates and configuration. Code Quality & Best Practices✅ Strengths
|
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 9930aaf 🎮 Control Plane Console |
Pull Request Review: Enable Shakapacker Early HintsThank you for this PR! I've reviewed the changes to enable early hints support via the shakapacker branch. Here's my detailed feedback: ✅ Positive Aspects
🔍 Code Quality & Best Practices1. PostInstall Script (package.json:20)The postinstall script has grown quite complex. This one-liner is hard to read and maintain. Concerns:
Recommendations:
2. Branch Dependency ManagementUsing a GitHub branch as a dependency is appropriate for testing/preview, but: Concerns:
Recommendations:
3. Early Hints Configuration (config/shakapacker.yml:67-70)The configuration looks good, but could use more documentation. Recommendations:
🐛 Potential Issues1. Ruby Version Change (Gemfile.lock)I noticed the Ruby version patch changed from 3.4.6p32 to 3.4.6p54. This appears to be an unintentional side effect rather than a deliberate change. Impact: Low - same minor/patch version 2. Yarn.lock ChangesThe yarn.lock shows all resolved URLs changed format. This is cosmetic but suggests a potential yarn version inconsistency. Recommendation: Ensure all developers are using the same yarn version (currently specified as 1.22.22 in package.json) 🔒 Security Considerations1. Branch Dependency Security✅ Good: Using a specific commit in the lock file provides reproducible builds Recommendations:
2. Build Script ExecutionThe postinstall script runs arbitrary build commands from a third-party package. Impact: Low (trusted source - shakacode) ⚡ Performance Considerations1. Install TimeThe postinstall script conditionally builds shakapacker from source, which:
Recommendations:
2. Early Hints Benefits✅ This is the whole point of the PR! Early hints should provide measurable performance improvements. Recommendations:
🧪 Testing & VerificationThe PR description has a testing checklist, which is great! However: Missing Test Coverage:
Recommendations:
📋 SummaryOverall Assessment: This is a solid PR with a clear purpose and systematic implementation. The main concerns are around the complexity of the postinstall script and the temporary nature of using a branch dependency. Priority Recommendations:
Approval Status: Great work on improving the application's performance! Let me know if you'd like help implementing any of these suggestions. |
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 395b7a4 🎮 Control Plane Console |
|
PR Review: Enable Shakapacker Early Hints Overview: This PR enables HTTP/2 early hints support in Shakapacker to improve perceived page load performance by allowing the server to send link headers early in the response lifecycle. Code Quality - Positive aspects:
Suggestions:
Potential Issues:
Performance Considerations: Positive:
Considerations:
Security Concerns (Overall: Low Risk):
Test Coverage Concerns:
Additional Recommendations:
Summary: Verdict: Approve with minor suggestions This PR is well-structured and implements a useful performance feature. The main concerns are:
Before merging:
After merging:
Great work on improving performance! |
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 58f9d8e 🎮 Control Plane Console |
Pull Request Review: Enable Shakapacker Early HintsOverviewThis PR enables HTTP/2 Early Hints support for Shakapacker by updating dependencies to use the justin808/early-hints branch and configuring the feature in production. Overall, this is a positive change that should improve perceived page load performance. Summary of Changes
Code Quality and Best PracticesStrengths
Areas for Improvement1. Temporary Dependency Configuration 2. Postinstall Script Complexity 3. Configuration Documentation Potential Bugs or IssuesMedium Priority
Low Priority
Performance ConsiderationsPositive Impact
Potential Concerns
Recommendation: Document server requirements in PR description or README Security ConcernsGenerally safe - no major security concerns identified. Minor Considerations:
Test CoverageMissing automated tests. The PR description has a testing checklist but no automated test coverage. Recommendations:
Additional RecommendationsDocumentation
Deployment Strategy
Future Improvements
ConclusionThis is a well-structured PR that adds a valuable performance feature. The implementation is clean and the commit history shows good iteration. Approve with Minor ChangesBefore Merging:
After Merging:
Great work on implementing early hints support! |
Pull Request Review: Enable Shakapacker Early HintsSummaryThis PR enables early hints support by switching to a development branch of Shakapacker. Overall, the implementation looks reasonable for experimental/development purposes, but there are several important considerations before merging. Code Quality & Best PracticesStrengths
Concerns1. Using a Development Branch in Production (Critical)Files: Gemfile:9, package.json:95 Both Ruby and Node dependencies point to a feature branch (justin808/early-hints) rather than a stable release. Issues:
Recommendation:
2. Complex postinstall Script (Medium Priority)File: package.json:20 The postinstall script is complex and fragile:
Questions:
Recommendations:
3. Debug Mode in Production (Security/Performance)File: config/shakapacker.yml:70 Debug mode is enabled in production config which may leak information about asset loading, timing, or internal paths through HTML comments. Recommendation: Set debug: false for production or make it environment-variable controlled Potential Bugs & Issues1. Gemfile.lock Ruby Version Change (Low Priority)The Ruby version changed from 3.4.6p32 to 3.4.6p54. Was this intentional? 2. Missing Error Handling
Performance ConsiderationsPositive Impacts
Concerns
Recommendations:
Security Concerns1. Supply Chain Risk (High Priority)
Mitigation:
2. Information Disclosure (Low Priority)
3. Dependency AuditRun security audits: bundle audit and yarn audit Test CoverageMissing TestsThe PR description shows an incomplete testing checklist Recommendations:
Additional Recommendations1. Documentation
2. Server RequirementsEarly hints require:
Action: Verify production infrastructure supports early hints 3. Monitoring
Summary & VerdictBlocking Issues (Must Fix Before Merge)
Non-Blocking Recommendations
Questions for Author
ConclusionThe early hints feature is a valuable performance optimization, but this PR introduces significant stability and security risks by depending on an unmerged development branch. I recommend either:
The code quality is good, but the deployment approach needs refinement for production use. |
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 8082229 🎮 Control Plane Console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/verify-early-hints-manual.md (1)
29-30: Fix markdown formatting for consistency.The document has several markdown lint violations that should be corrected for style consistency:
- Lines 29 & 38: Option headers use
**bold**instead of markdown heading syntax- Lines 30 & 125: Code blocks lack language identifiers for proper syntax highlighting
- Line 149: Dollar sign before command without showing output
🔎 Apply these fixes:
-**Option A: Separate 103 Entry (Best Case)** -``` +### Option A: Separate 103 Entry (Best Case) + +```shell Name Status Protocol Type / 103 h2 early-hints / 200 h2 document -``` +``` -**Option B: Headers Tab (More Common)** +### Option B: Headers Tab (More Common) Click on the main document request, then check the **Headers** tab. Look for:-1. Open DevTools → Network tab +1. Open DevTools → Network tab 2. Load the page 3. Right-click in the Network tab → **Save all as HAR with content** 4. Save the file as `early-hints-test.har` 5. Open the HAR file in a text editor -6. Search for `"status": 103` to find early hints responses +6. Search for `"status": 103` to find early hints responses- ```html + ```html <!-- Shakapacker Early Hints: HTTP/1.1 103 SENT --> <!-- Total Links: 2 --> <!-- Packs: generated/RouterApp, generated/NavigationBarApp, generated/Footer, stimulus-bundle --> <!-- CSS Packs: generated/RouterApp, generated/NavigationBarApp, generated/Footer, stimulus-bundle --> <!-- Headers: --> <!-- </packs/css/generated/RouterApp-f6749bde.css>; rel=preload; as=style; crossorigin="anonymous" --> <!-- </packs/css/stimulus-bundle-165ebf44.css>; rel=preload; as=style; crossorigin="anonymous" --> <!-- Note: Browsers only process the FIRST 103 response --> <!-- Note: Puma only supports HTTP/1.1 Early Hints (not HTTP/2) --> - ``` + ```-```bash -# Verbose curl to see all HTTP frames -curl -v --http2 https://YOUR-REVIEW-APP.cpln.app/ 2>&1 | less +```bash +# Verbose curl to see all HTTP frames +curl -v --http2 https://YOUR-REVIEW-APP.cpln.app/ 2>&1 | less -# Look for lines like: -# < HTTP/2 103 -# < link: ... -# < HTTP/2 200 -``` +# Look for lines like: +# < HTTP/2 103 +# < link: ... +# < HTTP/2 200 +```-```bash -$ curl https://YOUR-REVIEW-APP.cpln.app/ 2>&1 | grep -A5 "Early Hints" -``` +```bash +$ curl https://YOUR-REVIEW-APP.cpln.app/ 2>&1 | grep -A5 "Early Hints" +<!-- Output: --> +```Also applies to: 38-38, 125-125, 149-149
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
Gemfile.lockis excluded by!**/*.lockyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (1)
docs/verify-early-hints-manual.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/verify-early-hints-manual.md
[style] ~139-~139: Try using a synonym here to strengthen your wording.
Context: ...t working, you'd see: 1. No HTML debug comments about early hints 2. No Link headers in...
(COMMENT_REMARK)
🪛 markdownlint-cli2 (0.18.1)
docs/verify-early-hints-manual.md
29-29: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
30-30: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
38-38: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
125-125: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
149-149: Dollar signs used before commands without showing output
(MD014, commands-show-output)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: claude-review
🔇 Additional comments (1)
docs/verify-early-hints-manual.md (1)
1-11: ✅ Previous review comment addressed properly.The hardcoded PR review app URL has been successfully replaced with the
YOUR-REVIEW-APPplaceholder throughout the document. The note at lines 7–8 clearly instructs readers to substitute with their actual Control Plane URL, making this documentation reusable across PRs.
|
Re: CodeRabbit comment on |
Update both gem and npm package to shakapacker 9.4.0 to fix CI failures caused by version mismatch between gem (9.3.4.beta.0) and npm (9.3.3). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
51a862a to
224f536
Compare
Pull Request Review - PR #687: Enable Shakapacker Early HintsThank you for this comprehensive PR! This is a significant improvement that adds HTTP/2 support via Thruster and enables early hints for better performance. Here's my detailed review: ✅ Strengths1. Excellent Documentation
2. Proper Security Practices
3. Good Configuration Management
4. Modern Tooling
|
Pull Request Review - Thruster HTTP/2 and Early Hints IntegrationThank you for this comprehensive PR! This is a well-executed implementation of Thruster HTTP/2 proxy integration with extensive documentation. Below is my detailed review: ✅ Code Quality & Best PracticesStrengths
Minor Improvements Needed1. Duplicate configuration in
|
Fix eslint react/prop-types validation errors for CheckmarkIcon, CheckmarkCircleIcon, and InfoIcon components. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Pull Request Review: Enable Shakapacker Early HintsSummaryThis PR introduces HTTP/2 and Early Hints support via Thruster proxy, upgrades Ruby to 3.4.6, and updates Shakapacker. Overall, this is a well-executed modernization with comprehensive documentation. Below are my findings across code quality, security, performance, and testing. ✅ Strengths
|
|
/deploy-review-app |
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 2e51a03 🎮 Control Plane Console |
Load the Rails environment at script startup rather than lazily inside the locale generation step. This ensures ReactOnRails configuration is available before any precompile tasks run. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit a332db4 🎮 Control Plane Console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
bin/dev (1)
31-58: Consider capturing command output to show on failure.The current approach suppresses all output and directs users to manually re-run the command on failure. While functional, capturing the output and displaying it on error would improve the developer experience.
🔎 Alternative approach using output capture
# Build ReScript files first print " ReScript build... " - if system("yarn res:build > /dev/null 2>&1") + output = `yarn res:build 2>&1` + if $?.success? puts "✅" else puts "❌" - puts " Failed to build ReScript files. Run 'yarn res:build' to see errors." + puts " Failed to build ReScript files:" + puts output.lines.map { |line| " #{line}" }.join exit 1 end
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
bin/dev
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: deploy
- GitHub Check: test (22.x, 3.4.6)
- GitHub Check: claude-review
🔇 Additional comments (2)
bin/dev (2)
10-15: LGTM! Clear documentation of precompile behavior.The added comments effectively explain the precompile workflow and its purpose.
60-63: LGTM! Appropriate guard condition.The conditional correctly skips precompile tasks for help and kill commands. Once the Rails environment loading is moved inside this block (per the earlier comment), this will provide optimal performance.
|
|
||
| require "bundler/setup" | ||
| require "react_on_rails/dev" | ||
| require_relative "../config/environment" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move Rails environment loading inside the conditional to avoid overhead for help/kill commands.
Loading the Rails environment unconditionally adds 1-3+ seconds of overhead even for bin/dev --help or bin/dev kill. Since the environment is only needed for precompile tasks (line 49), consider moving this require inside the conditional at line 61.
🔎 Suggested refactor to improve startup time
require "bundler/setup"
require "react_on_rails/dev"
-require_relative "../config/environment"
# Run precompile tasks before starting development server
# This ensures rescript and locale files are generated before webpack starts
def run_precompile_tasks
+ require_relative "../config/environment"
+
puts "📦 Running precompile tasks..."Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In bin/dev around line 29 (require_relative "../config/environment") and the
conditional handling precompile tasks around line 61 (precompile at line 49),
the Rails environment is loaded unconditionally causing 1–3s overhead for
trivial commands; move the require_relative "../config/environment" inside the
branch that runs precompile tasks so the environment is only loaded when needed,
keeping any existing error handling and ensuring the require is executed before
any code that depends on Rails in that branch.
Pull Request Review: Enable Shakapacker Early HintsOverviewThis PR adds comprehensive HTTP/2 and Early Hints support through Thruster integration, upgrades Ruby to 3.4.6, and includes extensive documentation. The implementation is well-executed with attention to detail. ✅ Strengths1. Comprehensive Documentation
2. Thoughtful Chrome Driver Fix
3. Security Improvements
4. Process Management
🔍 Issues & Recommendations1. Security: Weak Placeholder Secret in GVC TemplateSeverity: HIGH Issue: Hardcoded placeholder secret is visible in git history and could be used in production if not overridden. Recommendation: Replace with empty value and clearer documentation requiring explicit configuration. 2. Early Hints Debug Mode in ProductionSeverity: MEDIUM Issue: Debug mode is enabled in production, which increases HTML payload size and exposes internal asset paths. Recommendation: Set debug: false for production once Early Hints are verified working. 3. Code Quality: Duplicate ConfigurationSeverity: LOW Line 69 and Line 105 both have: config.infer_spec_type_from_file_location! Recommendation: Remove the duplicate at line 105. 🎯 Performance ConsiderationsHTTP/2 multiplexing and Brotli compression should provide:
The Footer correctly indicates Early Hints (Configured) since Cloudflare may strip HTTP 103 responses. Good transparency. 🧪 Test CoveragePositive:
Gaps:
🔒 Security AssessmentConcerns:
📝 Documentation QualityExcellent: Comprehensive documentation for Thruster, Early Hints, and Control Plane deployment. Suggestions:
Summary & RecommendationOverall Assessment: Strong PR with Minor Security ConcernsApprove with Changes: I recommend addressing the security issues before merging. Must Fix (Pre-Merge)
Should Fix (Post-Merge OK)
Nice to Have
Code Quality Score
Overall: 8.2/10 Final NotesThis is a well-executed PR that adds significant value through HTTP/2 support and comprehensive documentation. The Thruster integration is clean, and the Control Plane deployment guidance is excellent. Once the security issues are addressed, this will be an excellent addition to the codebase. Great work on the documentation and thoughtful implementation! 🎉 |
- bin/dev now runs rescript build and locale generation BEFORE starting Procfile processes, eliminating race conditions and sleep delays - Added res:watch npm script (watch without clean) for Procfile.dev - Removed sleep delays and inline locale generation from Procfile.dev - Updated build_production_command to include rescript build - Removed precompile_hook from shakapacker.yml (handled by bin/dev and build commands) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit e410de6 🎮 Control Plane Console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
Procfile.devconfig/initializers/react_on_rails.rbconfig/shakapacker.ymlpackage.json
🚧 Files skipped from review as they are similar to previous changes (3)
- config/shakapacker.yml
- config/initializers/react_on_rails.rb
- package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: deploy
- GitHub Check: claude-review
- GitHub Check: test (22.x, 3.4.6)
🔇 Additional comments (5)
Procfile.dev (5)
3-6: Clear documentation of the precompile workflow.The comments effectively explain the startup sequence and why precompile tasks run first, helping developers understand the build orchestration changes.
12-12: Good practice: Explicit environment variables.Making
RAILS_ENVandNODE_ENVexplicit removes ambiguity and ensures consistent behavior across different development setups.
9-9: No action needed — Redis is not required for development workflows.Verification confirms Redis is completely unused in the development environment. There is no cache configuration, Sidekiq/ActiveJob, ActionCable, or any other code that depends on Redis. Session storage uses the default cookie store. Commenting out Redis from Procfile.dev is the correct approach.
10-10: Thruster is properly set up.The
thrustergem is already present in the Gemfile (line 18:gem "thruster", "~> 0.1"). Thruster uses sensible defaults and does not require a configuration file—custom configuration is optional and can be set via environment variables if needed. Early hints are configured in the production section ofconfig/shakapacker.yml(enabled with debug mode), which is the appropriate place for this production-focused feature. Comprehensive documentation exists indocs/thruster.md.
8-8: Theres:watchnpm script is properly defined.Verified that
yarn res:watchreferences the script"rescript build -w"in package.json. No issues found.
| # Client webpack dev server with HMR | ||
| wp-client: RAILS_ENV=development NODE_ENV=development bin/shakapacker-dev-server | ||
| # Server webpack watcher for SSR bundle | ||
| wp-server: HMR=true SERVER_BUNDLE_ONLY=yes bin/shakapacker --watch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, explore the repository structure to understand the webpack configuration setup
echo "=== Repository structure ==="
find . -type d -name webpack -o -name config 2>/dev/null | head -20
echo -e "\n=== Files in root directory ==="
ls -la | head -20
echo -e "\n=== Checking for webpack-related files ==="
fd webpack --max-depth 3 -type f 2>/dev/null | head -20Repository: shakacode/react-webpack-rails-tutorial
Length of output: 1484
🏁 Script executed:
#!/bin/bash
# List webpack config directory and search for the environment variables
echo "=== Files in config/webpack directory ==="
ls -la config/webpack/
echo -e "\n=== All files in config/webpack (recursive) ==="
find config/webpack -type f
echo -e "\n=== Searching for HMR environment variable usage ==="
rg -n 'process\.env\.HMR|HMR' config/webpack/ --type js --type ts
echo -e "\n=== Searching for SERVER_BUNDLE_ONLY environment variable usage ==="
rg -n 'process\.env\.SERVER_BUNDLE_ONLY|SERVER_BUNDLE_ONLY' config/webpack/ --type js --type tsRepository: shakacode/react-webpack-rails-tutorial
Length of output: 2025
🏁 Script executed:
#!/bin/bash
# Read the relevant webpack config files to understand the implementation
echo "=== webpackConfig.js around SERVER_BUNDLE_ONLY (line 21) ==="
cat -n config/webpack/webpackConfig.js | sed -n '15,30p'
echo -e "\n=== client.js to see HMR/WEBPACK_DEV_SERVER usage ==="
cat -n config/webpack/client.js
echo -e "\n=== Check if HMR env var is used anywhere else ==="
rg -n '\bHMR\b' . --type js --type ts -g '!node_modules' -g '!.git'
echo -e "\n=== Check Procfile.dev ==="
cat -n Procfile.devRepository: shakacode/react-webpack-rails-tutorial
Length of output: 3234
Remove HMR=true from wp-server or properly consume it in webpack config.
The SERVER_BUNDLE_ONLY=yes environment variable is properly handled in webpackConfig.js (line 21). However, HMR=true is set in the wp-server process but never consumed by the webpack configuration. The webpack config checks process.env.WEBPACK_DEV_SERVER === 'TRUE' (client.js, line 2), which is only set when running the dev server. Since wp-server uses bin/shakapacker --watch (not the dev server), HMR=true is unused and should either be removed or the webpack configuration should be updated to properly consume it if HMR is intended for the server bundle.
🤖 Prompt for AI Agents
In Procfile.dev around line 14, the wp-server process sets HMR=true but the
webpack config never reads it (wp-server uses bin/shakapacker --watch not the
dev server), so remove HMR=true from this Procfile entry or wire it into the
webpack/server build path; either delete the HMR=true env var from the wp-server
line, or modify the webpack configuration to detect and respect process.env.HMR
(or map HMR=true to the existing check like process.env.WEBPACK_DEV_SERVER) so
server bundle hot-reloading actually functions.
Pull Request Review: Enable Shakapacker Early HintsSummaryThis PR integrates Thruster HTTP/2 proxy and enables Early Hints support. The changes are well-structured with excellent documentation. Code Quality - Areas for Improvement1. SECRET_KEY_BASE Handling (.controlplane/Dockerfile, release_script.sh, app.yml)
2. Duplicate Configuration (spec/rails_helper.rb:40-106)
3. bin/dev Error Handling (bin/dev:38)
Security ConcernsHIGH PRIORITY - Hardcoded Secrets (app.yml:26)
Debug Mode in Production (config/shakapacker.yml:75)
Chrome Debug Scripts (check_early_hints.js/py)
PerformancePositive:
Concerns:
Test CoverageMissing tests for:
Recommendation: Add integration and request specs Must Fix Before Merge
Should Fix
Overall: Well-executed PR with excellent documentation. Address security issues before merge. |
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 3ba2fa7 🎮 Control Plane Console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.gitignore (1)
69-69: Addition looks good; consider leading slash for consistency.The new
.context/entry is necessary for the Thruster integration and follows the same format as.claude/. However, most root-level directory entries use a leading slash (e.g.,/.bundle,/public/packs) to be explicit about matching only at the project root. Consider/.context/instead to maintain consistency with the majority of entries and to prevent accidental matches in nested directories.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.gitignore
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: deploy
- GitHub Check: test (22.x, 3.4.6)
- GitHub Check: claude-review
Pull Request Review: Enable Shakapacker Early HintsOverall AssessmentStatus: ✅ APPROVED with minor suggestions This is a well-executed PR with thorough documentation and careful attention to deployment details. The code quality is high, and the implementation is production-ready. Strengths
Issues & SuggestionsSecurity
Code Quality
Documentation
Security Assessment✅ No critical security vulnerabilities
PerformanceExpected improvements:
Recommend establishing baseline metrics for TTFB, LCP, page load time, and asset sizes. Testing Checklist
ConclusionHigh-quality pull request with excellent documentation, consistent implementation, and thoughtful developer experience improvements. Recommendation: APPROVE with minor revisions The issues are minor and can be addressed in follow-up commits. Core implementation is solid and production-ready. Questions
Great work! The documentation quality is particularly impressive. |
- Add Chrome debug scripts to .gitignore - Improve bin/dev ReScript build error output with detailed messages - Disable early_hints debug mode in production (exposes internals) - Remove duplicate infer_spec_type_from_file_location! call in rails_helper 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🎉 ✨ Deploy Complete! 🚀🌐 ➡️ Open Review AppDeployment successful for PR #687, commit 9042c4a 🎮 Control Plane Console |
Pull Request Review: Enable Shakapacker Early HintsSummaryThis PR successfully integrates Thruster HTTP/2 proxy, updates Ruby to 3.4.6, and modernizes the deployment infrastructure. The changes are well-documented and demonstrate a thoughtful approach to improving performance and developer experience. Strengths1. Excellent Documentation
2. Thoughtful Architecture
3. Security Best Practices
4. Performance Improvements
Issues and Recommendations1. Security: Placeholder SECRET_KEY_BASE in Production Template - HIGH PRIORITYLocation: .controlplane/templates/app.yml:25 Issue: This uses a hardcoded placeholder secret in the app template, which could be deployed to production if not manually updated. Recommendation:
2. Potential Bug: Ruby Version Mismatch in CILocations: .github/workflows/*.yml
3. Code Quality: Debug Scripts CommittedLocation: check_early_hints.js and check_early_hints.py Issue: These are added to .gitignore but also committed to the repo Recommendation:
4. Shakapacker Version DiscrepancyLocation: Gemfile:9 The PR description mentions updating to justin808/early-hints branch, but the actual change is to version 9.4.0 (a stable release). Question: Was the early-hints branch merged into 9.4.0? The PR description might be outdated. Overall AssessmentQuality: 4/5 stars - Excellent documentation and architecture, one security concern needs addressing Risk Level: Medium - The SECRET_KEY_BASE placeholder in production template is a security risk if not properly configured Approval RecommendationStatus: Approve with changes requested Required Changes:
Great work on the Thruster integration and comprehensive testing! |
Changes
Gemfileto point toshakapackerfrom thejustin808/early-hintsbranch.package.jsonto useshakapackerfrom thejustin808/early-hintsbranch.early_hintsinconfig/shakapacker.ymlfor the production environment.Testing
This change is
Summary by CodeRabbit
New Features
Chores
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.
Results when