fix: Standardize namespace before userId parameter order in Java SDK#180
fix: Standardize namespace before userId parameter order in Java SDK#180raphaeldelio wants to merge 1 commit intoredis:mainfrom
Conversation
| .build(); | ||
|
|
||
| return putWorkingMemory(sessionId, updated, userId, namespace, null, null); | ||
| return putWorkingMemory(sessionId, updated, namespace, userId, null, null); |
There was a problem hiding this comment.
Swapped namespace and userId in addMemoriesToWorkingMemory call
High Severity
In addMemoriesToWorkingMemory, the call putWorkingMemory(sessionId, updated, null, namespace, null, null) passes null as the namespace parameter and the local namespace variable as the userId parameter. After the signature reorder to (sessionId, memory, namespace, userId, ...), this call was not updated and now has the arguments swapped. The namespace value gets sent as a user_id query parameter and namespace falls back to the default instead of the intended value.
|
|
||
| // Execute | ||
| AckResponse response = client.workingMemory().deleteWorkingMemory("session-123", "user-456", "test-namespace"); | ||
| AckResponse response = client.workingMemory().deleteWorkingMemory("session-123", "test-namespace", "user-456"); |
There was a problem hiding this comment.
Test passes userId and namespace in wrong order
Medium Severity
In testPutWorkingMemory, the call putWorkingMemory("session-123", memory, "user-456", "test-namespace", null, null) was not updated for the new parameter order. After the signature change to (sessionId, memory, namespace, userId, ...), this passes "user-456" as namespace and "test-namespace" as userId, which is reversed from the intended values.
bsbodden
left a comment
There was a problem hiding this comment.
LGTM, but check the automated reviews and why the CI is breaking


Summary
Fixes inconsistent parameter ordering in
WorkingMemoryServicethat caused confusion and bugsChanges
namespacebeforeuserIdparameter orderBreaking Change
This changes the method signatures for:
getWorkingMemoryputWorkingMemorydeleteWorkingMemoryCallers passing explicit values for both
namespaceanduserIdwill need to swap the argument order.Note
Medium Risk
This is a breaking SDK API change: it reorders public method parameters for
getWorkingMemory,putWorkingMemory, anddeleteWorkingMemory, so existing callers passing bothnamespaceanduserIdmay silently swap values and hit wrong keys/queries if not updated.Overview
Standardizes
WorkingMemoryServicepublic APIs to use consistent parameter ordering withnamespacebeforeuserIdforgetWorkingMemory,putWorkingMemory, anddeleteWorkingMemory, and updates all internal call sites to match.Updates unit/integration tests to use the new signature, and adds an integration test that creates multiple working memories and verifies each can be retrieved independently.
Written by Cursor Bugbot for commit 63df6cc. This will update automatically on new commits. Configure here.