PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: zeromicro/go-zero (go)

Issue:
http timeout error not handled by the customized error handler
go-zero 的 http 超时不会走自定义的错误处理，希望能全部自定义处理，可以参考下 echo 默认 有个 HTTPErrorHandler 错误处理器, 在初始化的时候自己实现一个 HTTPErrorHandler，然后做一些自定义的东西
https://github.com/labstack/echo/blob/9fc4672195953a79193c10508c168ab563e842c8/echo.go#L662

Pull request:
fix #1070

Patch:
diff --git a/rest/handler/timeouthandler.go b/rest/handler/timeouthandler.go
index 1b9532cf..aab564a3 100644
--- a/rest/handler/timeouthandler.go
+++ b/rest/handler/timeouthandler.go
@@ -13,6 +13,7 @@ import (
 	"sync"
 	"time"
 
+	"github.com/tal-tech/go-zero/rest/httpx"
 	"github.com/tal-tech/go-zero/rest/internal"
 )
 
@@ -91,12 +92,14 @@ func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		defer tw.mu.Unlock()
 		// there isn't any user-defined middleware before TimoutHandler,
 		// so we can guarantee that cancelation in biz related code won't come here.
-		if errors.Is(ctx.Err(), context.Canceled) {
-			w.WriteHeader(statusClientClosedRequest)
-		} else {
-			w.WriteHeader(http.StatusServiceUnavailable)
-		}
-		io.WriteString(w, h.errorBody())
+		httpx.Error(w, ctx.Err(), func(w http.ResponseWriter, err error) {
+			if errors.Is(err, context.Canceled) {
+				w.WriteHeader(statusClientClosedRequest)
+			} else {
+				w.WriteHeader(http.StatusServiceUnavailable)
+			}
+			io.WriteString(w, h.errorBody())
+		})
 		tw.timedOut = true
 	}
 }
diff --git a/rest/httpx/responses.go b/rest/httpx/responses.go
index 055f521b..ef1ebc0a 100644
--- a/rest/httpx/responses.go
+++ b/rest/httpx/responses.go
@@ -14,13 +14,17 @@ var (
 )
 
 // Error writes err into w.
