before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
newobj:=store.NewObj(obj.Value,ttl,obj.TypeEncoding,obj.TypeEncoding) var keepttl=true if(ttl>0){ store.Put(key, newobj, dstore.WithKeepTTL(keepttl)) }else{ store.Put(key,obj) } return clientio.RespOK } func rdbDeserialize(data []byte) (*object.Obj, error) { if len(data) < 3 { return nil, errors.New("i...
No issues found.
newobj:=store.NewObj(obj.Value,ttl,obj.TypeEncoding,obj.TypeEncoding) var keepttl=true if(ttl>0){ store.Put(key, newobj, dstore.WithKeepTTL(keepttl)) }else{ store.Put(key,obj) } return clientio.RespOK } func rdbDeserialize(data []byte) (*object.Obj, error) { if len(data) < 3 { return nil, errors.New("i...
@@ -0,0 +1,158 @@ +package eval + +import ( + "bytes" + "encoding/base64" + "encoding/binary" + "errors" + "hash/crc64" + "strconv" + + "github.com/dicedb/dice/internal/clientio" + diceerrors "github.com/dicedb/dice/internal/errors" + "github.com/dicedb/dice/internal/object" + dstore "github.com/dicedb/dice/internal/st...
internal/eval/dump_restore.go
0
Go
1
none
16
51
51
true
#281: added support for DUMP command
633
DiceDB/dice
10,326
C
TheRanomial
Query: query, ResponseChan: responseChan, } queryResult := <-responseChan if queryResult.Err != nil { return clientio.Encode(queryResult.Err, false) } // TODO: We should return the list of all queries being watched by the client. return clientio.Encode(clientio.CreatePushResponse(&query, queryResul...
No issues found.
Query: query, ResponseChan: responseChan, } queryResult := <-responseChan if queryResult.Err != nil { return clientio.Encode(queryResult.Err, false) } // TODO: We should return the list of all queries being watched by the client. return clientio.Encode(clientio.CreatePushResponse(&query, queryResul...
@@ -2356,6 +2356,9 @@ func evalCommandList() []byte { cmds := make([]string, 0, diceCommandsCount) for k := range DiceCmds { cmds = append(cmds, k) + for _, sc := range DiceCmds[k].SubCommands { + cmds = append(cmds, fmt.Sprint(k, "|", sc)) + } } return clientio.Encode(cmds, false) }
internal/eval/eval.go
0
Go
1
none
16
51
51
true
#635: List Command Subcommands as separate commands
673
DiceDB/dice
10,326
C
hgupta12
{ name: "GetEx with PX option and invalid value", commands: []string{"SET foo bar", "GETEX foo", "TTL foo", "GETEX foo px -1", "TTL foo", "GETEX foo", "TTL foo"}, expected: []interface{}{"OK", "bar", int64(-1), "ERR invalid expire time in 'getex' command", int64(-1), "bar", int64(-1)}, assert...
No issues found.
{ name: "GetEx with PX option and invalid value", commands: []string{"SET foo bar", "GETEX foo", "TTL foo", "GETEX foo px -1", "TTL foo", "GETEX foo", "TTL foo"}, expected: []interface{}{"OK", "bar", int64(-1), "ERR invalid expire time in 'getex' command", int64(-1), "bar", int64(-1)}, assert...
@@ -119,6 +119,30 @@ func TestGetEx(t *testing.T) { assert_type: []string{"equal", "equal", "assert", "equal", "assert"}, delay: []time.Duration{0, 0, 0, 0, 0}, }, + { + name: "GetEx with key holding JSON type", + commands: []string{"JSON.SET KEY $ \"1\"", "GETEX KEY"}, + expected: ...
integration_tests/commands/async/getex_test.go
0
Go
1
none
16
51
51
true
Fix getex command returning value for json based object
674
DiceDB/dice
10,326
C
kapishmalik
{"i", "expiry_key", int64(1), utils.EmptyStr}, }, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { // Clean up keys before each test case keys := []string{"key1", "key2", "max_int", "min_int", "float_key", "string_key", "bool_key", "non_existent", "str_int1", "str_int2", "...
No issues found.
{"i", "expiry_key", int64(1), utils.EmptyStr}, }, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { // Clean up keys before each test case keys := []string{"key1", "key2", "max_int", "min_int", "float_key", "string_key", "bool_key", "non_existent", "str_int1", "str_int2", "...
@@ -162,3 +162,141 @@ func TestINCR(t *testing.T) { }) } } + +func TestINCRBY(t *testing.T) { + conn := getLocalConnection() + defer conn.Close() + + type SetCommand struct { + key string + val int64 + } + + type IncrByCommand struct { + key string + decrValue any + expectedVal int64 + expectedErr...
integration_tests/commands/async/incr_test.go
0
Go
1
none
16
51
51
true
#657: Add support for INCRBY command
676
DiceDB/dice
10,326
C
iamskp11
package async import ( "testing" "gotest.tools/v3/assert" ) func TestHDEL(t *testing.T) { conn := getLocalConnection() defer conn.Close() testCases := []TestCase{ { commands: []string{"HSET key field value", "HDEL key field"}, expected: []interface{}{ONE, ONE}, }, { commands: []string{"HSET key ...
No issues found.
package async import ( "testing" "gotest.tools/v3/assert" ) func TestHDEL(t *testing.T) { conn := getLocalConnection() defer conn.Close() testCases := []TestCase{ { commands: []string{"HSET key field value", "HDEL key field"}, expected: []interface{}{ONE, ONE}, }, { commands: []string{"HSET key ...
@@ -0,0 +1,42 @@ +package async + +import ( + "testing" + + "gotest.tools/v3/assert" +) + +func TestHDEL(t *testing.T) { + conn := getLocalConnection() + defer conn.Close() + + testCases := []TestCase{ + { + commands: []string{"HSET key field value", "HDEL key field"}, + expected: []interface{}{ONE, ONE}, + }, + ...
integration_tests/commands/async/hdel_test.go
0
Go
1
none
16
43
43
true
#645 Add HDEL command
678
DiceDB/dice
10,326
C
manishrw
}, input: []string{"NESTED_KEY", "$..isSimple"}, output: clientio.Encode([]interface{}{0, 1}, false), }, "deeply nested JSON structure with multiple matching fields": { setup: func() { key := "DEEP_NESTED_KEY" value := `{"field": true, "nested": {"field": false, "nested": {"field": true}}}` ...
No issues found.
}, input: []string{"NESTED_KEY", "$..isSimple"}, output: clientio.Encode([]interface{}{0, 1}, false), }, "deeply nested JSON structure with multiple matching fields": { setup: func() { key := "DEEP_NESTED_KEY" value := `{"field": true, "nested": {"field": false, "nested": {"field": true}}}` ...
@@ -80,6 +80,7 @@ func TestEval(t *testing.T) { testEvalJSONNUMINCRBY(t, store) testEvalTYPE(t, store) testEvalCOMMAND(t, store) + testEvalGETRANGE(t, store) } func testEvalECHO(t *testing.T, store *dstore.Store) { @@ -2883,6 +2884,171 @@ func testEvalCOMMAND(t *testing.T, store *dstore.Store) { runEvalTe...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
Add support for GETRANGE
679
DiceDB/dice
10,326
C
KaviiSuri
} else { logr.Debug("Running server in single-threaded mode") numCores = 1 } // The runtime.GOMAXPROCS(numCores) call limits the number of operating system // threads that can execute Go code simultaneously to the number of CPU cores. // This enables Go to run more efficiently, maximizing CPU utilization and ...
No issues found.
} else { logr.Debug("Running server in single-threaded mode") numCores = 1 } // The runtime.GOMAXPROCS(numCores) call limits the number of operating system // threads that can execute Go code simultaneously to the number of CPU cores. // This enables Go to run more efficiently, maximizing CPU utilization and ...
@@ -25,6 +25,7 @@ func init() { flag.StringVar(&config.Host, "host", "0.0.0.0", "host for the dice server") flag.IntVar(&config.Port, "port", 7379, "port for the dice server") flag.BoolVar(&config.EnableHTTP, "enable-http", true, "run server in HTTP mode as well") + flag.BoolVar(&config.EnableMultiThreading, "ena...
main.go
0
Go
1
none
16
51
51
true
Add flag to enable/disable multi-threading on server
682
DiceDB/dice
10,326
C
lucifercr07
if len(args) != 1 { return diceerrors.NewErrArity("QUNWATCH") } query, e := sql.ParseQuery( /*sql=*/ args[0]) if e != nil { return clientio.Encode(e, false) } querywatcher.WatchSubscriptionChan <- querywatcher.WatchSubscription{ Subscribe: false, Query: query, ClientFD: clientFd, } return clien...
No issues found.
if len(args) != 1 { return diceerrors.NewErrArity("QUNWATCH") } query, e := sql.ParseQuery( /*sql=*/ args[0]) if e != nil { return clientio.Encode(e, false) } querywatcher.WatchSubscriptionChan <- querywatcher.WatchSubscription{ Subscribe: false, Query: query, ClientFD: clientFd, } return clien...
@@ -1424,11 +1424,11 @@ func evalEXPIRE(args []string, store *dstore.Store) []byte { var key string = args[0] exDurationSec, err := strconv.ParseInt(args[1], 10, 64) - if exDurationSec < 0 || exDurationSec > maxExDuration { - return diceerrors.NewErrExpireTime("EXPIRE") + if err != nil { + return diceerrors.New...
internal/eval/eval.go
0
Go
1
none
16
51
51
true
#671: Inconsistent EXPIRE: EXPIRE with empty string as TTL should report an…
691
DiceDB/dice
10,326
C
Abh-ay
} func testEvalDbsize(t *testing.T, store *dstore.Store) { tests := map[string]evalTestCase{ "DBSIZE command with invalid no of args": { input: []string{"INVALID_ARG"}, output: []byte("-ERR wrong number of arguments for 'dbsize' command\r\n"), }, "no key in db": { input: nil, output: []byte(":0\r\...
No issues found.
} func testEvalDbsize(t *testing.T, store *dstore.Store) { tests := map[string]evalTestCase{ "DBSIZE command with invalid no of args": { input: []string{"INVALID_ARG"}, output: []byte("-ERR wrong number of arguments for 'dbsize' command\r\n"), }, "no key in db": { input: nil, output: []byte(":0\r\...
@@ -72,6 +72,7 @@ func TestEval(t *testing.T) { testEvalPFADD(t, store) testEvalPFCOUNT(t, store) testEvalHGET(t, store) + testEvalHSTRLEN(t, store) testEvalPFMERGE(t, store) testEvalJSONSTRLEN(t, store) testEvalJSONOBJLEN(t, store) @@ -1863,6 +1864,64 @@ func testEvalHGET(t *testing.T, store *dstore.Store)...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#655: Adds support for HSTRLEN command
693
DiceDB/dice
10,326
C
c-harish
}, input: []string{"string_key", "field"}, output: []byte("-WRONGTYPE Operation against a key holding the wrong kind of value\r\n"), }, "HDEL with delete existing fields": { setup: func() { evalHSET([]string{"hash_key", "field1", "value1", "field2", "value2"}, store) }, input: []string{"hash...
No issues found.
}, input: []string{"string_key", "field"}, output: []byte("-WRONGTYPE Operation against a key holding the wrong kind of value\r\n"), }, "HDEL with delete existing fields": { setup: func() { evalHSET([]string{"hash_key", "field1", "value1", "field2", "value2"}, store) }, input: []string{"hash...
@@ -4,6 +4,7 @@ import ( "bytes" "errors" "fmt" + "math" "reflect" "strconv" "strings" @@ -84,6 +85,7 @@ func TestEval(t *testing.T) { testEvalJSONNUMINCRBY(t, store) testEvalTYPE(t, store) testEvalCOMMAND(t, store) + testEvalHINCRBY(t, store) testEvalJSONOBJKEYS(t, store) testEvalGETRANGE(t, stor...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#647: Added HINCRBY Command
701
DiceDB/dice
10,326
C
ankkyprasad
expectedCmd: "MSET", expectedArgs: []string{"key1", "v1", "key2", "v2"}, }, { name: "Test MSET command with options", method: "POST", url: "/mset", body: `{"key_values": {"key1": "v1", "key2": "v2"}, "nx": "true"}`, expectedCmd: "MSET", expectedArgs: []string...
No issues found.
expectedCmd: "MSET", expectedArgs: []string{"key1", "v1", "key2", "v2"}, }, { name: "Test MSET command with options", method: "POST", url: "/mset", body: `{"key_values": {"key1": "v1", "key2": "v2"}, "nx": "true"}`, expectedCmd: "MSET", expectedArgs: []string...
@@ -34,6 +34,62 @@ func TestParseHTTPRequest(t *testing.T) { expectedCmd: "GET", expectedArgs: []string{"k1"}, }, + { + name: "Test DEL command", + method: "POST", + url: "/del", + body: `{"key": "k1"}`, + expectedCmd: "DEL", + expectedArgs: []string{"k1"}, + },...
internal/server/utils/redisCmdAdapter_test.go
0
Go
1
none
16
51
51
true
add more tests and enhance support for commands over HTTP
708
DiceDB/dice
10,326
C
pratikpandey21
"gotest.tools/v3/assert" ) func TestHvals(t *testing.T) { conn := getLocalConnection() defer conn.Close() defer FireCommand(conn, "DEL key_hVals key_hVals02") testCases := []TestCase{ { commands: []string{"HSET key_hVals field value", "HSET key_hVals field2 value_new", "HVALS key_hVals"}, expected: []in...
No issues found.
"gotest.tools/v3/assert" ) func TestHvals(t *testing.T) { conn := getLocalConnection() defer conn.Close() defer FireCommand(conn, "DEL key_hVals key_hVals02") testCases := []TestCase{ { commands: []string{"HSET key_hVals field value", "HSET key_hVals field2 value_new", "HVALS key_hVals"}, expected: []in...
@@ -0,0 +1,60 @@ +package async + +import ( + "reflect" + "testing" + + "gotest.tools/v3/assert" +) + +func TestHvals(t *testing.T) { + conn := getLocalConnection() + defer conn.Close() + defer FireCommand(conn, "DEL key_hVals key_hVals02") + + testCases := []TestCase{ + { + commands: []string{"HSET key_hVals field ...
integration_tests/commands/async/hvals_test.go
0
Go
1
none
16
51
51
true
#656: added HVALS command
710
DiceDB/dice
10,326
C
bijuli74
LastAccessedAt: uint32(time.Now().Unix()), } store.Put(key, obj) }, input: []string{"KEY_MOCK", "non_existent_key"}, output: clientio.RespNIL, }, "both key and field_name exists": { setup: func() { key := "KEY_MOCK" field := "mock_field_name" newMap := make(HashMap) newMap...
No issues found.
LastAccessedAt: uint32(time.Now().Unix()), } store.Put(key, obj) }, input: []string{"KEY_MOCK", "non_existent_key"}, output: clientio.RespNIL, }, "both key and field_name exists": { setup: func() { key := "KEY_MOCK" field := "mock_field_name" newMap := make(HashMap) newMap...
@@ -9,7 +9,7 @@ import ( "strings" "testing" "time" - + "github.com/bytedance/sonic" "github.com/dicedb/dice/internal/server/utils" "github.com/ohler55/ojg/jp" @@ -87,6 +87,7 @@ func TestEval(t *testing.T) { testEvalCOMMAND(t, store) testEvalJSONOBJKEYS(t, store) testEvalGETRANGE(t, store) + testEva...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#654: feat: Implement HSETNX command
715
DiceDB/dice
10,326
C
shreyas23sk
input: []string{"KEY_MOCK", "non_existent_key"}, output: clientio.Encode(0, false), }, "both key and field_name exists": { setup: func() { key := "KEY_MOCK" field := "mock_field_name" newMap := make(HashMap) newMap[field] = "HelloWorld" obj := &object.Obj{ TypeEncoding: object....
No issues found.
input: []string{"KEY_MOCK", "non_existent_key"}, output: clientio.Encode(0, false), }, "both key and field_name exists": { setup: func() { key := "KEY_MOCK" field := "mock_field_name" newMap := make(HashMap) newMap[field] = "HelloWorld" obj := &object.Obj{ TypeEncoding: object....
@@ -73,6 +73,7 @@ func TestEval(t *testing.T) { testEvalPFADD(t, store) testEvalPFCOUNT(t, store) testEvalHGET(t, store) + testEvalHMGET(t, store) testEvalHSTRLEN(t, store) testEvalHDEL(t, store) testEvalPFMERGE(t, store) @@ -2005,6 +2006,82 @@ func testEvalHGET(t *testing.T, store *dstore.Store) { runEva...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#650: Implementation `HMGET` command
743
DiceDB/dice
10,326
C
vishnuchandrashekar
key := "EXISTING_KEY" value := `{"partner":{"name":21,"language":["rust"]}}` var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []string{"EXISTING_KEY", "$..nam...
No issues found.
key := "EXISTING_KEY" value := `{"partner":{"name":21,"language":["rust"]}}` var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []string{"EXISTING_KEY", "$..nam...
@@ -60,6 +60,7 @@ func TestEval(t *testing.T) { testEvalJSONNUMMULTBY(t, store) testEvalJSONTOGGLE(t, store) testEvalJSONARRAPPEND(t, store) + testEvalJSONRESP(t, store) testEvalTTL(t, store) testEvalDel(t, store) testEvalPersist(t, store) @@ -4404,6 +4405,130 @@ func testEvalHRANDFIELD(t *testing.T, store ...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#500: Added JSON.RESP Command
751
DiceDB/dice
10,326
C
psrvere
var v *object.Obj v, _ = store.store.Get(k) if v != nil { if hasExpired(v, store) { store.deleteKey(k, v) v = nil } else if touch { v.LastAccessedAt = UpdateLastAccessedAt(v.LastAccessedAt) } } return v } func (store *Store) GetAll(keys []string) []*object.Obj { response := make([]*object.Obj, 0, ...
No issues found.
var v *object.Obj v, _ = store.store.Get(k) if v != nil { if hasExpired(v, store) { store.deleteKey(k, v) v = nil } else if touch { v.LastAccessedAt = UpdateLastAccessedAt(v.LastAccessedAt) } } return v } func (store *Store) GetAll(keys []string) []*object.Obj { response := make([]*object.Obj, 0, ...
@@ -25,23 +25,22 @@ type WatchEvent struct { type Store struct { store *swiss.Map[string, *object.Obj] expires *swiss.Map[*object.Obj, uint64] // Does not need to be thread-safe as it is only accessed by a single thread. + numKeys int watchChan chan WatchEvent } func NewStore(watchChan chan WatchEven...
internal/store/store.go
0
Go
1
none
16
51
51
true
Make keystat localized to store instance
755
DiceDB/dice
10,326
C
soumya-codes
User, Password, KeyValues, QwatchQuery, Offset, Member, Members, } for _, key := range priorityKeys { if val, exists := jsonBody[key]; exists { if key == Keys { for _, v := range val.([]interface{}) { args = append(args, fmt.Sprintf("%v", v)) } delete(...
No issues found.
User, Password, KeyValues, QwatchQuery, Offset, Member, Members, } for _, key := range priorityKeys { if val, exists := jsonBody[key]; exists { if key == Keys { for _, v := range val.([]interface{}) { args = append(args, fmt.Sprintf("%v", v)) } delete(...
@@ -107,6 +107,29 @@ func ParseHTTPRequest(r *http.Request) (*cmd.RedisCmd, error) { delete(jsonBody, key) continue } + + if key == Value { + var jsonValue string + + switch v := val.(type) { + case string: + // Use the string directly without marshaling + jsonValue = ...
internal/server/utils/redisCmdAdapter.go
0
Go
1
none
16
51
51
true
Marshalling the value in set command
757
DiceDB/dice
10,326
C
lovish2525
setup: func() { key := "number" value := "{\"a\": 2, \"b\": 10, \"c\": [15, {\"d\": 20}]}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []string{"number...
No issues found.
setup: func() { key := "number" value := "{\"a\": 2, \"b\": 10, \"c\": [15, {\"d\": 20}]}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []string{"number...
@@ -94,6 +94,7 @@ func TestEval(t *testing.T) { testEvalFLUSHDB(t, store) testEvalINCRBYFLOAT(t, store) testEvalBITOP(t, store) + testEvalAPPEND(t, store) testEvalHRANDFIELD(t, store) testEvalZADD(t, store) testEvalZRANGE(t, store) @@ -4405,6 +4406,170 @@ func testEvalHRANDFIELD(t *testing.T, store *dstore....
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#638: Adds APPEND Command
759
DiceDB/dice
10,326
C
arbha1erao
commands: []HTTPCommand{ {Command: "SET", Body: map[string]interface{}{"key": "k1", "value": "v1"}}, {Command: "SET", Body: map[string]interface{}{"key": "k2", "value": "v2"}}, {Command: "GET", Body: map[string]interface{}{"key": "k2"}}, {Command: "COPY", Body: map[string]interface{}{"keys": []interf...
No issues found.
commands: []HTTPCommand{ {Command: "SET", Body: map[string]interface{}{"key": "k1", "value": "v1"}}, {Command: "SET", Body: map[string]interface{}{"key": "k2", "value": "v2"}}, {Command: "GET", Body: map[string]interface{}{"key": "k2"}}, {Command: "COPY", Body: map[string]interface{}{"keys": []interf...
@@ -0,0 +1,114 @@ +package http + +import ( + "testing" + + "gotest.tools/v3/assert" +) + +func TestCopy(t *testing.T) { + exec := NewHTTPCommandExecutor() + simpleJSON := `{"name":"John","age":30}` + + testCases := []TestCase{ + { + name: "COPY when source key doesn't exist", + commands: []HTTPCommand{ + {Comm...
integration_tests/commands/http/copy_test.go
0
Go
1
none
16
51
51
true
#735: tests: COMMAND GETKEYS, COMMAND INFO, COMMAND LIST, COMMAND RENAME, COPY
768
DiceDB/dice
10,326
C
Indranil0603
evalHSET([]string{"hash_key", "field1", "value1", "field2", "value2"}, store) }, input: []string{"hash_key", "field1", "field2", "nonexistent"}, output: clientio.Encode(int64(2), false), }, "HDEL with delete non-existing fields": { setup: func() { evalHSET([]string{"hash_key", "field1", "value1...
No issues found.
evalHSET([]string{"hash_key", "field1", "value1", "field2", "value2"}, store) }, input: []string{"hash_key", "field1", "field2", "nonexistent"}, output: clientio.Encode(int64(2), false), }, "HDEL with delete non-existing fields": { setup: func() { evalHSET([]string{"hash_key", "field1", "value1...
@@ -49,6 +49,7 @@ func TestEval(t *testing.T) { testEvalGET(t, store) testEvalGETEX(t, store) testEvalDebug(t, store) + testEvalJSONARRTRIM(t, store) testEvalJSONARRINSERT(t, store) testEvalJSONARRPOP(t, store) testEvalJSONARRLEN(t, store) @@ -657,6 +658,137 @@ func testEvalEXPIREAT(t *testing.T, store *dst...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#490: feat:add support for command [JSON.ARRTRIM]
769
DiceDB/dice
10,326
C
jujiale
input: []string{"EXISTING_KEY"}, output: []byte("-WRONGTYPE wrong type of path value - expected string but found integer\r\n"), }, "root array strlen": { setup: func() { key := "EXISTING_KEY" value := `"hello"` var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj ...
No issues found.
input: []string{"EXISTING_KEY"}, output: []byte("-WRONGTYPE wrong type of path value - expected string but found integer\r\n"), }, "root array strlen": { setup: func() { key := "EXISTING_KEY" value := `"hello"` var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj ...
@@ -74,6 +74,7 @@ func TestEval(t *testing.T) { testEvalPFCOUNT(t, store) testEvalHGET(t, store) testEvalHSTRLEN(t, store) + testEvalHEXISTS(t, store) testEvalHDEL(t, store) testEvalPFMERGE(t, store) testEvalJSONSTRLEN(t, store) @@ -2233,6 +2234,64 @@ func testEvalHSTRLEN(t *testing.T, store *dstore.Store) ...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#646: Adds support for HEXISTS command
864
DiceDB/dice
10,326
C
c-harish
expected: []interface{}{float64(0), "(nil)", "(nil)"}, }, { name: "NX on non-existing key", commands: []string{"DEL k", "SET k v NX", "GET k"}, expected: []interface{}{float64(0), "OK", "v"}, }, { name: "NX on existing key", commands: []string{"DEL k", "SET k v NX", "GET k", "SET k v N...
No issues found.
expected: []interface{}{float64(0), "(nil)", "(nil)"}, }, { name: "NX on non-existing key", commands: []string{"DEL k", "SET k v NX", "GET k"}, expected: []interface{}{float64(0), "OK", "v"}, }, { name: "NX on existing key", commands: []string{"DEL k", "SET k v NX", "GET k", "SET k v N...
@@ -3,18 +3,15 @@ package websocket import ( "fmt" "strconv" - "strings" "testing" "time" - testifyAssert "github.com/stretchr/testify/assert" - "gotest.tools/v3/assert" ) type TestCase struct { name string - commands []WebsocketCommand + commands []string expected []interface{} } @@ -23,44 ...
integration_tests/commands/websocket/set_test.go
0
Go
1
none
16
51
51
true
Websocket integration tests - SET and GET
878
DiceDB/dice
10,326
C
psrvere
package object import ( "errors" diceerrors "github.com/dicedb/dice/internal/errors" ) func GetType(te uint8) uint8 { return (te >> 4) << 4 } func GetEncoding(te uint8) uint8 { return te & 0b00001111 } func AssertType(te, t uint8) error { if GetType(te) != t { return errors.New("WRONGTYPE Operation against ...
No issues found.
package object import ( "errors" diceerrors "github.com/dicedb/dice/internal/errors" ) func GetType(te uint8) uint8 { return (te >> 4) << 4 } func GetEncoding(te uint8) uint8 { return te & 0b00001111 } func AssertType(te, t uint8) error { if GetType(te) != t { return errors.New("WRONGTYPE Operation against ...
@@ -30,10 +30,10 @@ func AssertEncoding(te, e uint8) error { func AssertTypeAndEncoding(typeEncoding, expectedType, expectedEncoding uint8) []byte { if err := AssertType(typeEncoding, expectedType); err != nil { - return diceerrors.NewErrWithMessage("Existing key has wrong Dice type") + return diceerrors.NewErrW...
internal/object/typeencoding.go
0
Go
1
none
16
40
40
true
Add support for command JSON.STRAPPEND #501
882
DiceDB/dice
10,326
C
karandixit10
m.WatchList.Range(func(key, value interface{}) bool { queryString := key.(string) clients := value.(*sync.Map) query, err := sql.ParseQuery(queryString) if err != nil { m.logger.Error( "error parsing query", slog.String("query", queryString), ) return true } // Check if the key matches t...
No issues found.
m.WatchList.Range(func(key, value interface{}) bool { queryString := key.(string) clients := value.(*sync.Map) query, err := sql.ParseQuery(queryString) if err != nil { m.logger.Error( "error parsing query", slog.String("query", queryString), ) return true } // Check if the key matches t...
@@ -1,4 +1,4 @@ -package querywatcher +package querymanager import ( "context" @@ -25,8 +25,8 @@ import ( type ( cacheStore *swiss.Map[string, *object.Obj] - // WatchSubscription represents a subscription to watch a query. - WatchSubscription struct { + // QuerySubscription represents a subscription to watch ...
internal/querymanager/query_manager.go
0
Go
1
none
16
51
51
true
improves naming for querywatcher package
883
DiceDB/dice
10,326
C
JyotinderSingh
output: []byte("*1\r\n:3\r\n"), }, "subpath not string strlen": { setup: func() { key := "EXISTING_KEY" value := `{"partner":{"name":21,"language":["rust"]}}` var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object...
No issues found.
output: []byte("*1\r\n:3\r\n"), }, "subpath not string strlen": { setup: func() { key := "EXISTING_KEY" value := `{"partner":{"name":21,"language":["rust"]}}` var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object...
@@ -70,6 +70,7 @@ func TestEval(t *testing.T) { testEvalDbsize(t, store) testEvalGETSET(t, store) testEvalHSET(t, store) + testEvalHKEYS(t, store) testEvalPFADD(t, store) testEvalPFCOUNT(t, store) testEvalHGET(t, store) @@ -2743,6 +2744,59 @@ func testEvalHSET(t *testing.T, store *dstore.Store) { runEvalT...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
Add Support for HKEYS command.
886
DiceDB/dice
10,326
C
swarajrb7
}{ IOBufferLength: 512, IOBufferLengthMAX: 50 * 1024, }, } var defaultConfig Config func init() { config := baseConfig env := os.Getenv("DICE_ENV") switch env { case "dev": config.Server.LogLevel = "debug" config.Server.PrettyPrintLogs = true default: } logLevel := os.Getenv("DICE_LOG_LEVEL") if ...
No issues found.
}{ IOBufferLength: 512, IOBufferLengthMAX: 50 * 1024, }, } var defaultConfig Config func init() { config := baseConfig env := os.Getenv("DICE_ENV") switch env { case "dev": config.Server.LogLevel = "debug" config.Server.PrettyPrintLogs = true default: } logLevel := os.Getenv("DICE_LOG_LEVEL") if ...
@@ -24,6 +24,8 @@ const ( EvictAllKeysRandom = "allkeys-random" EvictAllKeysLRU = "allkeys-lru" EvictAllKeysLFU = "allkeys-lfu" + + DefaultKeysLimit int = 200000000 ) var ( @@ -44,6 +46,8 @@ var ( FileLocation = utils.EmptyStr InitConfigCmd = false + + KeysLimit = DefaultKeysLimit ) ty...
config/config.go
0
Go
1
none
16
51
51
true
fix: Allows users to customize the KeysLimit value at server start
888
DiceDB/dice
10,326
C
vpsinghg
package http import ( "fmt" "testing" "github.com/dicedb/dice/internal/eval" "gotest.tools/v3/assert" ) func TestCommandDefault(t *testing.T) { exec := NewHTTPCommandExecutor() commands := getCommandDefault(exec) t.Run("Command should not be empty", func(t *testing.T) { assert.Assert(t, len(commands) > 0, ...
No issues found.
package http import ( "fmt" "testing" "github.com/dicedb/dice/internal/eval" "gotest.tools/v3/assert" ) func TestCommandDefault(t *testing.T) { exec := NewHTTPCommandExecutor() commands := getCommandDefault(exec) t.Run("Command should not be empty", func(t *testing.T) { assert.Assert(t, len(commands) > 0, ...
@@ -0,0 +1,46 @@ +package http + +import ( + "fmt" + "testing" + + "github.com/dicedb/dice/internal/eval" + "gotest.tools/v3/assert" +) + +func TestCommandDefault(t *testing.T) { + exec := NewHTTPCommandExecutor() + commands := getCommandDefault(exec) + t.Run("Command should not be empty", func(t *testing.T) { + asser...
integration_tests/commands/http/command_default_test.go
0
Go
1
none
16
47
47
true
#734: Http Integration tests for COMMAND and COMMAND/COUNT
899
DiceDB/dice
10,326
C
svkaizoku
}, } runEvalTests(t, tests, evalLLEN, store) } func testEvalJSONNUMINCRBY(t *testing.T, store *dstore.Store) { tests := map[string]evalTestCase{ "incr on numeric field": { setup: func() { key := "number" value := "{\"a\": 2}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootD...
No issues found.
}, } runEvalTests(t, tests, evalLLEN, store) } func testEvalJSONNUMINCRBY(t *testing.T, store *dstore.Store) { tests := map[string]evalTestCase{ "incr on numeric field": { setup: func() { key := "number" value := "{\"a\": 2}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootD...
@@ -82,6 +82,7 @@ func TestEval(t *testing.T) { testEvalHSTRLEN(t, store) testEvalHEXISTS(t, store) testEvalHDEL(t, store) + testEvalHSCAN(t, store) testEvalPFMERGE(t, store) testEvalJSONSTRLEN(t, store) testEvalJSONOBJLEN(t, store) @@ -2425,6 +2426,91 @@ func testEvalHDEL(t *testing.T, store *dstore.Store)...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#653: Added HSCAN command
907
DiceDB/dice
10,326
C
manishrw
if i < minLength { result[i] = values[maxKeyIterator][i] } } } else { for i := 0; i < maxLength; i++ { result[i] = 0x00 } } // perform the operation for _, value := range values { for i := 0; i < len(value); i++ { switch operation { case AND: result[i] &= value[i] case OR: res...
No issues found.
if i < minLength { result[i] = values[maxKeyIterator][i] } } } else { for i := 0; i < maxLength; i++ { result[i] = 0x00 } } // perform the operation for _, value := range values { for i := 0; i < len(value); i++ { switch operation { case AND: result[i] &= value[i] case OR: res...
@@ -171,8 +171,11 @@ func evalDBSIZE(args []string, store *dstore.Store) []byte { return diceerrors.NewErrArity("DBSIZE") } + // Expired keys must be explicitly deleted since the cronFrequency for cleanup is configurable. + // A longer delay may prevent timely cleanup, leading to incorrect DBSIZE results. + dsto...
internal/eval/eval.go
0
Go
1
none
16
51
51
true
Adding default config file to be used when dice server starts
908
DiceDB/dice
10,326
C
lucifercr07
} iter := 0 argLength := len(keyValuePairs) for iter <= argLength-1 { if iter >= argLength-1 || iter+1 > argLength-1 { return hmap, -1, diceerrors.NewErr(fmt.Sprintf(diceerrors.ArityErr, "HSET")) } k := keyValuePairs[iter] v := keyValuePairs[iter+1] _, present := hmap.Set(k, v) if !present { n...
No issues found.
} iter := 0 argLength := len(keyValuePairs) for iter <= argLength-1 { if iter >= argLength-1 || iter+1 > argLength-1 { return hmap, -1, diceerrors.NewErr(fmt.Sprintf(diceerrors.ArityErr, "HSET")) } k := keyValuePairs[iter] v := keyValuePairs[iter+1] _, present := hmap.Set(k, v) if !present { n...
@@ -121,7 +121,7 @@ func (h HashMap) incrementFloatValue(field string, incr float64) (string, error) return "-1", diceerrors.NewErr(diceerrors.IntOrFloatErr) } - if (i > 0 && incr > 0 && i > math.MaxFloat64-incr) || (i < 0 && incr < 0 && i < -math.MaxFloat64-incr) { + if math.IsInf(i+incr, 1) || math.IsInf(i+inc...
internal/eval/hmap.go
0
Go
1
none
16
51
51
true
#921: Added Hashmap incrementFloatValue overflow check
927
DiceDB/dice
10,326
C
dograprabhav
}, { name: "STRLEN nested", commands: []string{ `JSON.SET doc $ {"name":"jerry","partner":{"name":"tom"}}`, "JSON.STRLEN doc $..name", }, expected: []interface{}{"OK", []interface{}{int64(5), int64(3)}}, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { for i, cmd...
No issues found.
}, { name: "STRLEN nested", commands: []string{ `JSON.SET doc $ {"name":"jerry","partner":{"name":"tom"}}`, "JSON.STRLEN doc $..name", }, expected: []interface{}{"OK", []interface{}{int64(5), int64(3)}}, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { for i, cmd...
@@ -504,6 +504,14 @@ func TestJSONDelOperations(t *testing.T) { "JSON.GET user $"}, expected: []interface{}{"OK", int64(1), `{"name":"sugar"}`}, }, + { + name: "delete key with []", + commands: []string{ + `JSON.SET data $ {"key[0]":"value","array":["a","b"]}`, + `JSON.DEL data ["key[0]"]`, + ...
integration_tests/commands/async/json_test.go
0
Go
1
none
16
51
51
true
fix null value in removing array element and add test for this scenario
953
DiceDB/dice
10,326
C
Dhroov7
"incr on nested fields": { setup: func() { key := "number" value := "{\"a\": {\"b\": {\"c\": 10}}}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []str...
No issues found.
"incr on nested fields": { setup: func() { key := "number" value := "{\"a\": {\"b\": {\"c\": 10}}}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []str...
@@ -72,6 +72,7 @@ func TestEval(t *testing.T) { testEvalDbsize(t, store) testEvalGETSET(t, store) testEvalHSET(t, store) + testEvalHMSET(t, store) testEvalHKEYS(t, store) testEvalPFADD(t, store) testEvalPFCOUNT(t, store) @@ -2762,6 +2763,92 @@ func testEvalHSET(t *testing.T, store *dstore.Store) { runEval...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#651: FEAT: Added support for HMSET
960
DiceDB/dice
10,326
C
raghavbabbar
conn := createWebSocketConn(t) defer conn.Close() // Simulate a network error by closing the connection beforehand conn.Close() err := server.WriteResponseWithRetries(conn, []byte("hello"), 3) assert.Error(t, err) assert.Contains(t, err.Error(), "network operation error") } func TestWriteResponseWithRetries_B...
No issues found.
conn := createWebSocketConn(t) defer conn.Close() // Simulate a network error by closing the connection beforehand conn.Close() err := server.WriteResponseWithRetries(conn, []byte("hello"), 3) assert.Error(t, err) assert.Contains(t, err.Error(), "network operation error") } func TestWriteResponseWithRetries_B...
@@ -0,0 +1,108 @@ +package websocket + +import ( + "net" + "net/http" + "net/url" + "os" + "sync" + "testing" + "time" + + "github.com/dicedb/dice/internal/server" + "github.com/gorilla/websocket" + "github.com/stretchr/testify/assert" +) + +var serverAddr = "localhost:12345" +var once sync.Once + +func TestWriteRespon...
integration_tests/commands/websocket/websocket_write_retries_test.go
0
Go
1
none
16
51
51
true
fix: handling multiple failure/error scenarios during socket writes
983
DiceDB/dice
10,326
C
ayushsatyam146
"summary", string("GET returns the value for the queried key in args\n\t\tThe key should be the only param in args\n\t\tThe RESP value of the key is encoded and then returned\n\t\tGET returns RespNIL if key is expired or it does not exist"), "arity", int64(2), "beginIndex", int64(1), "lastIndex", int64(0...
No issues found.
"summary", string("GET returns the value for the queried key in args\n\t\tThe key should be the only param in args\n\t\tThe RESP value of the key is encoded and then returned\n\t\tGET returns RespNIL if key is expired or it does not exist"), "arity", int64(2), "beginIndex", int64(1), "lastIndex", int64(0...
@@ -0,0 +1,104 @@ +package resp + +import ( + "testing" + + "gotest.tools/v3/assert" +) + +var getDocsTestCases = []struct { + name string + inCmd string + expected interface{} +}{ + {"Set command", "SET", []interface{}{[]interface{}{ + "set", + []interface{}{ + "summary", + string("SET puts a new <key, va...
integration_tests/commands/resp/command_docs_test.go
0
Go
1
none
16
51
51
true
added docs and corrected info code
993
DiceDB/dice
10,326
C
sa-k-shore
listTitle := "LIST" listMessage := " Return a list of all commands in this Dice server." getKeysTitle := "GETKEYS <full-command>" getKeysMessage := " Return the keys from a full Dice command." helpTitle := "HELP" helpMessage := " Print this help." message := []string{ format, noTitle, noMessage...
No issues found.
listTitle := "LIST" listMessage := " Return a list of all commands in this Dice server." getKeysTitle := "GETKEYS <full-command>" getKeysMessage := " Return the keys from a full Dice command." helpTitle := "HELP" helpMessage := " Print this help." message := []string{ format, noTitle, noMessage...
@@ -3497,7 +3497,64 @@ func evalObjectIdleTime(key string, store *dstore.Store) []byte { return clientio.Encode(int64(dstore.GetIdleTime(obj.LastAccessedAt)), true) } +func evalObjectEncoding(key string, store *dstore.Store) []byte { + var encodingTypeStr string + obj := store.GetNoTouch(key) + if obj == nil { +...
internal/eval/eval.go
0
Go
1
none
16
51
51
true
#964 Support for OBJECT ENCODING
1,039
DiceDB/dice
10,326
C
sashpawar11
Name: "RENAME", Info: "Renames a key and overwrites the destination", Eval: evalRename, Arity: 3, } getexCmdMeta = DiceCmdMeta{ Name: "GETEX", Info: `Get the value of key and optionally set its expiration. GETEX is similar to GET, but is a write command with additional options.`, Eval: evalGETE...
No issues found.
Name: "RENAME", Info: "Renames a key and overwrites the destination", Eval: evalRename, Arity: 3, } getexCmdMeta = DiceCmdMeta{ Name: "GETEX", Info: `Get the value of key and optionally set its expiration. GETEX is similar to GET, but is a write command with additional options.`, Eval: evalGETE...
@@ -1086,123 +1086,123 @@ var ( ) func init() { - DiceCmds["PING"] = pingCmdMeta - DiceCmds["ECHO"] = echoCmdMeta + DiceCmds["ABORT"] = abortCmdMeta + DiceCmds["APPEND"] = appendCmdMeta DiceCmds["AUTH"] = authCmdMeta - DiceCmds["DUMP"] = dumpkeyCMmdMeta - DiceCmds["RESTORE"] = restorekeyCmdMeta - DiceCmds["SET"] ...
internal/eval/commands.go
0
Go
1
none
16
51
51
true
Refactoring to handle Watch command type in the generic flow of command handlers
1,043
DiceDB/dice
10,326
C
AshwinKul28
KeysLimit int `mapstructure:"keyslimit"` LFULogFactor int `mapstructure:"lfulogfactor"` }{ MaxMemory: 0, EvictionPolicy: EvictAllKeysLFU, EvictionRatio: 0.9, KeysLimit: DefaultKeysLimit, LFULogFactor: 10, }, Persistence: struct { AOFFile string `mapstructure:"ao...
No issues found.
KeysLimit int `mapstructure:"keyslimit"` LFULogFactor int `mapstructure:"lfulogfactor"` }{ MaxMemory: 0, EvictionPolicy: EvictAllKeysLFU, EvictionRatio: 0.9, KeysLimit: DefaultKeysLimit, LFULogFactor: 10, }, Persistence: struct { AOFFile string `mapstructure:"ao...
@@ -50,6 +50,8 @@ var ( InitConfigCmd = false KeysLimit = DefaultKeysLimit + + EnableProfiling = false ) type Config struct { @@ -83,6 +85,7 @@ type Config struct { EnableMultiThreading bool `mapstructure:"enablemultithreading"` StoreMapInitSize int `mapstructure:"storemapinit...
config/config.go
0
Go
1
none
16
51
51
true
Add profiling for DiceDB
1,048
DiceDB/dice
10,326
C
soumya-codes
IncrDecrOverflowErr = "increment or decrement would overflow" NoKeyErr = "no such key" ErrDefault = "-ERR %s" WrongTypeErr = "-WRONGTYPE Operation against a key holding the wrong kind of value" WrongTypeHllErr = "-WRONGTYPE Key is not a valid HyperLogLog string value."...
No issues found.
IncrDecrOverflowErr = "increment or decrement would overflow" NoKeyErr = "no such key" ErrDefault = "-ERR %s" WrongTypeErr = "-WRONGTYPE Operation against a key holding the wrong kind of value" WrongTypeHllErr = "-WRONGTYPE Key is not a valid HyperLogLog string value."...
@@ -20,7 +20,7 @@ const ( WrongTypeHllErr = "-WRONGTYPE Key is not a valid HyperLogLog string value." InvalidHllErr = "-INVALIDOBJ Corrupted HLL object detected" WorkerNotFoundErr = "worker with ID %s not found" - JSONPathValueTypeErr = "-WRONGTYPE wrong type of path value - expected string...
internal/errors/errors.go
0
Go
1
none
16
51
51
true
#1060 JSON.STRLEN no path and type error
1,064
DiceDB/dice
10,326
C
bhima2001
return runtime.NumCPU() } func getTotalMemoryMB() (int64, error) { var res string var err error switch runtime.GOOS { case linux: res, err = executeCommand("free -b | grep Mem | awk '{print $2}'") if err != nil { return 0, fmt.Errorf("error:stats.total_memory_mb failed to capture memory err=%w", err) } ...
No issues found.
return runtime.NumCPU() } func getTotalMemoryMB() (int64, error) { var res string var err error switch runtime.GOOS { case linux: res, err = executeCommand("free -b | grep Mem | awk '{print $2}'") if err != nil { return 0, fmt.Errorf("error:stats.total_memory_mb failed to capture memory err=%w", err) } ...
@@ -125,7 +125,7 @@ func executeCommand(cmd string) (string, error) { var out []byte var err error - if runtime.GOOS == "windows" { + if runtime.GOOS == windows { out, err = exec.Command("cmd", "/C", cmd).Output() } else { out, err = exec.Command("sh", "-c", cmd).Output()
internal/observability/hardware.go
0
Go
1
none
16
51
51
true
Fix lint issues for master build
1,069
DiceDB/dice
10,326
C
lucifercr07
"same key -> update value, add new field and value": { setup: func() { key := "KEY_MOCK" field := "mock_field_name" mockValue := "mock_field_value" newMap := make(HashMap) newMap[field] = mockValue obj := &object.Obj{ TypeEncoding: object.ObjTypeHashMap | object.ObjEncodingHashMap, ...
No issues found.
"same key -> update value, add new field and value": { setup: func() { key := "KEY_MOCK" field := "mock_field_name" mockValue := "mock_field_value" newMap := make(HashMap) newMap[field] = mockValue obj := &object.Obj{ TypeEncoding: object.ObjTypeHashMap | object.ObjEncodingHashMap, ...
@@ -2832,6 +2832,50 @@ func runEvalTests(t *testing.T, tests map[string]evalTestCase, evalFunc func([]s } } +func runMigratedEvalTests(t *testing.T, tests map[string]evalTestCase, evalFunc func([]string, *dstore.Store) *EvalResponse, store *dstore.Store) { + for name, tc := range tests { + t.Run(name, func(t *tes...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#1034 Command Migration: ('ZADD', 'ZRANGE') (Issue #1034)
1,077
DiceDB/dice
10,326
C
benjaminmishra
commands: []string{"SET k2 v2 PXAT 123123", "GET k2"}, expected: []interface{}{"OK", "(nil)"}, }, { name: "XX on existing key", commands: []string{"SET k v1", "SET k v2 XX", "GET k"}, expected: []interface{}{"OK", "OK", "v2"}, }, { name: "Multiple XX operations", commands: []string{...
No issues found.
commands: []string{"SET k2 v2 PXAT 123123", "GET k2"}, expected: []interface{}{"OK", "(nil)"}, }, { name: "XX on existing key", commands: []string{"SET k v1", "SET k v2 XX", "GET k"}, expected: []interface{}{"OK", "OK", "v2"}, }, { name: "Multiple XX operations", commands: []string{...
@@ -6,7 +6,7 @@ import ( "testing" "time" - "gotest.tools/v3/assert" + "github.com/stretchr/testify/assert" ) type TestCase struct { @@ -39,11 +39,13 @@ func TestSet(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { conn := exec.ConnectToServer() - exec.FireCommand(...
integration_tests/commands/websocket/set_test.go
0
Go
1
none
16
51
51
true
Fixed bugs in Websocket Integration Tests
1,142
DiceDB/dice
10,326
C
psrvere
}, { Command: "JSON.GET", Body: map[string]interface{}{"key": "k"}, }, }, expected: []interface{}{"OK", float64(3), "[0,1,2]"}, }, { name: "update array within array", commands: []HTTPCommand{ { Command: "JSON.SET", Body: map[string]interface{}{"key": "k", "path...
No issues found.
}, { Command: "JSON.GET", Body: map[string]interface{}{"key": "k"}, }, }, expected: []interface{}{"OK", float64(3), "[0,1,2]"}, }, { name: "update array within array", commands: []HTTPCommand{ { Command: "JSON.SET", Body: map[string]interface{}{"key": "k", "path...
@@ -14,7 +14,7 @@ func TestJSONARRPOP(t *testing.T) { arrayAtRoot := []interface{}{0, 1, 2, 3} nestedArray := map[string]interface{}{"a": 2, "b": []interface{}{0, 1, 2, 3}} arrayWithinArray := map[string]interface{}{"a": 2, "b": []interface{}{0, 1, 2, []interface{}{3, 4, 5}}} - + simpleJson := map[string]interfac...
integration_tests/commands/http/json_arrpop_test.go
0
Go
1
none
16
51
51
true
Refactor HTTP response
1,150
DiceDB/dice
10,326
C
lucifercr07
} }(wg) slog.Info("ready to accept and serve requests on", slog.Int("port", config.Port)) select { case <-ctx.Done(): slog.Info("initiating shutdown") case err = <-errChan: slog.Error("error while accepting connections, initiating shutdown", slog.Any("error", err)) } s.Shutdown() wg.Wait() // Wait for...
No issues found.
} }(wg) slog.Info("ready to accept and serve requests on", slog.Int("port", config.Port)) select { case <-ctx.Done(): slog.Info("initiating shutdown") case err = <-errChan: slog.Error("error while accepting connections, initiating shutdown", slog.Any("error", err)) } s.Shutdown() wg.Wait() // Wait for...
@@ -39,27 +39,30 @@ const ( type Server struct { abstractserver.AbstractServer - Host string - Port int - serverFD int - connBacklogSize int - workerManager *worker.WorkerManager - shardManager *shard.ShardManager - watchManager *watchmanager.Manager - cmdWatchChan chan dsto...
internal/server/resp/server.go
0
Go
1
none
16
51
51
true
Changed scope of CmdWatchSubscriptionChan to local
1,169
DiceDB/dice
10,326
C
KanniShashankh
expected: []interface{}{float64(3), []interface{}{"member1", "1", "member2", "2", "member3", "3"}}, }, { name: "ZPOPMIN on empty sorted set", commands: []string{"ZADD myzset 1 member1", "ZPOPMIN myzset 1", "ZPOPMIN myzset"}, expected: []interface{}{float64(1), []interface{}{"member1", "1"}, []interf...
No issues found.
expected: []interface{}{float64(3), []interface{}{"member1", "1", "member2", "2", "member3", "3"}}, }, { name: "ZPOPMIN on empty sorted set", commands: []string{"ZADD myzset 1 member1", "ZPOPMIN myzset 1", "ZPOPMIN myzset"}, expected: []interface{}{float64(1), []interface{}{"member1", "1"}, []interf...
@@ -76,3 +76,75 @@ func TestZPOPMIN(t *testing.T) { }) } } + +func TestZCOUNT(t *testing.T) { + exec := NewWebsocketCommandExecutor() + + testCases := []TestCase{ + { + name: "ZCOUNT on non-existing key", + commands: []string{"ZCOUNT NON_EXISTENT_KEY 0 10"}, + expected: []interface{}{float64(0)}, + },...
integration_tests/commands/websocket/zset_test.go
0
Go
1
none
16
51
51
true
#1130: Adds support for command ZCOUNT
1,171
DiceDB/dice
10,326
C
tarun-29
obj := store.Get(key) var hashMap HashMap if obj != nil { if err := object.AssertTypeAndEncoding(obj.TypeEncoding, object.ObjTypeHashMap, object.ObjEncodingHashMap); err != nil { return &EvalResponse{ Result: nil, Error: diceerrors.ErrWrongTypeOperation, } } hashMap = obj.Value.(HashMap) } el...
No issues found.
obj := store.Get(key) var hashMap HashMap if obj != nil { if err := object.AssertTypeAndEncoding(obj.TypeEncoding, object.ObjTypeHashMap, object.ObjEncodingHashMap); err != nil { return &EvalResponse{ Result: nil, Error: diceerrors.ErrWrongTypeOperation, } } hashMap = obj.Value.(HashMap) } el...
@@ -1226,7 +1226,7 @@ func evalPFADD(args []string, store *dstore.Store) *EvalResponse { obj = store.NewObj(hll, -1, object.ObjTypeString, object.ObjEncodingRaw) - store.Put(key, obj) + store.Put(key, obj, dstore.WithPutCmd(dstore.PFADD)) return &EvalResponse{ Result: int64(1), Error: nil, @@ -1245...
internal/eval/store_eval.go
0
Go
1
none
16
51
51
true
#1133: Add support for PFCOUNT.WATCH command
1,197
DiceDB/dice
10,326
C
iamskp11
} // Fire updates to the key using the publisher, then check if the subscribers receive the updates in the push-response form (i.e. array of three elements, with third element being the value) for _, tc := range getUnwatchTestCases { res := FireCommand(publisher, fmt.Sprintf("SET %s %s", tc.key, tc.val)) assert...
No issues found.
} // Fire updates to the key using the publisher, then check if the subscribers receive the updates in the push-response form (i.e. array of three elements, with third element being the value) for _, tc := range getUnwatchTestCases { res := FireCommand(publisher, fmt.Sprintf("SET %s %s", tc.key, tc.val)) assert...
@@ -0,0 +1,181 @@ +package resp + +import ( + "context" + "fmt" + "net" + "testing" + "time" + + "github.com/dicedb/dice/internal/clientio" + "github.com/dicedb/dicedb-go" + "github.com/stretchr/testify/assert" +) + +const ( + getUnwatchKey = "getunwatchkey" + fingerprint = "3557732805" +) + +type getUnwatchTestCase ...
integration_tests/commands/resp/getunwatch_test.go
0
Go
1
none
16
51
51
true
#998: Added GET.UNWATCH command support and fix watch related issues
1,201
DiceDB/dice
10,326
C
psrvere
{Command: "GET", Body: map[string]interface{}{"key": "k2"}}, }, expected: []interface{}{"OK", nil}, }, { name: "XX on existing key", commands: []HTTPCommand{ {Command: "SET", Body: map[string]interface{}{"key": "k", "value": "v1"}}, {Command: "SET", Body: map[string]interface{}{"key": "k", "...
No issues found.
{Command: "GET", Body: map[string]interface{}{"key": "k2"}}, }, expected: []interface{}{"OK", nil}, }, { name: "XX on existing key", commands: []HTTPCommand{ {Command: "SET", Body: map[string]interface{}{"key": "k", "value": "v1"}}, {Command: "SET", Body: map[string]interface{}{"key": "k", "...
@@ -203,6 +203,94 @@ func TestSetWithOptions(t *testing.T) { } } +func TestWithKeepTTLFlag(t *testing.T) { + exec := NewHTTPCommandExecutor() + expiryTime := strconv.FormatInt(time.Now().Add(1*time.Minute).UnixMilli(), 10) + + testCases := []TestCase { + { + name: "SET WITH KEEP TTL", + commands: []HTTPComman...
integration_tests/commands/http/set_test.go
0
Go
1
none
16
51
51
true
FIX: SET Command Inconsistency
1,215
DiceDB/dice
10,326
C
vanshavenger
"github.com/stretchr/testify/assert" ) func TestLPOPCount(t *testing.T) { exec := NewWebsocketCommandExecutor() testCases := []struct { name string commands []string expected []interface{} cleanupKey string }{ { name: "LPOP with count argument - valid, invalid, and edge cases", commands...
No issues found.
"github.com/stretchr/testify/assert" ) func TestLPOPCount(t *testing.T) { exec := NewWebsocketCommandExecutor() testCases := []struct { name string commands []string expected []interface{} cleanupKey string }{ { name: "LPOP with count argument - valid, invalid, and edge cases", commands...
@@ -0,0 +1,58 @@ +package websocket + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestLPOPCount(t *testing.T) { + exec := NewWebsocketCommandExecutor() + + testCases := []struct { + name string + commands []string + expected []interface{} + cleanupKey string + }{ + { + nam...
integration_tests/commands/websocket/deque_test.go
0
Go
1
none
16
51
51
true
#1100: Fix LPOP to support multiple arguments
1,231
DiceDB/dice
10,326
C
tren03
key := "EXISTING_KEY" value := "{\"a\": 1}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []string{"MEMORY", "EXISTING_KEY", "$"}, output: []byte(":89\r\...
No issues found.
key := "EXISTING_KEY" value := "{\"a\": 1}" var rootData interface{} _ = sonic.Unmarshal([]byte(value), &rootData) obj := store.NewObj(rootData, -1, object.ObjTypeJSON, object.ObjEncodingJSON) store.Put(key, obj) }, input: []string{"MEMORY", "EXISTING_KEY", "$"}, output: []byte(":89\r\...
@@ -187,204 +187,129 @@ func testEvalHELLO(t *testing.T, store *dstore.Store) { } func testEvalSET(t *testing.T, store *dstore.Store) { - tests := []evalTestCase{ - { - name: "nil value", + tests := map[string]evalTestCase{ + "nil value": { input: nil, migratedOutput: EvalResponse{Res...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
#207 Feature: get in set
1,238
DiceDB/dice
10,326
C
apoorvyadav1111
if val := os.Getenv("DICEDB_HOST"); val != "" { dhost = val } dport := "7379" if val := os.Getenv("DICEDB_PORT"); val != "" { dport = val } db = dicedb.NewClient(&dicedb.Options{ Addr: fmt.Sprintf("%s:%s", dhost, dport), }) } // Creates a short URL from a given long URL func createShortURL(c *gin.Contex...
No issues found.
if val := os.Getenv("DICEDB_HOST"); val != "" { dhost = val } dport := "7379" if val := os.Getenv("DICEDB_PORT"); val != "" { dport = val } db = dicedb.NewClient(&dicedb.Options{ Addr: fmt.Sprintf("%s:%s", dhost, dport), }) } // Creates a short URL from a given long URL func createShortURL(c *gin.Contex...
@@ -0,0 +1,100 @@ +package main + +import ( + "context" + "encoding/json" + "os" + "fmt" + + "log" + "net/http" + + "github.com/gin-gonic/gin" + "github.com/google/uuid" + "github.com/dicedb/dicedb-go" // DiceDB Go SDK +) + +type URL struct { + LongURL string `json:"long_url"` +} + +var db *dicedb.Client + +// Initia...
examples/url-shortener/main.go
0
Go
1
none
16
51
51
true
feat: Add a tutorial example for URL Shortner built using DiceDB and Go
1,259
DiceDB/dice
10,326
C
Prachi-Jamdade
if !ok { t.Errorf("Type assertion to []interface{} failed for value: %v", v) } fmt.Println(castedValue) assert.Equal(t, 3, len(castedValue)) assert.Equal(t, "GET", castedValue[0]) assert.Equal(t, "426696421", castedValue[1]) assert.Equal(t, tc.val, castedValue[2]) } } // unsubscribe from u...
No issues found.
if !ok { t.Errorf("Type assertion to []interface{} failed for value: %v", v) } fmt.Println(castedValue) assert.Equal(t, 3, len(castedValue)) assert.Equal(t, "GET", castedValue[0]) assert.Equal(t, "426696421", castedValue[1]) assert.Equal(t, tc.val, castedValue[2]) } } // unsubscribe from u...
@@ -80,7 +80,7 @@ func TestGETUNWATCH(t *testing.T) { } // unsubscribe from updates - unsubscribeFromUpdates(t, subscribers) + unsubscribeFromUpdates(t, subscribers, "426696421") // Test updates are not sent after unsubscribing for _, tc := range getUnwatchTestCases[2:] { @@ -113,9 +113,9 @@ func TestGETUNW...
integration_tests/commands/resp/getunwatch_test.go
0
Go
1
none
16
51
51
true
Added Label for Watch commands
1,267
DiceDB/dice
10,326
C
psrvere
{ name: "NoZeroBitFound", val: []byte("\xff\xff\xff"), inCmd: HTTPCommand{Command: "BITPOS", Body: map[string]interface{}{"key": "testkey", "value": 0}}, out: float64(24), }, { name: "NoZeroBitFoundWithRangeStartPos", val: []byte("\xff\xff\xff"), inCmd: HTTPCommand{Command: "BITPOS", ...
No issues found.
{ name: "NoZeroBitFound", val: []byte("\xff\xff\xff"), inCmd: HTTPCommand{Command: "BITPOS", Body: map[string]interface{}{"key": "testkey", "value": 0}}, out: float64(24), }, { name: "NoZeroBitFoundWithRangeStartPos", val: []byte("\xff\xff\xff"), inCmd: HTTPCommand{Command: "BITPOS", ...
@@ -481,6 +481,30 @@ func TestBitCount(t *testing.T) { }, Out: []interface{}{float64(0)}, }, + { + InCmds: []HTTPCommand{ + {Command: "SETBIT", Body: map[string]interface{}{"key": "mykey", "values": []interface{}{-1, 1}}}, + }, + Out: []interface{}{"ERR bit offset is not an integer or out of range"...
integration_tests/commands/http/bit_test.go
0
Go
1
none
16
51
51
true
#1114: changes for issue
1,296
DiceDB/dice
10,326
C
Yashasv-Prajapati
func testPFCountAdd(t *testing.T, publisher net.Conn, respParsers []*clientio.RESPParser) { for _, tc := range pfcountWatchTestCases { res := FireCommand(publisher, fmt.Sprintf("PFADD %s %s", tc.key, tc.val)) assert.Equal(t, int64(1), res) verifyWatchResults(t, respParsers, tc.result) } } func testPFCountMerg...
No issues found.
func testPFCountAdd(t *testing.T, publisher net.Conn, respParsers []*clientio.RESPParser) { for _, tc := range pfcountWatchTestCases { res := FireCommand(publisher, fmt.Sprintf("PFADD %s %s", tc.key, tc.val)) assert.Equal(t, int64(1), res) verifyWatchResults(t, respParsers, tc.result) } } func testPFCountMerg...
@@ -9,7 +9,7 @@ import ( "github.com/dicedb/dice/internal/clientio" dicedb "github.com/dicedb/dicedb-go" - "gotest.tools/v3/assert" + "github.com/stretchr/testify/assert" ) type pfcountWatchTestCase struct { @@ -19,11 +19,11 @@ type pfcountWatchTestCase struct { } type pfcountWatchWithPFMergeTestCase stru...
integration_tests/commands/resp/pfcountwatch_test.go
0
Go
1
none
16
51
51
true
Fixed goroutine leaks and deadlocks in Worker and Resp Integrations Tests
1,298
DiceDB/dice
10,326
C
psrvere
input: []string{"string_key"}, migratedOutput: EvalResponse{Result: nil, Error: errors.New("ERR -WRONGTYPE Operation against a key holding the wrong kind of value")}, }, { name: "HKEYS key exists and is a hash", setup: func() { key := "KEY_MOCK" field1 := "mock_field_name" newMap :=...
No issues found.
input: []string{"string_key"}, migratedOutput: EvalResponse{Result: nil, Error: errors.New("ERR -WRONGTYPE Operation against a key holding the wrong kind of value")}, }, { name: "HKEYS key exists and is a hash", setup: func() { key := "KEY_MOCK" field1 := "mock_field_name" newMap :=...
@@ -130,6 +130,7 @@ func TestEval(t *testing.T) { testEvalBitFieldRO(t, store) testEvalGEOADD(t, store) testEvalGEODIST(t, store) + testEvalGEOPOS(t, store) testEvalJSONSTRAPPEND(t, store) testEvalINCR(t, store) testEvalINCRBY(t, store) @@ -8247,6 +8248,96 @@ func testEvalGEODIST(t *testing.T, store *dstore...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
Add support for command GEOPOS
1,328
DiceDB/dice
10,326
C
helios2003
Result: len(jsonData.([]interface{})), Error: nil, } } return &EvalResponse{ Result: nil, Error: diceerrors.ErrWrongTypeOperation, } } path := args[1] // Getting the path to find the length of the array expr, err := jp.ParseString(path) if err != nil { return &EvalResponse{ Result: ni...
No issues found.
Result: len(jsonData.([]interface{})), Error: nil, } } return &EvalResponse{ Result: nil, Error: diceerrors.ErrWrongTypeOperation, } } path := args[1] // Getting the path to find the length of the array expr, err := jp.ParseString(path) if err != nil { return &EvalResponse{ Result: ni...
@@ -400,6 +400,20 @@ func evalGET(args []string, store *dstore.Store) *EvalResponse { Error: diceerrors.ErrWrongTypeOperation, } + case object.ObjTypeHLL: + // Value is stored as a hyperloglog, use type assertion + if val, ok := obj.Value.(*hyperloglog.Sketch); ok { + return &EvalResponse{ + Result: va...
internal/eval/store_eval.go
0
Go
1
none
16
51
51
true
Update `PFMERGE` to be supported as multishard command
1,388
DiceDB/dice
10,326
C
lucifercr07
// Copyright (c) 2022-present, DiceDB contributors // All rights reserved. Licensed under the BSD 3-Clause License. See LICENSE file in the project root for full license information. package cmd import ( "fmt" "path/filepath" "github.com/dicedb/dice/config" "github.com/spf13/cobra" "github.com/spf13/viper" ) v...
No issues found.
// Copyright (c) 2022-present, DiceDB contributors // All rights reserved. Licensed under the BSD 3-Clause License. See LICENSE file in the project root for full license information. package cmd import ( "fmt" "path/filepath" "github.com/dicedb/dice/config" "github.com/spf13/cobra" "github.com/spf13/viper" ) v...
@@ -5,6 +5,7 @@ package cmd import ( "fmt" + "path/filepath" "github.com/dicedb/dice/config" "github.com/spf13/cobra" @@ -16,8 +17,8 @@ var initConfigCmd = &cobra.Command{ Short: "creates a config file at dicedb.yaml with default values", Run: func(cmd *cobra.Command, args []string) { config.Init(cmd....
cmd/init_config.go
0
Go
1
none
16
28
28
true
Add default data directory for storing logs and other dicedb files, minor fixes
1,432
DiceDB/dice
10,326
C
lucifercr07
Arity: -2, KeySpecs: KeySpecs{BeginIndex: 1}, IsMigrated: true, } hValsCmdMeta = DiceCmdMeta{ Name: "HVALS", Info: `Returns all values of the hash stored at key. The length of the reply is same as the size of the hash.`, NewEval: evalHVALS, Arity: -2, KeySpecs: KeySpecs{Be...
No issues found.
Arity: -2, KeySpecs: KeySpecs{BeginIndex: 1}, IsMigrated: true, } hValsCmdMeta = DiceCmdMeta{ Name: "HVALS", Info: `Returns all values of the hash stored at key. The length of the reply is same as the size of the hash.`, NewEval: evalHVALS, Arity: -2, KeySpecs: KeySpecs{Be...
@@ -1372,7 +1372,7 @@ func init() { DiceCmds["OBJECTCOPY"] = objectCopyCmdMeta DiceCmds["DECR"] = decrCmdMeta // moved to ironhawk DiceCmds["DECRBY"] = decrByCmdMeta - DiceCmds["DEL"] = delCmdMeta + DiceCmds["DEL"] = delCmdMeta // moved to ironhawk DiceCmds["DUMP"] = dumpkeyCMmdMeta DiceCmds["ECHO"] = echoCmd...
internal/eval/commands.go
0
Go
1
none
16
51
51
true
feat: port DEL command
1,445
DiceDB/dice
10,326
C
manosriram
migratedOutput: EvalResponse{Result: []string{"mock_field_name"}, Error: nil}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if tt.setup != nil { tt.setup() } response := evalHKEYS(tt.input, store) // fmt.Printf("EvalReponse: %v\n", response) // Handle comparison f...
No issues found.
migratedOutput: EvalResponse{Result: []string{"mock_field_name"}, Error: nil}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if tt.setup != nil { tt.setup() } response := evalHKEYS(tt.input, store) // fmt.Printf("EvalReponse: %v\n", response) // Handle comparison f...
@@ -47,7 +47,7 @@ type evalMultiShardTestCase struct { } func setupTest(store *dstore.Store) *dstore.Store { - dstore.ResetStore(store) + dstore.Reset(store) return store } @@ -7576,7 +7576,7 @@ func BenchmarkEvalZPOPMIN(b *testing.B) { for i := 0; i < b.N; i++ { // Reset the store before each run t...
internal/eval/eval_test.go
0
Go
1
none
16
51
51
true
port FLUSHDB command to IronHawk
1,457
DiceDB/dice
10,326
C
manosriram
var commandRegistry CmdRegistry = CmdRegistry{ cmds: []*DiceDBCommand{}, } func Execute(c *Cmd, s *dstore.Store) (*CmdRes, error) { // TODO: Replace this iteration with a HashTable lookup. for _, cmd := range commandRegistry.cmds { if cmd.Name != c.C.Cmd { continue } start := time.Now() resp, err := cm...
No issues found.
var commandRegistry CmdRegistry = CmdRegistry{ cmds: []*DiceDBCommand{}, } func Execute(c *Cmd, s *dstore.Store) (*CmdRes, error) { // TODO: Replace this iteration with a HashTable lookup. for _, cmd := range commandRegistry.cmds { if cmd.Name != c.C.Cmd { continue } start := time.Now() resp, err := cm...
@@ -16,7 +16,7 @@ import ( "github.com/dicedb/dice/wire" ) -//nolint: stylecheck +// nolint: stylecheck const INFINITE_EXPIRATION = int64(-1) type Cmd struct {
internal/cmd/cmds.go
0
Go
1
none
16
51
51
true
feat: port GETDEL command
1,464
DiceDB/dice
10,326
C
manosriram
{ name: "Test(XX): Set the expiration only if the key already has an expiration time", commands: []string{ "SET test_key test_value", "EXPIRE test_key " + strconv.FormatInt(10, 10) + " XX", "TTL test_key", "EXPIRE test_key " + strconv.FormatInt(10, 10), "EXPIRE test_key " + strconv.FormatInt...
No issues found.
{ name: "Test(XX): Set the expiration only if the key already has an expiration time", commands: []string{ "SET test_key test_value", "EXPIRE test_key " + strconv.FormatInt(10, 10) + " XX", "TTL test_key", "EXPIRE test_key " + strconv.FormatInt(10, 10), "EXPIRE test_key " + strconv.FormatInt...
@@ -47,15 +47,15 @@ func TestEXPIRE(t *testing.T) { "EXPIRE test_key -1", "GET test_key", }, - expected: []interface{}{"OK", errors.New("invalid expire time in 'EXPIRE' command"), "test_value"}, + expected: []interface{}{"OK", errors.New("invalid expire time in 'expire' command"), "test_value"}, },...
tests/commands/ironhawk/expire_test.go
0
Go
1
none
16
51
51
true
Del, Exists, Get command test cases
1,515
DiceDB/dice
10,326
C
Abhijeetsng97
expected: []interface{}{ "OK", 3, 5, 6, 6, }, }, { name: "INCRBY negetive values", commands: []string{ "SET key 100", "INCRBY key -2", "INCRBY key -10", "INCRBY key -88", "INCRBY key -100", "GET key", }, expected: []interface{}{ "OK", 98, 88, 0, -100, -100, }, ...
No issues found.
expected: []interface{}{ "OK", 3, 5, 6, 6, }, }, { name: "INCRBY negetive values", commands: []string{ "SET key 100", "INCRBY key -2", "INCRBY key -10", "INCRBY key -88", "INCRBY key -100", "GET key", }, expected: []interface{}{ "OK", 98, 88, 0, -100, -100, }, ...
@@ -0,0 +1,85 @@ +package ironhawk + +import ( + "fmt" + "math" + "testing" +) + +func TestINCRBY(t *testing.T) { + client := getLocalConnection() + defer client.Close() + + testCases := []TestCase{ + { + name: "INCRBY multiple integer keys", + commands: []string{ + "SET key 3", "GET key", "INCRBY key 2", "INCR...
tests/commands/ironhawk/incrby_test.go
0
Go
1
none
16
51
51
true
Integration tests fixes - INCRBY & INCR
1,516
DiceDB/dice
10,326
C
bipoool
export async function fetchGitHubRepoData() { try { const response = await fetch("https://api.github.com/repos/DiceDB/dice"); if (!response.ok) { throw new Error( `GitHub API request failed with status ${response.status}`, ); } const data = await response.json(); const format...
No issues found.
export async function fetchGitHubRepoData() { try { const response = await fetch("https://api.github.com/repos/DiceDB/dice"); if (!response.ok) { throw new Error( `GitHub API request failed with status ${response.status}`, ); } const data = await response.json(); const format...
@@ -0,0 +1,29 @@ +export async function fetchGitHubRepoData() { + try { + const response = await fetch("https://api.github.com/repos/DiceDB/dice"); + if (!response.ok) { + throw new Error( + `GitHub API request failed with status ${response.status}`, + ); + } + + const data = await respons...
docs/src/utils/github.ts
0
TypeScript
1
none
16
30
30
true
feat: Fetch and format GitHub stars dynamically
1,590
DiceDB/dice
10,326
C
dipanshurdev
Syntax: "EXISTS key [key ...]", HelpShort: "EXISTS returns the count of keys that exist among the given", HelpLong: `EXISTS command returns the count of keys that exist among the given arguments without modifying them.`, Examples: ` localhost:7379> SET k1 v1 OK localhost:7379> SET k2 v2 OK localhost:7379> EXIST...
No issues found.
Syntax: "EXISTS key [key ...]", HelpShort: "EXISTS returns the count of keys that exist among the given", HelpLong: `EXISTS command returns the count of keys that exist among the given arguments without modifying them.`, Examples: ` localhost:7379> SET k1 v1 OK localhost:7379> SET k2 v2 OK localhost:7379> EXIST...
@@ -5,6 +5,7 @@ package cmd import ( "github.com/dicedb/dice/internal/errors" + "github.com/dicedb/dice/internal/shard" "github.com/dicedb/dice/internal/shardmanager" dstore "github.com/dicedb/dice/internal/store" "github.com/dicedb/dicedb-go/wire" @@ -59,8 +60,14 @@ func executeEXISTS(c *Cmd, sm *shardmanag...
internal/cmd/cmd_exists.go
0
Go
1
none
16
51
51
true
fix result for multiple keys in exists command
1,598
DiceDB/dice
10,326
C
Abhijeetsng97
errors.New("wrong number of arguments for 'ZADD' command"), }, }, { name: "Call ZADD with NX, XX, and CH flags", commands: []string{ "ZADD key NX 1 memberNX", // Add new member with NX "ZADD key NX 2 memberNX", // Try to update existing member with NX "ZADD key XX 3 memberNX", // Update exi...
No issues found.
errors.New("wrong number of arguments for 'ZADD' command"), }, }, { name: "Call ZADD with NX, XX, and CH flags", commands: []string{ "ZADD key NX 1 memberNX", // Add new member with NX "ZADD key NX 2 memberNX", // Try to update existing member with NX "ZADD key XX 3 memberNX", // Update exi...
@@ -0,0 +1,109 @@ +package ironhawk + +import ( + "errors" + "testing" +) + +func TestZADD(t *testing.T) { + client := getLocalConnection() + defer client.Close() + + testCases := []TestCase{ + { + name: "Call ZADD with no arguments", + commands: []string{"ZADD"}, + expected: []interface{}{ + errors.New("...
tests/commands/ironhawk/zadd_test.go
0
Go
1
none
16
51
51
true
Migrate ZADD
1,613
DiceDB/dice
10,326
C
vivekkothari
if _, ok := w.fpClientMap[fp]; !ok { w.fpClientMap[fp] = make(map[string]bool) } w.fpClientMap[fp][t.ClientID] = true // Store the fingerprint <--> command mapping // so that we understand what should we execute when the data changes w.fpCmdMap[fp] = c w.clientWatchThreadMap[t.ClientID] = t } func (w *Watch...
No issues found.
if _, ok := w.fpClientMap[fp]; !ok { w.fpClientMap[fp] = make(map[string]bool) } w.fpClientMap[fp][t.ClientID] = true // Store the fingerprint <--> command mapping // so that we understand what should we execute when the data changes w.fpCmdMap[fp] = c w.clientWatchThreadMap[t.ClientID] = t } func (w *Watch...
@@ -8,12 +8,14 @@ import ( "log/slog" "strconv" "strings" + "sync" "github.com/dicedb/dice/internal/cmd" "github.com/dicedb/dice/internal/shardmanager" ) type WatchManager struct { + mu sync.RWMutex clientWatchThreadMap map[string]*IOThread keyFPMap map[string]map[uint32]bool ...
internal/server/ironhawk/watch_manager.go
0
Go
1
none
16
51
51
true
Fix concurrent client connections watch mode
1,651
DiceDB/dice
10,326
C
lucifercr07
serverWire: w, Session: auth.NewSession(), }, nil } func (t *IOThread) Start(ctx context.Context, shardManager *shardmanager.ShardManager, watchManager *WatchManager) error { for { var c *wire.Command { tmpC, err := t.serverWire.Receive() if err != nil { return err.Unwrap() } c = tmpC }...
No issues found.
serverWire: w, Session: auth.NewSession(), }, nil } func (t *IOThread) Start(ctx context.Context, shardManager *shardmanager.ShardManager, watchManager *WatchManager) error { for { var c *wire.Command { tmpC, err := t.serverWire.Receive() if err != nil { return err.Unwrap() } c = tmpC }...
@@ -98,9 +98,7 @@ func (t *IOThread) Start(ctx context.Context, shardManager *shardmanager.ShardMa if isWatchCmd{ watchManager.HandleWatch(_c, t) - } - - if strings.HasSuffix(c.Cmd, "UNWATCH") { + } else if strings.HasSuffix(c.Cmd, "UNWATCH") { watchManager.HandleUnwatch(_c, t) }
internal/server/ironhawk/iothread.go
0
Go
1
none
16
51
51
true
Reduce scope of locks
1,668
DiceDB/dice
10,326
C
vivekkothari
"time" "github.com/dicedb/dicedb-go/wire" ) func extractValueGET(result *wire.Result) interface{} { return result.GetGETRes().Value } func TestGET(t *testing.T) { client := getLocalConnection() defer client.Close() testCases := []TestCase{ { name: "Get with expiration", commands: []str...
No issues found.
"time" "github.com/dicedb/dicedb-go/wire" ) func extractValueGET(result *wire.Result) interface{} { return result.GetGETRes().Value } func TestGET(t *testing.T) { client := getLocalConnection() defer client.Close() testCases := []TestCase{ { name: "Get with expiration", commands: []str...
@@ -33,6 +33,18 @@ func TestGET(t *testing.T) { expected: []interface{}{"OK", "v"}, valueExtractor: []ValueExtractorFn{extractValueSET, extractValueGET}, }, + { + name: "Set Floating Point Value", + commands: []string{"SET fp 123.123", "GET fp"}, + expected: []interface{}{"...
tests/commands/ironhawk/get_test.go
0
Go
1
none
16
51
51
true
Server doesn't crash if Obj Type is not present and float support in GET Command
1,703
DiceDB/dice
10,326
C
Abhijeetsng97
"errors" "testing" "github.com/dicedb/dicedb-go/wire" ) func extractValueZRANK(res *wire.Result) interface{} { resp := res.GetZRANKRes() if resp.Element == nil { return int64(0) } else { return resp.Element.Rank } } func TestZRANK(t *testing.T) { client := getLocalConnection() defer client.Close() tes...
No issues found.
"errors" "testing" "github.com/dicedb/dicedb-go/wire" ) func extractValueZRANK(res *wire.Result) interface{} { resp := res.GetZRANKRes() if resp.Element == nil { return int64(0) } else { return resp.Element.Rank } } func TestZRANK(t *testing.T) { client := getLocalConnection() defer client.Close() tes...
@@ -11,7 +11,12 @@ import ( ) func extractValueZRANK(res *wire.Result) interface{} { - return res.GetZRANKRes().Rank + resp := res.GetZRANKRes() + if resp.Element == nil { + return int64(0) + } else { + return resp.Element.Rank + } } func TestZRANK(t *testing.T) {
tests/commands/ironhawk/zrank_test.go
0
Go
1
none
16
51
51
true
Fixed z-* Commands & Tests
1,726
DiceDB/dice
10,326
C
bipoool
await execAsyncRemote(compose.serverId, command); } else { await execAsync(command, { cwd: projectPath, }); } } } catch (error) { throw error; } return true; }; export const startCompose = async (composeId: string) => { const compose = await findComposeById(composeId); try { const { ...
@Siumauricio Should you also consider`compose.yml` here? [That's the default now](https://docs.docker.com/compose/intro/compose-application-model/#the-compose-file) and `docker-compose.yml` is for backwards compatibility.
deleteVolumes ? "--volumes" : "" } && rm -rf ${projectPath}`; if (compose.serverId) { await execAsyncRemote(compose.serverId, command); } else { await execAsync(command, { cwd: projectPath, }); } } } catch (error) { throw error; } return true; }; export const startCompose = as...
@@ -516,19 +520,20 @@ export const startCompose = async (composeId: string) => { const compose = await findComposeById(composeId); try { const { COMPOSE_PATH } = paths(!!compose.serverId); + + const projectPath = join(COMPOSE_PATH, compose.appName, "code"); + const path = + compose.sourceType === "raw" ? "do...
packages/server/src/services/compose.ts
26
TypeScript
0.643
suggestion
221
51
51
false
refactor(compose): reorganize imports and simplify command execution …
2,289
Dokploy/dokploy
23,726
TypeScript
rob
Siumauricio
<Tooltip> <TooltipTrigger asChild> <FormLabel className="break-all w-fit flex flex-row gap-1 items-center"> Select a Server {!isCloud ? "(Optional)" : ""} <HelpCircle className="size-4 text-muted-foreground" /> </FormLabel> </Toolt...
We have to take into account the IS_CLOUD flag. To do this, you can use this query: `const { data: isCloud } = api.settings.isCloud.useQuery();` because in the cloud version we do not have a dokploy server, so we will always use a remote server, so we cannot have the default value as dokploy So in short: when isc...
name="serverId" render={({ field }) => ( <FormItem> <TooltipProvider delayDuration={0}> <Tooltip> <TooltipTrigger asChild> <FormLabel className="break-all w-fit flex flex-row gap-1 items-center"> Select a Server {!isCloud ? "(Optional)...
@@ -186,13 +186,21 @@ export const AddApplication = ({ projectId, projectName }: Props) => { <Select onValueChange={field.onChange} - defaultValue={field.value} + defaultValue={field.value || "dokploy"} > <SelectTrigger> - <SelectValue place...
apps/dokploy/components/dashboard/project/add-application.tsx
26
TypeScript
0.643
suggestion
546
51
51
false
feat: Add default "Dokploy" option to server selection dropdown (#1852)
2,502
Dokploy/dokploy
23,726
TypeScript
Siumauricio
Harikrishnan1367709
description: z.string().optional(), server: z.boolean().optional(), type: z.enum(["deploy", "redeploy"]), applicationType: z.literal("application"), serverId: z.string().min(1), }), z.object({ composeId: z.string(), title: z.string().optional(), description: z.string().optional(), server: z.boolean(...
why are we duplicating this structure? since we already have the `deployJobSchema` it doesn't make sense to duplicate the structure with another name
import { z } from "zod"; export const deployJobSchema = z.discriminatedUnion("applicationType", [ z.object({ applicationId: z.string(), titleLog: z.string().optional(), descriptionLog: z.string().optional(), server: z.boolean().optional(), type: z.enum(["deploy", "redeploy"]), applicationType: z.literal("...
@@ -31,4 +31,35 @@ export const deployJobSchema = z.discriminatedUnion("applicationType", [ }), ]); +export const deployRequestSchema = z.discriminatedUnion("applicationType", [ + z.object({ + applicationId: z.string(), + title: z.string().optional(), + description: z.string().optional(), + server: z.boolean()...
apps/api/src/schema.ts
26
TypeScript
0.5
refactor
149
29
35
false
feat: Add custom title/description support for API/CLI deployments (#1485)
2,507
Dokploy/dokploy
23,726
TypeScript
Siumauricio
Harikrishnan1367709
const authHeader = c.req.header("X-API-Key"); if (process.env.API_KEY !== authHeader) { return c.json({ message: "Invalid API Key" }, 403); } return next(); }); app.post("/deploy", zValidator("json", deployRequestSchema), async (c) => { const data = c.req.valid("json"); logger.info("Received deployment reque...
Here we would not have to change anything, since the properties are passed completely to the deployment.
const authHeader = c.req.header("X-API-Key"); if (process.env.API_KEY !== authHeader) { return c.json({ message: "Invalid API Key" }, 403); } return next(); }); app.post("/deploy", zValidator("json", deployJobSchema), async (c) => { const data = c.req.valid("json"); logger.info("Received deployment request",...
@@ -84,15 +84,22 @@ app.use(async (c, next) => { return next(); }); -app.post("/deploy", zValidator("json", deployJobSchema), async (c) => { +app.post("/deploy", zValidator("json", deployRequestSchema), async (c) => { const data = c.req.valid("json"); logger.info("Received deployment request", data); try {...
apps/api/src/index.ts
26
TypeScript
0.429
suggestion
104
51
51
false
feat: Add custom title/description support for API/CLI deployments (#1485)
2,507
Dokploy/dokploy
23,726
TypeScript
Siumauricio
Harikrishnan1367709
/> <div className="flex flex-col gap-2 text-center"> <span className="text-sm text-muted-foreground"> Can't scan the QR code? </span> <span className="text-xs font-mono bg-muted p-2 rounded"> {data.secret} </span> ...
Please the library we have installed: import copy from "copy-to-clipboard";
<form id="password-form" onSubmit={passwordForm.handleSubmit(handlePasswordSubmit)} className="space-y-4" > <FormField control={passwordForm.control} name="password" render={({ field }) => ( <FormItem> <FormLabel>Password</FormLabel> ...
@@ -281,7 +287,33 @@ export const Enable2FA = () => { {backupCodes && backupCodes.length > 0 && ( <div className="w-full space-y-3 border rounded-lg p-4"> - <h4 className="font-medium">Backup Codes</h4> + <div className="flex items-center justify-between"> + <h...
apps/dokploy/components/dashboard/settings/profile/enable-2fa.tsx
26
TypeScript
0.214
suggestion
80
51
51
false
feat: add a button to copy backup codes to clipboard
2,821
Dokploy/dokploy
23,726
TypeScript
Siumauricio
imran-vz
return showExtraLogs; } return showExtraLogs ? true : !hideSubsequentLogs; }); } setFilteredLogs(filteredLogsResult); }, [data, showExtraLogs]); useEffect(() => { scrollToBottom(); if (autoScroll && scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }...
Use the library we use for copy `import copy from "copy-to-clipboard";`
hideSubsequentLogs = true; return showExtraLogs; } return showExtraLogs ? true : !hideSubsequentLogs; }); } setFilteredLogs(filteredLogsResult); }, [data, showExtraLogs]); useEffect(() => { scrollToBottom(); if (autoScroll && scrollRef.current) { scrollRef.current.scrollTop = scroll...
@@ -106,6 +108,29 @@ export const ShowDeployment = ({ } }, [filteredLogs, autoScroll]); + const handleCopy = async () => { + const logContent = filteredLogs + .map(({ timestamp, message }: LogLine) => + `${timestamp?.toISOString() || ""} ${message}`.trim(), + ) + .join("\n"); + + try { + await navig...
apps/dokploy/components/dashboard/application/deployments/show-deployment.tsx
26
TypeScript
0.429
suggestion
71
51
51
false
feat: Add copy to clipboard functionality for deployment and runtime logs
2,893
Dokploy/dokploy
23,726
TypeScript
Siumauricio
hl9020
.slice(11, 19) .replace(/:/g, "")}.log.txt`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; const handleCopy = async () => { const logContent = filteredLogs .map( ({ timestamp, message, }: { timestamp: Date | null; me...
Use the library we use for copy `import copy from "copy-to-clipboard";`
a.download = `${appName}-${isoDate.slice(0, 10).replace(/-/g, "")}_${isoDate .slice(11, 19) .replace(/:/g, "")}.log.txt`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; const handleCopy = async () => { const logContent = filteredLogs .map( ...
@@ -237,6 +245,38 @@ export const DockerLogsId: React.FC<Props> = ({ URL.revokeObjectURL(url); }; + const handleCopy = async () => { + const logContent = filteredLogs + .map( + ({ + timestamp, + message, + }: { + timestamp: Date | null; + message: string; + }) => + showTimestamp +...
apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx
26
TypeScript
0.429
suggestion
71
51
51
false
feat: Add copy to clipboard functionality for deployment and runtime logs
2,893
Dokploy/dokploy
23,726
TypeScript
Siumauricio
hl9020
import { Queue } from "bullmq"; import { redisConfig } from "./redis-connection"; const myQueue = new Queue("deployments", { connection: redisConfig, }); process.on("SIGTERM", () => { myQueue.close(); process.exit(0); }); myQueue.on("error", (error) => { if ((error as any).code === "ECONNREFUSED") { console.er...
Hey @Siumauricio, Just glancing at the code changes here: ```ts if (type === "application") { const command = `pkill -2 -f "docker build"`; if (serverId) { await execAsyncRemote(serverId, command); } else { await execAsync(command); } } else if (type === "compose") { const co...
export const cleanQueuesByCompose = async (composeId: string) => { const jobs = await myQueue.getJobs(["waiting", "delayed"]); for (const job of jobs) { if (job?.data?.composeId === composeId) { await job.remove(); console.log(`Removed job ${job.id} for compose ${composeId}`); } } }; export const killDoc...
@@ -41,4 +45,31 @@ export const cleanQueuesByCompose = async (composeId: string) => { } }; +export const killDockerBuild = async ( + type: "application" | "compose", + serverId: string | null, +) => { + try { + if (type === "application") { + const command = `pkill -2 -f "docker build"`; + + if (serverId) { +...
apps/dokploy/server/queues/queueSetup.ts
26
TypeScript
1
suggestion
575
45
40
false
feat: add KillBuild component and API mutation for terminating Docker…
3,052
Dokploy/dokploy
23,726
TypeScript
nktnet1
Siumauricio
/> <FormField control={form.control} name="cpuReservation" render={({ field }) => { return ( <FormItem> <div className="flex items-center gap-2" onClick={(e) => e.preventDefault()} > <FormLabel>CPU Reserva...
The tooltip mentions adjusting by 0.25 CPU, but the actual step value is defined elsewhere. Consider adding a comment here or in the converter explaining that CPU values are stored as nanoseconds (10^-9 CPUs) to clarify the conversion relationship.
className="flex items-center gap-2" onClick={(e) => e.preventDefault()} > <FormLabel>CPU Limit</FormLabel> <TooltipProvider> <Tooltip delayDuration={0}> <TooltipTrigger> <InfoIcon className="h-4 w-4 text-muted-foregroun...
@@ -234,17 +263,20 @@ export const ShowResources = ({ id, type }: Props) => { <TooltipContent> <p> CPU quota in units of 10^-9 CPUs. Example: 2 - CPUs = 2000000000 + CPUs = 2000000000. Use +/- buttons to adjust by + 0.25 CPU. ...
apps/dokploy/components/dashboard/application/advanced/show-resources.tsx
26
TypeScript
0.5
suggestion
248
47
51
false
feat(resources): Add number component to have better UX control over Docker resources
3,186
Dokploy/dokploy
23,726
TypeScript
Copilot
divaltor
className="w-full mt-2" > <ShieldOff className="size-4 mr-2" /> Disable 2FA </Button> </div> </div> <div className="flex justify-end"> <Button variant="outline" onClick={() => setIsDialogOpen(false)} > Clos...
Backup codes are expected to be unique; using `${code}-${index}` makes keys order-dependent. Prefer `key={code}` for a stable key. ```suggestion key={code} ```
className="w-full mt-2" > <ShieldOff className="size-4 mr-2" /> Disable 2FA </Button> </div> </div> <div className="flex justify-end"> <Button variant="outline" onClick={() => setIsDialogOpen(false)} > Clos...
@@ -356,7 +356,7 @@ export const Configure2FA = () => { <div className="grid grid-cols-2 gap-2"> {backupCodes.map((code, index) => ( <code - key={index} + key={`${code}-${index}`}
apps/dokploy/components/dashboard/settings/profile/configure-2fa.tsx
26
TypeScript
0.786
suggestion
170
51
51
false
fix: replace index-only keys with stable composite keys in mapped lists
3,777
Dokploy/dokploy
23,726
TypeScript
Copilot
karyanayandi
if (autoScroll && scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [filteredLogs, autoScroll]); return ( <Sheet open={!!isOpen} onOpenChange={() => { onClose(); }} > <SheetContent className="sm:max-w-[740px] flex flex-col"> <SheetHeader> <Shee...
The list key still depends on `index`, so when `filteredLogs` changes due to filtering/searching the same log line can receive a different key and be remounted. Prefer a key derived solely from log identity (e.g., `rawTimestamp` + `message`, or introduce a stable id/lineNumber in `LogLine`) and avoid `index` unless dup...
if (autoScroll && scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [filteredLogs, autoScroll]); return ( <Sheet open={!!isOpen} onOpenChange={() => { onClose(); }} > <SheetContent className="sm:max-w-[740px] flex flex-col"> <SheetHeader> <Shee...
@@ -60,7 +60,11 @@ export const DrawerLogs = ({ isOpen, onClose, filteredLogs }: Props) => { {" "} {filteredLogs.length > 0 ? ( filteredLogs.map((log: LogLine, index: number) => ( - <TerminalLine key={index} log={log} noTimestamp /> + <TerminalLine + key={`${log.rawTimestamp ?? ""}...
apps/dokploy/components/shared/drawer-logs.tsx
26
TypeScript
1
refactor
405
37
41
false
fix: replace index-only keys with stable composite keys in mapped lists
3,777
Dokploy/dokploy
23,726
TypeScript
Copilot
karyanayandi
</div> </div> {isPaused && ( <AlertBlock type="warning"> <div className="flex items-center gap-2"> <Pause className="h-4 w-4" /> <span> Logs paused {messageBuffer.length > 0 && ( <span className="ml-1 font-medium"> ({messageBuffer.lengt...
`key` still incorporates the array `index`, so changing `filteredLogs` (search/type filters, etc.) will reshuffle indexes and cause React to remount existing log rows. Use a key based on the log content/identity (e.g., `rawTimestamp` + `message`, or a stable id from parsing) to keep rows stable across filtering. ```sug...
</div> </div> {isPaused && ( <AlertBlock type="warning"> <div className="flex items-center gap-2"> <Pause className="h-4 w-4" /> <span> Logs paused {messageBuffer.length > 0 && ( <span className="ml-1 font-medium"> ({messageBuffer.lengt...
@@ -402,7 +402,7 @@ export const DockerLogsId: React.FC<Props> = ({ {filteredLogs.length > 0 ? ( filteredLogs.map((filteredLog: LogLine, index: number) => ( <TerminalLine - key={index} + key={`${filteredLog.rawTimestamp ?? ""}-${index}`}
apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx
26
TypeScript
1
suggestion
411
47
47
false
fix: replace index-only keys with stable composite keys in mapped lists
3,777
Dokploy/dokploy
23,726
TypeScript
Copilot
karyanayandi
</DialogDescription> </DialogHeader> <div ref={scrollRef} onScroll={handleScroll} className="h-[720px] overflow-y-auto space-y-0 border p-4 bg-[#fafafa] dark:bg-[#050506] rounded custom-logs-scrollbar" > {" "} {filteredLogs.length > 0 ? ( filteredLogs.map((log: LogLine, ...
Both mapped log lists use keys that include `index`, which will change when logs are filtered/toggled and can cause unnecessary remounting. Prefer keys based on log identity only (e.g., `rawTimestamp` + `message` or a stable parsed id/lineNumber) to keep rows stable.
</DialogDescription> </DialogHeader> <div ref={scrollRef} onScroll={handleScroll} className="h-[720px] overflow-y-auto space-y-0 border p-4 bg-[#fafafa] dark:bg-[#050506] rounded custom-logs-scrollbar" > {" "} {filteredLogs.length > 0 ? ( filteredLogs.map((log: LogLine, ...
@@ -194,13 +194,21 @@ export const ShowDeployment = ({ {" "} {filteredLogs.length > 0 ? ( filteredLogs.map((log: LogLine, index: number) => ( - <TerminalLine key={index} log={log} noTimestamp /> + <TerminalLine + key={`${log.rawTimestamp ?? ""}-${index}`} + log={log} + ...
apps/dokploy/components/dashboard/application/deployments/show-deployment.tsx
26
TypeScript
0.643
suggestion
267
32
40
false
fix: replace index-only keys with stable composite keys in mapped lists
3,777
Dokploy/dokploy
23,726
TypeScript
Copilot
karyanayandi
</TooltipProvider> <TooltipProvider> <Tooltip delayDuration={0}> <TooltipTrigger asChild> <Button type="button" variant="outline" size="icon" onClick={handleDownloadBackup...
Backup codes should already be unique values; including `index` makes the key unstable if the list order changes. Consider using `key={code}` to keep keys stable and simpler.
</TooltipProvider> <TooltipProvider> <Tooltip delayDuration={0}> <TooltipTrigger asChild> <Button type="button" variant="outline" size="icon" onClick={handleDownloadBackup...
@@ -401,7 +401,7 @@ export const Enable2FA = () => { <div className="grid grid-cols-2 gap-2"> {backupCodes.map((code, index) => ( <code - key={index} + key={`${code}-${index}`} className="bg-muted p-2 rounded text-sm font-mono"
apps/dokploy/components/dashboard/settings/profile/enable-2fa.tsx
26
TypeScript
0.571
suggestion
174
51
51
false
fix: replace index-only keys with stable composite keys in mapped lists
3,777
Dokploy/dokploy
23,726
TypeScript
Copilot
karyanayandi
<DialogTrigger className="" asChild> <Button> {" "} <PlusIcon className="h-4 w-4" /> Add Certificate </Button> </DialogTrigger> <DialogContent className="sm:max-w-2xl"> <DialogHeader> <DialogTitle>Add New Certificate</DialogTitle> <DialogDescription> Upload or generat...
No issues found.
<DialogTrigger className="" asChild> <Button> {" "} <PlusIcon className="h-4 w-4" /> Add Certificate </Button> </DialogTrigger> <DialogContent className="sm:max-w-2xl"> <DialogHeader> <DialogTitle>Add New Certificate</DialogTitle> <DialogDescription> Upload or generat...
@@ -65,6 +65,11 @@ export const AddCertificate = () => { const { mutateAsync, isError, error, isLoading } = api.certificates.create.useMutation(); const { data: servers } = api.server.withSSHKey.useQuery(); + const hasServers = servers && servers.length > 0; + // Show dropdown logic based on cloud environment + ...
apps/dokploy/components/dashboard/settings/certificates/add-certificate.tsx
0
TypeScript
1
none
16
51
51
true
feat: Add default "Dokploy" option to server selection dropdown (#1852)
2,502
Dokploy/dokploy
23,726
TypeScript
Harikrishnan1367709
if (job.type === "redeploy") { await rebuildRemoteApplication({ applicationId: job.applicationId, titleLog: job.titleLog || "Rebuild deployment", descriptionLog: job.descriptionLog || "", }); } else if (job.type === "deploy") { await deployRemoteApplication({ applicationId...
No issues found.
if (job.type === "redeploy") { await rebuildRemoteApplication({ applicationId: job.applicationId, titleLog: job.titleLog || "Rebuild deployment", descriptionLog: job.descriptionLog || "", }); } else if (job.type === "deploy") { await deployRemoteApplication({ applicationId...
@@ -18,14 +18,14 @@ export const deploy = async (job: DeployJob) => { if (job.type === "redeploy") { await rebuildRemoteApplication({ applicationId: job.applicationId, - titleLog: job.titleLog, - descriptionLog: job.descriptionLog, + titleLog: job.titleLog || "Rebuild deployment", + ...
apps/api/src/utils.ts
0
TypeScript
1
none
16
51
51
true
feat: Add custom title/description support for API/CLI deployments (#1485)
2,507
Dokploy/dokploy
23,726
TypeScript
Harikrishnan1367709
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: "hover:bg-accent hover:text-accent-foreground", link: "text-primary underline-offset-4 hover:underline", }, size: { default: "h-10 px-4 py-2", sm: "h-9 rounded-md px-3", lg: "h-11 rounded-md px-8", i...
No issues found.
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: "hover:bg-accent hover:text-accent-foreground", link: "text-primary underline-offset-4 hover:underline", }, size: { default: "h-10 px-4 py-2", sm: "h-9 rounded-md px-3", lg: "h-11 rounded-md px-8", i...
@@ -55,6 +55,8 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( ref, ) => { const Comp = asChild ? Slot : "button"; + const type = props.type ?? undefined; + return ( <> <Comp @@ -65,6 +67,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( ref={ref} ...
apps/dokploy/components/ui/button.tsx
0
TypeScript
1
none
16
51
51
true
feat: add a button to copy backup codes to clipboard
2,821
Dokploy/dokploy
23,726
TypeScript
imran-vz
AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { api } from "@/utils/api"; interface Props { id: string; type: "application" | "compose"; } export const KillBuild = ({ id, type }: Props) =...
No issues found.
AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { api } from "@/utils/api"; interface Props { id: string; type: "application" | "compose"; } export const KillBuild = ({ id, type }: Props) =...
@@ -0,0 +1,65 @@ +import { Scissors } from "lucide-react"; +import { toast } from "sonner"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/aler...
apps/dokploy/components/dashboard/application/deployments/kill-build.tsx
0
TypeScript
1
none
16
51
51
true
feat: add KillBuild component and API mutation for terminating Docker…
3,052
Dokploy/dokploy
23,726
TypeScript
Siumauricio
href=" https://app.americancloud.com/register?ref=dokploy" className="text-link underline" > American Cloud - Get $20 Credits </a> </li> <li> <a href="https://m.do.co/c/db24efd43f35" className="tex...
No issues found.
href=" https://app.americancloud.com/register?ref=dokploy" className="text-link underline" > American Cloud - Get $20 Credits </a> </li> <li> <a href="https://m.do.co/c/db24efd43f35" className="tex...
@@ -307,9 +307,9 @@ export const WelcomeSuscription = () => { </div> <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6"> - {features.map((feature, index) => ( + {features.map((feature) => ( <div - key={index} + key={feat...
apps/dokploy/components/dashboard/settings/servers/welcome-stripe/welcome-suscription.tsx
0
TypeScript
1
none
16
51
51
true
fix: replace index-only keys with stable composite keys in mapped lists
3,777
Dokploy/dokploy
23,726
TypeScript
karyanayandi
elif cmp == 0: devices['ROCM']['found'] = True name = 'rocm' tag = f'rocm{version_str}' else: msg = 'No ROCm version found. Falling back to CPU.' warn(msg) # =================================================...
Variable name typo: `tage` should be `tag`. This will cause the tag value not to be assigned correctly, potentially breaking the device installation logic. ```suggestion tag = f'cu{major}{minor}' ```
name = 'rocm' tag = f'rocm{version_str}' else: msg = 'No ROCm version found. Falling back to CPU.' warn(msg) # ============================================================ # CUDA # ======================================...
@@ -228,18 +226,42 @@ def warn(msg:str)->None: msg = 'No ROCm version found. Falling back to CPU.' warn(msg) + # ============================================================ + # CUDA + # ============================================================ + elif h...
lib/classes/device_installer.py
26
Python
0.857
suggestion
215
51
51
false
v25.12.2b11
1,236
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if ( (non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is not None and non_standard_tag != device_info['tag']) ): try: ...
Undefined variable: `nump_version` is used but never defined. This should likely be `numpy_version` which is defined on line 468. This will cause a `NameError` at runtime. ```suggestion if Version(torch_version) <= Version('2.2.2') and numpy_version and numpy_version >= Version('2.0....
(non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is not None and non_standard_tag != device_info['tag']) ): try: torch_ver...
@@ -467,7 +466,7 @@ def install_device_packages(self, install_pkg:str)->bool: if device_info['name'] == 'cuda': subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', 'deepspeed']) ...
lib/classes/device_installer.py
26
Python
1
suggestion
328
49
48
false
v25.12.2b11
1,236
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def warn(msg:str)->None: print(f'[WARNING] {msg}') name = None tag = None arch = platform.machine().lower() # ============================================================ # CUDA # ============================================================ i...
The command `uname - a` has incorrect syntax. It should be `uname -a` (without space before the hyphen). This will cause the command to fail. ```suggestion out = try_cmd('uname -a') ```
def warn(msg:str)->None: print(f'[WARNING] {msg}') name = None tag = None arch = platform.machine().lower() # ============================================================ # JETSON # ============================================================ ...
@@ -182,33 +182,31 @@ def warn(msg:str)->None: arch = platform.machine().lower() # ============================================================ - # CUDA + # JETSON # ============================================================ - if has_cmd('nvcc'): - out = tr...
lib/classes/device_installer.py
26
Python
0.786
bug
197
51
51
false
v25.12.2b11
1,236
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
name = None tag = None arch = platform.machine().lower() # ============================================================ # CUDA # ============================================================ if has_cmd('nvcc'): out = try_cmd('nvcc --version') ...
Typo in error message: "Failing back" should be "Falling back". ```suggestion msg = 'Unknown Jetson device. Falling back to cpu' ```
name = None tag = None arch = platform.machine().lower() # ============================================================ # JETSON # ============================================================ if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_rele...
@@ -182,33 +182,31 @@ def warn(msg:str)->None: arch = platform.machine().lower() # ============================================================ - # CUDA + # JETSON # ============================================================ - if has_cmd('nvcc'): - out = tr...
lib/classes/device_installer.py
26
Python
0.929
bug
148
51
51
false
v25.12.2b11
1,236
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
elif cmp == 0: devices['ROCM']['found'] = True name = 'rocm' tag = f'rocm{version_str}' else: msg = 'No ROCm version found. Falling back to CPU.' warn(msg) # =================================================...
Typo: Variable name should be `tag` instead of `tage`. This will cause the tag to not be properly set for CUDA devices. ```suggestion tag = f'cu{major}{minor}' ```
name = 'rocm' tag = f'rocm{version_str}' else: msg = 'No ROCm version found. Falling back to CPU.' warn(msg) # ============================================================ # CUDA # ======================================...
@@ -228,18 +226,42 @@ def warn(msg:str)->None: msg = 'No ROCm version found. Falling back to CPU.' warn(msg) + # ============================================================ + # CUDA + # ============================================================ + elif h...
lib/classes/device_installer.py
26
Python
0.786
suggestion
179
51
51
false
v25.12.2b11
1,237
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def warn(msg:str)->None: print(f'[WARNING] {msg}') name = None tag = None arch = platform.machine().lower() # ============================================================ # CUDA # ============================================================ i...
Incorrect command syntax: `uname - a` should be `uname -a` (no space between hyphen and 'a'). This will cause the command to fail. ```suggestion out = try_cmd('uname -a') ```
def warn(msg:str)->None: print(f'[WARNING] {msg}') name = None tag = None arch = platform.machine().lower() # ============================================================ # JETSON # ============================================================ ...
@@ -182,33 +182,31 @@ def warn(msg:str)->None: arch = platform.machine().lower() # ============================================================ - # CUDA + # JETSON # ============================================================ - if has_cmd('nvcc'): - out = tr...
lib/classes/device_installer.py
26
Python
0.786
bug
186
51
51
false
v25.12.2b11
1,237
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
name = None tag = None arch = platform.machine().lower() # ============================================================ # CUDA # ============================================================ if has_cmd('nvcc'): out = try_cmd('nvcc --version') ...
Typo: "Failing back" should be "Falling back" to be consistent with other error messages in the codebase. ```suggestion msg = 'Unknown Jetson device. Falling back to cpu' ```
name = None tag = None arch = platform.machine().lower() # ============================================================ # JETSON # ============================================================ if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_rele...
@@ -182,33 +182,31 @@ def warn(msg:str)->None: arch = platform.machine().lower() # ============================================================ - # CUDA + # JETSON # ============================================================ - if has_cmd('nvcc'): - out = tr...
lib/classes/device_installer.py
26
Python
0.929
bug
190
51
51
false
v25.12.2b11
1,237
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if ( (non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is not None and non_standard_tag != device_info['tag']) ): try: ...
Undefined variable: `nump_version` is referenced but never defined. This should likely be `numpy_version` which is defined on line 468. ```suggestion if Version(torch_version) <= Version('2.2.2') and numpy_version and numpy_version >= Version('2.0.0'): ```
(non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is not None and non_standard_tag != device_info['tag']) ): try: torch_ver...
@@ -467,7 +466,7 @@ def install_device_packages(self, install_pkg:str)->bool: if device_info['name'] == 'cuda': subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', 'deepspeed']) ...
lib/classes/device_installer.py
26
Python
1
suggestion
292
49
48
false
v25.12.2b11
1,237
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
fi export SCRIPT_DIR="$(cd "$(dirname "$script_path")" >/dev/null 2>&1 && pwd -P)" export PYTHONUTF8="1" export PYTHONIOENCODING="utf-8" export TTS_CACHE="$SCRIPT_DIR/models" export TESSDATA_PREFIX="$SCRIPT_DIR/models/tessdata" export TMPDIR="$SCRIPT_DIR/tmp" export CONDA_HOME="$HOME/Miniforge3" export CONDA_BIN_PATH=...
Inconsistency with cargo and rustc in DOCKER_PROGRAMS array. In the Dockerfile: - Line 16: `cargo` and `rustc` are installed as temporary build dependencies - Line 26: They are purged to reduce image size - However, `cargo` is now included in DOCKER_PROGRAMS (this line), which means it will be installed via `$DOCKER_PR...
fi export SCRIPT_DIR="$(cd "$(dirname "$script_path")" >/dev/null 2>&1 && pwd -P)" export PYTHONUTF8="1" export PYTHONIOENCODING="utf-8" export TTS_CACHE="$SCRIPT_DIR/models" export TESSDATA_PREFIX="$SCRIPT_DIR/models/tessdata" export TMPDIR="$SCRIPT_DIR/tmp" export CONDA_HOME="$HOME/Miniforge3" export CONDA_BIN_PATH=...
@@ -36,7 +36,7 @@ APP_NAME="ebook2audiobook" APP_VERSION=$(<"$SCRIPT_DIR/VERSION.txt") OS_LANG=$(echo "${LANG:-en}" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]') HOST_PROGRAMS=("curl" "pkg-config" "calibre" "ffmpeg" "nodejs" "espeak-ng" "rust" "sox" "tesseract") -DOCKER_PROGRAMS=("curl" "pkg-config" "ffmpeg" "nodejs" ...
ebook2audiobook.sh
26
Shell
1
suggestion
817
51
51
false
v25.12.3b12
1,247
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if current_tag is not None: non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if ( (non_standard_tag is None and current_tag != device_info['tag']) or (non_stand...
The variable `nump_version` is undefined. The variable is declared as `numpy_version` on line 465, but then referenced as `nump_version` on line 466. This will cause a NameError at runtime. Change `nump_version` to `numpy_version` on line 466. ```suggestion if Version(torch_version) <= ...
current_tag = m.group(1) if m else None if current_tag is not None: non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if ((non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_ta...
@@ -429,56 +429,53 @@ def check_dictionary(self)->bool: return False return True - def install_device_packages(self, install_pkg:str)->bool: + def install_device_packages(self, device_info_str:str)->bool: try: - device_info = json.loads(install_pkg) + ...
lib/classes/device_installer.py
26
Python
1
suggestion
397
51
48
false
v25.12.4b13
1,250
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if current_tag is not None: non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if ( (non_standard_tag is None and current_tag != device_info['tag']) or (non_stand...
Undefined variable `nump_version` used in condition. This should be `numpy_version` (defined on line 465). ```suggestion if Version(torch_version) <= Version('2.2.2') and numpy_version and numpy_version >= Version('2.0.0'): ```
current_tag = m.group(1) if m else None if current_tag is not None: non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if ((non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_ta...
@@ -429,56 +429,53 @@ def check_dictionary(self)->bool: return False return True - def install_device_packages(self, install_pkg:str)->bool: + def install_device_packages(self, device_info_str:str)->bool: try: - device_info = json.loads(install_pkg) + ...
lib/classes/device_installer.py
26
Python
1
suggestion
259
51
48
false
v25.12.4b13
1,251
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def check_dictionary(self)->bool: import unidic unidic_path = unidic.DICDIR dicrc = os.path.join(unidic_path, 'dicrc') if not os.path.exists(dicrc) or os.path.getsize(dicrc) == 0: try: error = 'UniDic dictionary not found or incomplete. Download...
Variable `non_standard_tag` may be undefined when used in this condition. It's only defined on line 443 when `current_tag is not None`, but it's used unconditionally on line 444. This will cause a NameError if `current_tag` is None. ```suggestion current_tag = m.group(1) if m else None ...
def check_dictionary(self)->bool: import unidic unidic_path = unidic.DICDIR dicrc = os.path.join(unidic_path, 'dicrc') if not os.path.exists(dicrc) or os.path.getsize(dicrc) == 0: try: error = 'UniDic dictionary not found or incomplete. Download...
@@ -429,56 +429,53 @@ def check_dictionary(self)->bool: return False return True - def install_device_packages(self, install_pkg:str)->bool: + def install_device_packages(self, device_info_str:str)->bool: try: - device_info = json.loads(install_pkg) + ...
lib/classes/device_installer.py
26
Python
1
suggestion
362
51
51
false
v25.12.4b13
1,251
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
print(msg) return self.check_dictionary() except Exception as e: error = f'check_and_install_requirements() error: {e}' print(error) return False def check_dictionary(self)->bool: import unidic unidic_path = unidic.DI...
Missing exception handling for `json.loads()`. If `device_info_str` contains invalid JSON, `json.loads()` will raise a `json.JSONDecodeError` which is not caught. Consider adding a specific except clause for JSONDecodeError before the general Exception handler.
print(msg) return self.check_dictionary() except Exception as e: error = f'check_and_install_requirements() error: {e}' print(error) return False def check_dictionary(self)->bool: import unidic unidic_path = unidic.DI...
@@ -429,54 +429,64 @@ def check_dictionary(self)->bool: return False return True - def install_device_packages(self, device_info_str:str)->bool: + def install_device_packages(self, device_info_str:str)->int: try: - device_info = json.loads(device_info_str)...
lib/classes/device_installer.py
26
Python
0.786
suggestion
261
51
51
false
v25.12.4b14
1,258
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL