nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: VictoriaMetrics/VictoriaMetrics
Pull request #1261 (2021-05-03 01:48:29)

adds stalePartsRemover
for new created partitions


Patch:
diff --git a/lib/storage/partition.go b/lib/storage/partition.go
index 4bf6f833b..7a6327f64 100644
--- a/lib/storage/partition.go
+++ b/lib/storage/partition.go
@@ -229,6 +229,7 @@ func createPartition(timestamp int64, smallPartitionsPath, bigPartitionsPath str
 	pt.startMergeWorkers()
 	pt.startRawRowsFlusher()
 	pt.startInmemoryPartsFlusher()
+	pt.startStalePartsRemover()
 
 	logger.Infof("partition %q has been created", name)
 


Test patch:
diff --git a/lib/promrelabel/relabel_test.go b/lib/promrelabel/relabel_test.go
index c8033877a..58c51c81e 100644
--- a/lib/promrelabel/relabel_test.go
+++ b/lib/promrelabel/relabel_test.go
@@ -121,6 +121,56 @@ func TestApplyRelabelConfigs(t *testing.T) {
 			},
 		})
 	})
+	t.Run("replace-remove-label-value-hit", func(t *testing.T) {
+		f(`
+- action: replace
+  source_labels: ["foo"]
+  target_label: "foo"
+  regex: "xxx"
+  replacement: ""
+`, []prompbmarshal.Label{
+			{
+				Name:  "foo",
+				Value: "xxx",
+			},
+			{
+				Name:  "bar",
+				Value: "baz",
+			},
+		}, false, []prompbmarshal.Label{
+			{
+				Name:  "bar",
+				Value: "baz",
+			},
+		})
+	})
+	t.Run("replace-remove-label-value-miss", func(t *testing.T) {
+		f(`
+- action: replace
+  source_labels: ["foo"]
+  target_label: "foo"
+  regex: "xxx"
+  replacement: ""
+`, []prompbmarshal.Label{
+			{
+				Name:  "foo",
+				Value: "yyy",
+			},
+			{
+				Name:  "bar",
+				Value: "baz",
+			},
+		}, false, []prompbmarshal.Label{
+			{
+				Name:  "bar",
+				Value: "baz",
+			},
+			{
+				Name:  "foo",
+				Value: "yyy",
+			},
+		})
+	})
 	t.Run("replace-hit-target-label-with-capture-group", func(t *testing.T) {
 		f(`
 - action: replace
Repository: VictoriaMetrics/VictoriaMetrics
Pull request #439 (2020-04-26 10:39:06)

vmalert - validate template in labels

kreedom: build failed due to d7c1ff8b0c6df29a65b1331af5df463401e6575a


Patch:
diff --git a/app/vmalert/config.go b/app/vmalert/config.go
index 34dd99e54..aabd6ff2d 100644
--- a/app/vmalert/config.go
+++ b/app/vmalert/config.go
@@ -40,7 +40,10 @@ func Parse(pathPatterns []string, validateAnnotations bool) ([]Group, error) {
 				rule.alerts = make(map[uint64]*notifier.Alert)
 				if validateAnnotations {
 					if err = notifier.ValidateAnnotations(rule.Annotations); err != nil {
-						return nil, fmt.Errorf("invalida annotations filepath:%s, group %s:%w", file, group.Name, err)
+						return nil, fmt.Errorf("invalid annotations filepath:%s, group %s:%w", file, group.Name, err)
+					}
+					if err = notifier.ValidateAnnotations(rule.Labels); err != nil {
+						return nil, fmt.Errorf("invalid labels filepath:%s, group %s:%w", file, group.Name, err)
 					}
 				}
 				rule.group = &group


Test patch:
diff --git a/app/vmalert/config_test.go b/app/vmalert/config_test.go
index 6eaabb3b6..057d1ab8b 100644
--- a/app/vmalert/config_test.go
+++ b/app/vmalert/config_test.go
@@ -30,6 +30,9 @@ func TestParseBad(t *testing.T) {
 	if _, err := Parse([]string{"testdata/dir/rules1-bad.rules"}, true); err == nil {
 		t.Errorf("expected same group error")
 	}
+	if _, err := Parse([]string{"testdata/dir/rules2-bad.rules"}, true); err == nil {
+		t.Errorf("expected template label error")
+	}
 	if _, err := Parse([]string{"testdata/*.yaml"}, true); err == nil {
 		t.Errorf("expected empty group")
 	}
diff --git a/app/vmalert/testdata/dir/rules2-bad.rules b/app/vmalert/testdata/dir/rules2-bad.rules
new file mode 100644
index 000000000..57ed21357
--- /dev/null
+++ b/app/vmalert/testdata/dir/rules2-bad.rules
@@ -0,0 +1,11 @@
+groups:
+  - name: group
+    rules:
+      - alert: UnkownLabelFunction
+        for: 5m
+        expr: vm_rows > 0
+        labels:
+          label: bar
+          summary: "{{ value|query }}"
+        annotations:
+          description: "{{$labels}}"
diff --git a/app/vmalert/testdata/rules0-good.rules b/app/vmalert/testdata/rules0-good.rules
index 6419f3c92..ddb55a1d8 100644
--- a/app/vmalert/testdata/rules0-good.rules
+++ b/app/vmalert/testdata/rules0-good.rules
@@ -6,6 +6,7 @@ groups:
         expr: vm_rows > 0
         labels:
           label: bar
+          template: "{{ $value|humanize }}"
         annotations:
           summary: "{{ $value|humanize }}"
           description: "{{$labels}}"
Repository: VictoriaMetrics/VictoriaMetrics
Pull request #510 (2020-05-20 18:42:46)

vmalert add quotes escape function

hagen1778: lgtm!

Patch:
diff --git a/app/vmalert/notifier/template_func.go b/app/vmalert/notifier/template_func.go
index 88547d1a5..abfd8fc91 100644
--- a/app/vmalert/notifier/template_func.go
+++ b/app/vmalert/notifier/template_func.go
@@ -148,6 +148,9 @@ func InitTemplateFunc(externalURL *url.URL) {
 		"queryEscape": func(q string) string {
 			return url.QueryEscape(q)
 		},
+		"quotesEscape": func(q string) string {
+			return strings.Replace(q, `"`, `\"`, -1)
+		},
 	}
 }
 


