nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: whatyouhide/redix
Pull request #100 (2018-06-27 10:19:57)

Make sure starting options is a keyword list
I accidentally put the connection uri as part of the options when starting some redix workers and got a `FunctionClauseError`. This PR checks that the options is a keyword list, maybe it can save someone else some time if they make the same mistake :)


Patch:
diff --git a/lib/redix/utils.ex b/lib/redix/utils.ex
index 8a3af4d..57d9ceb 100644
--- a/lib/redix/utils.ex
+++ b/lib/redix/utils.ex
@@ -115,6 +115,10 @@ defmodule Redix.Utils do
   end
 
   defp check_redis_opts(opts) when is_list(opts) do
+    unless Keyword.keyword?(opts) do
+      raise ArgumentError, "expected a keyword list as options, got: #{inspect(opts)}"
+    end
+
     Enum.each(opts, fn {option, _value} ->
       unless option in @redis_opts do
         raise ArgumentError,


Test patch:
diff --git a/test/redix/utils_test.exs b/test/redix/utils_test.exs
index 697501f..1f99e16 100644
--- a/test/redix/utils_test.exs
+++ b/test/redix/utils_test.exs
@@ -7,23 +7,38 @@ defmodule Redix.UtilsTest do
     assert format_host(%{opts: [host: 'example.com', port: 6379]}) == "example.com:6379"
   end
 
-  test "sanitize_starting_opts/2" do
-    redis_opts = [host: "foo.com"]
-    other_opts = [backoff_max: 0, sync_connect: true, name: :redix]
-    assert {redix_opts, connection_opts} = sanitize_starting_opts(redis_opts, other_opts)
-    assert redix_opts[:host] == 'foo.com'
-    assert redix_opts[:backoff_max] == 0
-    assert redix_opts[:sync_connect] == true
-    assert connection_opts[:name] == :redix
-
-    assert_raise ArgumentError, ~r/unknown Redis connection option: :foo/, fn ->
-      sanitize_starting_opts([foo: 1], [])
+  describe "sanitize_starting_opts/2" do
+    test "correct options are parsed" do
+      redis_opts = [host: "foo.com"]
+      other_opts = [backoff_max: 0, sync_connect: true, name: :redix]
+
+      assert {redix_opts, connection_opts} = sanitize_starting_opts(redis_opts, other_opts)
+      assert redix_opts[:host] == 'foo.com'
+      assert redix_opts[:backoff_max] == 0
+      assert redix_opts[:sync_connect] == true
+      assert connection_opts[:name] == :redix
+    end
+
+    test "raise ArgumentError on unknown option" do
+      assert_raise ArgumentError, ~r/unknown Redis connection option: :foo/, fn ->
+        sanitize_starting_opts([foo: 1], [])
+      end
+    end
+
+    test "raise ArgumentError on incorrect type" do
+      message = "expected an integer as the value of the :port option, got: %{}"
+
+      assert_raise ArgumentError, message, fn ->
+        sanitize_starting_opts([port: %{}], [])
+      end
     end
 
-    message = "expected an integer as the value of the :port option, got: %{}"
+    test "raise ArgumentError on non-keyword list" do
+      message = "expected a keyword list as options, got: [\"foo.com\"]"
 
-    assert_raise ArgumentError, message, fn ->
-      sanitize_starting_opts([port: %{}], [])
+      assert_raise ArgumentError, message, fn ->
+        sanitize_starting_opts(["foo.com"], [])
+      end
     end
   end
 end
Repository: whatyouhide/redix
Pull request #114 (2018-12-04 17:19:36)

Update log message when failing to connect to sentinel


Patch:
diff --git a/lib/redix/connector.ex b/lib/redix/connector.ex
index f16ac92..b94caaf 100644
--- a/lib/redix/connector.ex
+++ b/lib/redix/connector.ex
@@ -102,8 +102,7 @@ defmodule Redix.Connector do
 
       {:error, reason} ->
         log(opts, :failed_connection, fn ->
-          "Couldn't connect to #{sentinel_opts[:role]} through #{format_host(sentinel)}: " <>
-            inspect(reason)
+          "Couldn't connect to sentinel #{format_host(sentinel)}: #{inspect(reason)}"
         end)
 
         connect_through_sentinel(rest, sentinel_opts, opts, transport)


Test patch:
diff --git a/test/redix/sentinel_test.exs b/test/redix/sentinel_test.exs
index 227673f..f6062e7 100644
--- a/test/redix/sentinel_test.exs
+++ b/test/redix/sentinel_test.exs
@@ -64,7 +64,7 @@ defmodule Redix.SentinelTest do
                         %Redix.ConnectionError{reason: :no_viable_sentinel_connection}}
       end)
 
