Repository navigation
Reload the development server when application code changes - #5
Merged
Merged
Conversation
Use a development-only Rerun watcher to rebuild mounted Grape routes in a fresh server process. Document the command and verify changed routes and responses over real HTTP on modern and legacy Goliath. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1.
Add Rerun only to the development dependencies and configure it to watch app.rb and Ruby files under api/, app/, and config/. Document
bundle exec rerun -- ruby app.rb -sv -e development, with a polling option for shared filesystems. The ordinary server command remains unchanged.Restart the whole process deliberately: Grape compiles routes and retains references to mounted API classes, so Rack::Reloader can reload a file without updating the mounted routes. This avoids relying on obsolete ActiveSupport autoloading APIs or clearing constants while concurrent requests are running. Development restarts can interrupt requests, as documented.
Add an isolated regression test that starts the actual watcher/server, waits for watcher readiness, edits a copied API file, verifies the new route and JSON response over HTTP, and confirms the old route returns 404. Temporary files and the watcher/server process group are cleaned up afterward.
Local validation passes on Ruby 3.3/Goliath 1.0 and Ruby 2.7/Goliath 0.9 (two examples each), with RuboCop clean. All five hosted Ruby/Goliath matrix jobs, RuboCop, and Coveralls pass: https://github.com/ruby-grape/grape-on-goliath/actions/runs/40505201217 (tests and coverage), https://github.com/ruby-grape/grape-on-goliath/actions/runs/40505201256 (lint).
AI-authored on behalf of @dblock.