Repository navigation
Inline mustermann-grape into Grape::Router::MustermannPattern - #2755
Merged
Merged
Conversation
ericproulx
force-pushed
the
refactor/inline-mustermann-grape
branch
from
June 1, 2026 13:39
8d60f9c to
2b7d16c
Compare
Danger ReportNo issues found. |
ericproulx
marked this pull request as draft
June 1, 2026 13:56
ericproulx
force-pushed
the
refactor/inline-mustermann-grape
branch
from
June 1, 2026 13:56
2b7d16c to
a969b46
Compare
mustermann-grape is a ~40-line Mustermann::AST::Pattern subclass that exists only for Grape's path syntax, and it had already grown Grape-specific: the Integer constraint reads Grape's own `params` option. Maintaining it as a separate gem meant a two-step release for every syntax tweak (cut a mustermann-grape release, then bump Grape's pin) plus its own CI/versioning. Move the grammar into Grape as Grape::Router::MustermannPattern (attribution to the original authors preserved), depend on `mustermann` directly, and instantiate it directly from Grape::Router::Pattern as Grape always did. The `mustermann` core dependency is unchanged; the graph collapses from grape -> mustermann-grape -> mustermann to grape -> mustermann. The class is no longer registered as a Mustermann `type: :grape` (Grape never used the registry). Apps that called `Mustermann.new(_, type: :grape)` relying on Grape pulling in mustermann-grape transitively should depend on it directly; see UPGRADING. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ericproulx
force-pushed
the
refactor/inline-mustermann-grape
branch
from
June 1, 2026 14:01
a969b46 to
f3be4cd
Compare
ericproulx
added a commit
that referenced
this pull request
Jun 1, 2026
Grape requires Ruby >= 3.3 and activesupport >= 7.2 (Rails 7.2+), but several dependency floors still advertised support for much older releases that Grape no longer tests: - rack >= 2 -> >= 2.2.4 (minimum rack across Rails 7.2 and above) - zeitwerk (none) -> >= 2.7 (where zeitwerk moved to Ruby >= 3.2) - dry-configurable (none) -> >= 1.4 (first release requiring Ruby >= 3.3) - dry-types >= 1.1 -> >= 1.9 (current line, Ruby >= 3.2) Resolved versions are unchanged (rack 3.2.6, zeitwerk 2.8.2, dry-configurable 1.4.0, dry-types 1.9.1); only the floors change. mustermann is left to #2755. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ericproulx
marked this pull request as ready for review
June 1, 2026 15:09
Member
|
Makes sense, let's just check-in with @namusyaka on whether there was a reason to have a separate gem for this? |
dblock
approved these changes
Jun 2, 2026
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops the `if index` guard in `RouteBuckets::Bucket#match`: each alternative in a bucket's union is its route's named group, so a match of the union always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param: the qualifying params are neither stored nor read, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param: the qualifying params are neither stored nor read, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 22, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param: the qualifying params are neither stored nor read, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param: the qualifying params are neither stored nor read, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param: the qualifying params are neither stored nor read, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param: the qualifying params are neither stored nor read, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param: the qualifying params are neither stored nor read, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - `Validators::Base#validate!` passing over an empty element of an optional array scope nested past the one-level shortcut. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param and for an array param at the root (`Validators::Base#validate_elements!`): nothing is tracked, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - `Validators::Base#validate!` passing over an empty element of an optional array scope nested past the one-level shortcut. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param and for an array param at the root (`Validators::Base#validate_elements!`): nothing is tracked, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - `Validators::Base#validate!` passing over an empty element of an optional array scope nested past the one-level shortcut. - `Validators::ExceptValuesValidator`: a Proc taking an argument is rejected at definition, a non-Hash array element is left to its own type check, a Proc handing back no list accepts any value, and an excluded nil rejects an explicit null without also rejecting a required param that was left out. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param and for an array param at the root (`Validators::Base#validate_elements!`): nothing is tracked, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - `Validators::Base#validate!` passing over an empty element of an optional array scope nested past the one-level shortcut. - `Validators::ExceptValuesValidator`: a Proc taking an argument is rejected at definition, a non-Hash array element is left to its own type check, a Proc handing back no list accepts any value, and an excluded nil rejects an explicit null without also rejecting a required param that was left out. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Validators::HashElementsValidator#validate_param!`'s `hash_like?` guard: the validator is registered not required, and Base only asks such a validator about params that are a Hash. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param and for an array param at the root (`Validators::Base#validate_elements!`): nothing is tracked, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - `Validators::Base#validate!` passing over an empty element of an optional array scope nested past the one-level shortcut. - `Validators::ExceptValuesValidator`: a Proc taking an argument is rejected at definition, a non-Hash array element is left to its own type check, a Proc handing back no list accepts any value, and an excluded nil rejects an explicit null without also rejecting a required param that was left out. - `Validators::OneofValidator` accepting an optional param sent as an explicit null rather than left out. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Validators::HashElementsValidator#validate_param!`'s `hash_like?` guard: the validator is registered not required, and Base only asks such a validator about params that are a Hash. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param and for an array param at the root (`Validators::Base#validate_elements!`): nothing is tracked, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - `Validators::Base#validate!` passing over an empty element of an optional array scope nested past the one-level shortcut. - `Validators::ExceptValuesValidator`: a Proc taking an argument is rejected at definition, a non-Hash array element is left to its own type check, a Proc handing back no list accepts any value, and an excluded nil rejects an explicit null without also rejecting a required param that was left out. - `Validators::ValuesValidator` accepting any value when a `values:` Proc hands back no list, unlike an empty one. - `Validators::OneofValidator` accepting an optional param sent as an explicit null rather than left out. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Validators::HashElementsValidator#validate_param!`'s `hash_like?` guard: the validator is registered not required, and Base only asks such a validator about params that are a Hash. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
added a commit
that referenced
this pull request
Sep 23, 2026
…DSL readers (#2983) Covers branches no spec reached: - `Exceptions::Base#compose_message` skipping a step whose translation is blank (a step missing from the locale was already covered). - `Middleware::Error` answering its failsafe response on an env without `rack.errors`, which Rack::Lint rejects and rack-test cannot send. - `Middleware::Formatter` passing through a request that announces a body but carries none: no `rack.input` (optional since Rack 3.1), or a chunked input that reads empty. - `Router::BaseRoute` with a route naming a param twice: its captures cannot be read off the union match, so it has none of its own, in the router's union or in any bucket, and Mustermann answers every position. - `Router::RouteBuckets#segment_key` with a path that has fewer segments than the position the buckets split on: it names no bucket, and the request goes to the fallback. - `Grape::Testing`'s `reset_before_each` on an endpoint class no hook was ever registered on. The suite's `after` hook only reached that depending on example order. - `ParamsScope` validators run on their own, outside the request's ParamScopeTracker, for a `given` scope within an array param and for an array param at the root (`Validators::Base#validate_elements!`): nothing is tracked, and what is missing is still reported. - `optional :all, using:` with a field whose options are nil: the field is left out, as `requires :none` already does. - `Types::ArrayCoercer` built strict, for an Array member type in `types:` with `coerce_with`: the custom method's result is only type-checked, so a blank String is not coerced into an empty Array. - `Types::CustomTypeCoercer` with a callable given as `type:` alongside `coerce_with`, as its docs describe: the callable checks the coerced value. - `Types::MultipleTypeCoercer` and `Types::VariantCollectionCoercer` with `coerce_with` given as an object responding to `parse`: its `parse` method does the coercion. - `ValidationsSpec#guess_coerce_type` skipping an empty `values:` list for a bare `type: Array` and guessing the member type from `except_values:` instead. - `Validators::Base#validate!` passing over an empty element of an optional array scope nested past the one-level shortcut. - `Validators::ExceptValuesValidator`: a Proc taking an argument is rejected at definition, a non-Hash array element is left to its own type check, a Proc handing back no list accepts any value, and an excluded nil rejects an explicit null without also rejecting a required param that was left out. - `Validators::ValuesValidator` accepting any value when a `values:` Proc hands back no list, unlike an empty one. - `Validators::OneofValidator` accepting an optional param sent as an explicit null rather than left out. - The `format`, `default_error_formatter` and `default_error_status` readers, `format` raising for a format with no content type, and `format` accepting one registered with `content_type`. Drops two safe navigations whose nil branch could never be covered: - `DSL::Routing#version`'s on `@versions`, which is assigned just above. - `Router::Pattern::Path#uses_path_versioning?`'s on `version_options`, which the `version` DSL always sets together with `version`. It also drops `ParamsScope#should_validate?`'s `return true if @parent.nil?`: past the `@independent` return, the scope or one above it is a `given` scope, which is always nested. It also drops `Validators::HashElementsValidator#validate_param!`'s `hash_like?` guard: the validator is registered not required, and Base only asks such a validator about params that are a Hash. It also drops `Util::MediaType.match?`'s blank-subtype check: the vendor regexp is anchored on `vnd.`, so a blank subtype already fails it (pinned by a new `application/` example). It also drops `Util::Translation#translate`'s check for a caller's `default:` after a miss: I18n answers any given default with that default, never with the private MISSING sentinel, so only a call without one gets past it. It also drops the guard for a union match that sets no route's group, in `RouteBuckets::Bucket#match` and in `Router#transaction` and `Router#neighbour_match?`: each alternative in these unions is its route's named group, so a match always sets one of them. - `Router::MustermannPattern`'s on `pattern` and `pattern.options`. `Mustermann::Pattern.new` always sets the options, and the parser runs without a pattern only for Mustermann's `except:` option, which Grape never passes. Both came in with mustermann-grape (#2755), a registered type that could be built with `except:`. Folds #2984 and #2985. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.
Why
mustermann-grapeis a ~40-lineMustermann::AST::Patternsubclass that defines Grape's path syntax (:param,*splat,{name}/{+splat},( )optionals,|, and an Integer digit-only constraint). In practice it exists only for Grape — and it has already grown Grape-specific: the Integer constraint reaches into Grape's ownparamsoption.Keeping it as a separate gem means a two-step release for any syntax change (cut a
mustermann-graperelease, then bump Grape's~> 1.1.0pin), plus its own CI and versioning — a lot of ceremony for 40 lines only Grape uses. Grape also always instantiated the class directly (Mustermann::Grape.new), never through thetype: :graperegistry.What
Grape::Router::MustermannPattern(MIT attribution to the original authors — namusyaka, Konstantin Haase, Daniel Doubrovkine — preserved), and instantiate it directly fromGrape::Router::Pattern.mustermanndirectly instead ofmustermann-grape.register :grapecall — Grape never used the registry, and not squatting a global Mustermann type keeps the inlined grammar a private Grape detail.This is not a deep dependency reduction: the grammar extends
Mustermann::AST::Pattern, so themustermanncore dependency stays. The graph just collapses fromgrape → mustermann-grape → mustermanntogrape → mustermann, and Grape owns the 40 lines it was already coupled to. The win is maintenance: pattern-syntax changes become a single PR instead of a cross-gem release dance.Compatibility
One behavioral change: the pattern class is no longer registered as
type: :grape. Apps that calledMustermann.new(_, type: :grape)and relied on Grape pulling inmustermann-grapetransitively should addgem 'mustermann-grape'to their Gemfile directly. Documented inUPGRADING.md.Validation
bundle installnow resolves withoutmustermann-grape(onlymustermann 4.0.0) — Grape is self-sufficient./api/:idmatches42, rejectsfoo.🤖 Generated with Claude Code