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

Issue:
App logs with follow option does not work after upgrade to 1.5
Having the command:
`bin/kamal app logs -r web -f`
It worked fine on kamal 1.4.0, thus giving output:
```
  INFO Following logs on i-0d1a6eb781c5d3ad2...
  INFO ssh -o ProxyCommand='aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'' -t ubuntu@<ip> -p 22 'docker ps --quiet --filter label=service=replenisher --filter label=role=web --filter status=running --filter status=restarting --latest | xargs docker logs --timestamps --tail 10 --follow 2>&1'
```

while on 1.5.0, it throws:
```
  INFO Following logs on i-0d1a6eb781c5d3ad2...
  INFO ssh -o ProxyCommand='aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'' -t ubuntu@<ip> -p 22 'sh -c 'docker ps --latest --quiet --filter label=service=replenisher --filter label=role=web --filter status=running --filter status=restarting --filter ancestor=$(docker image ls --filter reference=ecr-repo-address/image-name:latest --format '\''{{.ID}}'\'') ; docker ps --latest --quiet --filter label=service=replenisher --filter label=role=web --filter status=running --filter status=restarting' | head -1 | xargs docker logs --timestamps --tail 10 --follow 2>&1'
sh: 1: Syntax error: Unterminated quoted string
```
Running ``bin/kamal app logs -r web` (without follow option) works fine

My nonstandard SSH config:
```
ssh:
  user: ubuntu
  proxy_command: <%= %q(aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p') %>
```


Discussion: Thanks @morgoth - looks like it was generally broken and nothing to do with your specific config. Fixed in https://github.com/basecamp/kamal/pull/779
I've released v1.5.1, could you confirm that it's fixed for you now @morgoth?
It works. Thank you



Fix (patch):
diff --git a/lib/kamal/commands/base.rb b/lib/kamal/commands/base.rb
index 8c289ae0b..824047839 100644
--- a/lib/kamal/commands/base.rb
+++ b/lib/kamal/commands/base.rb
@@ -18,7 +18,7 @@ def run_over_ssh(*command, host:)
         elsif config.ssh.proxy && config.ssh.proxy.is_a?(Net::SSH::Proxy::Command)
           cmd << " -o ProxyCommand='#{config.ssh.proxy.command_line_template}'"
         end
-        cmd << " -t #{config.ssh.user}@#{host} -p #{config.ssh.port} '#{command.join(" ")}'"
+        cmd << " -t #{config.ssh.user}@#{host} -p #{config.ssh.port} '#{command.join(" ").gsub("'", "'\\\\''")}'"
       end
     end
Repository: puma/puma (Ruby)

Issue:
Puma::ErrorLogger: missing "?" when logging requests with a query string
```diff
diff --git a/lib/puma/error_logger.rb b/lib/puma/error_logger.rb
index 792e14a6..a12fba67 100644
--- a/lib/puma/error_logger.rb
+++ b/lib/puma/error_logger.rb
@@ -78,13 +78,13 @@ module Puma
     def request_title(req)
       env = req.env
 
       REQUEST_FORMAT % [
         env[REQUEST_METHOD],
         env[REQUEST_PATH] || env[PATH_INFO],
-        env[QUERY_STRING] || "",
+        (qs = env[QUERY_STRING]) && !qs.empty? ? "?#{qs}" : "",
         env[HTTP_X_FORWARDED_FOR] || env[REMOTE_ADDR] || "-"
       ]
     end
 
     def request_headers(req)
       headers = req.env.select { |key, _| key.start_with?('HTTP_') }
```



Fix (patch):
diff --git a/lib/puma/error_logger.rb b/lib/puma/error_logger.rb
index 792e14a6ae..ed70204b17 100644
--- a/lib/puma/error_logger.rb
+++ b/lib/puma/error_logger.rb
@@ -78,10 +78,12 @@ def request_dump(req)
     def request_title(req)
       env = req.env
 
+      query_string = env[QUERY_STRING]
+
       REQUEST_FORMAT % [
         env[REQUEST_METHOD],
         env[REQUEST_PATH] || env[PATH_INFO],
-        env[QUERY_STRING] || "",
+        query_string.nil? || query_string.empty? ? "" : "?#{query_string}",
         env[HTTP_X_FORWARDED_FOR] || env[REMOTE_ADDR] || "-"
       ]
     end
Repository: rack/rack (Ruby)

Issue:
MockRequest can't handle an empty cookie anymore
Executing
```ruby
Rack::MockRequest.new(->(env) { [200, { "Set-Cookie" => "" }, [""]] }).get("")
```
will fail with
> NoMethodError: undefined method `split' for nil
from /Users/foobar/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/rack-3.1.0/lib/rack/mock_response.rb:101:in `identify_cookie_attributes'

In earlier versions (<= 3.0.11) this used to work.


Discussion: Are you able to submit a PR? Thanks :)
> Are you able to submit a PR? Thanks :)

Give me a few hours 👍 



Fix (patch):
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e6e216a1..7b1973844 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. For info on
 ### Fixed
 
 - Fix passing non-strings to `Rack::Utils.escape_html`. ([#2202](https://github.com/rack/rack/pull/2202), [@earlopain])
+- `Rack::MockResponse` gracefully handles empty cookies ([#2203](https://github.com/rack/rack/pull/2203) [@wynksaiddestroy](https://github.com/wynksaiddestroy))
 
 ### Added
 
diff --git a/lib/rack/mock_response.rb b/lib/rack/mock_response.rb
index 817f3cac1..9af8079e1 100644
--- a/lib/rack/mock_response.rb
+++ b/lib/rack/mock_response.rb
@@ -78,8 +78,8 @@ def cookie(name)
 
     def parse_cookies_from_header
       cookies = Hash.new
-      if headers.has_key? 'set-cookie'
-        set_cookie_header = headers.fetch('set-cookie')
+      set_cookie_header = headers['set-cookie']
+      if set_cookie_header && !set_cookie_header.empty?
         Array(set_cookie_header).each do |cookie|
           cookie_name, cookie_filling = cookie.split('=', 2)
           cookie_attributes = identify_cookie_attributes cookie_filling
Repository: soutaro/steep (Ruby)

Issue:
`obj.[]=(k, v)` does not (necessarily) return `v` in Ruby
… whereas `obj[k] = v` gives `v` regardless of the implementation.
Discussion is open for whether this is a Ruby bug (inconsistency).

Ruby:
```ruby
def []=(k, v)
  -1
end

# Control Subject
p(self[:k] = :v) #: Symbol

# Experimental Subject
p self.[]=(:k, :v) #: Integer
```

Ruby output:
```
:v
-1
```

RBS:
```
class Object
  def []=: (untyped, untyped) -> Integer
end
```

`steep check`:
```
# Type checking files:

..................................................................................F.

writer.rb:9:0: [error] Assertion cannot hold: no relationship between inferred type (`::Symbol`) and asserted type (`::Integer`)
│ Diagnostic ID: Ruby::FalseAssertion
│
└ p self.[]=(:k, :v) #: Integer
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Detected 1 problem from 1 file
```


Discussion: ```ruby
def k=(v)
  -1
end

self.k=(:v) #=> :v
self.__send__(:k=, :v) #=> -1
```



Fix (patch):
diff --git a/lib/steep/type_construction.rb b/lib/steep/type_construction.rb
index 6beb063d9..6ddb1ccf4 100644
--- a/lib/steep/type_construction.rb
+++ b/lib/steep/type_construction.rb
@@ -3285,7 +3285,14 @@ def type_send_interface(node, interface:, receiver:, receiver_type:, method_name
 
         if call && constr
           case method_name.to_s
-          when "[]=", /\w=\Z/
+          when "[]="
+            if test_send_node(node) {|_, _, _, loc| !loc.dot }
+              last_arg = arguments.last or raise
+              if typing.has_type?(last_arg)
+                call = call.with_return_type(typing.type_of(node: last_arg))
+              end
+            end
+          when /\w=\Z/
             last_arg = arguments.last or raise
             if typing.has_type?(last_arg)
               call = call.with_return_type(typing.type_of(node: last_arg))
Repository: soutaro/steep (Ruby)

Issue:
Returning multiple value
```ruby
# @type method foo: () -> [Integer, String]
def foo
  return 1, ""       # => should type check
end
```



Fix (patch):
diff --git a/lib/steep/type_construction.rb b/lib/steep/type_construction.rb
index 9b626ab8b..c37506c8a 100644
--- a/lib/steep/type_construction.rb
+++ b/lib/steep/type_construction.rb
@@ -1100,12 +1100,9 @@ def synthesize(node, hint: nil, condition: false)
               return_value_node = node.children[0]
               value_type, constr = synthesize(return_value_node, hint: method_return_type)
             else
-              constr = synthesize_children(node)
-              return_types = node.children.map do |value|
-                constr.typing.type_of(node: value)
-              end
-
-              value_type = AST::Builtin::Array.instance_type(union_type(*return_types))
+              # It returns an array
+              array = node.updated(:array)
+              value_type, constr = synthesize(array, hint: method_return_type)
             end
 
             if method_return_type
Repository: hashicorp/vagrant (Ruby)

Issue:
`get_current_disk': undefined method `[]' for nil when using Hyper-V provider and attempting to resize the Primary Disk
### Debug output

The debug output does not seem to contain the relevant information, which is the ControllerLocation actually discovered. I present this information largely redacted here with supporting information in the proposed fix below.

```plaintext
{"Path"=>"C:\\Users\\...packer-almalinux-8.vhdx",
  "DiskNumber"=>nil,
...
  "ControllerLocation"=>1, 
  "ControllerNumber"=>0,
  "ControllerType"=>1,
  "Name"=>"Hard Drive on SCSI controller number 0 at location 1",
...
}
```

### Expected behavior

The primary disk should be resized.

### Actual behavior

C:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.3/plugins/providers/hyperv/cap/configure_disks.rb:63:in `get_current_disk': undefined method `[]' for nil (NoMethodError)

### Reproduction information 

vagrant up

#### Vagrant version

2.4.3

#### Host operating system

Windows 11 Education

#### Guest operating system

almalinux/8

#### Steps to reproduce

1. vagrant up

#### Vagrantfile

```ruby
Vagrant.configure("2") do |config|
  config.vm.box = "almalinux/8"
  config.vm.provider "hyperv"
  config.vm.disk :disk, size: "30GB", primary: true
end
```

#### Fix

![Image](https://github.com/user-attachments/assets/3c4a6fd7-8b40-439b-ad76-13c44f65db9a)

As the image indicates, the minimal "location" appears to be '1' thus the all_disks.detect filtering below should use a controller location of 1.

plugins/providers/hyperv/cap/configure_disks.rb:54 should be:
```ruby
# always come in port order, but primary should always be Location 1 Number 0.

current_disk = all_disks.detect { |d| d["ControllerLocation"] == 1 && d["ControllerNumber"] == 0 }
```

I'll open a corresponding pull request momentarily.



Fix (patch):
diff --git a/plugins/providers/hyperv/cap/configure_disks.rb b/plugins/providers/hyperv/cap/configure_disks.rb
index 28a7a664a0a..3d2ecf4eccd 100644
--- a/plugins/providers/hyperv/cap/configure_disks.rb
+++ b/plugins/providers/hyperv/cap/configure_disks.rb
@@ -51,9 +51,16 @@ def self.get_current_disk(machine, disk, all_disks)
           if disk.primary
             # Ensure we grab the proper primary disk
             # We can't rely on the order of `all_disks`, as they will not
-            # always come in port order, but primary should always be Location 0 Number 0.
+            # always come in port order, but primary should always be the
+            # first disk.
 
-            current_disk = all_disks.detect { |d| d["ControllerLocation"] == 0 && d["ControllerNumber"] == 0 }
+            sorted_disks = all_disks.sort_by { |d|
+              [d["ControllerNumber"].to_i, d["ControllerLocation"].to_i]
+            }
+
+            LOGGER.debug("sorted disks for primary detection: #{sorted_disks}")
+
+            current_disk = sorted_disks.first
 
             # Need to get actual disk info to obtain UUID instead of what's returned
             #
Repository: decidim/decidim (Ruby)

Issue:
Refactor Decidim jobs to inherit from Decidim::ApplicationJob
While working on #11416, i have noticed that not all of the jobs are inherited from the same decidim job (`Decidim::ApplicationJob`). We need to refactor and add the Decidim::ApplicationJob as a single point of inheritance. 
_See the comment https://github.com/decidim/decidim/pull/11416#discussion_r1277666214_



Fix (patch):
diff --git a/decidim-admin/app/jobs/decidim/admin/application_job.rb b/decidim-admin/app/jobs/decidim/admin/application_job.rb
index 5b4ca4e2b7c01..b085320d7d499 100644
--- a/decidim-admin/app/jobs/decidim/admin/application_job.rb
+++ b/decidim-admin/app/jobs/decidim/admin/application_job.rb
@@ -4,7 +4,7 @@ module Decidim
   module Admin
     # Custom ApplicationJob scoped to the admin panel.
     #
-    class ApplicationJob < ActiveJob::Base
+    class ApplicationJob < Decidim::ApplicationJob
     end
   end
 end
diff --git a/decidim-system/app/jobs/decidim/system/application_job.rb b/decidim-system/app/jobs/decidim/system/application_job.rb
index a6e5ecc8e057e..101481845d3b8 100644
--- a/decidim-system/app/jobs/decidim/system/application_job.rb
+++ b/decidim-system/app/jobs/decidim/system/application_job.rb
@@ -4,7 +4,7 @@ module Decidim
   module System
     # Custom ApplicationJob scoped to the system panel.
     #
-    class ApplicationJob < ActiveJob::Base
+    class ApplicationJob < Decidim::ApplicationJob
     end
   end
 end
diff --git a/decidim-verifications/app/jobs/decidim/verifications/csv_census/application_job.rb b/decidim-verifications/app/jobs/decidim/verifications/csv_census/application_job.rb
index 3f3c604c1abfc..1a84bedad9c20 100644
--- a/decidim-verifications/app/jobs/decidim/verifications/csv_census/application_job.rb
+++ b/decidim-verifications/app/jobs/decidim/verifications/csv_census/application_job.rb
@@ -3,7 +3,7 @@
 module Decidim
   module Verifications
     module CsvCensus
-      class ApplicationJob < ActiveJob::Base
+      class ApplicationJob < Decidim::ApplicationJob
       end
     end
   end
Repository: ViewComponent/view_component (Ruby)

Issue:
Add Rails url helpers to Previews
## Feature request
Add Rails Url helpers to previews, for instance, if `resources :items` is defined in `routes.rb`, I may want to use `items_path` in the component preview method

### Motivation
I have personally come across the need to use these url helpers inside of the preview file, for example 

```
class LinkComponentPreview < ViewComponent::Preview
 def items_link_component
    render(LinkComponent.new(url: items_path))
  end
end
 ```
  Currently, when I try this I get this error 
  
  ```
  undefined local variable or method `items_path' for #<LinkComponentPreview:0x00000001113d7770>
  ```

<!-- What would you like to do with this feature? Can you provide
context or references to similar behavior in other libraries? -->
A similar way to achieve this is by using the preview template which will have the URL helpers loaded but that seems like overkill just to get access to a helper 




Fix (patch):
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 578c4145e..b54c37412 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -18,6 +18,10 @@ nav_order: 5
 
     *Pasha Kalashnikov*
 
+* Add URL helpers to previews
+
+    *Reegan Viljoen*
+
 ## 3.1.0
 
 * Check `defined?(Rails) && Rails.application` before using `ViewComponent::Base.config.view_component_path`.
diff --git a/lib/view_component/preview.rb b/lib/view_component/preview.rb
index 0af154413..e80087404 100644
--- a/lib/view_component/preview.rb
+++ b/lib/view_component/preview.rb
@@ -4,6 +4,7 @@
 
 module ViewComponent # :nodoc:
   class Preview
+    include Rails.application.routes.url_helpers
     include ActionView::Helpers::TagHelper
     include ActionView::Helpers::AssetTagHelper
     extend ActiveSupport::DescendantsTracker
Repository: Shopify/ruby-lsp-rails (Ruby)

Issue:
Code lens doesn't handle multiline escaped strings
We're not handling this case, but it shouldn't be hard to support it.

```ruby
test "something" \
  "otherthing" do
end
```



Fix (patch):
diff --git a/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb b/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb
index 1ad20443..f051a7c6 100644
--- a/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb
+++ b/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb
@@ -59,16 +59,26 @@ def on_command(node)
         return unless message_value == "test" && node.arguments.parts.any?
 
         first_argument = node.arguments.parts.first
-        return unless first_argument.is_a?(SyntaxTree::StringLiteral)
+
+        parts = case first_argument
+        when SyntaxTree::StringConcat
+          # We only support two lines of concatenation on test names
+          if first_argument.left.is_a?(SyntaxTree::StringLiteral) &&
+              first_argument.right.is_a?(SyntaxTree::StringLiteral)
+            [*first_argument.left.parts, *first_argument.right.parts]
+          end
+        when SyntaxTree::StringLiteral
+          first_argument.parts
+        end
 
         # The test name may be a blank string while the code is being typed
-        return if first_argument.parts.empty?
+        return if parts.nil? || parts.empty?
 
         # We can't handle interpolation yet
-        return unless first_argument.parts.all? { |part| part.is_a?(SyntaxTree::TStringContent) }
+        return unless parts.all? { |part| part.is_a?(SyntaxTree::TStringContent) }
 
-        test_name = first_argument.parts.first.value
-        return unless test_name
+        test_name = parts.map(&:value).join
+        return if test_name.empty?
 
         line_number = node.location.start_line
         command = "#{BASE_COMMAND} #{@path}:#{line_number}"
Repository: Shopify/ruby-lsp-rails (Ruby)

Issue:
"Jump to view" includes folders as well
### Description

### Ruby LSP Information


### Ruby LSP Information

#### VS Code Version

1.93.1

#### Ruby LSP Extension Version

0.8.1

#### Ruby LSP Server Version

0.18.3

#### Ruby LSP Addons

- Ruby LSP Rails

#### Ruby Version

3.2.5

#### Ruby Version Manager

rbenv

#### Installed Extensions

<details>
<summary>Click to expand</summary>

- copilot (1.233.0)
- copilot-chat (0.20.3)
- haml (1.4.1)
- rainbow-csv (3.12.0)
- ruby-lsp (0.8.1)
</details>

#### Ruby LSP Settings

<details>
<summary>Click to expand</summary>

##### Workspace

```json
{}
```

##### User

```json
{
  "enableExperimentalFeatures": false,
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": false,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": false,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": false,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": true,
    "codeLens": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "auto"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true
}
```

</details>

### Reproduction steps

1. Start the Ruby LSP using VS Code
2. Open a Rails controller file (e.g. `posts`). Choose an action (e.g. `show`) which has a "Jump to View" option.
3. If `views/posts/` has a `show` directory inside it, it will be offered as a possible view, even though it's a folder.

Folders should be skipped when collecting possible views of a Rails action.


Discussion: Thanks, https://github.com/Shopify/ruby-lsp-rails/pull/464 should solve this.



Fix (patch):
diff --git a/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb b/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb
index 51866b2c..3a7371b0 100644
--- a/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb
+++ b/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb
@@ -198,9 +198,13 @@ def add_jump_to_view(node)
           .gsub("::", "/")
           .downcase
 
-        view_uris = Dir.glob("#{@client.rails_root}/app/views/#{controller_name}/#{action_name}*").map! do |path|
+        view_uris = Dir.glob("#{@client.rails_root}/app/views/#{controller_name}/#{action_name}*").filter_map do |path|
+          # it's possible we could have a directory with the same name as the action, so we need to skip those
+          next if File.directory?(path)
+
           URI::Generic.from_path(path: path).to_s
         end
+
         return if view_uris.empty?
 
         @response_builder << create_code_lens(
Repository: Shopify/ruby-lsp-rails (Ruby)

Issue:
Rails 6.x compatibility broken due to `schema_dump_path`
From https://github.com/Shopify/ruby-lsp-rails/pull/250#discussion_r1494018448 the compatibility with Rails 6.x is broken.

The gemspec specify it is compatible with [ActiveRecord 6](https://github.com/Shopify/ruby-lsp-rails/blob/ba16bf3d9c4f150a1e9438c48165f2dcb926b192/ruby-lsp-rails.gemspec#L25) but the `schema_dump_path` is from ActiveRecord 7.0.

`schema_dump_path` is not present in ActiveRecord 6.1: https://github.com/rails/rails/blob/v6.1.7.6/activerecord/lib/active_record/tasks/database_tasks.rb

`schema_dump_path` is available from 7.0: https://github.com/rails/rails/blob/v7.0.0/activerecord/lib/active_record/tasks/database_tasks.rb#L448



Discussion: The method `schema_dump_path` rely on `ActiveRecord.schema_format` and `db_config.schema_dump` that seems to be also available only in Rails 7+.


Thanks for the report, I will look into this.



Fix (patch):
diff --git a/lib/ruby_lsp/ruby_lsp_rails/server.rb b/lib/ruby_lsp/ruby_lsp_rails/server.rb
index e1d55743..b14351fd 100644
--- a/lib/ruby_lsp/ruby_lsp_rails/server.rb
+++ b/lib/ruby_lsp/ruby_lsp_rails/server.rb
@@ -26,7 +26,7 @@ class Server
 
       extend T::Sig
 
-      sig { params(model_name: String).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
+      sig { params(model_name: String).returns(T::Hash[Symbol, T.untyped]) }
       def resolve_database_info_from_model(model_name)
         const = ActiveSupport::Inflector.safe_constantize(model_name)
         unless const && const < ActiveRecord::Base && !const.abstract_class?
@@ -35,14 +35,18 @@ def resolve_database_info_from_model(model_name)
           }
         end
 
-        schema_file = ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(const.connection.pool.db_config)
-
-        {
+        info = {
           result: {
             columns: const.columns.map { |column| [column.name, column.type] },
-            schema_file: ::Rails.root + schema_file,
           },
         }
+
+        if ActiveRecord::Tasks::DatabaseTasks.respond_to?(:schema_dump_path)
+          info[:result][:schema_file] =
+            ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(const.connection.pool.db_config)
+
+        end
+        info
       rescue => e
         {
           error: e.message,