nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: tablelandnetwork/go-tableland
Pull request #203 (2022-07-24 13:19:10)

Updates to most recent version of the parser [stagingdeploy]
REFERENCES is a keyword that is not allowed as identifier. This was causing the validator to be stuck.

Signed-off-by: Bruno Calza <brunoangelicalza@gmail.com>


Patch:
diff --git a/go.mod b/go.mod
index 7232299..674538c 100644
--- a/go.mod
+++ b/go.mod
@@ -17,7 +17,7 @@ require (
 	github.com/spf13/cobra v1.5.0
 	github.com/spruceid/siwe-go v0.2.1-0.20220711143404-817846826282
 	github.com/stretchr/testify v1.8.0
-	github.com/tablelandnetwork/sqlparser v0.0.0-20220706202446-651da656fce8
+	github.com/tablelandnetwork/sqlparser v0.0.0-20220724131240-e324c674632c
 	github.com/textileio/cli v1.0.2
 	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0
 	go.opentelemetry.io/contrib/instrumentation/runtime v0.33.0
diff --git a/go.sum b/go.sum
index c928501..a46a080 100644
--- a/go.sum
+++ b/go.sum
@@ -1287,8 +1287,8 @@ github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG
 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
 github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI=
 github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
-github.com/tablelandnetwork/sqlparser v0.0.0-20220706202446-651da656fce8 h1:0mcnXoayzxj8iopdjQ6NizPcLxMrxyTFeDwhsWUbKqc=
-github.com/tablelandnetwork/sqlparser v0.0.0-20220706202446-651da656fce8/go.mod h1:GneggLILTJ6yM9xfBXu4OSZ0bfc/8Cw/PkzDfawhhkg=
+github.com/tablelandnetwork/sqlparser v0.0.0-20220724131240-e324c674632c h1:iOGVItskC65cypzlXiXorESrXY5SjV/eQdVuo06sVTU=
+github.com/tablelandnetwork/sqlparser v0.0.0-20220724131240-e324c674632c/go.mod h1:tiNXABmR9dWeLDts7u2l6onz2sH9isfctTnUOakplAU=
 github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I=
 github.com/textileio/cli v1.0.2 h1:qSp/x4d/9SZ93TxhgZnE5okRKqzqHqrzAwKAPjuPw50=
 github.com/textileio/cli v1.0.2/go.mod h1:vTlCvvVyOmXXLwddCcBg3PDavfUsCkRBZoyr6Nu1lkc=


Test patch:
diff --git a/pkg/parsing/impl/validator_test.go b/pkg/parsing/impl/validator_test.go
index 5dfc26c..501ae68 100644
--- a/pkg/parsing/impl/validator_test.go
+++ b/pkg/parsing/impl/validator_test.go
@@ -535,6 +535,14 @@ func TestCreateTableChecks(t *testing.T) {
 			query:      "delete from foo",
 			expErrType: ptr2ErrNoTopLevelCreate(),
 		},
+
+		// reserved keywords
+		{
+			name:       "keyword references",
+			query:      "create table any_1337 (references text);",
+			chainID:    1337,
+			expErrType: ptr2ErrKeywordIsNotAllowed(),
+		},
 	}
 
 	for _, it := range tests {
@@ -908,6 +916,11 @@ func ptr2ErrNonDeterministicFunction() **sqlparser.ErrKeywordIsNotAllowed {
 	return &e
 }
 
+func ptr2ErrKeywordIsNotAllowed() **sqlparser.ErrKeywordIsNotAllowed {
+	var e *sqlparser.ErrKeywordIsNotAllowed
+	return &e
+}
+
 func ptr2ErrSubquery() **sqlparser.ErrStatementContainsSubquery {
 	var e *sqlparser.ErrStatementContainsSubquery
 	return &e
Repository: tablelandnetwork/go-tableland
Pull request #272 (2022-09-21 21:46:30)

Use extract for mode=list
This is to provide compatibility with urls using `mode=list` for NFT metadata


Patch:
diff --git a/internal/router/controllers/user.go b/internal/router/controllers/user.go
index 4785886..35b1cce 100644
--- a/internal/router/controllers/user.go
+++ b/internal/router/controllers/user.go
@@ -323,6 +323,7 @@ func getFormatterParams(r *http.Request) (formatterParams, error) {
 	if mode == "list" {
 		v := true
 		c.unwrap = &v
+		c.extract = &v
 	} else if mode == "json" {
 		v := formatter.Objects
 		c.output = &v


Test patch:
diff --git a/internal/router/controllers/user_test.go b/internal/router/controllers/user_test.go
index bf51a85..41cb9ac 100644
--- a/internal/router/controllers/user_test.go
+++ b/internal/router/controllers/user_test.go
@@ -184,16 +184,42 @@ func TestUserControllerQuery(t *testing.T) {
 	for i, wantString := range wantStrings {
 		require.JSONEq(t, wantString, gotStrings[i])
 	}
+}
+
+func TestUserControllerLegacyQuery(t *testing.T) {
+	r := mocks.NewSQLRunner(t)
+	r.EXPECT().RunReadQuery(mock.Anything, mock.AnythingOfType("string")).Return(
+		&tableland.TableData{
+			Columns: []tableland.Column{
+				{Name: "name"},
+			},
+			Rows: [][]*tableland.ColumnValue{
+				{
+					tableland.OtherColValue("Bob"),
+				},
+				{
+					tableland.OtherColValue("John"),
+				},
+				{
+					tableland.OtherColValue("Jane"),
+				},
+			},
+		},
+		nil,
+	)
 
-	// Legacy 'mode' support
+	userController := NewUserController(r)
+
+	router := mux.NewRouter()
+	router.HandleFunc("/query", userController.GetTableQuery)
 
 	// Mode = json
-	req, err = http.NewRequest("GET", "/query?s=select%20*%20from%20foo%3B&mode=json", nil)
+	req, err := http.NewRequest("GET", "/query?s=select%20*%20from%20foo%3B&mode=json", nil)
 	require.NoError(t, err)
-	rr = httptest.NewRecorder()
+	rr := httptest.NewRecorder()
 	router.ServeHTTP(rr, req)
 	require.Equal(t, http.StatusOK, rr.Code)
-	exp = `[{"eyes":"Big","id":1,"mouth":"Surprised"},{"eyes":"Medium","id":2,"mouth":"Sad"},{"eyes":"Small","id":3,"mouth":"Happy"}]` // nolint
+	exp := `[{"name":"Bob"},{"name":"John"},{"name":"Jane"}]`
 	require.JSONEq(t, exp, rr.Body.String())
 
 	// Mode = list
@@ -202,9 +228,9 @@ func TestUserControllerQuery(t *testing.T) {
 	rr = httptest.NewRecorder()
 	router.ServeHTTP(rr, req)
 	require.Equal(t, http.StatusOK, rr.Code)
-	exp = "{\"eyes\":\"Big\",\"id\":1,\"mouth\":\"Surprised\"}\n{\"eyes\":\"Medium\",\"id\":2,\"mouth\":\"Sad\"}\n{\"eyes\":\"Small\",\"id\":3,\"mouth\":\"Happy\"}\n" // nolint
-	wantStrings = parseJSONLString(exp)
-	gotStrings = parseJSONLString(rr.Body.String())
+	exp = "\"Bob\"\n\"John\"\n\"Jane\"\n"
+	wantStrings := parseJSONLString(exp)
+	gotStrings := parseJSONLString(rr.Body.String())
 	require.Equal(t, len(wantStrings), len(gotStrings))
 	for i, wantString := range wantStrings {
 		require.JSONEq(t, wantString, gotStrings[i])
Repository: tablelandnetwork/go-tableland
Pull request #383 (2022-11-03 13:07:44)

Adjusts healthbot to check at a slower pace
# Summary

Adjusts healthbot check interval config to check at a slower pace

# Context

Funds are draining too fast and goerli is scarce 

# Implementation overview

na

# Implementation details and review orientation

na




Patch:
diff --git a/db.db b/db.db
deleted file mode 100644
index e69de29..0000000
diff --git a/docker/deployed/staging/healthbot/config.json b/docker/deployed/staging/healthbot/config.json
index 7a94b60..c93e663 100644
--- a/docker/deployed/staging/healthbot/config.json
+++ b/docker/deployed/staging/healthbot/config.json
@@ -11,7 +11,7 @@
         {
             "Name": "optimism-goerli",
             "Probe": {
-                "CheckInterval": "15s",
+                "CheckInterval": "360s",
                 "ReceiptTimeout": "20s",
                 "SIWE": "${HEALTHBOT_OPTIMISM_GOERLI_SIWE}",
                 "Tablename": "${HEALTHBOT_OPTIMISM_GOERLI_TABLE}"


Test patch:
diff --git a/docker/deployed/testnet/healthbot/config.json b/docker/deployed/testnet/healthbot/config.json
index 8d274d6..a36ac25 100644
--- a/docker/deployed/testnet/healthbot/config.json
+++ b/docker/deployed/testnet/healthbot/config.json
@@ -11,7 +11,7 @@
         {
             "Name": "arbitrum-goerli",
             "Probe": {
-                "CheckInterval": "120s",
+                "CheckInterval": "360s",
                 "ReceiptTimeout": "25s",
                 "SIWE": "${HEALTHBOT_ARBITRUM_GOERLI_SIWE}",
                 "Tablename": "${HEALTHBOT_ARBITRUM_GOERLI_TABLE}"
@@ -38,7 +38,7 @@
         {
             "Name": "optimism-goerli",
             "Probe": {
-                "CheckInterval": "120s",
+                "CheckInterval": "360s",
                 "ReceiptTimeout": "25s",
                 "SIWE": "${HEALTHBOT_OPTIMISM_GOERLI_SIWE}",
                 "Tablename": "${HEALTHBOT_OPTIMISM_GOERLI_TABLE}"
Repository: tablelandnetwork/go-tableland
Pull request #421 (2022-12-16 18:08:08)

animationurl: temporal workaround for OpenSea problem
# Summary

This PR disables `animation_url` for testnet chains.

**Note: This PR deployment isn't confirmed yet. If the decision is confirmed, we can review+merge, if not we can close it.**

# Context

There's a current problem in OpenSea for testnets that is currently under investigation. As a workaround, we're disabling `animation_url` for testnets.

# Implementation overview

NA

# Implementation details and review orientation

NA




Patch:
diff --git a/internal/system/impl/sqlstore.go b/internal/system/impl/sqlstore.go
index 8292b16..1f23308 100644
--- a/internal/system/impl/sqlstore.go
+++ b/internal/system/impl/sqlstore.go
@@ -200,6 +200,17 @@ func (s *SystemSQLStoreService) getAnimationURL(chainID tableland.ChainID, table
 	if s.animationRendererURI == "" {
 		return DefaultAnimationURL
 	}
+
+	// TODO(jsign): this is a temporal hack to workaround an unknown OpenSea problem. This isn't acceptable production
+	// code. When the final solution lands, we should reorg this code chunk.
+	//
+	// For non-mainnet chains, we must return empty. An empty string in `animation_url` will make the field disappear
+	// since we configured it with an `omitempy` JSON tag.
+	if !(chainID == 1 || chainID == 42161 || chainID == 137 || chainID == 10) {
+		return ""
+	}
+	///
+
 	return fmt.Sprintf("%s/?chain=%d&id=%s", s.animationRendererURI, chainID, tableID)
 }
 


Test patch:
diff --git a/internal/system/impl/sqlstore_test.go b/internal/system/impl/sqlstore_test.go
index 37e3b24..e9564e4 100644
--- a/internal/system/impl/sqlstore_test.go
+++ b/internal/system/impl/sqlstore_test.go
@@ -294,7 +294,8 @@ func TestGetMetadata(t *testing.T) {
 		require.Equal(t, "foo_1337_42", metadata.Name)
 		require.Equal(t, fmt.Sprintf("https://tableland.network/tables/chain/%d/tables/%s", 1337, id), metadata.ExternalURL)
 		require.Equal(t, "https://render.tableland.xyz/1337/42", metadata.Image)
-		require.Equal(t, "https://render.tableland.xyz/anim/?chain=1337&id=42", metadata.AnimationURL)
+		// TODO(jsign): skipped do to active workaround for OpenSea.
+		// require.Equal(t, "https://render.tableland.xyz/anim/?chain=1337&id=42", metadata.AnimationURL)
 		require.Equal(t, "date", metadata.Attributes[0].DisplayType)
 		require.Equal(t, "created", metadata.Attributes[0].TraitType)
 	})
Repository: tablelandnetwork/go-tableland
Pull request #454 (2023-02-02 21:22:16)

Update golangci-lint, lint fix
golangci-lint has been broken when using Go 1.19.x giving some `Can't run linter goanalysis_metalinter: goimports: can't extract issues from gofmt diff output` error. They just released an update that fixes that. It introduced a lint failure I fixed.


Patch:
diff --git a/Makefile b/Makefile
index d123129..a03a997 100644
--- a/Makefile
+++ b/Makefile
@@ -77,7 +77,7 @@ test-replayhistory:
 
 # Lint
 lint:
-	go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 run
+	go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0 run
 .PHONY: lint
 
 # OpenAPI


Test patch:
diff --git a/pkg/backup/pruner_test.go b/pkg/backup/pruner_test.go
index b417e7b..11b62c2 100644
--- a/pkg/backup/pruner_test.go
+++ b/pkg/backup/pruner_test.go
@@ -14,10 +14,12 @@ func TestPruner(t *testing.T) {
 
 	for n := 1; n <= 10; n++ {
 		for keep := 1; keep <= 5; keep++ {
-			t.Run(fmt.Sprintf("%d-%d", n, keep), func(t *testing.T) {
-				t.Parallel()
-				testPruner(t, n, keep)
-			})
+			func(keep int) {
+				t.Run(fmt.Sprintf("%d-%d", n, keep), func(t *testing.T) {
+					t.Parallel()
+					testPruner(t, n, keep)
+				})
+			}(keep)
 		}
 	}
 }
Repository: tablelandnetwork/go-tableland
Pull request #465 (2023-02-17 23:01:28)

upgrade the actions/setup-go action
# Summary

I noticed that the binaries.yml workflow failed with a message saying "Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: actions/setup-go@v2." https://github.com/tablelandnetwork/go-tableland/actions/runs/4204737716

I'm not sure if upgrading the setup-go action to v3 will fix the issue that caused the binaries build to fail, but seems like a good thing to do anyway. 

# Context

n/a

# Implementation overview

n/a

# Implementation details and review orientation

n/a

# Checklist

- [x]  Are changes backward compatible with existing SDKs, or is there a plan to manage it correctly?
- [x]  Are changes covered by existing tests, or were new tests included?
- [x]  Are code changes optimized for future code readers, commenting on problematic areas to understand (if any)?
- [x]  Future-self question: Did you avoid unjustified/unnecessary complexity to achieve the goal?



Patch:
diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml
index 590624f..a4f10fd 100644
--- a/.github/workflows/binaries.yml
+++ b/.github/workflows/binaries.yml
@@ -25,7 +25,7 @@ jobs:
       - name: Checkout repo
         uses: actions/checkout@v3
       - name: Install Go
-        uses: actions/setup-go@v2
+        uses: actions/setup-go@v3
         with:
           go-version: v1.19.x
       - name: Build binary
diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml
index 60dd5a4..3974758 100644
--- a/.github/workflows/review.yml
+++ b/.github/workflows/review.yml
@@ -15,7 +15,7 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - name: Install Go
-        uses: actions/setup-go@v2
+        uses: actions/setup-go@v3
         with:
           go-version: 1.19
       - name: Checkout code


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e389664..527ee9f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -23,7 +23,7 @@ jobs:
     runs-on: ${{ matrix.os }}
     steps:
       - name: Install Go
-        uses: actions/setup-go@v2
+        uses: actions/setup-go@v3
         with:
           go-version: ${{ matrix.go-version }}
       - name: Checkout code