-    assert log =~ "Couldn't connect to primary through nonexistent:9999: :nxdomain"
+    assert log =~ "Couldn't connect to sentinel nonexistent:9999: :nxdomain"
   end
 
   test "sentinel supports password", %{sentinel_config: sentinel_config} do
Repository: whatyouhide/redix
Pull request #167 (2020-04-02 18:39:40)

Adapt to telemetry span exception event name convention
The `telemetry:span` convention specifies that `:exception` is used in exception cases instead of `:stop` events... This PR simply corrects the event name for exception cases.

* https://github.com/beam-telemetry/telemetry/issues/57

@whatyouhide @keathley @GregMefford @josevalim


Patch:
diff --git a/lib/redix.ex b/lib/redix.ex
index da366e6..3aa74ef 100644
--- a/lib/redix.ex
+++ b/lib/redix.ex
@@ -807,7 +807,9 @@ defmodule Redix do
           |> Map.put(:reason, reason)
           |> Map.put(:kind, :error)
 
-        :ok = :telemetry.execute([:redix, :pipeline, :stop], measurements, telemetry_metadata)
+        :ok =
+          :telemetry.execute([:redix, :pipeline, :exception], measurements, telemetry_metadata)
+
         {:error, reason}
     end
   end


Test patch:
diff --git a/test/redix_test.exs b/test/redix_test.exs
index 860f234..7e1bf5f 100644
--- a/test/redix_test.exs
+++ b/test/redix_test.exs
@@ -553,7 +553,7 @@ defmodule RedixTest do
 
       handler = fn event, measurements, meta, _config ->
         if meta.connection == c do
-          assert event == [:redix, :pipeline, :stop]
+          assert event == [:redix, :pipeline, :exception]
           assert is_integer(measurements.duration)
           assert meta.commands == [["PING"], ["PING"]]
           assert meta.kind == :error
@@ -563,7 +563,12 @@ defmodule RedixTest do
         send(parent, ref)
       end
 
-      :telemetry.attach(to_string(test_name), [:redix, :pipeline, :stop], handler, :no_config)
+      :telemetry.attach(
+        to_string(test_name),
+        [:redix, :pipeline, :exception],
+        handler,
+        :no_config
+      )
 
       assert {:error, %ConnectionError{reason: :timeout}} =
                Redix.pipeline(c, [~w(PING), ~w(PING)], timeout: 0)
Repository: whatyouhide/redix
Pull request #170 (2020-04-04 14:21:44)

Revert "Adapt to telemetry span exception event name convention"
Reverts whatyouhide/redix#167.


Patch:
diff --git a/lib/redix.ex b/lib/redix.ex
index 3aa74ef..da366e6 100644
--- a/lib/redix.ex
+++ b/lib/redix.ex
@@ -807,9 +807,7 @@ defmodule Redix do
           |> Map.put(:reason, reason)
           |> Map.put(:kind, :error)
 
-        :ok =
-          :telemetry.execute([:redix, :pipeline, :exception], measurements, telemetry_metadata)
-
+        :ok = :telemetry.execute([:redix, :pipeline, :stop], measurements, telemetry_metadata)
         {:error, reason}
     end
   end


