nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: hetznercloud/hcloud-cloud-controller-manager
Pull request #306 (2022-08-03 13:35:07)

Prioritize IPv4 address family by dual-stack
This is a quick-fix / enhancement for the issue described in https://github.com/hetznercloud/hcloud-cloud-controller-manager/issues/305

Switches the order of the node `ExternalIP` list to favour IPv4, as most of the dual-stack k8s clusters probably will be mostly relying on IPv4 control plane before apiserver properly supports dual-stack.

Signed-off-by: Rastislav Szabo <rastislav@kubermatic.com>


Patch:
diff --git a/hcloud/instances.go b/hcloud/instances.go
index c872b2a7..9d80a1a7 100644
--- a/hcloud/instances.go
+++ b/hcloud/instances.go
@@ -169,6 +169,15 @@ func (i *instances) nodeAddresses(ctx context.Context, server *hcloud.Server) []
 		v1.NodeAddress{Type: v1.NodeHostName, Address: server.Name},
 	)
 
+	if i.addressFamily == AddressFamilyIPv4 || i.addressFamily == AddressFamilyDualStack {
+		if !server.PublicNet.IPv4.IP.IsUnspecified() {
+			addresses = append(
+				addresses,
+				v1.NodeAddress{Type: v1.NodeExternalIP, Address: server.PublicNet.IPv4.IP.String()},
+			)
+		}
+	}
+
 	if i.addressFamily == AddressFamilyIPv6 || i.addressFamily == AddressFamilyDualStack {
 		if !server.PublicNet.IPv6.IP.IsUnspecified() {
 			// For a given IPv6 network of 2001:db8:1234::/64, the instance address is 2001:db8:1234::1
@@ -182,15 +191,6 @@ func (i *instances) nodeAddresses(ctx context.Context, server *hcloud.Server) []
 		}
 	}
 
