Repository navigation
refactor: Model the hosting platform with per-platform classes - #275
Merged
Merged
Conversation
Replace Config::RuntimeContainer with a Platform hierarchy detected from the environment. Platform-specific checks (redundant_instance?, one_off?) now live on the platforms that have them (Heroku, Scalingo); opaque-id platforms (Render, Fly, Ecs, Railway, Custom, Unknown) inherit no-op defaults, instead of re-deriving behavior from the shape of the container string. Config#current_runtime_container is replaced by Config#current_platform (the container id is current_platform.container). Co-authored-by: Cursor <cursoragent@cursor.com>
The service-id prefix stripping is Render-specific, so it belongs on the Render class rather than in Platform.detect. Behavior is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
adamlogic
marked this pull request as ready for review
June 9, 2026 21:28
carlosantoniodasilva
approved these changes
Jun 10, 2026
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
This was referenced Jun 11, 2026
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.
Summary
Follows up on @carlosantoniodasilva's suggestion in #273: model the hosting platform as a first-class concept instead of a bare "runtime container" string, and put platform-specific behavior on the platform classes that actually have those concepts.
Config::RuntimeContainer(aStringsubclass) with aJudoscale::Platformhierarchy detected from the environment viaPlatform.detect.HerokuandScalingoimplementredundant_instance?/one_off?; opaque-id platforms (Render,Fly,Ecs,Railway,Custom,Unknown) inherit no-op defaults. This removes the old reliance on a shared regex that only coincidentally didn't match opaque instance ids — those platforms now simply can't be misclassified as redundant or one-off.Config#current_runtime_containeris replaced byConfig#current_platform(the container id iscurrent_platform.container, still reported under thecontainerJSON key). The old accessor was undocumented and effectively internal, so it's removed rather than shimmed.\d{1,3}ordinal-width cap now that detection already proves the platform is Heroku/Scalingo;\d+also correctly classifies formations with 1000+ instances.Test plan
bundle exec rake test(judoscale-ruby): 110 runs, 0 failuresbundle exec rake test(judoscale-rails): 7 runs, 0 failuresstandardrbclean on changed filesMade with Cursor
Note
Medium Risk
Changes how job metrics are skipped on redundant dynos and how platforms are detected; behavior is meant to stay equivalent but affects core reporting paths and removes the internal
current_runtime_containerAPI.Overview
Replaces the string-based
Config::RuntimeContainerwith aJudoscale::Platformmodel detected viaPlatform.detect(ENV).Config#current_platformholds the detected platform; the reportedcontainervalue iscurrent_platform.container(unchanged JSON shape).Heroku and Scalingo now own
redundant_instance?andone_off?; opaque-id platforms (Render, ECS, Fly, Railway, Custom, Unknown) default both to false instead of inferring from shared container-string regexes. Render also suppliesdefault_api_base_urlwhenJUDOSCALE_URLis unset (legacy adapter URL). Ordinal redundancy matching drops the old 3-digit cap in favor of\d+(e.g.web.1000counts as redundant).Call sites switch from
current_runtime_containertocurrent_platformfor job metric collection gating, one-off Rails reporting skips, and report payloads. The undocumentedcurrent_runtime_containeraccessor is removed without a shim.Reviewed by Cursor Bugbot for commit ac02199. Bugbot is set up for automated code reviews on this repo. Configure here.