Test patch:
diff --git a/test/redix_test.exs b/test/redix_test.exs
index 7e1bf5f..860f234 100644
--- a/test/redix_test.exs
+++ b/test/redix_test.exs
@@ -553,7 +553,7 @@ defmodule RedixTest do
 
       handler = fn event, measurements, meta, _config ->
         if meta.connection == c do
-          assert event == [:redix, :pipeline, :exception]
+          assert event == [:redix, :pipeline, :stop]
           assert is_integer(measurements.duration)
           assert meta.commands == [["PING"], ["PING"]]
           assert meta.kind == :error
@@ -563,12 +563,7 @@ defmodule RedixTest do
         send(parent, ref)
       end
 
-      :telemetry.attach(
-        to_string(test_name),
-        [:redix, :pipeline, :exception],
-        handler,
-        :no_config
-      )
+      :telemetry.attach(to_string(test_name), [:redix, :pipeline, :stop], handler, :no_config)
 
       assert {:error, %ConnectionError{reason: :timeout}} =
                Redix.pipeline(c, [~w(PING), ~w(PING)], timeout: 0)
Repository: woylie/doggo
Pull request #282 (2024-06-24 05:40:36)

replace h2 with p


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c1f1d59..e45bb52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
 
 - Allow to set required text and required title attributes for input and label.
 - Require `live_view ~> 1.0.0-rc.0`.
+- Don't use `h2` for `Doggo.page_header/1` sub title.
 
 ## [0.5.0] - 2024-02-12
 
diff --git a/lib/doggo.ex b/lib/doggo.ex
index d2d74a2..be5a594 100644
--- a/lib/doggo.ex
+++ b/lib/doggo.ex
@@ -4633,7 +4633,7 @@ defmodule Doggo do
     <header class={["page-header" | List.wrap(@class)]} {@rest}>
       <div class="page-header-title">
         <h1><%= @title %></h1>
-        <h2 :if={@subtitle}><%= @subtitle %></h2>
+        <p :if={@subtitle}><%= @subtitle %></p>
       </div>
       <div :if={@action != []} class="page-header-actions">
         <%= for action <- @action do %>


