You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: Universal process manager bundler context fallback (#1833)
* Fix foreman execution in bundler context with intelligent fallback
This commit resolves the issue where bin/dev fails when foreman is not included
in the Gemfile (following React on Rails best practices).
The fix implements an intelligent fallback strategy:
1. First attempt: Try running foreman within bundler context
2. Fallback: Use Bundler.with_unbundled_env to run system-installed foreman
3. Enhanced error handling with helpful user guidance
Key improvements:
- Maintains compatibility with projects that include foreman in Gemfile
- Supports React on Rails best practice of system-installed foreman
- Provides clear error messages linking to documentation
- Comprehensive test coverage for all fallback scenarios
Fixes#1832
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Enhance process manager with universal bundler context fallback
This commit generalizes the foreman-specific bundler context fix to work
for ALL process managers (overmind, foreman, and any future additions).
Key improvements:
- Context-aware process detection for all processes, not just foreman
- Universal fallback mechanism using Bundler.with_unbundled_env
- Consistent API with run_process(process, args) for any process manager
- Enhanced test coverage for generalized functionality
Benefits:
- Robust handling of bundler context for any process manager
- Future-proof architecture for new process managers
- Consistent behavior across all system commands
- Eliminates bundler interceptor issues universally
Builds on previous commit to create a comprehensive solution.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Optimize process manager performance and robustness
This commit improves the process manager implementation with several optimizations:
Performance improvements:
- Eliminate redundant system calls in run_process_if_available
- Streamlined control flow with early returns
- More efficient process availability checking
Robustness enhancements:
- Support multiple version flags per process (--version, -v, -V)
- Process-specific version flag mapping for better compatibility
- Improved fallback strategy that avoids double execution
Code quality:
- Cleaner, more readable method structure
- Better separation of concerns
- Enhanced test coverage for version flag handling
- RuboCop compliant code style
The implementation is now more efficient and robust while maintaining
full backward compatibility and comprehensive bundler context handling.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add timeout protection for version checking operations
This commit adds a 5-second timeout to all version checking operations to
prevent the development setup from hanging indefinitely on unresponsive
process managers.
Safety improvements:
- Timeout protection for installed_in_current_context? checks
- Timeout protection for process_available_in_system? checks
- Graceful handling of Timeout::Error alongside Errno::ENOENT
- Prevents hanging development setup on problematic installations
Implementation details:
- Uses Ruby's Timeout module with 5-second limit
- Only applied to version checking, not main process execution
- Main process execution remains unlimited (expected for dev servers)
- Comprehensive test coverage for timeout scenarios
The timeout is conservative (5 seconds) to account for slow systems while
still preventing indefinite hangs that would block developer workflow.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add Bundler API compatibility with DRY helper method
Implement with_unbundled_context helper that supports both modern
(with_unbundled_env) and legacy (with_clean_env) Bundler APIs, with
graceful fallback for very old versions. This addresses backward
compatibility concerns while maintaining clean, DRY code.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add timeout protection for version checking operations
Extract hardcoded timeout value to VERSION_CHECK_TIMEOUT constant for better maintainability and testability.
Co-authored-by: Abanoub Ghadban <AbanoubGhadban@users.noreply.github.com>
* Apply CodeRabbit review suggestions
- Extract process managers to PROCESS_MANAGERS constant for DRY code
- Relax procfile path validation (remove shell metacharacter check)
- Refactor tests to use around hook with ensure clause for proper cleanup
- Close file descriptors properly to avoid leaks
Co-authored-by: Abanoub Ghadban <AbanoubGhadban@users.noreply.github.com>
* Revert process_manager.rb changes from commit 5740b0e
- Remove PROCESS_MANAGERS constant (revert to explicit calls)
- Revert procfile validation to stricter shell metacharacter check
- Keep spec file changes from commit 5740b0e (around hook improvements)
Co-authored-by: Abanoub Ghadban <AbanoubGhadban@users.noreply.github.com>
* Fix RSpec/ExpectOutput violations by removing global stream reassignment
Remove the around hook that was mutating $stdout/$stderr, which triggered
RuboCop's RSpec/ExpectOutput warnings. Tests that need to capture output
already use RSpec's .to output(...).to_stderr matcher correctly.
Co-authored-by: Abanoub Ghadban <AbanoubGhadban@users.noreply.github.com>
* Update spec/react_on_rails/dev/process_manager_spec.rb
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Remove duplicate RSpec.describe for ProcessManager
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Abanoub Ghadban <AbanoubGhadban@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
0 commit comments