Test patch:
diff --git a/app/vmalert/notifier/alert_test.go b/app/vmalert/notifier/alert_test.go
index 6612891b2..3cd032d6a 100644
--- a/app/vmalert/notifier/alert_test.go
+++ b/app/vmalert/notifier/alert_test.go
@@ -52,15 +52,15 @@ func TestAlert_ExecTemplate(t *testing.T) {
 		{
 			name: "expression-template",
 			alert: &Alert{
-				Expr: "vm_rows>0",
+				Expr: `vm_rows{"label"="bar"}>0`,
 			},
 			annotations: map[string]string{
-				"exprEscapedQuery": "{{ $expr|queryEscape }}",
-				"exprEscapedPath":  "{{ $expr|pathEscape }}",
+				"exprEscapedQuery": "{{ $expr|quotesEscape|queryEscape }}",
+				"exprEscapedPath":  "{{ $expr|quotesEscape|pathEscape }}",
 			},
 			expTpl: map[string]string{
-				"exprEscapedQuery": "vm_rows%3E0",
-				"exprEscapedPath":  "vm_rows%3E0",
+				"exprEscapedQuery": "vm_rows%7B%5C%22label%5C%22%3D%5C%22bar%5C%22%7D%3E0",
+				"exprEscapedPath":  "vm_rows%7B%5C%22label%5C%22=%5C%22bar%5C%22%7D%3E0",
 			},
 		},
 	}
Repository: VictoriaMetrics/VictoriaMetrics
Pull request #872 (2020-10-30 05:17:22)

Fix InfluxDB support on docker-compose deployment.
This is necessary for Proxmox VE External Metric Server support.
https://pve.proxmox.com/wiki/External_Metric_Server

Additionally created Grafana Dashboard for monitoring Proxmox VE hosts.
https://grafana.com/grafana/dashboards/13307

PS: Sorry, I didn't check with InfluxDB in the previous PR. My fall.


Patch:
diff --git a/app/vmalert/alerting.go b/app/vmalert/alerting.go
index 7e11ad850..51eee637f 100644
--- a/app/vmalert/alerting.go
+++ b/app/vmalert/alerting.go
@@ -403,7 +403,7 @@ func (ar *AlertingRule) Restore(ctx context.Context, q datasource.Querier, lookb
 		labelsFilter += fmt.Sprintf(",%s=%q", k, v)
 	}
 