Test patch:
diff --git a/test/doggo_test.exs b/test/doggo_test.exs
index 1b8e13f..c282952 100644
--- a/test/doggo_test.exs
+++ b/test/doggo_test.exs
@@ -4650,7 +4650,7 @@ defmodule DoggoTest do
         <Doggo.page_header title="Pets" subtitle="All of them" />
         """)
 
-      assert text(html, ":root > .page-header-title > h2") == "All of them"
+      assert text(html, ":root > .page-header-title > p") == "All of them"
     end
 
     test "with action" do
Repository: woylie/flop_phoenix
Pull request #225 (2023-07-07 21:06:27)

Update table component to allow passage of opts[:thead_attrs]
This pull request enables the passage of custom attributes to the `thead` element of flop_phoenix tables via `opts[:thead_attrs]`, which is particularly useful for custom styling, and is consistent with the `opts[:tbody_attrs]` option

**Checklist**

- [x] I added tests that cover my proposed changes.
- [x] I updated the documentation related to my changes (if applicable).



Patch:
diff --git a/lib/flop_phoenix.ex b/lib/flop_phoenix.ex
index dd0f4a9..85d349f 100644
--- a/lib/flop_phoenix.ex
+++ b/lib/flop_phoenix.ex
@@ -242,6 +242,8 @@ defmodule Flop.Phoenix do
     `<table>`. Default: `#{inspect(Table.default_opts()[:tbody_attrs])}`.
   - `:tbody_td_attrs`: Attributes to be added to each `<td>` tag within the
     `<tbody>`. Default: `#{inspect(Table.default_opts()[:tbody_td_attrs])}`.
+  - `:thead_attrs`: Attributes to be added to the `<thead>` tag within the
+    `<table>`. Default: `#{inspect(Table.default_opts()[:thead_attrs])}`.
   - `:tbody_tr_attrs`: Attributes to be added to each `<tr>` tag within the
     `<tbody>`. Default: `#{inspect(Table.default_opts()[:tbody_tr_attrs])}`.
   - `:thead_th_attrs`: Attributes to be added to each `<th>` tag within the
@@ -259,6 +261,7 @@ defmodule Flop.Phoenix do
           | {:symbol_unsorted, Phoenix.HTML.safe() | binary}
           | {:table_attrs, keyword}
           | {:tbody_attrs, keyword}
+          | {:thead_attrs, keyword}
           | {:tbody_td_attrs, keyword}
           | {:tbody_tr_attrs, keyword}
           | {:th_wrapper_attrs, keyword}
diff --git a/lib/flop_phoenix/table.ex b/lib/flop_phoenix/table.ex
index f1f361e..1eb85b8 100644
--- a/lib/flop_phoenix/table.ex
+++ b/lib/flop_phoenix/table.ex
@@ -72,6 +72,7 @@ defmodule Flop.Phoenix.Table do
       tbody_attrs: [],
       tbody_td_attrs: [],
       tbody_tr_attrs: [],
+      thead_attrs: [],
       th_wrapper_attrs: [],
       thead_th_attrs: [],
       thead_tr_attrs: []
@@ -140,7 +141,7 @@ defmodule Flop.Phoenix.Table do
           <col :if={show_column?(action)} style={action[:col_style]} />
         <% end %>
       </colgroup>
-      <thead>
+      <thead {@opts[:thead_attrs]}>
         <tr {@opts[:thead_tr_attrs]}>
           <%= for col <- @col do %>
             <.header_column


Test patch:
diff --git a/test/flop_phoenix_test.exs b/test/flop_phoenix_test.exs
index 6e84975..6507155 100644
--- a/test/flop_phoenix_test.exs
+++ b/test/flop_phoenix_test.exs
@@ -1454,6 +1454,18 @@ defmodule Flop.PhoenixTest do
       assert [_] = Floki.find(html, "tbody.mango_body")
     end
 
+    test "setting thead attributes" do
+      html =
+        render_table(
+          opts: [
+            thead_attrs: [class: "text-left text-zinc-500 leading-6"],
+            container: true
+          ]
+        )
+
+      assert [_] = Floki.find(html, "thead.text-left.text-zinc-500.leading-6")
+    end
+
     test "allows to set id on tbody" do
       html = render_table(id: "some-id")
       assert [_] = Floki.find(html, "tbody#some-id")
Repository: woylie/flop_phoenix
Pull request #355 (2024-07-08 06:44:21)

Fix pagination_list_item_attrs missing from right ellipsis list item
This commit adds the `pagination_list_item_attrs` option to the right ellipsis list item.
The test to cover this only verified that the first list child had the assigned options.
I've changed it to verify all list items, and added opts to trigger ellipsis rendering.

This was missing from the #337 PR that introduced `pagination_list_item_attrs`.


Patch:
diff --git a/lib/flop_phoenix.ex b/lib/flop_phoenix.ex
index 75b506f..5ee49d7 100644
--- a/lib/flop_phoenix.ex
+++ b/lib/flop_phoenix.ex
@@ -534,7 +534,7 @@ defmodule Flop.Phoenix do
         </.pagination_link>
       </li>
 
-      <li :if={@last < @meta.total_pages - 1}>
+      <li :if={@last < @meta.total_pages - 1} {@opts[:pagination_list_item_attrs]}>
         <span {@opts[:ellipsis_attrs]}><%= @opts[:ellipsis_content] %></span>
       </li>
 


Test patch:
diff --git a/test/flop_phoenix_test.exs b/test/flop_phoenix_test.exs
index 499fc49..d99c91f 100644
--- a/test/flop_phoenix_test.exs
+++ b/test/flop_phoenix_test.exs
@@ -604,19 +604,22 @@ defmodule Flop.PhoenixTest do
     end
 
     test "allows to overwrite pagination list item attributes" do
-      assigns = %{meta: build(:meta_on_first_page)}
+      assigns = %{
+        meta: build(:meta_on_first_page, current_page: 12, total_pages: 20),
+        opts: [
+          page_links: {:ellipsis, 6},
+          pagination_list_item_attrs: [class: "p-list-item"]
+        ]
+      }
 
       html =
         parse_heex(~H"""