-	if i.addressFamily == AddressFamilyIPv4 || i.addressFamily == AddressFamilyDualStack {
-		if !server.PublicNet.IPv4.IP.IsUnspecified() {
-			addresses = append(
-				addresses,
-				v1.NodeAddress{Type: v1.NodeExternalIP, Address: server.PublicNet.IPv4.IP.String()},
-			)
-		}
-	}
-
 	n := os.Getenv(hcloudNetworkENVVar)
 	if len(n) > 0 {
 		network, _, _ := i.client.Network.Get(ctx, n)


Test patch:
diff --git a/hcloud/instances_test.go b/hcloud/instances_test.go
index faa80c56..7565f061 100644
--- a/hcloud/instances_test.go
+++ b/hcloud/instances_test.go
@@ -165,8 +165,8 @@ func TestNodeAddressesDualStack(t *testing.T) {
 	}
 	if len(addr) != 3 ||
 		addr[0].Type != v1.NodeHostName || addr[0].Address != "node15" ||
-		addr[1].Type != v1.NodeExternalIP || addr[1].Address != "2001:db8:1234::1" ||
-		addr[2].Type != v1.NodeExternalIP || addr[2].Address != "131.232.99.1" {
+		addr[1].Type != v1.NodeExternalIP || addr[1].Address != "131.232.99.1" ||
+		addr[2].Type != v1.NodeExternalIP || addr[2].Address != "2001:db8:1234::1" {
 		t.Errorf("Unexpected node addresses: %v", addr)
 	}
 }
Repository: bytecodealliance/wasmtime
Pull request #8698 (2024-05-28 16:39:20)

Allow empty block param lists in clif files
Allow block definitions to be parsed with empty parens, rather than requiring that there be a non-empty list of arguments if they're present.

```
function %f() {
block0():
    trap ud0
}
```

This is a pretty superficial change, but when iterating on clif files, it is nice to have to make fewer changes to get to a file that can make it through the pipeline.
<!--
Please make sure you include the following information:

- If this work has been discussed elsewhere, please include a link to that
  conversation. If it was discussed in an issue, just mention "issue #...".

- Explain why this change is needed. If the details are in an issue already,
  this can be brief.

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->



Patch:
diff --git a/cranelift/reader/src/parser.rs b/cranelift/reader/src/parser.rs
index 5947802b0..23ce76526 100644
--- a/cranelift/reader/src/parser.rs
+++ b/cranelift/reader/src/parser.rs
@@ -2043,14 +2043,19 @@ impl<'a> Parser<'a> {
         Ok(())
     }
 
-    // Parse parenthesized list of block parameters. Returns a vector of (u32, Type) pairs with the
-    // value numbers of the defined values and the defined types.
+    // Parse parenthesized list of block parameters.
     //
-    // block-params ::= * "(" block-param { "," block-param } ")"
+    // block-params ::= * "(" ( block-param { "," block-param } )? ")"
     fn parse_block_params(&mut self, ctx: &mut Context, block: Block) -> ParseResult<()> {
-        // block-params ::= * "(" block-param { "," block-param } ")"
+        // block-params ::= * "(" ( block-param { "," block-param } )? ")"
         self.match_token(Token::LPar, "expected '(' before block parameters")?;
 
+        // block-params ::= "(" * ")"
+        if self.token() == Some(Token::RPar) {
+            self.consume();
+            return Ok(());
+        }
+
         // block-params ::= "(" * block-param { "," block-param } ")"
         self.parse_block_param(ctx, block)?;
 


Test patch:
diff --git a/cranelift/filetests/filetests/parser/tiny.clif b/cranelift/filetests/filetests/parser/tiny.clif
index 8906141cb..900e3ff70 100644
--- a/cranelift/filetests/filetests/parser/tiny.clif
+++ b/cranelift/filetests/filetests/parser/tiny.clif
@@ -10,6 +10,16 @@ block0:
 ; nextln:     trap user0
 ; nextln: }
 
+; The same small function, but with empty parens on the first block.
+function %minimal_empty_parens() {
+block0():
+    trap user0
+}
+; sameln: function %minimal_empty_parens() fast {
+; nextln: block0:
+; nextln:     trap user0
+; nextln: }
+
 ; Create and use values.
 ; Polymorphic instructions with type suffix.
 function %ivalues() {
Repository: bytecodealliance/wasmtime
Pull request #8801 (2024-06-13 22:31:20)

Fix a typo in the `wasmtime_test` macro
Follow-up to: https://github.com/bytecodealliance/wasmtime/pull/8789; fixes the validation error message.

<!--
Please make sure you include the following information:

- If this work has been discussed elsewhere, please include a link to that
  conversation. If it was discussed in an issue, just mention "issue #...".

- Explain why this change is needed. If the details are in an issue already,
  this can be brief.

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->



Patch:
diff --git a/.github/workflows/publish-artifacts.yml b/.github/workflows/publish-artifacts.yml
index 191d0cc4f..f43b37233 100644
--- a/.github/workflows/publish-artifacts.yml
+++ b/.github/workflows/publish-artifacts.yml
@@ -30,16 +30,13 @@ jobs:
 
     - run: ./ci/merge-artifacts.sh
 
-    # Deploy the `gh-pages.tar.gz` artifact to the `gh-pages` branch.
-    - run: tar xf gh-pages.tar.gz
-      working-directory: gh-pages
-    - name: Deploy to gh-pages
-      uses: JamesIves/github-pages-deploy-action@v4
+    # also prepare to deploy GH pages on main
+    - if: github.ref == 'refs/heads/main'
+      uses: actions/configure-pages@v5
+    - if: github.ref == 'refs/heads/main'
+      uses: actions/upload-pages-artifact@v3
       with:
-        folder: ./gh-pages/gh-pages
-        single-commit: true
-        clean: true
-      if: github.ref == 'refs/heads/main'
+        path: "./gh-pages/gh-pages"
 
     - run: npm install --production
       working-directory: .github/actions/github-release
@@ -49,3 +46,19 @@ jobs:
         files: "dist/*"
         token: ${{ github.token }}
       continue-on-error: true
+
+  # See https://github.com/actions/deploy-pages
+  deploy:
+    name: Deploy gh-pages artifact
+    if: github.ref == 'refs/heads/main'
+    needs: publish
+    permissions:
+      pages: write
+      id-token: write
+    runs-on: ubuntu-latest
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    steps:
+      - id: deployment
+        uses: actions/deploy-pages@v4


Test patch:
diff --git a/crates/test-macros/src/lib.rs b/crates/test-macros/src/lib.rs
index 2a5560fd1..fcd68d406 100644
--- a/crates/test-macros/src/lib.rs
+++ b/crates/test-macros/src/lib.rs
@@ -97,7 +97,7 @@ impl TestConfig {
         })?;
 
         if self.wasm_features.len() > 2 {
-            return Err(meta.error("Expected at most 7 strategies"));
+            return Err(meta.error("Expected at most 2 off-by-default wasm features"));
         }
 
         if self.wasm_features_unsupported_by_winch {
Repository: elixir-ecto/ecto
Pull request #2201 (2017-09-02 19:52:42)

Support `prefix` in subqueries (#2200)
Just back-porting https://github.com/elixir-ecto/ecto/pull/2200 so that hopefully a `2.2.2` can go out at some point and I can get back onto the hex version :)



Patch:
diff --git a/lib/ecto/query.ex b/lib/ecto/query.ex
index 4c81240b..df2adf57 100644
--- a/lib/ecto/query.ex
+++ b/lib/ecto/query.ex
@@ -409,6 +409,11 @@ defmodule Ecto.Query do
       query = from Employee, order_by: [desc: :salary], limit: 10
       from e in subquery(query), select: avg(e.salary)
 
+  A prefix can be specified for a subquery, similar to standard repo operations:
+
+      query = from Employee, order_by: [desc: :salary], limit: 10
+      from e in subquery(query, prefix: "my_prefix"), select: avg(e.salary)
+
   Although subqueries are not allowed in WHERE expressions,
   most subqueries in WHERE expression can be rewritten as JOINs.
   Imagine you want to write this query:
@@ -438,12 +443,17 @@ defmodule Ecto.Query do
       end)
 
   """
-  def subquery(%Ecto.SubQuery{} = subquery),
-    do: subquery
-  def subquery(%Ecto.Query{} = query),
-    do: %Ecto.SubQuery{query: query}
-  def subquery(queryable),
-    do: %Ecto.SubQuery{query: Ecto.Queryable.to_query(queryable)}
+  def subquery(query, opts \\ []) do
+    subquery = wrap_in_subquery(query)
+    case Keyword.fetch(opts, :prefix) do
+      {:ok, prefix} when is_binary(prefix) -> put_in(subquery.query.prefix, prefix)
+      :error -> subquery
+    end
+  end
+
+  defp wrap_in_subquery(%Ecto.SubQuery{} = subquery), do: subquery
+  defp wrap_in_subquery(%Ecto.Query{} = query), do: %Ecto.SubQuery{query: query}
+  defp wrap_in_subquery(queryable), do: %Ecto.SubQuery{query: Ecto.Queryable.to_query(queryable)}
 
   @doc """
   Resets a previously set field on a query.


Test patch:
diff --git a/test/ecto/query_test.exs b/test/ecto/query_test.exs
index 3f71812d..5a471d61 100644
--- a/test/ecto/query_test.exs
+++ b/test/ecto/query_test.exs
@@ -83,6 +83,18 @@ defmodule Ecto.QueryTest do
       assert subquery(subquery("posts")).query.from == {"posts", nil}
       assert subquery(subquery("posts").query).query.from == {"posts", nil}
     end
+
+    test "prefix is not applied if left blank" do
+      assert subquery("posts").query.prefix == nil
+      assert subquery(subquery("posts")).query.prefix == nil
+      assert subquery(subquery("posts").query).query.prefix == nil
+    end
+
+    test "applies prefix to the subquery's query if provided" do
+      assert subquery("posts", prefix: "my_prefix").query.prefix == "my_prefix"
+      assert subquery(subquery("posts", prefix: "my_prefix")).query.prefix == "my_prefix"
+      assert subquery(subquery("posts", prefix: "my_prefix").query).query.prefix == "my_prefix"
+    end
   end
 
   describe "bindings" do
Repository: elixir-ecto/ecto
Pull request #2439 (2018-02-22 07:38:21)

Fix crash ecto.create/drop on log: false for mysql adapter
Fixed crash on ecto.create/drop with mysql.

I referred to https://github.com/elixir-ecto/ecto/commit/4d4f1cc5e586bbeb80e0c1b0eb2a3e1a8a1fa7f4 for this pull request.


ebert[bot]: Hello, @utah-KT! This is your first Pull Request that will be reviewed by [Ebert](https://ebertapp.io/), an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its [review page](https://ebertapp.io/github/elixir-ecto/ecto/pulls/2439). Please check our [documentation](https://docs.ebertapp.io) for more information. 

Patch:
diff --git a/lib/ecto/adapters/mysql.ex b/lib/ecto/adapters/mysql.ex
index 20434250..e2a412f2 100644
--- a/lib/ecto/adapters/mysql.ex
+++ b/lib/ecto/adapters/mysql.ex
@@ -284,7 +284,7 @@ defmodule Ecto.Adapters.MySQL do
 
     opts =
       opts
-      |> Keyword.delete(:name)
+      |> Keyword.drop([:name, :log])
       |> Keyword.put(:pool, DBConnection.Connection)
       |> Keyword.put(:backoff_type, :stop)
 


Test patch:
diff --git a/integration_test/mysql/storage_test.exs b/integration_test/mysql/storage_test.exs
index aec2198f..fd3ad205 100644
--- a/integration_test/mysql/storage_test.exs
+++ b/integration_test/mysql/storage_test.exs
@@ -8,9 +8,9 @@ defmodule Ecto.Integration.StorageTest do
   alias Ecto.Integration.TestRepo
 
   def params do
-    Ecto.Repo.Supervisor.parse_url(
-      Application.get_env(:ecto, :mysql_test_url) <> "/storage_mgt"
-    )
+    # Pass log false to ensure we can still create/drop.
+    url = Application.get_env(:ecto, :mysql_test_url) <> "/storage_mgt"
+    [log: false] ++ Ecto.Repo.Supervisor.parse_url(url)
   end
 
   def wrong_params do
Repository: elixir-ecto/ecto
Pull request #2513 (2018-04-15 15:56:34)

Multi.error skips transaction and directly returns error
Implementation of issue #2507 

If a error operation is part of the multi operations no transaction will get started and the error gets returned. The tests got changed to reflect the new behaviour.
I only changed the docs for `Multi.error`, the documentation for `Repo.transaction` could get changed too but I think that's not necessary.

Just give me a feedback if additional changes have to be made e.g. in the documentation.


Patch:
diff --git a/lib/ecto/multi.ex b/lib/ecto/multi.ex
index 50be2a5b..5e4b72e1 100644
--- a/lib/ecto/multi.ex
+++ b/lib/ecto/multi.ex
@@ -292,8 +292,8 @@ defmodule Ecto.Multi do
   Causes the multi to fail with the given value.
 
   Running the multi in a transaction will execute
-  all previous steps until this operation which
-  halt with the given `value`.
+  no previous steps and returns the value of the first
+  error added.
   """
   @spec error(t, name, error :: term) :: t
   def error(multi, name, value) do
@@ -410,6 +410,8 @@ defmodule Ecto.Multi do
 
   defp invalid_operation({name, {:changeset, %{valid?: false} = changeset, _}}),
     do: {:error, {name, changeset, %{}}}
+  defp invalid_operation({name, {:error, value}}),
+    do: {:error, {name, value, %{}}}
   defp invalid_operation(_operation),
     do: nil
 


Test patch:
diff --git a/test/ecto/multi_test.exs b/test/ecto/multi_test.exs
index 68c51783..97856c1b 100644
--- a/test/ecto/multi_test.exs
+++ b/test/ecto/multi_test.exs
@@ -369,24 +369,6 @@ defmodule Ecto.MultiTest do
       refute Map.has_key?(changes, :update)
     end
 
-    test "rolls back on error" do
-      changeset = Changeset.change(%Comment{id: 1}, x: 1)
-      multi =
-        Multi.new
-        |> Multi.insert(:insert, changeset)
-        |> Multi.error(:oops, "explicit error")
-        |> Multi.update(:update, changeset)
-        |> Multi.delete(:delete, changeset)
-
-      assert {:error, :oops, "explicit error", changes} = TestRepo.transaction(multi)
-      assert_received {:transaction, _}
-      assert_received {:rollback, _}
-      assert {:messages, [{:insert, {nil, "comments"}}]} == Process.info(self(), :messages)
-      assert %Comment{} = changes.insert
-      refute Map.has_key?(changes, :run)
-      refute Map.has_key?(changes, :update)
-    end
-
     test "rolls back from repo" do
       changeset = Changeset.change(%Comment{id: 1}, x: 1)
       invalid   = put_in(changeset.data.__meta__.context, {:invalid, [unique: "comments_x_index"]})
@@ -417,6 +399,13 @@ defmodule Ecto.MultiTest do
       assert invalid.data == changeset.data
       refute_received {:transaction, _}
     end
+
+    test "checks error operation before starting transaction" do
+      multi = Multi.new |> Multi.error(:invalid, "error")
+
+      assert {:error, :invalid, "error", %{}} = TestRepo.transaction(multi)
+      refute_received {:transaction, _}
+    end
   end
 
   describe "Multi.run receives the repo module as the first argument" do