nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: pulumi/pulumi-terraform-bridge
Pull request #285 (2020-10-08 16:55:41)

Fix a bug building TF config.
Recent changes to the way we build Terraform configuration
unintentionally dropped the user input and only applied defaults. These
changes ensure that the user's inputs are taken into account.

github-actions[bot]: Diff for [pulumi-azuread](https://github.com/pulumi-bot/pulumi-azuread/compare/8f62a3a..9e0a721) with merge commit eb9dab6ffa7c78125d132a0ba420a7d37725f41a
github-actions[bot]: Diff for [pulumi-random](https://github.com/pulumi-bot/pulumi-random/compare/23f904f..1ada9f4) with merge commit eb9dab6ffa7c78125d132a0ba420a7d37725f41a
github-actions[bot]: Diff for [pulumi-aws](https://github.com/pulumi-bot/pulumi-aws/compare/e0d777bc3..da861409f) with merge commit eb9dab6ffa7c78125d132a0ba420a7d37725f41a
github-actions[bot]: Diff for [pulumi-azure](https://github.com/pulumi-bot/pulumi-azure/compare/c51f0ad1..1e6eed06) with merge commit eb9dab6ffa7c78125d132a0ba420a7d37725f41a

Patch:
diff --git a/pkg/tfbridge/provider.go b/pkg/tfbridge/provider.go
index 70894923..0b943f4a 100644
--- a/pkg/tfbridge/provider.go
+++ b/pkg/tfbridge/provider.go
@@ -351,7 +351,7 @@ func buildTerraformConfig(p *Provider, vars resource.PropertyMap) (shim.Resource
 		}
 	}
 
-	inputs, _, err := MakeTerraformInputs(nil, tfVars, nil, nil, p.config, p.info.Config)
+	inputs, _, err := MakeTerraformInputs(nil, tfVars, nil, tfVars, p.config, p.info.Config)
 	if err != nil {
 		return nil, err
 	}


Test patch:
diff --git a/pkg/tfbridge/provider_test.go b/pkg/tfbridge/provider_test.go
index 20e5374c..b65c8bb9 100644
--- a/pkg/tfbridge/provider_test.go
+++ b/pkg/tfbridge/provider_test.go
@@ -175,3 +175,22 @@ func TestDiffConfig(t *testing.T) {
 	assert.True(t, resp.HasDetailedDiff)
 	assert.Len(t, resp.DetailedDiff, 1)
 }
+
+func TestBuildConfig(t *testing.T) {
+	provider := &Provider{
+		tf:     shimv1.NewProvider(testTFProvider),
+		config: shimv1.NewSchemaMap(testTFProvider.Schema),
+	}
+
+	configIn := resource.PropertyMap{
+		"configValue": resource.NewStringProperty("foo"),
+		"version":     resource.NewStringProperty("0.0.1"),
+	}
+	configOut, err := buildTerraformConfig(provider, configIn)
+	assert.NoError(t, err)
+
+	expected := provider.tf.NewResourceConfig(map[string]interface{}{
+		"config_value": "foo",
+	})
+	assert.Equal(t, expected, configOut)
+}
Repository: iterative/dvc
Pull request #9240 (2023-03-24 16:47:19)

exp push: add trailing slash to the endpoint url
`/webhook/dvc` redirects to `/webhook/dvc/` where the payload gets lost. So we should be posting to the canonical url.


Patch:
diff --git a/dvc/repo/experiments/push.py b/dvc/repo/experiments/push.py
index d36cb7da5..09cc0a846 100644
--- a/dvc/repo/experiments/push.py
+++ b/dvc/repo/experiments/push.py
@@ -121,7 +121,7 @@ def _notify_studio(
     import requests
     from requests.adapters import HTTPAdapter
 
-    endpoint = urljoin(url or STUDIO_URL, "/webhook/dvc")
+    endpoint = urljoin(url or STUDIO_URL, "/webhook/dvc/")
     session = requests.Session()
     session.mount(endpoint, HTTPAdapter(max_retries=3))
 


Test patch:
diff --git a/tests/unit/repo/experiments/test_push.py b/tests/unit/repo/experiments/test_push.py
index f2ccfcd2d..970fe9c96 100644
--- a/tests/unit/repo/experiments/test_push.py
+++ b/tests/unit/repo/experiments/test_push.py
@@ -18,7 +18,7 @@ def test_notify_studio_for_exp_push(mocker):
 
     assert mock_post.called
     assert mock_post.call_args == mocker.call(
-        urljoin(STUDIO_URL, "/webhook/dvc"),
+        urljoin(STUDIO_URL, "/webhook/dvc/"),
         json={
             "repo_url": "git@github.com:iterative/dvc.git",
             "client": "dvc",
Repository: iterative/dvc
Pull request #9301 (2023-04-04 07:27:10)

utils.studio: disallow redirects, misc API refactoring
This PR prevents Studio API to return a redirect as the redirect don't work with POST request anyway, and might be more secure.

Also misc naming changes. Renamed `endpoint` to `url` and `url` to `base_url`.


Patch:
diff --git a/dvc/utils/studio.py b/dvc/utils/studio.py
index 8da724ad0..b98166dc6 100644
--- a/dvc/utils/studio.py
+++ b/dvc/utils/studio.py
@@ -15,21 +15,23 @@ STUDIO_URL = "https://studio.iterative.ai"
 
 
 def post(
-    endpoint: str,
+    url: str,
     token: str,
     data: Dict[str, Any],
-    url: Optional[str] = STUDIO_URL,
+    base_url: Optional[str] = STUDIO_URL,
     max_retries: int = 3,
     timeout: int = 5,
 ) -> "Response":
-    endpoint = urljoin(url or STUDIO_URL, endpoint)
+    url = urljoin(base_url or STUDIO_URL, url)
     session = requests.Session()
-    session.mount(endpoint, HTTPAdapter(max_retries=max_retries))
+    session.mount(url, HTTPAdapter(max_retries=max_retries))
 
-    logger.trace("Sending %s to %s", data, endpoint)  # type: ignore[attr-defined]
+    logger.trace("Sending %s to %s", data, url)  # type: ignore[attr-defined]
 
     headers = {"Authorization": f"token {token}"}
-    r = session.post(endpoint, json=data, headers=headers, timeout=timeout)
+    r = session.post(
+        url, json=data, headers=headers, timeout=timeout, allow_redirects=False
+    )
     r.raise_for_status()
     return r
 
@@ -55,7 +57,7 @@ def notify_refs(
     data = {"repo_url": repo_url, "client": "dvc", "refs": refs}
 
     try:
-        r = post("/webhook/dvc", token, data, url=studio_url)
+        r = post("/webhook/dvc", token, data, base_url=studio_url)
     except requests.RequestException as e:
         logger.trace("", exc_info=True)  # type: ignore[attr-defined]
 


Test patch:
diff --git a/tests/unit/utils/test_studio.py b/tests/unit/utils/test_studio.py
index e47c546e0..a10c88bb0 100644
--- a/tests/unit/utils/test_studio.py
+++ b/tests/unit/utils/test_studio.py
@@ -41,4 +41,5 @@ def test_notify_refs(mocker, status_code, side_effect):
         },
         headers={"Authorization": "token TOKEN"},
         timeout=5,
+        allow_redirects=False,
     )