-	// Get the last datapoint in range via MetricsQL `last_over_time`.
+	// Get the last data point in range via MetricsQL `last_over_time`.
 	// We don't use plain PromQL since Prometheus doesn't support
 	// remote write protocol which is used for state persistence in vmalert.
 	expr := fmt.Sprintf("last_over_time(%s{alertname=%q%s}[%ds])",
@@ -417,11 +417,14 @@ func (ar *AlertingRule) Restore(ctx context.Context, q datasource.Querier, lookb
 		labels := m.Labels
 		m.Labels = make([]datasource.Label, 0)
 		// drop all extra labels, so hash key will
-		// be identical to timeseries received in Exec
+		// be identical to time series received in Exec
 		for _, l := range labels {
 			if l.Name == alertNameLabel {
 				continue
 			}
+			if l.Name == alertGroupNameLabel {
+				continue
+			}
 			// drop all overridden labels
 			if _, ok := ar.Labels[l.Name]; ok {
 				continue
@@ -436,7 +439,7 @@ func (ar *AlertingRule) Restore(ctx context.Context, q datasource.Querier, lookb
 		a.ID = hash(m)
 		a.State = notifier.StatePending
 		ar.alerts[a.ID] = a
-		logger.Infof("alert %q(%d) restored to state at %v", a.Name, a.ID, a.Start)
+		logger.Infof("alert %q (%d) restored to state at %v", a.Name, a.ID, a.Start)
 	}
 	return nil
 }
diff --git a/deployment/docker/docker-compose.yml b/deployment/docker/docker-compose.yml
index 545e9f689..8ccab8569 100644
--- a/deployment/docker/docker-compose.yml
+++ b/deployment/docker/docker-compose.yml
@@ -21,7 +21,8 @@ services:
     image: victoriametrics/victoria-metrics
     ports:
       - 8428:8428
-      - 8428:8428/udp
+      - 8089:8089
+      - 8089:8089/udp
       - 2003:2003
       - 2003:2003/udp
       - 4242:4242
@@ -32,6 +33,7 @@ services:
       - '--graphiteListenAddr=:2003'
       - '--opentsdbListenAddr=:4242'
       - '--httpListenAddr=:8428'
+      - '--influxListenAddr=:8089'
     networks:
       - vm_net
     restart: always


Test patch:
diff --git a/app/vmalert/alerting_test.go b/app/vmalert/alerting_test.go
index cace27e6d..55aa2b48d 100644
--- a/app/vmalert/alerting_test.go
+++ b/app/vmalert/alerting_test.go
@@ -355,6 +355,7 @@ func TestAlertingRule_Restore(t *testing.T) {
 				metricWithValueAndLabels(t, float64(time.Now().Truncate(time.Hour).Unix()),
 					"__name__", alertForStateMetricName,
 					alertNameLabel, "",
+					alertGroupNameLabel, "groupID",
 					"foo", "bar",
 					"namespace", "baz",
 				),
Repository: jlowin/fastmcp
Pull request #369 (2025-05-08 03:22:51)

Fix import error
Fixes issue in #367 


Patch:
diff --git a/src/fastmcp/server/http.py b/src/fastmcp/server/http.py
index 0a2c6e6..3db6138 100644
--- a/src/fastmcp/server/http.py
+++ b/src/fastmcp/server/http.py
@@ -22,10 +22,11 @@ from starlette.responses import Response
 from starlette.routing import Mount, Route
 from starlette.types import Receive, Scope, Send
 
-# This import is vendored until it is finalized in the upstream SDK
-from fastmcp.server.streamable_http_manager import StreamableHTTPSessionManager
 from fastmcp.utilities.logging import get_logger
 
+# This import is vendored until it is finalized in the upstream SDK
+from fastmcp.vendor.streamable_http_manager import StreamableHTTPSessionManager
+
 if TYPE_CHECKING:
     from fastmcp.server.server import FastMCP
 


Test patch:
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index db1e14e..33c3e8e 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -59,4 +59,4 @@ jobs:
           uv pip install pyreadline3
 
       - name: Run tests
-        run: uv run --frozen pytest -vv
+        run: uv run --frozen pytest