-        <Flop.Phoenix.pagination
-          meta={@meta}
-          path="/pets"
-          opts={[pagination_list_item_attrs: [class: "p-list-item"]]}
-        />
+        <Flop.Phoenix.pagination meta={@meta} path="/pets" opts={@opts} />
         """)
 
-      assert list_item = find_one(html, "ul li:first-child")
-      assert attribute(list_item, "class") == "p-list-item"
+      for list_item <- Floki.find(html, "ul li") do
+        assert attribute(list_item, "class") == "p-list-item"
+      end
     end
 
     test "allows to overwrite pagination link attributes" do
Repository: woylie/flop_phoenix
Pull request #478 (2025-06-25 08:40:43)

override maxlength
- **allow overriding the maxlength attribute of filter value text inputs**
- **bump version**



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1ef4af6..fd994be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
 
 ## Unreleased
 
+## [0.25.2] - 2025-06-25
+
+### Fixed
+
+- Allow overriding `maxlength` attribute in filter value field.
+
 ## [0.25.1] - 2025-05-05
 
 ### Fixed
diff --git a/README.md b/README.md
index 17d97d1..c232be1 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ application.
 ```elixir
 def deps do
   [
-    {:flop_phoenix, "~> 0.25.1"}
+    {:flop_phoenix, "~> 0.25.2"}
   ]
 end
 ```
diff --git a/lib/flop_phoenix/form_data.ex b/lib/flop_phoenix/form_data.ex
index 17588b9..940d33c 100644
--- a/lib/flop_phoenix/form_data.ex
+++ b/lib/flop_phoenix/form_data.ex
@@ -274,7 +274,9 @@ defimpl Phoenix.HTML.FormData, for: Flop.Meta do
   end
 
   def input_validations(_meta, %{options: options}, :value) do
-    if options[:type] == "text", do: [maxlength: 100], else: []
+    if options[:type] == "text",
+      do: [maxlength: Keyword.get(options, :maxlength, 100)],
+      else: []
   end
 
   def input_validations(_meta, _form, _field), do: []
diff --git a/mix.exs b/mix.exs
index 3c9024f..8aa8ebc 100644
--- a/mix.exs
+++ b/mix.exs
@@ -2,7 +2,7 @@ defmodule FlopPhoenix.MixProject do
   use Mix.Project
 
   @source_url "https://github.com/woylie/flop_phoenix"
-  @version "0.25.1"
+  @version "0.25.2"
 
   def project do
     [


Test patch:
diff --git a/test/flop/form_data_test.exs b/test/flop/form_data_test.exs
index a98484f..7341b30 100644
--- a/test/flop/form_data_test.exs
+++ b/test/flop/form_data_test.exs
@@ -604,6 +604,19 @@ defmodule Flop.Phoenix.FormDataTest do
         assert input_validations(filter_form, :value) == [maxlength: 100]
       end
     end
+
+    test "can override text input maxlength" do
+      meta =
+        build(:meta_on_first_page,
+          flop: %Flop{filters: []},
+          schema: __MODULE__.TestSchema
+        )
+
+      opts = [fields: [string: [type: "text", maxlength: 20]]]
+      form = FormData.to_form(meta, [])
+      assert [filter_form] = FormData.to_form(meta, form, :filters, opts)
+      assert input_validations(filter_form, :value) == [maxlength: 20]
+    end
   end
 
   describe "input_value/2" do