-func Error(w http.ResponseWriter, err error) {
+func Error(w http.ResponseWriter, err error, fns ...func(w http.ResponseWriter, err error)) {
 	lock.RLock()
 	handler := errorHandler
 	lock.RUnlock()
 
 	if handler == nil {
-		http.Error(w, err.Error(), http.StatusBadRequest)
+		if len(fns) > 0 {
+			fns[0](w, err)
+		} else {
+			http.Error(w, err.Error(), http.StatusBadRequest)
+		}
 		return
 	}
 
diff --git a/tools/goctl/api/apigen/gen.go b/tools/goctl/api/apigen/gen.go
index b4c7ea09..fcf352c4 100644
--- a/tools/goctl/api/apigen/gen.go
+++ b/tools/goctl/api/apigen/gen.go
@@ -52,7 +52,6 @@ func ApiCommand(c *cli.Context) error {
 	}
 	defer fp.Close()
 
-
 	home := c.String("home")
 	remote := c.String("remote")
 	if len(remote) > 0 {


Test patch:
diff --git a/rest/httpx/responses_test.go b/rest/httpx/responses_test.go
index adb94c79..17d14d66 100644
--- a/rest/httpx/responses_test.go
+++ b/rest/httpx/responses_test.go
@@ -95,6 +95,18 @@ func TestError(t *testing.T) {
 	}
 }
 
+func TestErrorWithHandler(t *testing.T) {
+	w := tracedResponseWriter{
+		headers: make(map[string][]string),
+	}
+	Error(&w, errors.New("foo"), func(w http.ResponseWriter, err error) {
+		http.Error(w, err.Error(), 499)
+	})
+	assert.Equal(t, 499, w.code)
+	assert.True(t, w.hasBody)
+	assert.Equal(t, "foo", strings.TrimSpace(w.builder.String()))
+}
+
 func TestOk(t *testing.T) {
 	w := tracedResponseWriter{
 		headers: make(map[string][]string),
Repository: vazco/uniforms (ts)

Issue:
SemanticUI BoolField is missing wrapClassName
<!--
  Before you open an issue, please check if a similar one already exists or has been closed before.
  We will be grateful for using our reproduction sandbox available at
  https://codesandbox.io/s/github/vazco/uniforms/tree/master/reproductions
  whenever a code sample is presented for debugging purposes.
-->


Pull request:
Update semantic BoolField (fixes #680, #681).
This pull request fixes #680 and #681 by introducing `wrapClassName` prop into `BoolField` and logic for adding _fitted_ class name  if `label` prop is falsy (instead of only if `label` is `undefined`, not passed). This last functionality differs from the one specified [here](https://react.semantic-ui.com/modules/checkbox/#variations-fitted).

Patch:
diff --git a/packages/uniforms-semantic/src/BoolField.tsx b/packages/uniforms-semantic/src/BoolField.tsx
index 14498580..3360c870 100644
--- a/packages/uniforms-semantic/src/BoolField.tsx
+++ b/packages/uniforms-semantic/src/BoolField.tsx
@@ -15,13 +15,21 @@ const Bool = ({
   required,
   showInlineError,
   value,
+  wrapClassName,
   ...props
 }) => (
   <div
     className={classnames(className, { disabled, error, required }, 'field')}
     {...filterDOMProps(props)}
   >
-    <div className="ui checkbox">
+    <div
+      className={classnames(
+        'ui',
+        wrapClassName,
+        !label && 'fitted',
+        'checkbox',
+      )}
+    >
       <input
         checked={value}
         className="hidden"
@@ -33,7 +41,7 @@ const Bool = ({
         type="checkbox"
       />
 
-      <label htmlFor={id}>{label}</label>
+      {!!label && <label htmlFor={id}>{label}</label>}
     </div>
 
     {!!(error && showInlineError) && (


Test patch:
diff --git a/packages/uniforms-semantic/__tests__/BoolField.tsx b/packages/uniforms-semantic/__tests__/BoolField.tsx
index b0e83b90..7095ce27 100644
--- a/packages/uniforms-semantic/__tests__/BoolField.tsx
+++ b/packages/uniforms-semantic/__tests__/BoolField.tsx
@@ -175,3 +175,26 @@ test('<BoolField> - renders correct error text (showInlineError=false)', () => {
       .text(),
   ).not.toBe('Error');
 });
+
+test('<BoolField> - renders with a custom wrapClassName', () => {
+  const element = <BoolField name="x" wrapClassName="test-class-name" />;
+  const wrapper = mount(element, createContext({ x: { type: String } }));
+
+  expect(wrapper.find('.ui.test-class-name')).toHaveLength(1);
+});
+
+test('<BoolField> - renders with a `fitted` className when `label` is disabled', () => {
+  const element = <BoolField name="x" />;
+  const wrapper = mount(element, createContext({ x: { type: String } }));
+
+  const found = wrapper.find('.ui');
+  expect(found.hasClass('fitted')).toEqual(true);
+});
+
+test('<BoolField> - renders without a `fitted` className when `label` is enabled', () => {
+  const element = <BoolField name="x" label />;
+  const wrapper = mount(element, createContext({ x: { type: String } }));
+
+  const found = wrapper.find('.ui');
+  expect(found.hasClass('fitted')).toEqual(false);
+});
Repository: bpicode/fritzctl (go)

Issue:
Error: fritzctl temperature
When using the command "fritzctl temperature x x" with an temperature above 28 degrees the script is giving out an error instead of showing a message with the allowed temperature range.

Pull request:
Issue #57: check for valid temperature values before apply
Closes #57 

Patch:
diff --git a/fritz/aha.go b/fritz/aha.go
index db9bc4e..641a370 100644
--- a/fritz/aha.go
+++ b/fritz/aha.go
@@ -67,12 +67,14 @@ func (aha *ahaHTTP) Toggle(ain string) (string, error) {
 
 // ApplyTemperature sets the desired temperature on a "HKR" device. The device is identified by its AIN.
 func (aha *ahaHTTP) ApplyTemperature(value float64, ain string) (string, error) {
-	doubledValue := 2 * value
-	rounded := round(doubledValue)
+	param, err := temperatureParam(value)
+	if err != nil {
+		return "", err
+	}
 	url := aha.homeAutoSwitch().
 		query("ain", ain).
 		query("switchcmd", "sethkrtsoll").
-		query("param", fmt.Sprintf("%d", rounded)).
+		query("param", fmt.Sprintf("%d", param)).
 		build()
 	return httpread.ReadFullyString(aha.getf(url))
 }
@@ -103,6 +105,16 @@ func (aha *ahaHTTP) homeAutoSwitch() fritzURLBuilder {
 	return newURLBuilder(aha.client.Config).path(homeAutomationURI).query("sid", aha.client.SessionInfo.SID)
 }
 
+func temperatureParam(t float64) (int64, error) {
+	doubled := round(2 * t)
+	regular := doubled >= 16 && doubled <= 56
+	special := doubled == 253 || doubled == 254
+	if ! (regular || special) {
+		return 0, fmt.Errorf("invalid temperature value: %.1f°C is not contained in the set of acceptable values: 8-28°C, 126.5, 127", t)
+	}
+	return doubled, nil
+}
+
 // round rounds a float64 value to an integer.
 func round(v float64) int64 {
 	return int64(v + 0.5)


Test patch:
diff --git a/fritz/aha_test.go b/fritz/aha_test.go
index de9a70f..1f9fe05 100644
--- a/fritz/aha_test.go
+++ b/fritz/aha_test.go
@@ -109,3 +109,15 @@ func TestRounding(t *testing.T) {
 		})
 	}
 }
+
+// TestUnacceptableTempValues asserts that temperatures outside the range of the spec are perceived as invalid.
+func TestUnacceptableTempValues(t *testing.T) {
+	assertions := assert.New(t)
+	h := HomeAutomation(nil)
+
+	_, err := h.ApplyTemperature(7.5, "1235")
+	assertions.Error(err)
+
+	_, err = h.ApplyTemperature(55, "1235")
+	assertions.Error(err)
+}