-
Notifications
You must be signed in to change notification settings - Fork 149
fix(rivetkit): deserialize actor keys properly in manager router #4063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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