ernie-research/MEnvBench huggingface dataset:
Repository: jekyll/jekyll (Ruby)

Issue:
[Bug]: serve --detach doesn't detach
### Operating System

macOS 12.6.2

### Ruby Version

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]

### Jekyll Version

jekyll 4.3.1

### GitHub Pages Version

_No response_

### Expected Behavior

I expected following commands to work after jekyll detaches:
``` sh
bundle exec jekyll serve --detach && echo "jekyll detached"
```

### Current Behavior

Jekyll keeps using terminal's stdin, stdout.

``` console
$ bundle exec jekyll serve --detach && echo "jekyll detached"
Configuration file: /path/to/site/_config.yml
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
            Source: /path/to/site
       Destination: /path/to/site/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    done in 1.411 seconds.
 Auto-regeneration: disabled when running server detached.
    Server address: http://127.0.0.1:4000/
Server detached with pid '77748'. Run `pkill -f jekyll' or `kill -9 77748' to stop the server.
```

If I press Ctrl-C, jekyll produces fatal crash:

- Crash log: [crash.log](https://github.com/jekyll/jekyll/files/10312418/crash.log)
- DiagnosticReports: [ruby-2022-12-28-145100.txt](https://github.com/jekyll/jekyll/files/10312408/ruby-2022-12-28-145100.txt)

### Relevant log output

_No response_

### Code Sample

_No response_



Fix (patch):
diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb
index 4600130f45c..e54542ff537 100644
--- a/lib/jekyll/commands/serve.rb
+++ b/lib/jekyll/commands/serve.rb
@@ -274,12 +274,19 @@ def launch_browser(server, opts)
         def boot_or_detach(server, opts)
           if opts["detach"]
             pid = Process.fork do
+              # Detach the process from controlling terminal
+              $stdin.reopen("/dev/null", "r")
+              $stdout.reopen("/dev/null", "w")
+              $stderr.reopen("/dev/null", "w")
               server.start
             end
 
             Process.detach(pid)
             Jekyll.logger.info "Server detached with pid '#{pid}'.",
                                "Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
+
+            # Exit without running `at_exit` inherited by the forked process.
+            Process.exit! 0
           else
             t = Thread.new { server.start }
             trap("INT") { server.shutdown }
Repository: jekyll/jekyll (Ruby)

Issue:
[Bug]: Permalink patterns changed/broken between Jekyll 4.3.4 and 4.4.0
### Operating System

Debian GNU/Linux 12 (bookworm)

### Ruby Version

ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-linux]

### Jekyll Version

jekyll 4.4.0

### GitHub Pages Version

Latest

### Expected Behavior

I had expected the permalink formats to operate the same way between 4.3.4 and 4.4.0, however instead of the expected paths of:

```
/hello/world/index.md -> /hello/world/index.html
/hello/world.md -> /hello/world/index.html
```

### Current Behavior

I'm now getting:

```
/hello/world/index.md -> /hello/world/index/index.html
/hello/world.md -> /hello/world/index.html
```

Notice the extra `/index/` folder in the path.

These are paths generated from pages in collections using the following config rules, which up until 4.4.0 were producing the expected output:

```yaml
permalink: pretty

collections:
  pages:
    output: true
  posts:
    output: true
  guides:
    output: true
  reference:
    output: true

defaults:
  - scope:
      path: "_*/**/*"
    values:
      permalink: /:categories/:collection/:path:output_ext
      layout: page
  - scope:  
      path: "_*/**/*.md"
    values:
      permalink: /:categories/:collection/:path/
  - scope:  
      path: "_*/**/index.md"
    values:
      permalink: /:categories/:collection/:path:output_ext
```

### Relevant log output

```shell

