fix(rivetkit): deserialize actor keys properly in manager router#4063
fix(rivetkit): deserialize actor keys properly in manager router#4063NathanFlurry wants to merge 1 commit intomainfrom
Conversation
Bug: c.key returned ['a/b/c'] instead of ['a', 'b', 'c'] The manager router was wrapping serialized key strings in single-element arrays instead of deserializing them back to ActorKey arrays. Changes: - Import deserializeActorKey - GET /actors: deserialize key query param - PUT /actors: deserialize body.key for getWithKey and getOrCreateWithKey - POST /actors: deserialize body.key, generate UUID only if null/undefined
PR Review: Fix Actor Key DeserializationSummaryThis PR fixes a critical bug where actor keys were being incorrectly wrapped in single-element arrays instead of being properly deserialized. The fix correctly uses Code Quality ✅Strengths:
Observations:
Potential Issues
|
Bug
c.keyin actor context returns['orgId/documentId/page']instead of['orgId', 'documentId', 'page']When creating an actor with:
Expected
c.key:[orgId, documentId, documentType](array of 3 strings)Actual
c.key:['orgId/documentId/documentType'](array with 1 joined string)Root Cause
The manager router was wrapping serialized key strings in single-element arrays (
key: [body.key]) instead of deserializing them back to ActorKey arrays usingdeserializeActorKey().Fix
deserializeActorKeyfrom@/actor/keysGET /actors: deserialize key query paramPUT /actors: deserializebody.keyforgetWithKeyandgetOrCreateWithKeyPOST /actors: deserializebody.key, generate UUID only if null/undefinedFiles Changed
rivetkit-typescript/packages/rivetkit/src/manager/router.ts