nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: gluesql/gluesql
Pull request #41 (2020-08-25 05:03:53)

Replace a single unreachable case in Row to controlled error (#39)


Patch:
diff --git a/src/data/row.rs b/src/data/row.rs
index 6ca2b80d..b2da3a11 100644
--- a/src/data/row.rs
+++ b/src/data/row.rs
@@ -83,7 +83,9 @@ impl Row {
                         .ok_or_else(|| RowError::LackOfRequiredColumn(name.clone())),
                 }?;
 
-                let literal = values.get(i).ok_or(RowError::Unreachable)?;
+                let literal = values
+                    .get(i)
+                    .ok_or_else(|| RowError::LackOfRequiredValue(name.clone()))?;
                 let nullable = options
                     .iter()
                     .any(|ColumnOptionDef { option, .. }| option == &ColumnOption::Null);


Test patch:
diff --git a/src/tests/error.rs b/src/tests/error.rs
index 95878699..2a2d3305 100644
--- a/src/tests/error.rs
+++ b/src/tests/error.rs
@@ -35,6 +35,10 @@ pub fn error(mut tester: impl tests::Tester) {
             RowError::LackOfRequiredColumn("id".to_owned()).into(),
             "INSERT INTO TableA (id2) VALUES (1);",
         ),
+        (
+            RowError::LackOfRequiredValue("id".to_owned()).into(),
+            "INSERT INTO TableA (id2, id) VALUES (100);",
+        ),
     ];
 
     test_cases
Repository: kumahq/kuma
Pull request #5492 (2022-12-13 13:11:15)

feat(kuma-cp): support IPV6 in intercp
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>

### Checklist prior to review

<!--
Each of these sections need to be filled by the author when opening the PR.

If something doesn't apply please check the box and add a justification after the `--`
-->