```

### Code Sample

_No response_



Fix (patch):
diff --git a/lib/jekyll/frontmatter_defaults.rb b/lib/jekyll/frontmatter_defaults.rb
index fb024fa9d52..5ad896b287c 100644
--- a/lib/jekyll/frontmatter_defaults.rb
+++ b/lib/jekyll/frontmatter_defaults.rb
@@ -109,7 +109,7 @@ def applies_path?(scope, path)
       sanitized_path = sanitize_path(path)
 
       if rel_scope_path.include?("*")
-        File.fnmatch?(strip_collections_dir(rel_scope_path), sanitized_path)
+        glob_scope(sanitized_path, rel_scope_path)
       else
         path_is_subpath?(sanitized_path, strip_collections_dir(rel_scope_path))
       end
Repository: jekyll/jekyll (Ruby)

Issue:
[Bug]: Jekyll::URL.escape_path interprets colons as protocol scheme
### Operating System

Alpine 3.13

### Ruby Version

ruby 3.1.5p252 (2024-04-23 revision 1945f8dc0e) [x86_64-linux-musl]

### Jekyll Version

jekyll 4.2.2

### GitHub Pages Version

_No response_

### Expected Behavior

I'm migrating a site and while generating tag pages, Jekyll throws an exception `#<Addressable::URI::InvalidURIError: Invalid scheme format: 'two words'>` for a tag with the format "two words: something else". I need to keep the original URLs, so I can't slugify the tag names, they should be escaped, so the page URL should be something like `/tag/two words: something else/`. I wrote a plugin that uses `Jekyll::URL` to generate them.

### Current Behavior

This will correctly escape the URL to `/tag/word:%20something%20else/`

```ruby
::Jekyll::URL.new(template: '/tag/:tag/', placeholders: { tag: 'word: something else' }).to_s
```

But

```ruby
::Jekyll::URL.new(template: '/tag/:tag/', placeholders: { tag: 'two words: something else' }).to_s
```

Will throw:

```
Addressable::URI::InvalidURIError: Invalid scheme format: 'two words'
from /usr/lib/ruby/gems/3.1.0/gems/addressable-2.8.7/lib/addressable/uri.rb:924:in `scheme='
```

Because `Jekyll::URL.escape_path` uses `Addressable::URI.encode`, that parses the placeholder value to an `Addressable::URI` before escaping it.

The escaping works correctly to `two%20words:%20something%20else` with `Addressable::URL.encode_component`:

```ruby
Addressable::URI.encode_component 'two words: something else'
```

So I'm wondering if patching `Jekyll::URL` to use `encode_component` instead of `encode` would be a good PR. Otherwise, change `Jekyll::URL#generate_url_from_drop` and `Jekyll::URL#generate_url_from_hash` to use a new method that calls `encode_component` instead of `encode`, by adding an `escape_component` method.  I can prepare such PR if that's fix.

### Relevant log output

```shell

```

### Code Sample

_No response_


Discussion: Hello @fauno
I am onboard with the idea of patching `Jekyll::URL` to use `Addressable::URI::encode_component` instead of `Addressable::URI::encode` since relying only on `:encode` is a deficiency as per this bug report.




Fix (patch):
diff --git a/lib/jekyll/url.rb b/lib/jekyll/url.rb
index aeb2ac0d867..d57352c4361 100644
--- a/lib/jekyll/url.rb
+++ b/lib/jekyll/url.rb
@@ -144,7 +144,13 @@ def self.escape_path(path)
       #   pct-encoded   = "%" HEXDIG HEXDIG
       #   sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
       #                 / "*" / "+" / "," / ";" / "="
-      Addressable::URI.encode(path).encode("utf-8").sub("#", "%23")
+      #
+      # `Addressable::URI::CharacterClassesRegexps::PATH` is used to encode
+      # non-alphanumeric characters such as "[", "]", etc.
+      Addressable::URI.encode_component(
+        path,
+        Addressable::URI::CharacterClassesRegexps::PATH
+      ).encode("utf-8").sub("#", "%23")
     end
 
     # Unescapes a URL path segment
Repository: primer/view_components (Ruby)

Issue:
Can't set `aria-label` on `IconButton` if tooltips are disabled
👋 Hello! I noticed an issue with the `IconButton` component in that you can't set an `aria-label` attribute on the button if you also pass in `show_tooltip: false`. 

**Steps to reproduce**

In the following example, one would expect to be able to set an `aria-label` on the button without enabling tooltips:

```
<%= render(Primer::Beta::IconButton.new(icon: :search, aria: { label: "Search" }, id: "search-button", show_tooltip: false)) %>
```

However, the `aria-label` attribute is not present in the rendered markup.

**Workaround**

This issue can be worked around by providing `aria-description` in addition to the `aria-label`. The value in `aria-label` will be preserved and rendered into the button's markup, while `aria-description` will be used for tooltip content (even if tooltips have been disabled).

It appears the issue is in [this block of code](https://github.com/primer/view_components/blob/main/app/components/primer/beta/icon_button.rb#L88-L98), which removes the `aria-label` from the system arguments hash so that it can be used in the tooltip, but it does this regardless of if tooltips are enabled or not.


Discussion: 👋 @strackoverflow would you be down to pair with @joelhawksley to upstream a fix for this?
Sure thing! I can coordinate with Joel on this.



Fix (patch):
diff --git a/.changeset/tidy-plums-pay.md b/.changeset/tidy-plums-pay.md
new file mode 100644
index 0000000000..72cbfbbdb7
--- /dev/null
+++ b/.changeset/tidy-plums-pay.md
@@ -0,0 +1,5 @@
+---
+"@primer/view-components": patch
+---
+
+Preserve aria-label when `Primer::Beta::IconButton` `show_tooltip` is false
diff --git a/app/components/primer/beta/icon_button.rb b/app/components/primer/beta/icon_button.rb
index d2b05cd8f1..f5d9c2301b 100644
--- a/app/components/primer/beta/icon_button.rb
+++ b/app/components/primer/beta/icon_button.rb
@@ -78,6 +78,8 @@ def initialize(icon:, scheme: DEFAULT_SCHEME, wrapper_arguments: {}, show_toolti
         @aria_label = aria("label", @system_arguments)
         @aria_description = aria("description", @system_arguments)
 
+        return unless @show_tooltip
+
         @tooltip_arguments = {
           for_id: @system_arguments[:id],
           direction: tooltip_direction
Repository: primer/view_components (Ruby)

Issue:
Setting properties on a form control when using the form builder
I am trying to use the autocomplete component from within a form builder:

```ruby
class MyForm < ApplicationForm
  form do |form|
    form.auto_complete(
      name: :skills,
      label: "Skills",
      placeholder: "Search skills library",
      required: true,
      list_id: "skills_autocomplete",
      src: "/skills/autocomplete?select_fields=id,name,description&search_field=name",
    )
  end
end
```

This renders a `FormControl` with the autocomplete inside and that is all great. However I want to set the form control to be full width. There is a property for this available on the form control but that seems to be inaccessible from here.

Is there a way to modify the values passed to the form control so we can set properties on it?

Thanks for your help


Discussion: Uh oh! @dereke, the image you shared is missing helpful alt text. Check  your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at [Basic writing and formatting syntax: images on GitHub Docs](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#images).

> 🤖 Beep boop! This comment was added automatically by [github/accessibility-alt-text-bot](https://github.com/github/accessibility-alt-text-bot).

Hey @dereke, thanks for bringing this to our attention 😄 It should be mitigated by https://github.com/primer/view_components/pull/3205 👍 



Fix (patch):
diff --git a/.changeset/seven-experts-return.md b/.changeset/seven-experts-return.md
new file mode 100644
index 0000000000..27c4dc91c7
--- /dev/null
+++ b/.changeset/seven-experts-return.md
@@ -0,0 +1,5 @@
+---
+'@primer/view-components': patch
+---
+
+Ensure `full_width:` option is respected by the auto_complete input
diff --git a/app/lib/primer/forms/auto_complete.rb b/app/lib/primer/forms/auto_complete.rb
index f1e2d48506..f2f8353b97 100644
--- a/app/lib/primer/forms/auto_complete.rb
+++ b/app/lib/primer/forms/auto_complete.rb
@@ -40,7 +40,8 @@ def auto_complete_arguments
             input_name: all_args[:name],
             input_id: all_args[:id],
             label_text: @input.label,
-            list_id: "#{all_args[:id]}-list"
+            list_id: "#{all_args[:id]}-list",
+            full_width: @input.full_width?
           )
       end
Repository: JEG2/highline (Ruby)

Issue:
Have to set convert type in order for `.in` to work with array
If you do this, no validation happens:

```Ruby
ask('Letter a, b, or c? ') { |q| q.in = %w[ a b c ] }
```

You can enter in `d`, and it accepts the input.

In order for it to work, you have to pass in `String`:

```Ruby
ask('Letter a, b, or c? ',String) { |q| q.in = %w[ a b c ] }
```

Is there another way I should do this (I don't want a full-blown menu like with `choose`)? Else, I think it'd be useful to change it.



Fix (patch):
diff --git a/lib/highline/question/answer_converter.rb b/lib/highline/question/answer_converter.rb
index 76558aeb..6a4585c2 100644
--- a/lib/highline/question/answer_converter.rb
+++ b/lib/highline/question/answer_converter.rb
@@ -9,7 +9,7 @@ class AnswerConverter
       extend Forwardable
 
       def_delegators :@question,
-                     :answer, :answer=, :check_range,
+                     :answer, :answer=,
                      :directory, :answer_type, :choices_complete
 
       # It should be initialized with a Question object.
@@ -26,10 +26,7 @@ def initialize(question)
       # it makes the conversion and returns the answer.
       # @return [Object] the converted answer.
       def convert
-        return unless answer_type
-
-        self.answer = convert_by_answer_type
-        check_range
+        self.answer = convert_by_answer_type if answer_type
         answer
       end
 
diff --git a/lib/highline/question_asker.rb b/lib/highline/question_asker.rb
index 03b3ff77..d28d36ca 100644
--- a/lib/highline/question_asker.rb
+++ b/lib/highline/question_asker.rb
@@ -31,6 +31,7 @@ def ask_once
         raise NotValidQuestionError unless question.valid_answer?
 
         question.convert
+        question.check_range
 
         if question.confirm
           confirmation = @highline.send(:confirm, question)
Repository: sidekiq/sidekiq (Ruby)

Issue:
Setting default retry and overriding the options should make sense

### Discussed in https://github.com/sidekiq/sidekiq/discussions/6875

<div type='discussions-op-text'>

<sup>Originally posted by **araishikeiwai** November 26, 2025</sup>
Hi team,

I have faced a surprise in my application that when `Sidekiq.default_configuration[:max_retries]` is set, adding `retry_for` to my job options without also overriding `retry` option does not work.

I came to realize that this is because retry count takes precedence over retry duration https://github.com/sidekiq/sidekiq/blob/b42be8b804eeeec87bc4b9aa99f4fb62e81d256d/lib/sidekiq/job_retry.rb#L181-L184, and the max retry count is read from the default configuration because I didn't set it in my job options.

This was a surprising behaviour to me because I was under the impression that anything in `sidekiq_options` should be prioritized over default values, although I realized `retry_for` and `retry` are two different options but they're related and should be handled as so!

Can we switch the `return retries_exhausted...` statements around?
Alternatively can we have the option to set a `Sidekiq.default_configuration[:max_retry_duration]` instead of `max_retries`? This may be breaking though. 
i.e. the default configuration should be checked last
*edit*: my suggestions may not work as expected because one thing will always take precedence over the other. The solution to this is now open to suggestion but the end result stays the same:

This way even if we set a default retry, overriding `retry` XOR `retry_for` in the job definition should work as expected.</div>


Discussion: Sidekiq should exclusively use either `retry_for` or `retry` and not mix both within the same logic.



Fix (patch):
diff --git a/lib/sidekiq/job_retry.rb b/lib/sidekiq/job_retry.rb
index 2d4e3b306..a4e9d679c 100644
--- a/lib/sidekiq/job_retry.rb
+++ b/lib/sidekiq/job_retry.rb
@@ -178,10 +178,14 @@ def process_retry(jobinst, msg, queue, exception)
         msg["error_backtrace"] = compress_backtrace(lines)
       end
 
-      return retries_exhausted(jobinst, msg, exception) if count >= max_retry_attempts
-
+      # retry_for and retry are mutually exclusive - if retry_for is set,
+      # we exclusively use duration-based retry logic and ignore count-based logic
       rf = msg["retry_for"]
-      return retries_exhausted(jobinst, msg, exception) if rf && (time_for(msg["failed_at"]) + rf) < Time.now
+      if rf
+        return retries_exhausted(jobinst, msg, exception) if (time_for(msg["failed_at"]) + rf) < Time.now
+      else
+        return retries_exhausted(jobinst, msg, exception) if count >= max_retry_attempts
+      end
 
       strategy, delay = delay_for(jobinst, count, exception, msg)
       case strategy
Repository: sidekiq/sidekiq (Ruby)

Issue:
Dealing with perform_bulk and dynamic queues set from a client middleware.
By design, `perform_bulk` will push all the jobs in a single queue since its based on a single worker. In my case, I've a `client_middleware` that will update a job's queue dynamically based on its args. This works perfectly when calling `perform_async` but when using `perform_bulk` the queue is [set](https://github.com/sidekiq/sidekiq/blob/7239276d85089e9a19c2642584bf6fa5a53224dc/lib/sidekiq/client.rb#L272) like this `payload['queue'].first`.

I wonder if it could be possible to partition queues from the payload and push jobs on different queues instead of relying on the first one.




Discussion: PRs welcome but this seems like not much value for the increase in code complexity.



Fix (patch):
diff --git a/lib/sidekiq/client.rb b/lib/sidekiq/client.rb
index 16580a19a9..2a4fb6a118 100644
--- a/lib/sidekiq/client.rb
+++ b/lib/sidekiq/client.rb
@@ -269,14 +269,16 @@ def atomic_push(conn, payloads)
           [at, Sidekiq.dump_json(hash)]
         })
       else
-        queue = payloads.first["queue"]
         now = Time.now.to_f
-        to_push = payloads.map { |entry|
-          entry["enqueued_at"] = now
-          Sidekiq.dump_json(entry)
-        }
-        conn.sadd("queues", [queue])
-        conn.lpush("queue:#{queue}", to_push)
+        grouped_queues = payloads.group_by { |job| job["queue"] }
+        conn.sadd("queues", grouped_queues.keys)
+        grouped_queues.each do |queue, grouped_payloads|
+          to_push = grouped_payloads.map { |entry|
+            entry["enqueued_at"] = now
+            Sidekiq.dump_json(entry)
+          }
+          conn.lpush("queue:#{queue}", to_push)
+        end
       end
     end
   end
Repository: freerange/mocha (Ruby)

Issue:
Better error message if `Mockery.teardown` is called when `Mockery.setup` has not been called successfully
This seems to have happened to at least a couple of people in relation to Rails fixtures - see #611. I think we could probably provide a more useful error message if `Mockery.instance` is not set.



Fix (patch):
diff --git a/lib/mocha/mockery.rb b/lib/mocha/mockery.rb
index 31839a748..740d697f3 100644
--- a/lib/mocha/mockery.rb
+++ b/lib/mocha/mockery.rb
@@ -49,9 +49,13 @@ def verify(*args)
       end
 
       def teardown(origin = nil)
+        if @instances.nil?
+          raise NotInitializedError, 'Mocha::Mockery.teardown called before Mocha::Mockery.setup'
+        end
+
         instance.teardown(origin)
       ensure
-        @instances.pop
+        @instances.pop unless @instances.nil?
       end
     end
Repository: sinatra/sinatra (Ruby)

Issue:
`NoMethodError - undefined method '=~' for 1:Integer`
```ruby
# config.ru
require "sinatra/base"

class App < Sinatra::Base
  get "/" do
    uri(1)
  end
end

run App
```

```
arm64 $ bundle exec puma
Puma starting in single mode...
* Puma version: 6.1.0 (ruby 3.2.1-p31) ("The Way Up")
*  Min threads: 0
*  Max threads: 5
*  Environment: development
*          PID: 59431
* Listening on http://0.0.0.0:9292
Use Ctrl-C to stop
2023-02-26 19:10:10 - NoMethodError - undefined method `=~' for 1:Integer:
	/Users/dentarg/src/sinatra/sinatra/lib/sinatra/base.rb:320:in `uri'
	config.ru:5:in `block in <class:App>'
```

https://github.com/sinatra/sinatra/blob/50b8398dd7bcd5d5c187da51b23a939c5f3de210/lib/sinatra/base.rb#L317-L334


Discussion: Before 3.2.0, a warning was printed (if you ran with warnings enabled)

```
arm64 $ RUBYOPT=-W bundle exec puma
Puma starting in single mode...
* Puma version: 6.1.0 (ruby 3.1.3-p185) ("The Way Up")
*  Min threads: 0
*  Max threads: 5
*  Environment: development
*          PID: 60791
* Listening on http://0.0.0.0:9292
Use Ctrl-C to stop
/Users/dentarg/src/sinatra/sinatra/lib/sinatra/base.rb:320: warning: deprecated Object#=~ is called on Integer; it always returns nil
```



Fix (patch):
diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb
index 9a2cd954c9..4982034b51 100644
--- a/lib/sinatra/base.rb
+++ b/lib/sinatra/base.rb
@@ -317,7 +317,7 @@ def redirect(uri, *args)
     # Generates the absolute URI for a given path in the app.
     # Takes Rack routers and reverse proxies into account.
     def uri(addr = nil, absolute = true, add_script_name = true)
-      return addr if addr =~ /\A[a-z][a-z0-9+.\-]*:/i
+      return addr if addr.to_s =~ /\A[a-z][a-z0-9+.\-]*:/i
 
       uri = [host = String.new]
       if absolute
Repository: sinatra/sinatra (Ruby)

Issue:
`NoMethodError` when using `content_type` params with `Integer` value
This app

```ruby
require "bundler/inline"

gemfile(true) do
  gem "nio4r"
  gem "sinatra", require: "sinatra/base"
end

class App < Sinatra::Base
  get "/" do
    content_type "foo/bar", baz: 1
    body "OK"
  end
end

run App
```

Blows up like this

```shell
$ puma content_type_bug.ru -p 8888
Puma starting in single mode...
* Puma version: 6.5.0 ("Sky's Version")
* Ruby version: ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin23]
*  Min threads: 0
*  Max threads: 5
*  Environment: development
*          PID: 12998
Resolving dependencies...
* Listening on http://0.0.0.0:8888
Use Ctrl-C to stop
2025-01-05 09:52:35 - NoMethodError - undefined method `=~' for an instance of Integer (NoMethodError):
	/Users/dentarg/.arm64_rubies/3.3.6/lib/ruby/gems/3.3.0/gems/sinatra-4.1.1/lib/sinatra/base.rb:401:in `block in content_type'
	/Users/dentarg/.arm64_rubies/3.3.6/lib/ruby/gems/3.3.0/gems/sinatra-4.1.1/lib/sinatra/base.rb:400:in `each'
	/Users/dentarg/.arm64_rubies/3.3.6/lib/ruby/gems/3.3.0/gems/sinatra-4.1.1/lib/sinatra/base.rb:400:in `map'
	/Users/dentarg/.arm64_rubies/3.3.6/lib/ruby/gems/3.3.0/gems/sinatra-4.1.1/lib/sinatra/base.rb:400:in `content_type'
	content_type_bug.ru:10:in `block in <class:App>'
```



Fix (patch):
diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb
index 7eef6533c..f0bccd8ae 100644
--- a/lib/sinatra/base.rb
+++ b/lib/sinatra/base.rb
@@ -398,7 +398,7 @@ def content_type(type = nil, params = {})
       unless params.empty?
         mime_type << (mime_type.include?(';') ? ', ' : ';')
         mime_type << params.map do |key, val|
-          val = val.inspect if val =~ /[";,]/
+          val = val.inspect if val.to_s =~ /[";,]/
           "#{key}=#{val}"
         end.join(', ')
       end