- [ ] Link to docs PR or issue --
- [ ] Link to UI issue or PR --
- [ ] Is the [issue worked on linked][1]? --
- [ ] The PR does not hardcode values that might break projects that depend on kuma (e.g. "kumahq" as a image registry) --
- [ ] The PR will work for both Linux and Windows, system specific functions like `syscall.Mkfifo` have equivalent implementation on the other OS --
- [ ] Unit Tests --
- [ ] E2E Tests --
- [ ] Manual Universal Tests --
- [ ] Manual Kubernetes Tests --
- [ ] Do you need to update [`UPGRADE.md`](../blob/master/UPGRADE.md)? --
- [ ] Does it need to be backported according to the [backporting policy](../blob/master/CONTRIBUTING.md#backporting)? --
- [ ] Do you need to explicitly set a [`> Changelog:` entry here](../blob/master/CONTRIBUTING.md#submitting-a-patch) or add a `ci/` label to run fewer/more tests?

[1]: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword



Patch:
diff --git a/pkg/intercp/catalog/catalog.go b/pkg/intercp/catalog/catalog.go
index a6a2b6dec..0ab4f1774 100644
--- a/pkg/intercp/catalog/catalog.go
+++ b/pkg/intercp/catalog/catalog.go
@@ -3,6 +3,8 @@ package catalog
 import (
 	"context"
 	"fmt"
+	"net"
+	"strconv"
 
 	"github.com/pkg/errors"
 )
@@ -15,7 +17,7 @@ type Instance struct {
 }
 
 func (i Instance) InterCpURL() string {
-	return fmt.Sprintf("grpcs://%s:%d", i.Address, i.InterCpPort)
+	return fmt.Sprintf("grpcs://%s", net.JoinHostPort(i.Address, strconv.Itoa(int(i.InterCpPort))))
 }
 
 type Catalog interface {


Test patch:
diff --git a/pkg/intercp/catalog/catalog_test.go b/pkg/intercp/catalog/catalog_test.go
index 38ea95ab8..5a911fc37 100644
--- a/pkg/intercp/catalog/catalog_test.go
+++ b/pkg/intercp/catalog/catalog_test.go
@@ -194,4 +194,12 @@ var _ = Describe("Catalog", func() {
 		Expect(err).ToNot(HaveOccurred())
 		Expect(instances).To(HaveLen(0))
 	})
+
+	It("should handle IPV6 addresses when building inter cp URL", func() {
+		instance := catalog.Instance{
+			Address:     "2001:0db8:85a3:0000",
+			InterCpPort: 5683,
+		}
+		Expect(instance.InterCpURL()).To(Equal("grpcs://[2001:0db8:85a3:0000]:5683"))
+	})
 })
Repository: kubernetes-client/javascript
Pull request #1255 (2023-09-08 18:25:51)

FEAT: Adding support for multiple client
I have found that while creating multiple client with different access in single application.
Both of the client overlap the credentials and start returning the 403 error. Whereas the client created with proper credentials.


Patch:
diff --git a/src/config.ts b/src/config.ts
index d35de407..00bae6d2 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -39,7 +39,7 @@ function fileExists(filepath: string): boolean {
 }
 
 export class KubeConfig {
-    private static authenticators: Authenticator[] = [
+    private authenticators: Authenticator[] = [
         new AzureAuth(),
         new GoogleCloudPlatformAuth(),
         new ExecAuth(),
@@ -450,7 +450,7 @@ export class KubeConfig {
         if (!user) {
             return;
         }
-        const authenticator = KubeConfig.authenticators.find((elt: Authenticator) => {
+        const authenticator = this.authenticators.find((elt: Authenticator) => {
             return elt.isAuthProvider(user);
         });
 


Test patch:
diff --git a/src/config_test.ts b/src/config_test.ts
index ecd97c3a..79243385 100644
--- a/src/config_test.ts
+++ b/src/config_test.ts
@@ -1169,7 +1169,7 @@ describe('KubeConfig', () => {
             // TODO: inject the exec command here?
             const opts = {} as requestlib.Options;
             await config.applyToRequest(opts);
-            let execAuthenticator = (KubeConfig as any).authenticators.find(
+            let execAuthenticator = (config as any).authenticators.find(
                 (authenticator) => authenticator instanceof ExecAuth,
             );
             expect(execAuthenticator.tokenCache['exec']).to.deep.equal(JSON.parse(responseStr));
Repository: kubernetes-client/javascript
Pull request #1269 (2023-09-17 15:31:26)

Add node 20 to our test matrix, remove node 14, fix test for node 20.
Includes cherry-pick of #1202 


Patch:
diff --git a/src/config.ts b/src/config.ts
index 00bae6d2..f4ea172d 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -126,7 +126,7 @@ export class KubeConfig {
 
     public loadFromFile(file: string, opts?: Partial<ConfigOptions>): void {
         const rootDirectory = path.dirname(file);
-        this.loadFromString(fs.readFileSync(file, 'utf8'), opts);
+        this.loadFromString(fs.readFileSync(file).toString('utf-8'), opts);
         this.makePathsAbsolute(rootDirectory);
     }
 
@@ -245,7 +245,7 @@ export class KubeConfig {
         const namespaceFile = `${pathPrefix}${Config.SERVICEACCOUNT_NAMESPACE_PATH}`;
         let namespace: string | undefined;
         if (fileExists(namespaceFile)) {
-            namespace = fs.readFileSync(namespaceFile, 'utf8');
+            namespace = fs.readFileSync(namespaceFile).toString('utf-8');
         }
         this.contexts = [
             {


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 6df7613a..4d1394aa 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -11,7 +11,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        node: [ '18', '16', '14' ]
+        node: [ '20', '18', '16' ]
     name: Node ${{ matrix.node }} validation
     steps:
       - uses: actions/checkout@v4
Repository: gluesql/gluesql
Pull request #126 (2020-11-25 18:01:02)

fix: Changed parse.rs to parse_sql.rs
In recent IntellijRust builds, there is an issue (tracked here: https://github.com/intellij-rust/intellij-rust/issues/5249) that causes an error while using an exported type that was imported using mod privately.

This PR only have for objective to fix this.


Patch:
diff --git a/src/executor/execute.rs b/src/executor/execute.rs
index a64dc2d2..e37df379 100644
--- a/src/executor/execute.rs
+++ b/src/executor/execute.rs
@@ -9,7 +9,7 @@ use sqlparser::ast::AlterTableOperation;
 use sqlparser::ast::{ObjectType, SetExpr, Statement, Values};
 
 use crate::data::{get_name, Row, Schema};
-use crate::parse::Query;
+use crate::parse_sql::Query;
 use crate::result::{Error, MutResult, Result};
 use crate::store::{AlterTable, Store, StoreMut};
 
diff --git a/src/lib.rs b/src/lib.rs
index 0c68078e..b43a2951 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -65,7 +65,7 @@ pub use sqlparser as parser;
 
 mod executor;
 mod glue;
-mod parse;
+mod parse_sql;
 mod storages;
 mod utils;
 
@@ -76,7 +76,7 @@ pub mod tests;
 
 pub use data::*;
 pub use executor::*;
-pub use parse::*;
+pub use parse_sql::*;
 pub use result::*;
 pub use store::*;
 


Test patch:
diff --git a/src/parse.rs b/src/parse_sql.rs
similarity index 100%
rename from src/parse.rs
rename to src/parse_sql.rs
diff --git a/src/tests/tester.rs b/src/tests/tester.rs
index 8398073b..dd690a68 100644
--- a/src/tests/tester.rs
+++ b/src/tests/tester.rs
@@ -4,7 +4,7 @@ use std::fmt::Debug;
 use std::rc::Rc;
 
 use crate::executor::{execute, Payload};
-use crate::parse::parse;
+use crate::parse_sql::parse;
 use crate::result::Result;
 use crate::store::{AlterTable, Store, StoreMut};
Repository: gluesql/gluesql
Pull request #185 (2021-03-23 13:56:18)

Fix CREATE TABLE IF NOT EXISTS not to call insert_schema when existin…
…g schema is found,

Also fix test/create_table.rs test case to be able to catch this bug.


Patch:
diff --git a/src/executor/alter/create_table.rs b/src/executor/alter/create_table.rs
index c6cf3fb7..7b31673e 100644
--- a/src/executor/alter/create_table.rs
+++ b/src/executor/alter/create_table.rs
@@ -25,11 +25,16 @@ pub async fn create_table<T: 'static + Debug, U: Store<T> + StoreMut<T> + AlterT
             validate(column_def)?;
         }
 
-        if !if_not_exists && storage.fetch_schema(&schema.table_name).await?.is_some() {
-            return Err(AlterError::TableAlreadyExists(schema.table_name.to_owned()).into());
+        match (
+            storage.fetch_schema(&schema.table_name).await?,
+            if_not_exists,
+        ) {
+            (None, _) => Ok(Some(schema)),
+            (Some(_), true) => Ok(None),
+            (Some(_), false) => {
+                Err(AlterError::TableAlreadyExists(schema.table_name.to_owned()).into())
+            }
         }
-
-        Ok(schema)
     })()
     .await;
 
@@ -40,5 +45,9 @@ pub async fn create_table<T: 'static + Debug, U: Store<T> + StoreMut<T> + AlterT
         }
     };
 
-    storage.insert_schema(&schema).await
+    if let Some(schema) = schema {
+        storage.insert_schema(&schema).await
+    } else {
+        Ok((storage, ()))
+    }
 }


Test patch:
diff --git a/src/tests/create_table.rs b/src/tests/create_table.rs
index 3bfb2cec..dfdc6841 100644
--- a/src/tests/create_table.rs
+++ b/src/tests/create_table.rs
@@ -32,12 +32,14 @@ test_case!(create_table, async move {
         (
             r#"
         CREATE TABLE IF NOT EXISTS CreateTable2 (
-            id INTEGER NULL,
-            num INTEGER,
-            name TEXT
+            id2 INTEGER NULL,
         )"#,
             Ok(Payload::Create),
         ),
+        (
+            r#"INSERT INTO CreateTable2 VALUES (NULL, 1, "1");"#,
+            Ok(Payload::Insert(1)),
+        ),
         (
             "CREATE TABLE Gluery (id SOMEWHAT);",
             Err(AlterError::UnsupportedDataType("SOMEWHAT".to_owned()).into()),
Repository: kubernetes-client/javascript
Pull request #1721 (2024-06-10 17:26:33)

Rev a different version in package-lock.json
This fixes an issue blocking automated release of this branch via github actions.


Patch:
diff --git a/package-lock.json b/package-lock.json
index 41a4ed4e..638948e9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,7 +6,7 @@
     "packages": {
         "": {
             "name": "@kubernetes/client-node",
-            "version": "1.0.0-rc4",
+            "version": "1.0.0-rc6",
             "license": "Apache-2.0",
             "dependencies": {
                 "@types/js-yaml": "^4.0.1",


Test patch:
diff --git a/src/package_test.ts b/src/package_test.ts
index 68a80e9a..a161a8fd 100644
--- a/src/package_test.ts
+++ b/src/package_test.ts
@@ -7,6 +7,9 @@ describe('package', () => {
         const v1 = require('../package.json').version;
         const v2 = require('../package-lock.json').version;
         expect(v1).to.equal(v2);
+
+        const v3 = require('../package-lock.json').packages[''].version;
+        expect(v1).to.equal(v3);
     });
 
     it('package-lock should only reference npm', () => {
Repository: kubernetes-client/javascript
Pull request #2144 (2025-01-08 18:41:44)

websocket: do not close when protocol supports it
This commit updates the WebSocket handler to not call `ws.close()` when stdin is closed but the ws protocol already supports closing (v5 protocol for example).


Patch:
diff --git a/src/web-socket-handler.ts b/src/web-socket-handler.ts
index 3ad71dbb..6772427d 100644
--- a/src/web-socket-handler.ts
+++ b/src/web-socket-handler.ts
@@ -96,6 +96,7 @@ export class WebSocketHandler implements WebSocketInterface {
                 buff.writeUint8(this.CloseStream, 0);
                 buff.writeUint8(this.StdinStream, 1);
                 ws.send(buff);
+                return;
             }
             ws.close();
         });


Test patch:
diff --git a/src/web-socket-handler_test.ts b/src/web-socket-handler_test.ts
index d652252e..b6e7f92f 100644
--- a/src/web-socket-handler_test.ts
+++ b/src/web-socket-handler_test.ts
@@ -404,8 +404,10 @@ describe('V5 protocol support', () => {
             send: (data) => {
                 sent = data;
             },
-            close: () => {},
-        } as WebSocket;
+            close: () => {
+                throw new Error('should not be called');
+            },
+        } as unknown as WebSocket;
         const stdinStream = new ReadableStreamBuffer();
         WebSocketHandler.handleStandardInput(ws, stdinStream);
         stdinStream.emit('end');